All files / src/abap/2_statements/expressions field_chain.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 1/1
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231x 1x 1x     1x     14x 14x   14x   14x 14x   14x   14x   14x    
import {seq, optPrio, star, tok, Expression, altPrio} from "../combi";
import {AttributeName, ClassName, SourceField, SourceFieldSymbol, TableExpression, ComponentName, FieldOffset, FieldLength, TableBody} from ".";
import {InstanceArrow, StaticArrow, Dash, DashW} from "../../1_lexer/tokens";
import {IStatementRunnable} from "../statement_runnable";
 
export class FieldChain extends Expression {
  public getRunnable(): IStatementRunnable {
 
    const attr = seq(tok(InstanceArrow), altPrio(AttributeName, "*"));
    const comp = seq(tok(Dash), optPrio(ComponentName));
 
    const chain = star(altPrio(attr, comp, TableExpression));
 
    const clas = seq(ClassName, tok(StaticArrow), AttributeName);
    const start = altPrio(clas, SourceField, SourceFieldSymbol);
 
    const after = altPrio(tok(DashW), seq(optPrio(TableBody), optPrio(FieldOffset), optPrio(FieldLength)));
 
    const ret = seq(start, chain, after);
 
    return ret;
  }
}