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

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

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 331x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 1x 1x
import {IStatement} from "./_statement";
import {seq, alt, opt, ver, altPrio, per, failCombinator} from "../combi";
import {ComponentCond, Dynamic, Source, SimpleName, LoopTarget, LoopSource} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
import {LoopGroupBy} from "../expressions/loop_group_by";
 
export class Loop implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const where = seq("WHERE", alt(ComponentCond, Dynamic));
 
    const group = ver(Version.v740sp08, seq("GROUP BY", LoopGroupBy), Version.OpenABAP);
 
    const step = ver(Version.v757, seq("STEP", Source));
 
    const from = seq("FROM", Source);
 
    const to = seq("TO", Source);
 
    const usingKey = seq("USING KEY", altPrio(SimpleName, Dynamic));
 
    const options = per(LoopTarget, from, to, where, usingKey, group, step);
 
    const at = seq(opt(seq("SCREEN", failCombinator())),
                   opt(ver(Version.v740sp08, "GROUP", Version.OpenABAP)),
                   LoopSource,
                   opt(options));
 
    return seq("LOOP AT", at);
  }
 
}