All files / src/abap/2_statements/expressions corresponding_body_mapping.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 24 251x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x  
import {seq, Expression, plus, alt, tok, optPrio, altPrio, ver} from "../combi";
import {WParenLeftW, WParenRightW} from "../../1_lexer/tokens";
import {ComponentChain, ComponentName, Field, Source} from ".";
import {Release} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class CorrespondingBodyMapping extends Expression {
  public getRunnable(): IStatementRunnable {
    // "t1 = DEFAULT val" and "t1 = s1 DEFAULT val", from 7.58
    const dflt = ver(Release.v758, seq("DEFAULT", Source));
    const single = seq(ComponentName, "=", altPrio(dflt, seq(ComponentChain, optPrio(dflt))));
 
    // mapping rule for a sub structure or tabular component, with its own MAPPING and EXCEPT
    const nested = seq(
      tok(WParenLeftW),
      single,
      optPrio(CorrespondingBodyMapping),
      optPrio(seq("EXCEPT", alt(plus(Field), "*"))),
      tok(WParenRightW));
 
    const mapping = seq("MAPPING", plus(alt(single, nested)));
    return mapping;
  }
}