UNPKG

@abaplint/core

Version:
20 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CDSArithmetics = void 0; const _1 = require("."); const combi_1 = require("../../abap/2_statements/combi"); const cds_integer_1 = require("./cds_integer"); class CDSArithmetics extends combi_1.Expression { getRunnable() { const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName))); const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, name); const operator = (0, combi_1.altPrio)("+", "-", "*", "/"); const operatorValue = (0, combi_1.seq)(operator, val); const paren = (0, combi_1.seq)("(", val, (0, combi_1.plusPrio)(operatorValue), ")"); const noParen = (0, combi_1.seq)(val, (0, combi_1.plusPrio)(operatorValue)); // todo: this is pretty bad, it needs a rewrite return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.starPrio)(operatorValue)), noParen); } } exports.CDSArithmetics = CDSArithmetics; //# sourceMappingURL=cds_arithmetics.js.map