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

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

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 451x 1x 1x 1x 1x 1x 1x 1x 1x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 513x 1x 1x
import {Version} from "../../../version";
import {IStatement} from "./_statement";
import {seq, alt, altPrio, ver, regex as reg, plusPrio, optPrio} from "../combi";
import {MethodDefChanging, MethodDefReturning, Redefinition, MethodName, MethodDefExporting, MethodDefImporting, EventHandler, Abstract, MethodDefRaising, NamespaceSimpleName} from "../expressions";
import {IStatementRunnable} from "../statement_runnable";
 
export class MethodDef implements IStatement {
 
  public getMatcher(): IStatementRunnable {
 
    const exceptions = seq("EXCEPTIONS", plusPrio(NamespaceSimpleName));
 
    const def = ver(Version.v740sp08, seq("DEFAULT", altPrio("FAIL", "IGNORE")));
 
    const parameters = seq(optPrio(altPrio("FINAL", def, Abstract)),
                           optPrio(MethodDefImporting),
                           optPrio(MethodDefExporting),
                           optPrio(MethodDefChanging),
                           optPrio(MethodDefReturning),
                           optPrio(altPrio(MethodDefRaising, exceptions)));
 
    const testing = seq(optPrio(Abstract), "FOR TESTING", optPrio(altPrio(MethodDefRaising, exceptions)));
 
// todo, this is only from version something
    const tableFunction = seq("FOR TABLE FUNCTION", reg(/^\w+?$/));
// todo, this is only from version something
    const ddl = "FOR DDL OBJECT OPTIONS CDS SESSION CLIENT REQUIRED";
// todo, this is only from version something
    const amdp = "AMDP OPTIONS CDS SESSION CLIENT current";
 
    const ret = seq(altPrio("CLASS-METHODS", "METHODS"),
                    MethodName,
                    alt(seq(optPrio(Abstract), EventHandler),
                        parameters,
                        testing,
                        tableFunction,
                        ddl,
                        amdp,
                        "NOT AT END OF MODE",
                        optPrio(Redefinition)));
 
    return ret;
  }
 
}