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

100% Statements 24/24
100% Branches 1/1
100% Functions 1/1
100% Lines 24/24

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 23 241x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
import {seq, altPrio, tok, alt, Expression, star} from "../combi";
import {Dash, InstanceArrow, StaticArrow} from "../../1_lexer/tokens";
import {ClassName, Dynamic, AttributeName, SourceField, SourceFieldSymbol, ComponentName, MethodCall} from ".";
import {IStatementRunnable} from "../statement_runnable";
 
export class MethodSource extends Expression {
  public getRunnable(): IStatementRunnable {
 
// note: AttributeName can be both an attribute and a method name, the syntax check will tell
// note: its allowed to end with MethodCall, however if this is done it will give a syntax error via syntax check
 
    const afterArrow = alt(AttributeName, MethodCall, Dynamic);
    const arrow = altPrio(tok(InstanceArrow), tok(StaticArrow));
    const attr = seq(arrow, afterArrow);
    const comp = seq(tok(Dash), ComponentName);
    const attrOrComp = altPrio(attr, comp);
    const staticClass = seq(ClassName, tok(StaticArrow));
    const clas = seq(staticClass, afterArrow);
 
    const start = seq(altPrio(clas, SourceField, SourceFieldSymbol, Dynamic), star(attrOrComp));
 
    return start;
  }
}