@abaplint/transpiler 2.3.73 → 2.3.74
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/src/index.js +6 -6
- package/build/src/keywords.d.ts +2 -0
- package/build/src/keywords.js +31 -22
- package/build/src/types.d.ts +2 -0
- package/build/src/validation.js +5 -0
- package/package.json +1 -1
package/build/src/index.js
CHANGED
|
@@ -30,17 +30,17 @@ class Transpiler {
|
|
|
30
30
|
return new Transpiler().run(reg);
|
|
31
31
|
}
|
|
32
32
|
async run(reg, progress) {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f;
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
34
34
|
reg.parse();
|
|
35
|
-
new keywords_1.Keywords().handle(reg);
|
|
35
|
+
new keywords_1.Keywords((_a = this.options) === null || _a === void 0 ? void 0 : _a.keywords).handle(reg);
|
|
36
36
|
this.validate(reg);
|
|
37
37
|
const dbSetup = new db_1.DatabaseSetup(reg).run();
|
|
38
38
|
const output = {
|
|
39
39
|
objects: [],
|
|
40
|
-
unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (
|
|
41
|
-
unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, (
|
|
42
|
-
initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (
|
|
43
|
-
initializationScript2: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (
|
|
40
|
+
unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (_b = this.options) === null || _b === void 0 ? void 0 : _b.skip, (_c = this.options) === null || _c === void 0 ? void 0 : _c.only),
|
|
41
|
+
unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, (_d = this.options) === null || _d === void 0 ? void 0 : _d.skip, (_e = this.options) === null || _e === void 0 ? void 0 : _e.only),
|
|
42
|
+
initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_f = this.options) === null || _f === void 0 ? void 0 : _f.extraSetup),
|
|
43
|
+
initializationScript2: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_g = this.options) === null || _g === void 0 ? void 0 : _g.extraSetup, true),
|
|
44
44
|
databaseSetup: dbSetup,
|
|
45
45
|
reg: reg,
|
|
46
46
|
};
|
package/build/src/keywords.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as abaplint from "@abaplint/core";
|
|
2
2
|
/** Replaces javascript keywords in ABAP source code, in-memory only */
|
|
3
3
|
export declare class Keywords {
|
|
4
|
+
private readonly keywords;
|
|
5
|
+
constructor(keywords?: string[]);
|
|
4
6
|
handle(reg: abaplint.IRegistry): void;
|
|
5
7
|
private traverse;
|
|
6
8
|
}
|
package/build/src/keywords.js
CHANGED
|
@@ -2,8 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Keywords = void 0;
|
|
4
4
|
const abaplint = require("@abaplint/core");
|
|
5
|
+
// https://www.w3schools.com/js/js_reserved.asp
|
|
6
|
+
const defaultKeywords = [
|
|
7
|
+
"abstract", "arguments", "await",
|
|
8
|
+
"break", "byte", "catch",
|
|
9
|
+
"char", "class", "const", "continue",
|
|
10
|
+
"debugger", "default", "do",
|
|
11
|
+
"double", "else", "enum", "eval",
|
|
12
|
+
"export", "extends", "false", "final",
|
|
13
|
+
"finally", "for", "function",
|
|
14
|
+
"goto", "if", "implements", "import",
|
|
15
|
+
"in", "instanceof", "interface",
|
|
16
|
+
"let", "long", "native", "new",
|
|
17
|
+
"null", "package", "private",
|
|
18
|
+
"public", "return", "short", "static",
|
|
19
|
+
"switch", "synchronized", "this",
|
|
20
|
+
"throw", "throws", "transient", "true",
|
|
21
|
+
"try", "typeof", "var", "void",
|
|
22
|
+
"volatile", "while", "yield"
|
|
23
|
+
];
|
|
24
|
+
// "with"
|
|
25
|
+
// "delete"
|
|
5
26
|
/** Replaces javascript keywords in ABAP source code, in-memory only */
|
|
6
27
|
class Keywords {
|
|
28
|
+
constructor(keywords) {
|
|
29
|
+
this.keywords = [];
|
|
30
|
+
if (keywords !== undefined) {
|
|
31
|
+
this.keywords = keywords;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.keywords = defaultKeywords;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
7
37
|
handle(reg) {
|
|
8
38
|
reg.parse();
|
|
9
39
|
for (const o of reg.getObjects()) {
|
|
@@ -30,27 +60,6 @@ class Keywords {
|
|
|
30
60
|
reg.parse();
|
|
31
61
|
}
|
|
32
62
|
traverse(node, file) {
|
|
33
|
-
// https://www.w3schools.com/js/js_reserved.asp
|
|
34
|
-
const keywords = [
|
|
35
|
-
"abstract", "arguments", "await",
|
|
36
|
-
"break", "byte", "catch",
|
|
37
|
-
"char", "class", "const", "continue",
|
|
38
|
-
"debugger", "default", "do",
|
|
39
|
-
"double", "else", "enum", "eval",
|
|
40
|
-
"export", "extends", "false", "final",
|
|
41
|
-
"finally", "for", "function",
|
|
42
|
-
"goto", "if", "implements", "import",
|
|
43
|
-
"in", "instanceof", "interface",
|
|
44
|
-
"let", "long", "native", "new",
|
|
45
|
-
"null", "package", "private",
|
|
46
|
-
"public", "return", "short", "static",
|
|
47
|
-
"switch", "synchronized", "this",
|
|
48
|
-
"throw", "throws", "transient", "true",
|
|
49
|
-
"try", "typeof", "var", "void",
|
|
50
|
-
"volatile", "while", "yield"
|
|
51
|
-
];
|
|
52
|
-
// "with"
|
|
53
|
-
// "delete"
|
|
54
63
|
const ret = [];
|
|
55
64
|
for (const c of node.getChildren()) {
|
|
56
65
|
if (c instanceof abaplint.Nodes.TokenNodeRegex) {
|
|
@@ -59,7 +68,7 @@ class Keywords {
|
|
|
59
68
|
if (start instanceof abaplint.VirtualPosition) {
|
|
60
69
|
continue;
|
|
61
70
|
}
|
|
62
|
-
for (const k of keywords) {
|
|
71
|
+
for (const k of this.keywords) {
|
|
63
72
|
const lower = token.getStr().toLowerCase();
|
|
64
73
|
if (k === lower
|
|
65
74
|
|| "!" + k === lower
|
package/build/src/types.d.ts
CHANGED
package/build/src/validation.js
CHANGED
|
@@ -28,6 +28,7 @@ exports.config = {
|
|
|
28
28
|
"parser_error": true,
|
|
29
29
|
"allowed_object_types": {
|
|
30
30
|
"allowed": [
|
|
31
|
+
"AUTH",
|
|
31
32
|
"CLAS",
|
|
32
33
|
"DEVC",
|
|
33
34
|
"DOMA",
|
|
@@ -43,7 +44,11 @@ exports.config = {
|
|
|
43
44
|
"SHMA",
|
|
44
45
|
"SICF",
|
|
45
46
|
"SMIM",
|
|
47
|
+
"SRFC",
|
|
48
|
+
"SUSO",
|
|
46
49
|
"TABL",
|
|
50
|
+
"TOBJ",
|
|
51
|
+
"TRAN",
|
|
47
52
|
"TTYP",
|
|
48
53
|
"TYPE",
|
|
49
54
|
"VIEW",
|