@abaplint/cli 2.91.33 → 2.91.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +8 -8
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -368,7 +368,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
368
368
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
369
369
|
|
|
370
370
|
"use strict";
|
|
371
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.fail = exports.verNot = exports.ver = exports.plusPrio = exports.plus = exports.starPrio = exports.star = exports.per = exports.optPrio = exports.opt = exports.altPrio = exports.alt = exports.seq = exports.tok = exports.regex = exports.str = exports.Combi = exports.Expression = void 0;\r\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst result_1 = __webpack_require__(/*! ./result */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/result.js\");\r\nclass Regex {\r\n constructor(r) {\r\n this.regexp = r;\r\n }\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n if (input.remainingLength() === 0) {\r\n continue;\r\n }\r\n const token = input.peek();\r\n if (this.regexp.test(token.getStr()) === true) {\r\n result.push(input.shift(new nodes_1.TokenNodeRegex(token)));\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal(\\\"\" + this.regexp.source.replace(/\\\\/g, \"\\\\\\\\\") + \"\\\")\";\r\n }\r\n toStr() {\r\n return this.regexp.toString();\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Word {\r\n constructor(s) {\r\n this.s = s.toUpperCase();\r\n }\r\n listKeywords() {\r\n return [this.s];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n if (input.remainingLength() !== 0\r\n && input.peek().getStr().toUpperCase() === this.s) {\r\n // console.log(\"match, \" + this.s + result.length);\r\n result.push(input.shift(new nodes_1.TokenNode(input.peek())));\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('\\\"\" + this.s + \"\\\"')\";\r\n }\r\n toStr() {\r\n return \"\\\"\" + this.s + \"\\\"\";\r\n }\r\n first() {\r\n return [this.s];\r\n }\r\n}\r\nclass Token {\r\n constructor(s) {\r\n this.name = s.toUpperCase();\r\n }\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n if (input.remainingLength() !== 0\r\n && input.peek().constructor.name.toUpperCase() === this.name) {\r\n result.push(input.shift(new nodes_1.TokenNode(input.peek())));\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n let text = this.name;\r\n const toke = Tokens;\r\n for (const token in Tokens) {\r\n if (token.toUpperCase() === this.name && toke[token].railroad) {\r\n text = toke[token].railroad();\r\n break;\r\n }\r\n }\r\n return \"Railroad.Terminal('!\\\"\" + text + \"\\\"')\";\r\n }\r\n toStr() {\r\n return \"Token \\\"\" + this.name + \"\\\"\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Vers {\r\n constructor(version, runnable, or) {\r\n this.version = version;\r\n this.runnable = runnable;\r\n this.or = or;\r\n }\r\n listKeywords() {\r\n return this.runnable.listKeywords();\r\n }\r\n run(r) {\r\n const targetVersion = Combi.getVersion();\r\n if (this.or && targetVersion === this.or) {\r\n return this.runnable.run(r);\r\n }\r\n else if (targetVersion === version_1.Version.OpenABAP) {\r\n if (this.version > version_1.Version.v702) {\r\n return [];\r\n }\r\n else {\r\n return this.runnable.run(r);\r\n }\r\n }\r\n else if (targetVersion >= this.version || targetVersion === version_1.Version.Cloud) {\r\n return this.runnable.run(r);\r\n }\r\n else {\r\n return [];\r\n }\r\n }\r\n getUsing() {\r\n return this.runnable.getUsing();\r\n }\r\n railroad() {\r\n let text = this.version;\r\n if (this.or) {\r\n text += \" or \" + this.or;\r\n }\r\n return \"Railroad.Sequence(Railroad.Comment(\\\"\" +\r\n text +\r\n \"\\\", {}), \" +\r\n this.runnable.railroad() +\r\n \")\";\r\n }\r\n toStr() {\r\n return \"Version(\" + this.runnable.toStr() + \")\";\r\n }\r\n first() {\r\n return this.runnable.first();\r\n }\r\n}\r\nclass VersNot {\r\n constructor(version, runnable) {\r\n this.version = version;\r\n this.runnable = runnable;\r\n }\r\n listKeywords() {\r\n return this.runnable.listKeywords();\r\n }\r\n getUsing() {\r\n return this.runnable.getUsing();\r\n }\r\n run(r) {\r\n if (Combi.getVersion() !== this.version) {\r\n return this.runnable.run(r);\r\n }\r\n else {\r\n return [];\r\n }\r\n }\r\n railroad() {\r\n return \"Railroad.Sequence(Railroad.Comment(\\\"not \" +\r\n this.version +\r\n \"\\\", {}), \" +\r\n this.runnable.railroad() +\r\n \")\";\r\n }\r\n toStr() {\r\n return \"VersionNot(\" + this.runnable.toStr() + \")\";\r\n }\r\n first() {\r\n return this.runnable.first();\r\n }\r\n}\r\nclass OptionalPriority {\r\n constructor(optional) {\r\n this.optional = optional;\r\n }\r\n listKeywords() {\r\n return this.optional.listKeywords();\r\n }\r\n getUsing() {\r\n return this.optional.getUsing();\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n const res = this.optional.run([input]);\r\n if (res.length > 1) {\r\n result.push(...res);\r\n }\r\n else if (res.length === 0) {\r\n result.push(input);\r\n }\r\n else if (res[0].remainingLength() < input.remainingLength()) {\r\n result.push(...res);\r\n }\r\n else {\r\n result.push(input);\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Optional(\" + this.optional.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"opt(\" + this.optional.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Optional {\r\n constructor(optional) {\r\n this.optional = optional;\r\n }\r\n listKeywords() {\r\n return this.optional.listKeywords();\r\n }\r\n getUsing() {\r\n return this.optional.getUsing();\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n result.push(input);\r\n const res = this.optional.run([input]);\r\n result.push(...res);\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Optional(\" + this.optional.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"opt(\" + this.optional.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Star {\r\n constructor(sta) {\r\n this.sta = sta;\r\n }\r\n listKeywords() {\r\n return this.sta.listKeywords();\r\n }\r\n getUsing() {\r\n return this.sta.getUsing();\r\n }\r\n run(r) {\r\n const result = r;\r\n let res = r;\r\n let input = [];\r\n for (;;) {\r\n input = res;\r\n res = this.sta.run(input);\r\n if (res.length === 0) {\r\n break;\r\n }\r\n result.push(...res);\r\n }\r\n // console.dir(result);\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.ZeroOrMore(\" + this.sta.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"star(\" + this.sta.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass StarPrioroity {\r\n constructor(sta) {\r\n this.sta = sta;\r\n }\r\n listKeywords() {\r\n return this.sta.listKeywords();\r\n }\r\n getUsing() {\r\n return this.sta.getUsing();\r\n }\r\n run(r) {\r\n let result = r;\r\n let res = r;\r\n // let input: Result[] = [];\r\n let prev;\r\n for (;;) {\r\n // input = res;\r\n res = this.sta.run(res);\r\n if (res.length === 0) {\r\n if (prev !== undefined) {\r\n // console.log(\"star length: \" + prev.length);\r\n let best = Number.MAX_SAFE_INTEGER;\r\n for (const p of prev) {\r\n if (p.remainingLength() < best) {\r\n result = [p];\r\n best = p.remainingLength();\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n prev = res;\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.ZeroOrMore(\" + this.sta.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"star(\" + this.sta.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Plus {\r\n constructor(plu) {\r\n this.plu = plu;\r\n this.sub = new Sequence([this.plu, new Star(this.plu)]);\r\n }\r\n listKeywords() {\r\n return this.plu.listKeywords();\r\n }\r\n getUsing() {\r\n return this.plu.getUsing();\r\n }\r\n run(r) {\r\n return this.sub.run(r);\r\n }\r\n railroad() {\r\n return \"Railroad.OneOrMore(\" + this.plu.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"plus(\" + this.plu.toStr() + \")\";\r\n }\r\n first() {\r\n return this.plu.first();\r\n }\r\n}\r\nclass PlusPriority {\r\n constructor(plu) {\r\n this.plu = plu;\r\n this.sub = new Sequence([this.plu, new StarPrioroity(this.plu)]);\r\n }\r\n listKeywords() {\r\n return this.plu.listKeywords();\r\n }\r\n getUsing() {\r\n return this.plu.getUsing();\r\n }\r\n run(r) {\r\n return this.sub.run(r);\r\n }\r\n railroad() {\r\n return \"Railroad.OneOrMore(\" + this.plu.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"plus(\" + this.plu.toStr() + \")\";\r\n }\r\n first() {\r\n return this.plu.first();\r\n }\r\n}\r\nclass Sequence {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Sequence, length error\");\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n let temp = [input];\r\n let match = true;\r\n for (const sequence of this.list) {\r\n temp = sequence.run(temp);\r\n if (temp.length === 0) {\r\n match = false;\r\n break;\r\n }\r\n }\r\n if (match === true) {\r\n result.push(...temp);\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.Sequence(\" + children.join() + \")\";\r\n }\r\n toStr() {\r\n let ret = \"\";\r\n for (const i of this.list) {\r\n ret = ret + i.toStr() + \",\";\r\n }\r\n return \"seq(\" + ret + \")\";\r\n }\r\n first() {\r\n return this.list[0].first();\r\n }\r\n}\r\nclass WordSequence {\r\n constructor(stri) {\r\n this.words = [];\r\n this.stri = stri;\r\n const foo = this.stri.replace(/-/g, \" - \");\r\n const split = foo.split(\" \");\r\n for (const st of split) {\r\n // todo, use Dash token\r\n this.words.push(new Word(st));\r\n }\r\n this.seq = new Sequence(this.words);\r\n }\r\n listKeywords() {\r\n return [this.stri.toString()];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n return this.seq.run(r);\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('\\\"\" + this.stri + \"\\\"')\";\r\n }\r\n toStr() {\r\n return \"str(\" + this.stri + \")\";\r\n }\r\n first() {\r\n return this.words[0].first();\r\n }\r\n}\r\nclass Expression {\r\n constructor() {\r\n this.runnable = undefined;\r\n }\r\n run(r) {\r\n const results = [];\r\n if (this.runnable === undefined) {\r\n this.runnable = this.getRunnable();\r\n }\r\n for (const input of r) {\r\n const temp = this.runnable.run([input]);\r\n for (const t of temp) {\r\n let consumed = input.remainingLength() - t.remainingLength();\r\n if (consumed > 0) {\r\n const originalLength = t.getNodes().length;\r\n const children = [];\r\n while (consumed > 0) {\r\n const sub = t.popNode();\r\n if (sub) {\r\n children.push(sub);\r\n consumed = consumed - sub.countTokens();\r\n }\r\n }\r\n const re = new nodes_1.ExpressionNode(this);\r\n re.setChildren(children.reverse());\r\n const n = t.getNodes().slice(0, originalLength - consumed);\r\n n.push(re);\r\n t.setNodes(n);\r\n }\r\n results.push(t);\r\n }\r\n }\r\n // console.dir(results);\r\n return results;\r\n }\r\n listKeywords() {\r\n // do not recurse, all Expressions are evaluated only on first level\r\n return [];\r\n }\r\n getUsing() {\r\n return [\"expression/\" + this.getName()];\r\n }\r\n getName() {\r\n return this.constructor.name;\r\n }\r\n railroad() {\r\n return \"Railroad.NonTerminal('\" + this.getName() + \"', {href: '#/expression/\" + this.getName() + \"'})\";\r\n }\r\n toStr() {\r\n return \"expression(\" + this.getName() + \")\";\r\n }\r\n first() {\r\n return this.getRunnable().first();\r\n }\r\n}\r\nexports.Expression = Expression;\r\nclass Permutation {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Permutation, length error, got \" + list.length);\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n const copy = this.list.slice();\r\n for (let index = 0; index < this.list.length; index++) {\r\n const temp = this.list[index].run(r);\r\n if (temp.length !== 0) {\r\n // match\r\n result.push(...temp);\r\n const left = copy;\r\n left.splice(index, 1);\r\n if (left.length === 1) {\r\n result.push(...left[0].run(temp));\r\n }\r\n else {\r\n result.push(...new Permutation(left).run(temp));\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.MultipleChoice(0, 'any',\" + children.join() + \")\";\r\n }\r\n toStr() {\r\n const children = this.list.map((e) => { return e.toStr(); });\r\n return \"per(\" + children.join() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass FailCombinator extends Error {\r\n}\r\nclass Fail {\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(_r) {\r\n throw new FailCombinator();\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('!Fail')\";\r\n }\r\n toStr() {\r\n return \"fail()\";\r\n }\r\n first() {\r\n return [];\r\n }\r\n}\r\nclass Alternative {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Alternative, length error\");\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const sequ of this.list) {\r\n const temp = sequ.run(r);\r\n result.push(...temp);\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.Choice(0, \" + children.join() + \")\";\r\n }\r\n toStr() {\r\n let ret = \"\";\r\n for (const i of this.list) {\r\n ret = ret + i.toStr() + \",\";\r\n }\r\n return \"alt(\" + ret + \")\";\r\n }\r\n first() {\r\n if (this.list.length !== 2) {\r\n return [\"\"];\r\n }\r\n const f1 = this.list[0].first();\r\n const f2 = this.list[1].first();\r\n if (f1.length === 1 && f1[0] === \"\") {\r\n return f1;\r\n }\r\n if (f2.length === 1 && f2[0] === \"\") {\r\n return f2;\r\n }\r\n if (f1.length === 1 && f2.length === 1 && f1[0] === f2[0]) {\r\n return f1;\r\n }\r\n f1.push(...f2);\r\n return f1;\r\n }\r\n}\r\n// prioritized alternative, skip others if match found\r\nclass AlternativePriority {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Alternative, length error\");\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const sequ of this.list) {\r\n // console.log(seq.toStr());\r\n const temp = sequ.run(r);\r\n if (temp.length > 0) {\r\n result.push(...temp);\r\n break;\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.Choice(0, \" + children.join() + \")\";\r\n }\r\n toStr() {\r\n let ret = \"\";\r\n for (const i of this.list) {\r\n ret = ret + i.toStr() + \",\";\r\n }\r\n return \"alt(\" + ret + \")\";\r\n }\r\n first() {\r\n if (this.list.length !== 2) {\r\n return [\"\"];\r\n }\r\n const f1 = this.list[0].first();\r\n const f2 = this.list[1].first();\r\n if (f1.length === 1 && f1[0] === \"\") {\r\n return f1;\r\n }\r\n if (f2.length === 1 && f2[0] === \"\") {\r\n return f2;\r\n }\r\n if (f1.length === 1 && f2.length === 1 && f1[0] === f2[0]) {\r\n return f1;\r\n }\r\n f1.push(...f2);\r\n return f1;\r\n }\r\n}\r\nclass Combi {\r\n static railroad(runnable, complex = false) {\r\n // todo, move method to graph.js?\r\n let type = \"Railroad.Diagram(\";\r\n if (complex === true) {\r\n type = \"Railroad.ComplexDiagram(\";\r\n }\r\n const result = \"Railroad.Diagram.INTERNAL_ALIGNMENT = 'left';\\n\" +\r\n type +\r\n runnable.railroad() +\r\n \").toString();\";\r\n return result;\r\n }\r\n static listKeywords(runnable) {\r\n // todo, move these walkers of the syntax tree to some abstraction?\r\n let res = runnable.listKeywords();\r\n // remove duplicates\r\n res = res.filter((x, i, a) => { return a.indexOf(x) === i; });\r\n return res;\r\n }\r\n // assumption: no pragmas supplied in tokens input\r\n static run(runnable, tokens, version) {\r\n this.ver = version;\r\n const input = new result_1.Result(tokens, 0);\r\n try {\r\n const result = runnable.run([input]);\r\n /*\r\n console.log(\"res: \" + result.length);\r\n for (const res of result) {\r\n console.dir(res.getNodes().map(n => n.get().constructor.name));\r\n console.dir(res.getNodes().map(n => n.concatTokens()));\r\n }\r\n */\r\n for (const res of result) {\r\n if (res.remainingLength() === 0) {\r\n return res.getNodes();\r\n }\r\n }\r\n }\r\n catch (err) {\r\n if (err instanceof FailCombinator) {\r\n return undefined;\r\n }\r\n throw err;\r\n }\r\n return undefined;\r\n }\r\n static getVersion() {\r\n return this.ver;\r\n }\r\n}\r\nexports.Combi = Combi;\r\n// -----------------------------------------------------------------------------\r\nfunction str(s) {\r\n if (s.indexOf(\" \") > 0 || s.indexOf(\"-\") > 0) {\r\n return new WordSequence(s);\r\n }\r\n else {\r\n return new Word(s);\r\n }\r\n}\r\nexports.str = str;\r\nfunction regex(r) {\r\n return new Regex(r);\r\n}\r\nexports.regex = regex;\r\nfunction tok(t) {\r\n return new Token(t.name);\r\n}\r\nexports.tok = tok;\r\nconst singletons = {};\r\nfunction map(s) {\r\n const type = typeof s;\r\n if (type === \"string\") {\r\n return str(s);\r\n }\r\n else if (type === \"function\") {\r\n // @ts-ignore\r\n const name = s.name;\r\n if (singletons[name] === undefined) {\r\n // @ts-ignore\r\n singletons[name] = new s();\r\n }\r\n return singletons[name];\r\n }\r\n else {\r\n return s;\r\n }\r\n}\r\nfunction seq(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new Sequence(list);\r\n}\r\nexports.seq = seq;\r\nfunction alt(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new Alternative(list);\r\n}\r\nexports.alt = alt;\r\nfunction altPrio(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new AlternativePriority(list);\r\n}\r\nexports.altPrio = altPrio;\r\nfunction opt(first) {\r\n return new Optional(map(first));\r\n}\r\nexports.opt = opt;\r\nfunction optPrio(first) {\r\n return new OptionalPriority(map(first));\r\n}\r\nexports.optPrio = optPrio;\r\nfunction per(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new Permutation(list);\r\n}\r\nexports.per = per;\r\nfunction star(first) {\r\n return new Star(map(first));\r\n}\r\nexports.star = star;\r\nfunction starPrio(first) {\r\n return new StarPrioroity(map(first));\r\n}\r\nexports.starPrio = starPrio;\r\nfunction plus(first) {\r\n return new Plus(map(first));\r\n}\r\nexports.plus = plus;\r\nfunction plusPrio(first) {\r\n return new PlusPriority(map(first));\r\n}\r\nexports.plusPrio = plusPrio;\r\nfunction ver(version, first, or) {\r\n return new Vers(version, map(first), or);\r\n}\r\nexports.ver = ver;\r\nfunction verNot(version, first) {\r\n return new VersNot(version, map(first));\r\n}\r\nexports.verNot = verNot;\r\nfunction fail() {\r\n return new Fail();\r\n}\r\nexports.fail = fail;\r\n//# sourceMappingURL=combi.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js?");
|
|
371
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.failStar = exports.failCombinator = exports.verNot = exports.ver = exports.plusPrio = exports.plus = exports.starPrio = exports.star = exports.per = exports.optPrio = exports.opt = exports.altPrio = exports.alt = exports.seq = exports.tok = exports.regex = exports.str = exports.Combi = exports.Expression = void 0;\r\nconst Tokens = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst result_1 = __webpack_require__(/*! ./result */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/result.js\");\r\nclass Regex {\r\n constructor(r) {\r\n this.regexp = r;\r\n }\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n if (input.remainingLength() === 0) {\r\n continue;\r\n }\r\n const token = input.peek();\r\n if (this.regexp.test(token.getStr()) === true) {\r\n result.push(input.shift(new nodes_1.TokenNodeRegex(token)));\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal(\\\"\" + this.regexp.source.replace(/\\\\/g, \"\\\\\\\\\") + \"\\\")\";\r\n }\r\n toStr() {\r\n return this.regexp.toString();\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Word {\r\n constructor(s) {\r\n this.s = s.toUpperCase();\r\n }\r\n listKeywords() {\r\n return [this.s];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n if (input.remainingLength() !== 0\r\n && input.peek().getStr().toUpperCase() === this.s) {\r\n // console.log(\"match, \" + this.s + result.length);\r\n result.push(input.shift(new nodes_1.TokenNode(input.peek())));\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('\\\"\" + this.s + \"\\\"')\";\r\n }\r\n toStr() {\r\n return \"\\\"\" + this.s + \"\\\"\";\r\n }\r\n first() {\r\n return [this.s];\r\n }\r\n}\r\nclass Token {\r\n constructor(s) {\r\n this.name = s.toUpperCase();\r\n }\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n if (input.remainingLength() !== 0\r\n && input.peek().constructor.name.toUpperCase() === this.name) {\r\n result.push(input.shift(new nodes_1.TokenNode(input.peek())));\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n let text = this.name;\r\n const toke = Tokens;\r\n for (const token in Tokens) {\r\n if (token.toUpperCase() === this.name && toke[token].railroad) {\r\n text = toke[token].railroad();\r\n break;\r\n }\r\n }\r\n return \"Railroad.Terminal('!\\\"\" + text + \"\\\"')\";\r\n }\r\n toStr() {\r\n return \"Token \\\"\" + this.name + \"\\\"\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Vers {\r\n constructor(version, runnable, or) {\r\n this.version = version;\r\n this.runnable = runnable;\r\n this.or = or;\r\n }\r\n listKeywords() {\r\n return this.runnable.listKeywords();\r\n }\r\n run(r) {\r\n const targetVersion = Combi.getVersion();\r\n if (this.or && targetVersion === this.or) {\r\n return this.runnable.run(r);\r\n }\r\n else if (targetVersion === version_1.Version.OpenABAP) {\r\n if (this.version > version_1.Version.v702) {\r\n return [];\r\n }\r\n else {\r\n return this.runnable.run(r);\r\n }\r\n }\r\n else if (targetVersion >= this.version || targetVersion === version_1.Version.Cloud) {\r\n return this.runnable.run(r);\r\n }\r\n else {\r\n return [];\r\n }\r\n }\r\n getUsing() {\r\n return this.runnable.getUsing();\r\n }\r\n railroad() {\r\n let text = this.version;\r\n if (this.or) {\r\n text += \" or \" + this.or;\r\n }\r\n return \"Railroad.Sequence(Railroad.Comment(\\\"\" +\r\n text +\r\n \"\\\", {}), \" +\r\n this.runnable.railroad() +\r\n \")\";\r\n }\r\n toStr() {\r\n return \"Version(\" + this.runnable.toStr() + \")\";\r\n }\r\n first() {\r\n return this.runnable.first();\r\n }\r\n}\r\nclass VersNot {\r\n constructor(version, runnable) {\r\n this.version = version;\r\n this.runnable = runnable;\r\n }\r\n listKeywords() {\r\n return this.runnable.listKeywords();\r\n }\r\n getUsing() {\r\n return this.runnable.getUsing();\r\n }\r\n run(r) {\r\n if (Combi.getVersion() !== this.version) {\r\n return this.runnable.run(r);\r\n }\r\n else {\r\n return [];\r\n }\r\n }\r\n railroad() {\r\n return \"Railroad.Sequence(Railroad.Comment(\\\"not \" +\r\n this.version +\r\n \"\\\", {}), \" +\r\n this.runnable.railroad() +\r\n \")\";\r\n }\r\n toStr() {\r\n return \"VersionNot(\" + this.runnable.toStr() + \")\";\r\n }\r\n first() {\r\n return this.runnable.first();\r\n }\r\n}\r\nclass OptionalPriority {\r\n constructor(optional) {\r\n this.optional = optional;\r\n }\r\n listKeywords() {\r\n return this.optional.listKeywords();\r\n }\r\n getUsing() {\r\n return this.optional.getUsing();\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n const res = this.optional.run([input]);\r\n if (res.length > 1) {\r\n result.push(...res);\r\n }\r\n else if (res.length === 0) {\r\n result.push(input);\r\n }\r\n else if (res[0].remainingLength() < input.remainingLength()) {\r\n result.push(...res);\r\n }\r\n else {\r\n result.push(input);\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Optional(\" + this.optional.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"opt(\" + this.optional.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Optional {\r\n constructor(optional) {\r\n this.optional = optional;\r\n }\r\n listKeywords() {\r\n return this.optional.listKeywords();\r\n }\r\n getUsing() {\r\n return this.optional.getUsing();\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n result.push(input);\r\n const res = this.optional.run([input]);\r\n result.push(...res);\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.Optional(\" + this.optional.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"opt(\" + this.optional.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Star {\r\n constructor(sta) {\r\n this.sta = sta;\r\n }\r\n listKeywords() {\r\n return this.sta.listKeywords();\r\n }\r\n getUsing() {\r\n return this.sta.getUsing();\r\n }\r\n run(r) {\r\n const result = r;\r\n try {\r\n let res = r;\r\n let input = [];\r\n for (;;) {\r\n input = res;\r\n res = this.sta.run(input);\r\n if (res.length === 0) {\r\n break;\r\n }\r\n result.push(...res);\r\n }\r\n }\r\n catch (err) {\r\n if (err instanceof FailStarError) {\r\n return result;\r\n }\r\n throw err;\r\n }\r\n // console.dir(result);\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.ZeroOrMore(\" + this.sta.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"star(\" + this.sta.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass StarPrioroity {\r\n constructor(sta) {\r\n this.sta = sta;\r\n }\r\n listKeywords() {\r\n return this.sta.listKeywords();\r\n }\r\n getUsing() {\r\n return this.sta.getUsing();\r\n }\r\n run(r) {\r\n let result = r;\r\n let res = r;\r\n // let input: Result[] = [];\r\n let prev;\r\n for (;;) {\r\n // input = res;\r\n res = this.sta.run(res);\r\n if (res.length === 0) {\r\n if (prev !== undefined) {\r\n // console.log(\"star length: \" + prev.length);\r\n let best = Number.MAX_SAFE_INTEGER;\r\n for (const p of prev) {\r\n if (p.remainingLength() < best) {\r\n result = [p];\r\n best = p.remainingLength();\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n prev = res;\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n return \"Railroad.ZeroOrMore(\" + this.sta.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"star(\" + this.sta.toStr() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass Plus {\r\n constructor(plu) {\r\n this.plu = plu;\r\n this.sub = new Sequence([this.plu, new Star(this.plu)]);\r\n }\r\n listKeywords() {\r\n return this.plu.listKeywords();\r\n }\r\n getUsing() {\r\n return this.plu.getUsing();\r\n }\r\n run(r) {\r\n return this.sub.run(r);\r\n }\r\n railroad() {\r\n return \"Railroad.OneOrMore(\" + this.plu.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"plus(\" + this.plu.toStr() + \")\";\r\n }\r\n first() {\r\n return this.plu.first();\r\n }\r\n}\r\nclass PlusPriority {\r\n constructor(plu) {\r\n this.plu = plu;\r\n this.sub = new Sequence([this.plu, new StarPrioroity(this.plu)]);\r\n }\r\n listKeywords() {\r\n return this.plu.listKeywords();\r\n }\r\n getUsing() {\r\n return this.plu.getUsing();\r\n }\r\n run(r) {\r\n return this.sub.run(r);\r\n }\r\n railroad() {\r\n return \"Railroad.OneOrMore(\" + this.plu.railroad() + \")\";\r\n }\r\n toStr() {\r\n return \"plus(\" + this.plu.toStr() + \")\";\r\n }\r\n first() {\r\n return this.plu.first();\r\n }\r\n}\r\nclass Sequence {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Sequence, length error\");\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const input of r) {\r\n let temp = [input];\r\n let match = true;\r\n for (const sequence of this.list) {\r\n temp = sequence.run(temp);\r\n if (temp.length === 0) {\r\n match = false;\r\n break;\r\n }\r\n }\r\n if (match === true) {\r\n result.push(...temp);\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.Sequence(\" + children.join() + \")\";\r\n }\r\n toStr() {\r\n let ret = \"\";\r\n for (const i of this.list) {\r\n ret = ret + i.toStr() + \",\";\r\n }\r\n return \"seq(\" + ret + \")\";\r\n }\r\n first() {\r\n return this.list[0].first();\r\n }\r\n}\r\nclass WordSequence {\r\n constructor(stri) {\r\n this.words = [];\r\n this.stri = stri;\r\n const foo = this.stri.replace(/-/g, \" - \");\r\n const split = foo.split(\" \");\r\n for (const st of split) {\r\n // todo, use Dash token\r\n this.words.push(new Word(st));\r\n }\r\n this.seq = new Sequence(this.words);\r\n }\r\n listKeywords() {\r\n return [this.stri.toString()];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(r) {\r\n return this.seq.run(r);\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('\\\"\" + this.stri + \"\\\"')\";\r\n }\r\n toStr() {\r\n return \"str(\" + this.stri + \")\";\r\n }\r\n first() {\r\n return this.words[0].first();\r\n }\r\n}\r\nclass Expression {\r\n constructor() {\r\n this.runnable = undefined;\r\n }\r\n run(r) {\r\n const results = [];\r\n if (this.runnable === undefined) {\r\n this.runnable = this.getRunnable();\r\n }\r\n for (const input of r) {\r\n const temp = this.runnable.run([input]);\r\n for (const t of temp) {\r\n let consumed = input.remainingLength() - t.remainingLength();\r\n if (consumed > 0) {\r\n const originalLength = t.getNodes().length;\r\n const children = [];\r\n while (consumed > 0) {\r\n const sub = t.popNode();\r\n if (sub) {\r\n children.push(sub);\r\n consumed = consumed - sub.countTokens();\r\n }\r\n }\r\n const re = new nodes_1.ExpressionNode(this);\r\n re.setChildren(children.reverse());\r\n const n = t.getNodes().slice(0, originalLength - consumed);\r\n n.push(re);\r\n t.setNodes(n);\r\n }\r\n results.push(t);\r\n }\r\n }\r\n // console.dir(results);\r\n return results;\r\n }\r\n listKeywords() {\r\n // do not recurse, all Expressions are evaluated only on first level\r\n return [];\r\n }\r\n getUsing() {\r\n return [\"expression/\" + this.getName()];\r\n }\r\n getName() {\r\n return this.constructor.name;\r\n }\r\n railroad() {\r\n return \"Railroad.NonTerminal('\" + this.getName() + \"', {href: '#/expression/\" + this.getName() + \"'})\";\r\n }\r\n toStr() {\r\n return \"expression(\" + this.getName() + \")\";\r\n }\r\n first() {\r\n return this.getRunnable().first();\r\n }\r\n}\r\nexports.Expression = Expression;\r\nclass Permutation {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Permutation, length error, got \" + list.length);\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n const copy = this.list.slice();\r\n for (let index = 0; index < this.list.length; index++) {\r\n const temp = this.list[index].run(r);\r\n if (temp.length !== 0) {\r\n // match\r\n result.push(...temp);\r\n const left = copy;\r\n left.splice(index, 1);\r\n if (left.length === 1) {\r\n result.push(...left[0].run(temp));\r\n }\r\n else {\r\n result.push(...new Permutation(left).run(temp));\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.MultipleChoice(0, 'any',\" + children.join() + \")\";\r\n }\r\n toStr() {\r\n const children = this.list.map((e) => { return e.toStr(); });\r\n return \"per(\" + children.join() + \")\";\r\n }\r\n first() {\r\n return [\"\"];\r\n }\r\n}\r\nclass FailCombinatorError extends Error {\r\n}\r\nclass FailStarError extends Error {\r\n}\r\nclass FailCombinator {\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(_r) {\r\n throw new FailCombinatorError();\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('!FailCombinator')\";\r\n }\r\n toStr() {\r\n return \"fail()\";\r\n }\r\n first() {\r\n return [];\r\n }\r\n}\r\n// Note that Plus is implemented with Star\r\nclass FailStar {\r\n listKeywords() {\r\n return [];\r\n }\r\n getUsing() {\r\n return [];\r\n }\r\n run(_r) {\r\n throw new FailStarError();\r\n }\r\n railroad() {\r\n return \"Railroad.Terminal('!FailStar')\";\r\n }\r\n toStr() {\r\n return \"fail()\";\r\n }\r\n first() {\r\n return [];\r\n }\r\n}\r\nclass Alternative {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Alternative, length error\");\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const sequ of this.list) {\r\n const temp = sequ.run(r);\r\n result.push(...temp);\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.Choice(0, \" + children.join() + \")\";\r\n }\r\n toStr() {\r\n let ret = \"\";\r\n for (const i of this.list) {\r\n ret = ret + i.toStr() + \",\";\r\n }\r\n return \"alt(\" + ret + \")\";\r\n }\r\n first() {\r\n if (this.list.length !== 2) {\r\n return [\"\"];\r\n }\r\n const f1 = this.list[0].first();\r\n const f2 = this.list[1].first();\r\n if (f1.length === 1 && f1[0] === \"\") {\r\n return f1;\r\n }\r\n if (f2.length === 1 && f2[0] === \"\") {\r\n return f2;\r\n }\r\n if (f1.length === 1 && f2.length === 1 && f1[0] === f2[0]) {\r\n return f1;\r\n }\r\n f1.push(...f2);\r\n return f1;\r\n }\r\n}\r\n// prioritized alternative, skip others if match found\r\nclass AlternativePriority {\r\n constructor(list) {\r\n if (list.length < 2) {\r\n throw new Error(\"Alternative, length error\");\r\n }\r\n this.list = list;\r\n }\r\n listKeywords() {\r\n const ret = [];\r\n for (const i of this.list) {\r\n ret.push(...i.listKeywords());\r\n }\r\n return ret;\r\n }\r\n getUsing() {\r\n return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);\r\n }\r\n run(r) {\r\n const result = [];\r\n for (const sequ of this.list) {\r\n // console.log(seq.toStr());\r\n const temp = sequ.run(r);\r\n if (temp.length > 0) {\r\n result.push(...temp);\r\n break;\r\n }\r\n }\r\n return result;\r\n }\r\n railroad() {\r\n const children = this.list.map((e) => { return e.railroad(); });\r\n return \"Railroad.Choice(0, \" + children.join() + \")\";\r\n }\r\n toStr() {\r\n let ret = \"\";\r\n for (const i of this.list) {\r\n ret = ret + i.toStr() + \",\";\r\n }\r\n return \"alt(\" + ret + \")\";\r\n }\r\n first() {\r\n if (this.list.length !== 2) {\r\n return [\"\"];\r\n }\r\n const f1 = this.list[0].first();\r\n const f2 = this.list[1].first();\r\n if (f1.length === 1 && f1[0] === \"\") {\r\n return f1;\r\n }\r\n if (f2.length === 1 && f2[0] === \"\") {\r\n return f2;\r\n }\r\n if (f1.length === 1 && f2.length === 1 && f1[0] === f2[0]) {\r\n return f1;\r\n }\r\n f1.push(...f2);\r\n return f1;\r\n }\r\n}\r\nclass Combi {\r\n static railroad(runnable, complex = false) {\r\n // todo, move method to graph.js?\r\n let type = \"Railroad.Diagram(\";\r\n if (complex === true) {\r\n type = \"Railroad.ComplexDiagram(\";\r\n }\r\n const result = \"Railroad.Diagram.INTERNAL_ALIGNMENT = 'left';\\n\" +\r\n type +\r\n runnable.railroad() +\r\n \").toString();\";\r\n return result;\r\n }\r\n static listKeywords(runnable) {\r\n // todo, move these walkers of the syntax tree to some abstraction?\r\n let res = runnable.listKeywords();\r\n // remove duplicates\r\n res = res.filter((x, i, a) => { return a.indexOf(x) === i; });\r\n return res;\r\n }\r\n // assumption: no pragmas supplied in tokens input\r\n static run(runnable, tokens, version) {\r\n this.ver = version;\r\n const input = new result_1.Result(tokens, 0);\r\n try {\r\n const result = runnable.run([input]);\r\n /*\r\n console.log(\"res: \" + result.length);\r\n for (const res of result) {\r\n console.dir(res.getNodes().map(n => n.get().constructor.name));\r\n console.dir(res.getNodes().map(n => n.concatTokens()));\r\n }\r\n */\r\n for (const res of result) {\r\n if (res.remainingLength() === 0) {\r\n return res.getNodes();\r\n }\r\n }\r\n }\r\n catch (err) {\r\n if (err instanceof FailCombinatorError) {\r\n return undefined;\r\n }\r\n throw err;\r\n }\r\n return undefined;\r\n }\r\n static getVersion() {\r\n return this.ver;\r\n }\r\n}\r\nexports.Combi = Combi;\r\n// -----------------------------------------------------------------------------\r\nfunction str(s) {\r\n if (s.indexOf(\" \") > 0 || s.indexOf(\"-\") > 0) {\r\n return new WordSequence(s);\r\n }\r\n else {\r\n return new Word(s);\r\n }\r\n}\r\nexports.str = str;\r\nfunction regex(r) {\r\n return new Regex(r);\r\n}\r\nexports.regex = regex;\r\nfunction tok(t) {\r\n return new Token(t.name);\r\n}\r\nexports.tok = tok;\r\nconst singletons = {};\r\nfunction map(s) {\r\n const type = typeof s;\r\n if (type === \"string\") {\r\n return str(s);\r\n }\r\n else if (type === \"function\") {\r\n // @ts-ignore\r\n const name = s.name;\r\n if (singletons[name] === undefined) {\r\n // @ts-ignore\r\n singletons[name] = new s();\r\n }\r\n return singletons[name];\r\n }\r\n else {\r\n return s;\r\n }\r\n}\r\nfunction seq(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new Sequence(list);\r\n}\r\nexports.seq = seq;\r\nfunction alt(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new Alternative(list);\r\n}\r\nexports.alt = alt;\r\nfunction altPrio(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new AlternativePriority(list);\r\n}\r\nexports.altPrio = altPrio;\r\nfunction opt(first) {\r\n return new Optional(map(first));\r\n}\r\nexports.opt = opt;\r\nfunction optPrio(first) {\r\n return new OptionalPriority(map(first));\r\n}\r\nexports.optPrio = optPrio;\r\nfunction per(first, second, ...rest) {\r\n const list = [map(first), map(second)];\r\n list.push(...rest.map(map));\r\n return new Permutation(list);\r\n}\r\nexports.per = per;\r\nfunction star(first) {\r\n return new Star(map(first));\r\n}\r\nexports.star = star;\r\nfunction starPrio(first) {\r\n return new StarPrioroity(map(first));\r\n}\r\nexports.starPrio = starPrio;\r\nfunction plus(first) {\r\n return new Plus(map(first));\r\n}\r\nexports.plus = plus;\r\nfunction plusPrio(first) {\r\n return new PlusPriority(map(first));\r\n}\r\nexports.plusPrio = plusPrio;\r\nfunction ver(version, first, or) {\r\n return new Vers(version, map(first), or);\r\n}\r\nexports.ver = ver;\r\nfunction verNot(version, first) {\r\n return new VersNot(version, map(first));\r\n}\r\nexports.verNot = verNot;\r\nfunction failCombinator() {\r\n return new FailCombinator();\r\n}\r\nexports.failCombinator = failCombinator;\r\nfunction failStar() {\r\n return new FailStar();\r\n}\r\nexports.failStar = failStar;\r\n//# sourceMappingURL=combi.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js?");
|
|
372
372
|
|
|
373
373
|
/***/ }),
|
|
374
374
|
|
|
@@ -2535,7 +2535,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2535
2535
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2536
2536
|
|
|
2537
2537
|
"use strict";
|
|
2538
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTable = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./field_chain */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/field_chain.js\");\r\nconst type_table_key_1 = __webpack_require__(/*! ./type_table_key */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table_key.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass TypeTable extends combi_1.Expression {\r\n getRunnable() {\r\n const header = \"WITH HEADER LINE\";\r\n const initial = (0, combi_1.seq)(\"INITIAL SIZE\", _1.Constant);\r\n const normal1 = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE\", (0, combi_1.opt)(\"OF\"), (0, combi_1.opt)(\"REF TO\"), (0, combi_1.opt)(_1.TypeName));\r\n const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE OF\", (0, combi_1.optPrio)(\"REF TO\"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));\r\n const rangeType = (0, combi_1.seq)(\"RANGE OF\", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n const rangeLike = (0, combi_1.seq)(\"RANGE OF\", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));\r\n const occurs = (0, combi_1.seq)(\"OCCURS\", _1.Integer);\r\n const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)(\"TABLE FOR\", (0, combi_1.altPrio)(\"CREATE\", \"FAILED\", \"LOCK\", \"ACTION IMPORT\", \"UPDATE\", \"READ RESULT\", \"ACTION RESULT\"), _1.TypeName));\r\n const oldType = (0, combi_1.seq)((0, combi_1.opt)(\"REF TO\"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));\r\n const oldLike = (0, combi_1.seq)((0, combi_1.opt)(\"REF TO\"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));\r\n const ret = (0, combi_1.altPrio)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), (0, combi_1.seq)(\"LIKE\", (0, combi_1.alt)(oldLike, likeType, rangeLike)), (0, combi_1.seq)(\"TYPE\", (0, combi_1.alt)(oldType, typetable, rangeType, derived)));\r\n return ret;\r\n }\r\n}\r\nexports.TypeTable = TypeTable;\r\n//# sourceMappingURL=type_table.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table.js?");
|
|
2538
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTable = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst field_chain_1 = __webpack_require__(/*! ./field_chain */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/field_chain.js\");\r\nconst type_table_key_1 = __webpack_require__(/*! ./type_table_key */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table_key.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass TypeTable extends combi_1.Expression {\r\n getRunnable() {\r\n const header = \"WITH HEADER LINE\";\r\n const initial = (0, combi_1.seq)(\"INITIAL SIZE\", _1.Constant);\r\n const normal1 = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE\", (0, combi_1.opt)(\"OF\"), (0, combi_1.opt)(\"REF TO\"), (0, combi_1.opt)(_1.TypeName));\r\n const likeType = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"STANDARD\", \"HASHED\", \"INDEX\", \"SORTED\", \"ANY\")), \"TABLE OF\", (0, combi_1.optPrio)(\"REF TO\"), (0, combi_1.opt)(field_chain_1.FieldChain), (0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))));\r\n const rangeType = (0, combi_1.seq)(\"RANGE OF\", _1.TypeName, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n const rangeLike = (0, combi_1.seq)(\"RANGE OF\", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));\r\n // a maximum of 15 secondary table keys can be defined\r\n // \"WITH\" is not allowed as a field name in keys\r\n const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));\r\n const occurs = (0, combi_1.seq)(\"OCCURS\", _1.Integer);\r\n const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)(\"TABLE FOR\", (0, combi_1.altPrio)(\"CREATE\", \"FAILED\", \"LOCK\", \"ACTION IMPORT\", \"UPDATE\", \"READ RESULT\", \"ACTION RESULT\"), _1.TypeName));\r\n const oldType = (0, combi_1.seq)((0, combi_1.opt)(\"REF TO\"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));\r\n const oldLike = (0, combi_1.seq)((0, combi_1.opt)(\"REF TO\"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));\r\n const ret = (0, combi_1.altPrio)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), (0, combi_1.seq)(\"LIKE\", (0, combi_1.alt)(oldLike, likeType, rangeLike)), (0, combi_1.seq)(\"TYPE\", (0, combi_1.alt)(oldType, typetable, rangeType, derived)));\r\n return ret;\r\n }\r\n}\r\nexports.TypeTable = TypeTable;\r\n//# sourceMappingURL=type_table.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table.js?");
|
|
2539
2539
|
|
|
2540
2540
|
/***/ }),
|
|
2541
2541
|
|
|
@@ -2546,7 +2546,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2546
2546
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2547
2547
|
|
|
2548
2548
|
"use strict";
|
|
2549
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTableKey = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass TypeTableKey extends combi_1.Expression {\r\n getRunnable() {\r\n const uniqueness = (0, combi_1.alt)(\"NON-UNIQUE\", \"UNIQUE\");\r\n const defaultKey = \"DEFAULT KEY\";\r\n const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, \"EMPTY KEY\");\r\n const key = (0, combi_1.seq)(\"WITH\", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"SORTED\", \"HASHED\")), \"KEY\", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, \"COMPONENTS\",
|
|
2549
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTableKey = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass TypeTableKey extends combi_1.Expression {\r\n getRunnable() {\r\n const uniqueness = (0, combi_1.alt)(\"NON-UNIQUE\", \"UNIQUE\");\r\n const defaultKey = \"DEFAULT KEY\";\r\n const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, \"EMPTY KEY\");\r\n const components = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)(\"WITH\", (0, combi_1.failStar)()), _1.FieldSub));\r\n const key = (0, combi_1.seq)(\"WITH\", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)(\"SORTED\", \"HASHED\")), \"KEY\", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, \"COMPONENTS\", components), components))), (0, combi_1.optPrio)(\"READ-ONLY\"));\r\n return key;\r\n }\r\n}\r\nexports.TypeTableKey = TypeTableKey;\r\n//# sourceMappingURL=type_table_key.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/type_table_key.js?");
|
|
2550
2550
|
|
|
2551
2551
|
/***/ }),
|
|
2552
2552
|
|
|
@@ -4504,7 +4504,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
4504
4504
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4505
4505
|
|
|
4506
4506
|
"use strict";
|
|
4507
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Loop = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst simple_source2_1 = __webpack_require__(/*! ../expressions/simple_source2 */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/simple_source2.js\");\r\nconst loop_group_by_1 = __webpack_require__(/*! ../expressions/loop_group_by */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/loop_group_by.js\");\r\nclass Loop {\r\n getMatcher() {\r\n const where = (0, combi_1.seq)(\"WHERE\", (0, combi_1.alt)(expressions_1.ComponentCond, expressions_1.Dynamic));\r\n const group = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)(\"GROUP BY\", loop_group_by_1.LoopGroupBy));\r\n const from = (0, combi_1.seq)(\"FROM\", expressions_1.Source);\r\n const to = (0, combi_1.seq)(\"TO\", expressions_1.Source);\r\n const usingKey = (0, combi_1.seq)(\"USING KEY\", (0, combi_1.altPrio)(expressions_1.SimpleName, expressions_1.Dynamic));\r\n const options = (0, combi_1.per)(expressions_1.LoopTarget, from, to, where, usingKey, group);\r\n const at = (0, combi_1.seq)(\"AT\", (0, combi_1.opt)((0, combi_1.seq)(\"SCREEN\", (0, combi_1.
|
|
4507
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Loop = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst simple_source2_1 = __webpack_require__(/*! ../expressions/simple_source2 */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/simple_source2.js\");\r\nconst loop_group_by_1 = __webpack_require__(/*! ../expressions/loop_group_by */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/loop_group_by.js\");\r\nclass Loop {\r\n getMatcher() {\r\n const where = (0, combi_1.seq)(\"WHERE\", (0, combi_1.alt)(expressions_1.ComponentCond, expressions_1.Dynamic));\r\n const group = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)(\"GROUP BY\", loop_group_by_1.LoopGroupBy));\r\n const from = (0, combi_1.seq)(\"FROM\", expressions_1.Source);\r\n const to = (0, combi_1.seq)(\"TO\", expressions_1.Source);\r\n const usingKey = (0, combi_1.seq)(\"USING KEY\", (0, combi_1.altPrio)(expressions_1.SimpleName, expressions_1.Dynamic));\r\n const options = (0, combi_1.per)(expressions_1.LoopTarget, from, to, where, usingKey, group);\r\n const at = (0, combi_1.seq)(\"AT\", (0, combi_1.opt)((0, combi_1.seq)(\"SCREEN\", (0, combi_1.failCombinator)())), (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v740sp08, \"GROUP\")), (0, combi_1.alt)(simple_source2_1.SimpleSource2, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source)), (0, combi_1.opt)(options));\r\n return (0, combi_1.seq)(\"LOOP\", (0, combi_1.opt)(at));\r\n }\r\n}\r\nexports.Loop = Loop;\r\n//# sourceMappingURL=loop.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/loop.js?");
|
|
4508
4508
|
|
|
4509
4509
|
/***/ }),
|
|
4510
4510
|
|
|
@@ -4933,7 +4933,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
4933
4933
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4934
4934
|
|
|
4935
4935
|
"use strict";
|
|
4936
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ReadTable = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass ReadTable {\r\n getMatcher() {\r\n const comparing = (0, combi_1.seq)(\"COMPARING\", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.FieldSub), expressions_1.Dynamic));\r\n const index = (0, combi_1.seq)(\"INDEX\", expressions_1.Source);\r\n const components = (0, combi_1.seq)((0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic), \"COMPONENTS\", expressions_1.ComponentCompareSimple);\r\n const key = (0, combi_1.seq)((0, combi_1.altPrio)(\"WITH KEY\", \"WITH TABLE KEY\"), (0, combi_1.alt)(expressions_1.ComponentCompareSimple, components, (0, combi_1.seq)((0, combi_1.optPrio)(\"=\"), expressions_1.Source)));\r\n const using = (0, combi_1.seq)(\"USING KEY\", (0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic));\r\n const from = (0, combi_1.seq)(\"FROM\", expressions_1.Source);\r\n const perm = (0, combi_1.per)((0, combi_1.alt)(index, key, from), expressions_1.ReadTableTarget, using, comparing, \"CASTING\", \"TRANSPORTING ALL FIELDS\", (0, combi_1.seq)(\"TRANSPORTING\", (0, combi_1.altPrio)(expressions_1.Dynamic,
|
|
4936
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ReadTable = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass ReadTable {\r\n getMatcher() {\r\n const comparing = (0, combi_1.seq)(\"COMPARING\", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.FieldSub), expressions_1.Dynamic));\r\n const index = (0, combi_1.seq)(\"INDEX\", expressions_1.Source);\r\n const components = (0, combi_1.seq)((0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic), \"COMPONENTS\", expressions_1.ComponentCompareSimple);\r\n const key = (0, combi_1.seq)((0, combi_1.altPrio)(\"WITH KEY\", \"WITH TABLE KEY\"), (0, combi_1.alt)(expressions_1.ComponentCompareSimple, components, (0, combi_1.seq)((0, combi_1.optPrio)(\"=\"), expressions_1.Source)));\r\n const using = (0, combi_1.seq)(\"USING KEY\", (0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic));\r\n const from = (0, combi_1.seq)(\"FROM\", expressions_1.Source);\r\n const fields = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)(\"INTO\", (0, combi_1.failStar)()), expressions_1.FieldSub));\r\n const perm = (0, combi_1.per)((0, combi_1.alt)(index, key, from), expressions_1.ReadTableTarget, using, comparing, \"CASTING\", \"TRANSPORTING ALL FIELDS\", (0, combi_1.seq)(\"TRANSPORTING\", (0, combi_1.altPrio)(expressions_1.Dynamic, fields)), \"BINARY SEARCH\");\r\n return (0, combi_1.seq)(\"READ TABLE\", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.SimpleSource2), (0, combi_1.opt)(perm));\r\n }\r\n}\r\nexports.ReadTable = ReadTable;\r\n//# sourceMappingURL=read_table.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/read_table.js?");
|
|
4937
4937
|
|
|
4938
4938
|
/***/ }),
|
|
4939
4939
|
|
|
@@ -7265,7 +7265,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
7265
7265
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7266
7266
|
|
|
7267
7267
|
"use strict";
|
|
7268
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTableKey = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass TypeTableKey {\r\n runSyntax(node, type) {\r\n if (type instanceof basic_1.TableType) {\r\n const rowType = type.getRowType();\r\n if (rowType instanceof basic_1.StructureType) {\r\n for (const c of node.findAllExpressions(Expressions.FieldSub)) {\r\n const concat = c.concatTokens();\r\n if (concat.includes(\"-\") === false // todo, properly check sub fields\r\n && rowType.getComponentByName(concat) === undefined\r\n && concat.toUpperCase() !== \"TABLE_LINE\") {\r\n return new basic_1.UnknownType(`Field ${concat} not part of structure`);\r\n }\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.TypeTableKey = TypeTableKey;\r\n//# sourceMappingURL=type_table_key.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/type_table_key.js?");
|
|
7268
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TypeTableKey = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass TypeTableKey {\r\n runSyntax(node, type) {\r\n if (type instanceof basic_1.TableType) {\r\n const rowType = type.getRowType();\r\n if (rowType instanceof basic_1.StructureType) {\r\n for (const c of node.findAllExpressions(Expressions.FieldSub)) {\r\n const concat = c.concatTokens().replace(/^!/, \"\");\r\n if (concat.includes(\"-\") === false // todo, properly check sub fields\r\n && rowType.getComponentByName(concat) === undefined\r\n && concat.toUpperCase() !== \"TABLE_LINE\") {\r\n return new basic_1.UnknownType(`Field ${concat} not part of structure`);\r\n }\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.TypeTableKey = TypeTableKey;\r\n//# sourceMappingURL=type_table_key.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/type_table_key.js?");
|
|
7269
7269
|
|
|
7270
7270
|
/***/ }),
|
|
7271
7271
|
|
|
@@ -9509,7 +9509,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
9509
9509
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
9510
9510
|
|
|
9511
9511
|
"use strict";
|
|
9512
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CDSCondition = void 0;\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/cds/expressions/index.js\");\r\nconst combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nclass CDSCondition extends combi_1.Expression {\r\n getRunnable() {\r\n const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(\".\", (0, combi_1.alt)(_1.CDSName, _1.CDSString))));\r\n const eq = (0, combi_1.seq)(name, (0, combi_1.alt)(\"=\", \"<>\", \"<\", \">\", \">=\", \"<=\", \"LIKE\"), (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSString));\r\n const isInitial = (0, combi_1.seq)(name, \"IS INITIAL\");\r\n const isNotInitial = (0, combi_1.seq)(name, \"IS NOT INITIAL\");\r\n const isNull = (0, combi_1.seq)(name, \"IS NULL\");\r\n const isNotNull = (0, combi_1.seq)(name, \"IS NOT NULL\");\r\n const condition = (0, combi_1.alt)(eq, isNull, isNotNull, isInitial, isNotInitial);\r\n const paren = (0, combi_1.seq)(\"(\", CDSCondition, \")\");\r\n return (0, combi_1.seq)((0, combi_1.alt)(condition, paren), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.alt)(\"AND\", \"OR\"), (0, combi_1.alt)(condition, paren))));\r\n }\r\n}\r\nexports.CDSCondition = CDSCondition;\r\n//# sourceMappingURL=cds_condition.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/cds/expressions/cds_condition.js?");
|
|
9512
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CDSCondition = void 0;\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/cds/expressions/index.js\");\r\nconst combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nclass CDSCondition extends combi_1.Expression {\r\n getRunnable() {\r\n const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(\".\", (0, combi_1.alt)(_1.CDSName, _1.CDSString))));\r\n const eq = (0, combi_1.seq)(name, (0, combi_1.alt)(\"=\", \"<>\", \"<\", \">\", \">=\", \"<=\", \"LIKE\", \"NOT LIKE\"), (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSString));\r\n const isInitial = (0, combi_1.seq)(name, \"IS INITIAL\");\r\n const isNotInitial = (0, combi_1.seq)(name, \"IS NOT INITIAL\");\r\n const isNull = (0, combi_1.seq)(name, \"IS NULL\");\r\n const isNotNull = (0, combi_1.seq)(name, \"IS NOT NULL\");\r\n const condition = (0, combi_1.alt)(eq, isNull, isNotNull, isInitial, isNotInitial);\r\n const paren = (0, combi_1.seq)(\"(\", CDSCondition, \")\");\r\n return (0, combi_1.seq)((0, combi_1.alt)(condition, paren), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.alt)(\"AND\", \"OR\"), (0, combi_1.alt)(condition, paren))));\r\n }\r\n}\r\nexports.CDSCondition = CDSCondition;\r\n//# sourceMappingURL=cds_condition.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/cds/expressions/cds_condition.js?");
|
|
9513
9513
|
|
|
9514
9514
|
/***/ }),
|
|
9515
9515
|
|
|
@@ -11412,7 +11412,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11412
11412
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11413
11413
|
|
|
11414
11414
|
"use strict";
|
|
11415
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.91.33\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11415
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.91.34\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11416
11416
|
|
|
11417
11417
|
/***/ }),
|
|
11418
11418
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.91.
|
|
3
|
+
"version": "2.91.34",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.91.
|
|
42
|
+
"@abaplint/core": "^2.91.34",
|
|
43
43
|
"@types/chai": "^4.3.3",
|
|
44
44
|
"@types/glob": "^7.2.0",
|
|
45
45
|
"@types/minimist": "^1.2.2",
|