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

100% Statements 19/19
100% Branches 0/0
100% Functions 1/1
100% Lines 19/19

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 40 41 42 43 44 45 46 47 48  1x 1x 1x     1x     58x 58x 58x 58x 58x 58x 58x 58x 58x 58x 58x 58x   58x                                 58x         58x      
import {IStatement} from "./_statement";
import {verNot, str, seq, opt, altPrio, per, regex as reg} from "../combi";
import {Source, Constant, FieldChain, Dynamic, Field, FieldLength, FieldSub, RadioGroupName, Modif, TypeName, SimpleSource1} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class Parameter implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const para = altPrio("PARAMETER", "PARAMETERS");
    const def = seq("DEFAULT", altPrio(Constant, FieldChain));
    const radio = seq("RADIOBUTTON GROUP", RadioGroupName);
    const type = seq(altPrio("TYPE", "LIKE"), altPrio(TypeName, Dynamic));
    const memory = seq("MEMORY ID", SimpleSource1);
    const listbox = str("AS LISTBOX");
    const cmd = seq("USER-COMMAND", reg(/^\w+$/));
    const modif = seq("MODIF ID", Modif);
    const visible = seq("VISIBLE LENGTH", Constant);
    const length = seq("LENGTH", Constant);
    const match = seq("MATCHCODE OBJECT", Field);
    const decimals = seq("DECIMALS", Source);
 
    const perm = per(type,
                     def,
                     "OBLIGATORY",
                     match,
                     cmd,
                     length,
                     decimals,
                     radio,
                     memory,
                     modif,
                     listbox,
                     visible,
                     "VALUE CHECK",
                     "NO-DISPLAY",
                     "AS CHECKBOX",
                     "LOWER CASE");
 
    const ret = seq(para,
                    FieldSub,
                    opt(FieldLength),
                    opt(perm));
 
    return verNot(Version.Cloud, ret);
  }
 
}