@abaplint/cli 2.94.9 → 2.94.10
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 +3 -3
- package/package.json +3 -3
package/build/cli.js
CHANGED
|
@@ -379,7 +379,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
379
379
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
380
380
|
|
|
381
381
|
"use strict";
|
|
382
|
-
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 StarPriority {\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 StarPriority(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 StarPriority(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?");
|
|
382
|
+
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 StarPriority {\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 StarPriority(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 expressionSingletons = {};\r\nconst stringSingletons = {};\r\nfunction map(s) {\r\n const type = typeof s;\r\n if (type === \"string\") {\r\n if (stringSingletons[s] === undefined) {\r\n stringSingletons[s] = str(s);\r\n }\r\n return stringSingletons[s];\r\n }\r\n else if (type === \"function\") {\r\n // @ts-ignore\r\n const name = s.name;\r\n if (expressionSingletons[name] === undefined) {\r\n // @ts-ignore\r\n expressionSingletons[name] = new s();\r\n }\r\n return expressionSingletons[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 StarPriority(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?");
|
|
383
383
|
|
|
384
384
|
/***/ }),
|
|
385
385
|
|
|
@@ -2700,7 +2700,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
2700
2700
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2701
2701
|
|
|
2702
2702
|
"use strict";
|
|
2703
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StatementParser = exports.STATEMENT_MAX_TOKENS = void 0;\r\nconst Statements = __webpack_require__(/*! ./statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ./expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\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 artifacts_1 = __webpack_require__(/*! ../artifacts */ \"./node_modules/@abaplint/core/build/src/abap/artifacts.js\");\r\nconst combi_1 = __webpack_require__(/*! ./combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _statement_1 = __webpack_require__(/*! ./statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst expand_macros_1 = __webpack_require__(/*! ./expand_macros */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nexports.STATEMENT_MAX_TOKENS = 1000;\r\nclass StatementMap {\r\n constructor() {\r\n this.map = {};\r\n for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {\r\n const f = stat.getMatcher().first();\r\n if (f.length === 0) {\r\n throw new Error(\"StatementMap, first must have contents\");\r\n }\r\n for (const first of f) {\r\n if (this.map[first]) {\r\n this.map[first].push(stat);\r\n }\r\n else {\r\n this.map[first] = [stat];\r\n }\r\n }\r\n }\r\n }\r\n lookup(str) {\r\n const res = this.map[str.toUpperCase()];\r\n if (res === undefined) {\r\n return [];\r\n }\r\n return res;\r\n }\r\n}\r\nclass WorkArea {\r\n constructor(file, tokens) {\r\n this.file = file;\r\n this.tokens = tokens;\r\n this.statements = [];\r\n }\r\n addUnknown(pre, post, colon) {\r\n const st = new nodes_1.StatementNode(new _statement_1.Unknown(), colon);\r\n st.setChildren(this.tokensToNodes(pre, post));\r\n this.statements.push(st);\r\n }\r\n toResult() {\r\n return { file: this.file, tokens: this.tokens, statements: this.statements };\r\n }\r\n tokensToNodes(tokens1, tokens2) {\r\n const ret = [];\r\n for (const t of tokens1) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n for (const t of tokens2) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n}\r\nclass StatementParser {\r\n constructor(version, reg) {\r\n if (!StatementParser.map) {\r\n StatementParser.map = new StatementMap();\r\n }\r\n this.version = version;\r\n this.reg = reg;\r\n }\r\n /** input is one full object */\r\n run(input, globalMacros) {\r\n const macros = new expand_macros_1.ExpandMacros(globalMacros, this.version, this.reg);\r\n const wa = input.map(i => new WorkArea(i.file, i.tokens));\r\n for (const w of wa) {\r\n this.process(w);\r\n this.categorize(w);\r\n macros.find(w.statements);\r\n }\r\n for (const w of wa) {\r\n const res = macros.handleMacros(w.statements);\r\n w.statements = res.statements;\r\n if (res.containsUnknown === true) {\r\n this.lazyUnknown(w);\r\n }\r\n this.nativeSQL(w);\r\n }\r\n return wa.map(w => w.toResult());\r\n }\r\n // todo, refactor, remove method here and only have in WorkArea class\r\n tokensToNodes(tokens) {\r\n const ret = [];\r\n for (const t of tokens) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n // tries to split Unknown statements by newlines, when adding/writing a new statement\r\n // in an editor, adding the statement terminator is typically the last thing to do\r\n // note: this will not work if the second statement is a macro call, guess this is okay\r\n lazyUnknown(wa) {\r\n const result = [];\r\n for (let statement of wa.statements) {\r\n // dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statment if lazy logic is evaluated\r\n if (statement.get() instanceof _statement_1.Unknown) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"CALL METHOD \") === false\r\n && concat.startsWith(\"RAISE EXCEPTION TYPE \") === false\r\n && concat.startsWith(\"LOOP AT \") === false\r\n && concat.startsWith(\"CALL FUNCTION \") === false) {\r\n for (const { first, second } of this.buildSplits(statement.getTokens())) {\r\n if (second.length === 1) {\r\n continue; // probably punctuation\r\n }\r\n const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));\r\n if (!(s.get() instanceof _statement_1.Unknown)) {\r\n result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));\r\n statement = s;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n result.push(statement);\r\n }\r\n wa.statements = result;\r\n }\r\n buildSplits(tokens) {\r\n const res = [];\r\n const before = [];\r\n let prevRow = tokens[0].getRow();\r\n for (let i = 0; i < tokens.length; i++) {\r\n if (tokens[i].getRow() !== prevRow) {\r\n res.push({ first: [...before], second: [...tokens].splice(i) });\r\n }\r\n prevRow = tokens[i].getRow();\r\n before.push(tokens[i]);\r\n }\r\n return res;\r\n }\r\n nativeSQL(wa) {\r\n let sql = false;\r\n for (let i = 0; i < wa.statements.length; i++) {\r\n const statement = wa.statements[i];\r\n const type = statement.get();\r\n if (type instanceof Statements.ExecSQL\r\n || (type instanceof Statements.MethodImplementation && statement.findDirectExpression(Expressions.Language))) {\r\n sql = true;\r\n }\r\n else if (sql === true) {\r\n if (type instanceof Statements.EndExec\r\n || type instanceof Statements.EndMethod) {\r\n sql = false;\r\n }\r\n else if (!(type instanceof _statement_1.Comment)) {\r\n wa.statements[i] = new nodes_1.StatementNode(new _statement_1.NativeSQL()).setChildren(this.tokensToNodes(statement.getTokens()));\r\n }\r\n }\r\n }\r\n }\r\n // for each statement, run statement matchers to figure out which kind of statement it is\r\n categorize(wa) {\r\n const result = [];\r\n for (const statement of wa.statements) {\r\n result.push(this.categorizeStatement(statement));\r\n }\r\n wa.statements = result;\r\n }\r\n categorizeStatement(input) {\r\n let statement = input;\r\n const length = input.getChildren().length;\r\n const lastToken = input.getLastToken();\r\n const isPunctuation = lastToken instanceof Tokens.Punctuation;\r\n if (length === 1 && isPunctuation) {\r\n const tokens = statement.getTokens();\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n else if (statement.get() instanceof _statement_1.Unknown) {\r\n if (isPunctuation) {\r\n statement = this.match(statement);\r\n }\r\n else if (length > exports.STATEMENT_MAX_TOKENS) {\r\n // if the statement contains more than STATEMENT_MAX_TOKENS tokens, just give up\r\n statement = input;\r\n }\r\n else if (length === 1 && lastToken instanceof tokens_1.Pragma) {\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty(), undefined, [lastToken]);\r\n }\r\n }\r\n return statement;\r\n }\r\n removePragma(tokens) {\r\n const result = [];\r\n const pragmas = [];\r\n // skip the last token as it is the punctuation\r\n for (let i = 0; i < tokens.length - 1; i++) {\r\n const t = tokens[i];\r\n if (t instanceof Tokens.Pragma) {\r\n pragmas.push(t);\r\n }\r\n else {\r\n result.push(t);\r\n }\r\n }\r\n return { tokens: result, pragmas: pragmas };\r\n }\r\n match(statement) {\r\n const tokens = statement.getTokens();\r\n const { tokens: filtered, pragmas } = this.removePragma(tokens);\r\n if (filtered.length === 0) {\r\n return new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n for (const st of StatementParser.map.lookup(filtered[0].getStr())) {\r\n const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n // next try the statements without specific keywords\r\n for (const st of StatementParser.map.lookup(\"\")) {\r\n const match = combi_1.Combi.run(st.getMatcher(), filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n return statement;\r\n }\r\n // takes care of splitting tokens into statements, also handles chained statements\r\n // statements are split by \",\" or \".\"\r\n // additional colons/chaining after the first colon are ignored\r\n process(wa) {\r\n let add = [];\r\n let pre = [];\r\n let colon = undefined;\r\n for (const token of wa.tokens) {\r\n if (token instanceof Tokens.Comment) {\r\n wa.statements.push(new nodes_1.StatementNode(new _statement_1.Comment()).setChildren(this.tokensToNodes([token])));\r\n continue;\r\n }\r\n add.push(token);\r\n const str = token.getStr();\r\n if (str === \".\") {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n pre = [];\r\n colon = undefined;\r\n }\r\n else if (str === \",\" && pre.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n }\r\n else if (str === \":\" && colon === undefined) {\r\n colon = token;\r\n add.pop(); // do not add colon token to statement\r\n pre.push(...add);\r\n add = [];\r\n }\r\n else if (str === \":\") {\r\n add.pop(); // do not add colon token to statement\r\n }\r\n }\r\n if (add.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n }\r\n }\r\n}\r\nexports.StatementParser = StatementParser;\r\n//# sourceMappingURL=statement_parser.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js?");
|
|
2703
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StatementParser = exports.STATEMENT_MAX_TOKENS = void 0;\r\nconst Statements = __webpack_require__(/*! ./statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ./expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\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 artifacts_1 = __webpack_require__(/*! ../artifacts */ \"./node_modules/@abaplint/core/build/src/abap/artifacts.js\");\r\nconst combi_1 = __webpack_require__(/*! ./combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _statement_1 = __webpack_require__(/*! ./statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst expand_macros_1 = __webpack_require__(/*! ./expand_macros */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nexports.STATEMENT_MAX_TOKENS = 1000;\r\nclass StatementMap {\r\n constructor() {\r\n this.map = {};\r\n for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {\r\n const f = stat.getMatcher().first();\r\n if (f.length === 0) {\r\n throw new Error(\"StatementMap, first must have contents\");\r\n }\r\n for (const first of f) {\r\n if (this.map[first]) {\r\n this.map[first].push({ statement: stat });\r\n }\r\n else {\r\n this.map[first] = [{ statement: stat }];\r\n }\r\n }\r\n }\r\n }\r\n lookup(str) {\r\n const res = this.map[str.toUpperCase()];\r\n if (res === undefined) {\r\n return [];\r\n }\r\n if (res[0].matcher === undefined) {\r\n for (const r of res) {\r\n r.matcher = r.statement.getMatcher();\r\n }\r\n }\r\n return res;\r\n }\r\n}\r\nclass WorkArea {\r\n constructor(file, tokens) {\r\n this.file = file;\r\n this.tokens = tokens;\r\n this.statements = [];\r\n }\r\n addUnknown(pre, post, colon) {\r\n const st = new nodes_1.StatementNode(new _statement_1.Unknown(), colon);\r\n st.setChildren(this.tokensToNodes(pre, post));\r\n this.statements.push(st);\r\n }\r\n toResult() {\r\n return { file: this.file, tokens: this.tokens, statements: this.statements };\r\n }\r\n tokensToNodes(tokens1, tokens2) {\r\n const ret = [];\r\n for (const t of tokens1) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n for (const t of tokens2) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n}\r\nclass StatementParser {\r\n constructor(version, reg) {\r\n if (!StatementParser.map) {\r\n StatementParser.map = new StatementMap();\r\n }\r\n this.version = version;\r\n this.reg = reg;\r\n }\r\n /** input is one full object */\r\n run(input, globalMacros) {\r\n const macros = new expand_macros_1.ExpandMacros(globalMacros, this.version, this.reg);\r\n const wa = input.map(i => new WorkArea(i.file, i.tokens));\r\n for (const w of wa) {\r\n this.process(w);\r\n this.categorize(w);\r\n macros.find(w.statements);\r\n }\r\n for (const w of wa) {\r\n const res = macros.handleMacros(w.statements);\r\n w.statements = res.statements;\r\n if (res.containsUnknown === true) {\r\n this.lazyUnknown(w);\r\n }\r\n this.nativeSQL(w);\r\n }\r\n return wa.map(w => w.toResult());\r\n }\r\n // todo, refactor, remove method here and only have in WorkArea class\r\n tokensToNodes(tokens) {\r\n const ret = [];\r\n for (const t of tokens) {\r\n ret.push(new nodes_1.TokenNode(t));\r\n }\r\n return ret;\r\n }\r\n // tries to split Unknown statements by newlines, when adding/writing a new statement\r\n // in an editor, adding the statement terminator is typically the last thing to do\r\n // note: this will not work if the second statement is a macro call, guess this is okay\r\n lazyUnknown(wa) {\r\n const result = [];\r\n for (let statement of wa.statements) {\r\n // dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statment if lazy logic is evaluated\r\n if (statement.get() instanceof _statement_1.Unknown) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"CALL METHOD \") === false\r\n && concat.startsWith(\"RAISE EXCEPTION TYPE \") === false\r\n && concat.startsWith(\"LOOP AT \") === false\r\n && concat.startsWith(\"CALL FUNCTION \") === false) {\r\n for (const { first, second } of this.buildSplits(statement.getTokens())) {\r\n if (second.length === 1) {\r\n continue; // probably punctuation\r\n }\r\n const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));\r\n if (!(s.get() instanceof _statement_1.Unknown)) {\r\n result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));\r\n statement = s;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n result.push(statement);\r\n }\r\n wa.statements = result;\r\n }\r\n buildSplits(tokens) {\r\n const res = [];\r\n const before = [];\r\n let prevRow = tokens[0].getRow();\r\n for (let i = 0; i < tokens.length; i++) {\r\n if (tokens[i].getRow() !== prevRow) {\r\n res.push({ first: [...before], second: [...tokens].splice(i) });\r\n }\r\n prevRow = tokens[i].getRow();\r\n before.push(tokens[i]);\r\n }\r\n return res;\r\n }\r\n nativeSQL(wa) {\r\n let sql = false;\r\n for (let i = 0; i < wa.statements.length; i++) {\r\n const statement = wa.statements[i];\r\n const type = statement.get();\r\n if (type instanceof Statements.ExecSQL\r\n || (type instanceof Statements.MethodImplementation && statement.findDirectExpression(Expressions.Language))) {\r\n sql = true;\r\n }\r\n else if (sql === true) {\r\n if (type instanceof Statements.EndExec\r\n || type instanceof Statements.EndMethod) {\r\n sql = false;\r\n }\r\n else if (!(type instanceof _statement_1.Comment)) {\r\n wa.statements[i] = new nodes_1.StatementNode(new _statement_1.NativeSQL()).setChildren(this.tokensToNodes(statement.getTokens()));\r\n }\r\n }\r\n }\r\n }\r\n // for each statement, run statement matchers to figure out which kind of statement it is\r\n categorize(wa) {\r\n const result = [];\r\n for (const statement of wa.statements) {\r\n result.push(this.categorizeStatement(statement));\r\n }\r\n wa.statements = result;\r\n }\r\n categorizeStatement(input) {\r\n let statement = input;\r\n const length = input.getChildren().length;\r\n const lastToken = input.getLastToken();\r\n const isPunctuation = lastToken instanceof Tokens.Punctuation;\r\n if (length === 1 && isPunctuation) {\r\n const tokens = statement.getTokens();\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n else if (statement.get() instanceof _statement_1.Unknown) {\r\n if (isPunctuation) {\r\n statement = this.match(statement);\r\n }\r\n else if (length > exports.STATEMENT_MAX_TOKENS) {\r\n // if the statement contains more than STATEMENT_MAX_TOKENS tokens, just give up\r\n statement = input;\r\n }\r\n else if (length === 1 && lastToken instanceof tokens_1.Pragma) {\r\n statement = new nodes_1.StatementNode(new _statement_1.Empty(), undefined, [lastToken]);\r\n }\r\n }\r\n return statement;\r\n }\r\n removePragma(tokens) {\r\n const result = [];\r\n const pragmas = [];\r\n // skip the last token as it is the punctuation\r\n for (let i = 0; i < tokens.length - 1; i++) {\r\n const t = tokens[i];\r\n if (t instanceof Tokens.Pragma) {\r\n pragmas.push(t);\r\n }\r\n else {\r\n result.push(t);\r\n }\r\n }\r\n return { tokens: result, pragmas: pragmas };\r\n }\r\n match(statement) {\r\n const tokens = statement.getTokens();\r\n const { tokens: filtered, pragmas } = this.removePragma(tokens);\r\n if (filtered.length === 0) {\r\n return new nodes_1.StatementNode(new _statement_1.Empty()).setChildren(this.tokensToNodes(tokens));\r\n }\r\n for (const st of StatementParser.map.lookup(filtered[0].getStr())) {\r\n const match = combi_1.Combi.run(st.matcher, filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n // next try the statements without specific keywords\r\n for (const st of StatementParser.map.lookup(\"\")) {\r\n const match = combi_1.Combi.run(st.matcher, filtered, this.version);\r\n if (match) {\r\n const last = tokens[tokens.length - 1];\r\n match.push(new nodes_1.TokenNode(last));\r\n return new nodes_1.StatementNode(st.statement, statement.getColon(), pragmas).setChildren(match);\r\n }\r\n }\r\n return statement;\r\n }\r\n // takes care of splitting tokens into statements, also handles chained statements\r\n // statements are split by \",\" or \".\"\r\n // additional colons/chaining after the first colon are ignored\r\n process(wa) {\r\n let add = [];\r\n let pre = [];\r\n let colon = undefined;\r\n for (const token of wa.tokens) {\r\n if (token instanceof Tokens.Comment) {\r\n wa.statements.push(new nodes_1.StatementNode(new _statement_1.Comment()).setChildren(this.tokensToNodes([token])));\r\n continue;\r\n }\r\n add.push(token);\r\n const str = token.getStr();\r\n if (str.length === 1) {\r\n if (str === \".\") {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n pre = [];\r\n colon = undefined;\r\n }\r\n else if (str === \",\" && pre.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n add = [];\r\n }\r\n else if (str === \":\" && colon === undefined) {\r\n colon = token;\r\n add.pop(); // do not add colon token to statement\r\n pre.push(...add);\r\n add = [];\r\n }\r\n else if (str === \":\") {\r\n add.pop(); // do not add colon token to statement\r\n }\r\n }\r\n }\r\n if (add.length > 0) {\r\n wa.addUnknown(pre, add, colon);\r\n }\r\n }\r\n}\r\nexports.StatementParser = StatementParser;\r\n//# sourceMappingURL=statement_parser.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.js?");
|
|
2704
2704
|
|
|
2705
2705
|
/***/ }),
|
|
2706
2706
|
|
|
@@ -11709,7 +11709,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11709
11709
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11710
11710
|
|
|
11711
11711
|
"use strict";
|
|
11712
|
-
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 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 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\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.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 this.dependencies = {};\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.94.9\";\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 // todo: performance? cache regexp?\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, dependency) {\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 let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === 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 new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), 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 new rules_runner_1.RulesRunner(this).runRules([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 for (const o of this.getObjects()) {\n this.parsePrivate(o);\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 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 }\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 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?");
|
|
11712
|
+
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 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 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\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.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 this.dependencies = {};\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.94.10\";\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 // todo: performance? cache regexp?\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, dependency) {\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 let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === 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 new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), 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 new rules_runner_1.RulesRunner(this).runRules([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 for (const o of this.getObjects()) {\n this.parsePrivate(o);\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 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 }\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 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?");
|
|
11713
11713
|
|
|
11714
11714
|
/***/ }),
|
|
11715
11715
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.94.
|
|
3
|
+
"version": "2.94.10",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://abaplint.org",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@abaplint/core": "^2.94.
|
|
40
|
+
"@abaplint/core": "^2.94.10",
|
|
41
41
|
"@types/chai": "^4.3.4",
|
|
42
42
|
"@types/glob": "^7.2.0",
|
|
43
43
|
"@types/minimist": "^1.2.2",
|
|
44
44
|
"@types/mocha": "^10.0.1",
|
|
45
|
-
"@types/node": "^18.11.
|
|
45
|
+
"@types/node": "^18.11.18",
|
|
46
46
|
"@types/progress": "^2.0.5",
|
|
47
47
|
"chai": "^4.3.7",
|
|
48
48
|
"chalk": "^5.2.0",
|