@abaplint/core
Version:
abaplint - Core API
26 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CDSArithParen = void 0;
const _1 = require(".");
const combi_1 = require("../../abap/2_statements/combi");
const cds_integer_1 = require("./cds_integer");
/**
* Parenthesized arithmetic sub-expression.
*
* Matches either:
* "(" CDSArithmetics ")" — parenthesized expression with operators, e.g. (A + B), (A - B * C)
* "(" CDSArithParen ")" — nested grouping parens, e.g. ((A + B)), (((A + B)))
* "(" val ")" — parenthesized single value used for grouping, e.g. (field), (func(...))
*
* Mutual recursion with CDSArithmetics enables n-level deep nesting with no fixed limit:
* CDSArithmetics → operand (op operand)+
* CDSArithParen → "(" CDSArithmetics ")" | "(" CDSArithParen ")" | "(" val ")"
*/
class CDSArithParen extends combi_1.Expression {
getRunnable() {
const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, _1.CDSAggregate, _1.CDSPrefixedName);
return (0, combi_1.seq)("(", (0, combi_1.altPrio)(_1.CDSArithmetics, CDSArithParen, val), ")");
}
}
exports.CDSArithParen = CDSArithParen;
//# sourceMappingURL=cds_arith_paren.js.map