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

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

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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 661x 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 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 {verNot, seq, opt, alt, per, altPrio} from "../combi";
import {Target, Source, Dynamic, FieldSub, Color, WriteOffsetLength} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class Write implements IStatement {
 
  public getMatcher(): IStatementRunnable {
 
    const mask = seq("USING",
                     altPrio("NO EDIT MASK",
                             seq("EDIT MASK", Source)));
 
    const onOff = alt(altPrio("ON", "OFF"), seq("=", FieldSub));
 
    const dateFormat = altPrio("DD/MM/YY",
                               "MM/DD/YY",
                               "DD/MM/YYYY",
                               "MM/DD/YYYY",
                               "DDMMYY",
                               "MMDDYY",
                               "YYMMDD");
 
    const as = seq("AS", altPrio("LINE", "ICON", "CHECKBOX", "SYMBOL"));
 
    const to = seq("TO", Target);
    const options = per(mask,
                        to,
                        seq("EXPONENT", Source),
                        "NO-GROUPING",
                        "NO-ZERO",
                        "CENTERED",
                        seq("INPUT", opt(onOff)),
                        "NO-GAP",
                        "LEFT-JUSTIFIED",
                        as,
                        seq("FRAMES", onOff),
                        seq("HOTSPOT", opt(onOff)),
                        "RIGHT-JUSTIFIED",
                        seq("TIME ZONE", Source),
                        seq("UNDER", Source),
                        seq("STYLE", Source),
                        seq("ROUND", Source),
                        seq("QUICKINFO", Source),
                        "ENVIRONMENT TIME FORMAT",
                        dateFormat,
                        seq("UNIT", Source),
                        seq("INTENSIFIED", opt(onOff)),
                        seq("INDEX", Source),
                        seq("DECIMALS", Source),
                        seq("INVERSE", opt(onOff)),
                        Color,
                        seq("CURRENCY", Source),
                        "RESET",
                        "NO-SIGN");
 
    const ret = seq("WRITE", alt("AT /",
                                 seq(opt(WriteOffsetLength),
                                     alt(Source, Dynamic, "/"),
                                     opt(options))));
 
    return verNot(Version.Cloud, ret);
  }
 
}