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

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

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  1x 1x 1x     1x     39x 39x 39x   39x       39x   39x                     39x               39x 39x 39x 39x 39x 39x 39x   39x   39x   39x      
import {IStatement} from "./_statement";
import {verNot, seq, opt, alt, per, altPrio} from "../combi";
import {Target, Source, FieldChain} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class Describe implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const tlines = seq("LINES", Target);
    const kind = seq("KIND", Target);
    const occurs = seq("OCCURS", Target);
 
    const table = seq("TABLE",
                      FieldChain,
                      opt(per(tlines, kind, occurs)));
 
    const mode = seq("IN", alt("BYTE", "CHARACTER"), "MODE");
 
    const field = seq("FIELD",
                      Source,
                      per(seq("TYPE", Target),
                          seq("COMPONENTS", Target),
                          seq("LENGTH", Target, opt(mode)),
                          seq("DECIMALS", Target),
                          seq("HELP-ID", Target),
                          seq("OUTPUT-LENGTH", Target),
                          seq("EDIT MASK", Target),
                          seq("INTO", Target)));
 
    const distance = seq("DISTANCE BETWEEN",
                         Source,
                         "AND",
                         Source,
                         "INTO",
                         Target,
                         mode);
 
    const lines = seq("NUMBER OF LINES", Target);
    const line = seq("LINE", Source);
    const page = seq("PAGE", Source);
    const index = seq("INDEX", Source);
    const top = seq("TOP-LINES", Target);
    const lineSize = seq("LINE-SIZE", Target);
    const first = seq("FIRST-LINE", Target);
 
    const list = seq("LIST", per(lines, index, line, page, top, first, lineSize));
 
    const ret = seq("DESCRIBE", altPrio(table, field, distance, list));
 
    return verNot(Version.Cloud, ret);
  }
 
}