UNPKG

@abaplint/core

Version:
25 lines 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.For = void 0; const combi_1 = require("../combi"); const _1 = require("."); const version_1 = require("../../../version"); const field_chain_1 = require("./field_chain"); class For extends combi_1.Expression { getRunnable() { const where = (0, combi_1.seq)("WHERE (", _1.ComponentCond, ")"); const from = (0, combi_1.seq)("FROM", _1.Source); const to = (0, combi_1.seq)("TO", _1.Source); const inn = (0, combi_1.seq)(_1.InlineLoopDefinition, (0, combi_1.optPrio)(from), (0, combi_1.optPrio)(to), (0, combi_1.optPrio)(where)); const then = (0, combi_1.seq)("THEN", _1.Source); const whil = (0, combi_1.seq)((0, combi_1.altPrio)("UNTIL", "WHILE"), _1.Cond); const itera = (0, combi_1.seq)(_1.InlineFieldDefinition, (0, combi_1.opt)(then), whil); const groupBy = (0, combi_1.seq)("GROUP BY", (0, combi_1.alt)(field_chain_1.FieldChain, (0, combi_1.seq)("(", (0, combi_1.plus)(_1.LoopGroupByComponent), ")")), (0, combi_1.opt)((0, combi_1.seq)((0, combi_1.alt)("ASCENDING", "DESCENDING"), (0, combi_1.opt)("AS TEXT"))), (0, combi_1.opt)("WITHOUT MEMBERS")); const t = (0, combi_1.alt)(_1.TargetField, _1.TargetFieldSymbol); const groups = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)("GROUPS", t, "OF", t, "IN", _1.Source, (0, combi_1.optPrio)(groupBy))); const f = (0, combi_1.seq)("FOR", (0, combi_1.alt)(itera, inn, groups), (0, combi_1.optPrio)(_1.Let)); return (0, combi_1.ver)(version_1.Version.v740sp05, f, version_1.Version.OpenABAP); } } exports.For = For; //# sourceMappingURL=for.js.map