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

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

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 32 33 34 35 36 37 38 39 401x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x
import {IStatement} from "./_statement";
import {str, seq, opt, per, ver, altPrio, alt} from "../combi";
import {Version} from "../../../version";
import {FSTarget, Target, Source, Dynamic, SimpleSource4} from "../expressions";
import {IStatementRunnable} from "../statement_runnable";
 
export class InsertInternal implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const target = altPrio(Source, Dynamic);
    const assigning = seq("ASSIGNING", FSTarget);
    const ref = seq("REFERENCE INTO", Target);
    const index = seq("INDEX", Source);
    const initial = str("INITIAL LINE");
    const into = seq("INTO", Target);
    const intoTable = seq("INTO TABLE", Target, opt(alt(ref, assigning)));
 
    const to = seq("TO", Source);
    const from = seq("FROM", Source);
    const fromTo = opt(per(from, to));
 
    const foo = alt(intoTable,
                    seq(into, opt(per(index, alt(ref, assigning)))),
                    per(index, alt(ref, assigning)));
 
    const lines = seq("LINES OF",
                      target,
                      opt(fromTo));
 
    const src = alt(SimpleSource4, ver(Version.v740sp02, Source));
 
    const tab = seq("TABLE", Source);
 
    const ret = seq("INSERT",
                    altPrio(tab, seq(altPrio(initial, lines, src), foo)));
 
    return ret;
  }
 
}