All files / src/abap/2_statements/statements export.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 40 411x 1x 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 1x 1x  
import {IStatement} from "./_statement";
import {seq, alt, altPrio, opt, regex, per, plus, tok} from "../combi";
import {ParenLeft, ParenRightW} from "../../1_lexer/tokens";
import {Target, Source, Dynamic, ParameterS, FieldSub, NamespaceSimpleName, FieldSymbol} from "../expressions";
import {IStatementRunnable} from "../statement_runnable";
 
// todo, cloud, split?
export class Export implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const from = seq("FROM", Source);
    const client = seq("CLIENT", Source);
    const id = seq("ID", Source);
    const using = seq("USING", Source);
 
    const cluster = seq(NamespaceSimpleName,
                        tok(ParenLeft),
                        regex(/^[\w$%\^]{2}$/),
                        tok(ParenRightW));
 
    const buffer = seq("DATA BUFFER", Target);
    const memory = seq("MEMORY", opt(seq("ID", Source)));
    const table = seq("INTERNAL TABLE", Target);
    const shared = seq(alt("SHARED MEMORY", "SHARED BUFFER"), cluster, per(from, client, id));
    const database = seq("DATABASE", cluster, per(from, client, id, using));
 
    const target = alt(buffer, memory, database, table, shared);
 
    const left = alt(FieldSub, FieldSymbol);
 
    const source = alt(plus(altPrio(ParameterS, seq(left, from), left)),
                       Dynamic);
 
    const compression = seq("COMPRESSION", alt("ON", "OFF"));
    const hint = seq("CODE PAGE HINT", Source);
 
    return seq("EXPORT", source, "TO", target, opt(compression), opt(hint));
  }
 
}