All files / src/abap/2_statements/statements modify_internal.ts

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

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 25 26 27 28 29 30 31 321x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x
import {IStatement} from "./_statement";
import {seq, opt, alt, per, plus} from "../combi";
import {FSTarget, Target, Source, Dynamic, ComponentCond, ComponentChainSimple, SimpleName} from "../expressions";
import {IStatementRunnable} from "../statement_runnable";
 
export class ModifyInternal implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const index = seq("INDEX", Source);
    const from = seq("FROM", Source);
    const transporting = seq("TRANSPORTING", plus(alt(ComponentChainSimple, Dynamic)));
 
    const where = seq("WHERE", ComponentCond);
    const assigning = seq("ASSIGNING", FSTarget);
    const using = seq("USING KEY", SimpleName);
    const additions = per(where, assigning, using);
 
    const target = alt(Target, Dynamic);
 
    const options = alt(
      per(index, transporting),
      seq(from, opt(per(index, transporting))),
      seq(per(index, transporting), from, opt(per(index, transporting))));
 
    const long = seq("MODIFY", opt("TABLE"), target, opt(options), opt(additions));
 
    const simple = seq("MODIFY TABLE", target, from, opt(using));
 
    return alt(long, simple);
  }
 
}