UNPKG

@abaplint/core

Version:
17 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CDSCase = void 0; const _1 = require("."); const combi_1 = require("../../abap/2_statements/combi"); class CDSCase extends combi_1.Expression { getRunnable() { const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName))); const value = (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, name); const thenValue = (0, combi_1.altPrio)((0, combi_1.seq)("(", value, ")"), value); const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", thenValue))); const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", thenValue)); return (0, combi_1.seq)("CASE", (0, combi_1.altPrio)(complex, simple), (0, combi_1.optPrio)((0, combi_1.seq)("ELSE", value)), "END"); } } exports.CDSCase = CDSCase; //# sourceMappingURL=cds_case.js.map