@abaplint/transpiler-cli 2.0.17 → 2.0.18
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/bundle.js +1 -1
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -13084,7 +13084,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13084
13084
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13085
13085
|
|
|
13086
13086
|
"use strict";
|
|
13087
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstantTranspiler = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass ConstantTranspiler {\r\n constructor(addGet = false) {\r\n this.addGet = addGet;\r\n }\r\n transpile(node, traversal) {\r\n const int = node.findFirstExpression(core_1.Expressions.Integer);\r\n if (int) {\r\n const concat = int.concatTokens().trim();\r\n const post = concat.startsWith(\"-\") ? \"minus_\" : \"\";\r\n let ret = \"constant_\" + post + int.getLastToken().getStr();\r\n if (this.addGet === true) {\r\n ret += \".get()\";\r\n }\r\n return new chunk_1.Chunk().append(ret, node, traversal);\r\n }\r\n let str = node.findFirstExpression(core_1.Expressions.ConstantString);\r\n if (str === undefined) {\r\n str = node.findFirstExpression(core_1.Expressions.TextElementString);\r\n }\r\n if (str) {\r\n let res = str.getFirstToken().getStr();\r\n if (res.startsWith(\"'\") && this.addGet === false) {\r\n const code = \"new abap.types.Character({length: \" + (res.length - 2) + \"}).set(\" + this.escape(res) + \")\";\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else if (res.startsWith(\"`\") && this.addGet === false) {\r\n const code = \"new abap.types.String().set(\" + this.escape(res) + \")\";\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else {\r\n if (res.startsWith(\"'\")) {\r\n res = \"'\" + res.substring(1, res.length - 1).trimEnd() + \"'\";\r\n }\r\n const code = this.escape(res);\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n }\r\n return new chunk_1.Chunk(`todo, Constant`);\r\n }\r\n escape(str) {\r\n str = str.replace(/\\\\/g, \"\\\\\\\\\");\r\n const reg = new RegExp(/(.+)''(.+)/g);\r\n
|
|
13087
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstantTranspiler = void 0;\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst chunk_1 = __webpack_require__(/*! ../chunk */ \"./node_modules/@abaplint/transpiler/build/src/chunk.js\");\r\nclass ConstantTranspiler {\r\n constructor(addGet = false) {\r\n this.addGet = addGet;\r\n }\r\n transpile(node, traversal) {\r\n const int = node.findFirstExpression(core_1.Expressions.Integer);\r\n if (int) {\r\n const concat = int.concatTokens().trim();\r\n const post = concat.startsWith(\"-\") ? \"minus_\" : \"\";\r\n let ret = \"constant_\" + post + int.getLastToken().getStr();\r\n if (this.addGet === true) {\r\n ret += \".get()\";\r\n }\r\n return new chunk_1.Chunk().append(ret, node, traversal);\r\n }\r\n let str = node.findFirstExpression(core_1.Expressions.ConstantString);\r\n if (str === undefined) {\r\n str = node.findFirstExpression(core_1.Expressions.TextElementString);\r\n }\r\n if (str) {\r\n let res = str.getFirstToken().getStr();\r\n if (res.startsWith(\"'\") && this.addGet === false) {\r\n const code = \"new abap.types.Character({length: \" + (res.length - 2) + \"}).set(\" + this.escape(res) + \")\";\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else if (res.startsWith(\"`\") && this.addGet === false) {\r\n const code = \"new abap.types.String().set(\" + this.escape(res) + \")\";\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n else {\r\n if (res.startsWith(\"'\")) {\r\n res = \"'\" + res.substring(1, res.length - 1).trimEnd() + \"'\";\r\n }\r\n const code = this.escape(res);\r\n return new chunk_1.Chunk().append(code, node, traversal);\r\n }\r\n }\r\n return new chunk_1.Chunk(`todo, Constant`);\r\n }\r\n escape(str) {\r\n str = str.replace(/\\\\/g, \"\\\\\\\\\");\r\n if (str.startsWith(\"'\")) {\r\n const reg = new RegExp(/(.+)''(.+)/g);\r\n while (reg.test(str)) {\r\n str = str.replace(reg, \"$1\\\\'$2\");\r\n }\r\n }\r\n if (str.startsWith(\"`\")) {\r\n const reg = new RegExp(/(.+)``(.+)/g);\r\n while (reg.test(str)) {\r\n str = str.replace(reg, \"$1\\\\`$2\");\r\n }\r\n }\r\n return str;\r\n }\r\n}\r\nexports.ConstantTranspiler = ConstantTranspiler;\r\n//# sourceMappingURL=constant.js.map\n\n//# sourceURL=webpack://@abaplint/transpiler-cli/./node_modules/@abaplint/transpiler/build/src/expressions/constant.js?");
|
|
13088
13088
|
|
|
13089
13089
|
/***/ }),
|
|
13090
13090
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.0.
|
|
28
|
+
"@abaplint/transpiler": "^2.0.18",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "^7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|