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

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

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 381x 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 1x 1x
import {IStatement} from "./_statement";
import {verNot, seq, alt, opt, per} from "../combi";
import {Target, Source} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class Communication implements IStatement {
 
  public getMatcher(): IStatementRunnable {
    const length = seq("LENGTH", Target);
 
    const returncode = seq("RETURNCODE", Source);
    const buffer = seq("BUFFER", Target);
    const init = seq("INIT ID", Source, "DESTINATION", Target);
    const allocate = seq("ALLOCATE ID", Source, opt(returncode));
    const send = seq("SEND ID", Source, opt(per(buffer, length)), opt(returncode));
    const deallocate = seq("DEALLOCATE ID", Source, opt(returncode));
    const accept = seq("ACCEPT ID", Source);
 
    const receive = seq("RECEIVE ID",
                        Source,
                        "BUFFER",
                        Source,
                        opt(length),
                        "DATAINFO",
                        Target,
                        "STATUSINFO",
                        Target,
                        "RECEIVED",
                        Target);
 
    const ret = seq("COMMUNICATION",
                    alt(init, allocate, send, deallocate, receive, accept));
 
    return verNot(Version.Cloud, ret);
  }
 
}