UNPKG

@abaplint/core

Version:
24 lines 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CDSElement = void 0; const _1 = require("."); const combi_1 = require("../../abap/2_statements/combi"); const cds_as_1 = require("./cds_as"); const cds_cast_1 = require("./cds_cast"); class CDSElement extends combi_1.Expression { getRunnable() { const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName); const colonThing = (0, combi_1.seq)(":", (0, combi_1.altPrio)(_1.CDSType, _1.CDSName, "LOCALIZED")); // $extension.* — extension field wildcard const extensionWildcard = (0, combi_1.seq)("$extension", ".", "*"); const body = (0, combi_1.altPrio)(extensionWildcard, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))), _1.CDSInteger); // KEY/VIRTUAL keyword handling via altPrio: // - Try keyword form first: if keyword consumed but body fails (e.g. "virtual.Field"), // altPrio backtracks to plain body (which handles "virtual" as a datasource alias prefix). // - This gives exactly 1 state in all cases (no exponential blowup from opt()). const elementBody = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body); return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), elementBody, (0, combi_1.optPrio)(cds_as_1.CDSAs)); } } exports.CDSElement = CDSElement; //# sourceMappingURL=cds_element.js.map