UNPKG

@abaplint/core

Version:
24 lines 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SQLCase = void 0; const _1 = require("."); const version_1 = require("../../../version"); const tokens_1 = require("../../1_lexer/tokens"); const combi_1 = require("../combi"); const constant_1 = require("./constant"); const sql_cond_1 = require("./sql_cond"); const sql_field_name_1 = require("./sql_field_name"); const sql_source_1 = require("./sql_source"); class SQLCase extends combi_1.Expression { getRunnable() { const field = (0, combi_1.altPrio)(_1.SQLAggregation, SQLCase, _1.SQLFunction, _1.SQLPath, sql_field_name_1.SQLFieldName, constant_1.Constant); const sub = (0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW))); const sourc = (0, combi_1.altPrio)(SQLCase, _1.SQLAggregation, _1.SQLFunction, sql_source_1.SQLSource, constant_1.Constant); const val = (0, combi_1.altPrio)(sql_cond_1.SQLCond, constant_1.Constant, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleSource3)); const when = (0, combi_1.seq)("WHEN", val, "THEN", sourc, (0, combi_1.starPrio)(sub)); const els = (0, combi_1.seq)("ELSE", sourc); return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CASE", (0, combi_1.opt)(sql_field_name_1.SQLFieldName), (0, combi_1.plusPrio)(when), (0, combi_1.optPrio)(els), "END")); } } exports.SQLCase = SQLCase; //# sourceMappingURL=sql_case.js.map