@abaplint/transpiler 2.12.30 → 2.12.31
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/rearranger.js +17 -1
- package/build/src/statements/at_line_selection.d.ts +6 -0
- package/build/src/statements/at_line_selection.js +11 -0
- package/build/src/statements/at_selection_screen.js +1 -1
- package/build/src/statements/index.d.ts +1 -0
- package/build/src/statements/index.js +1 -0
- package/package.json +1 -1
package/build/src/rearranger.js
CHANGED
|
@@ -8,6 +8,8 @@ var EventKind;
|
|
|
8
8
|
EventKind[EventKind["None"] = 0] = "None";
|
|
9
9
|
EventKind[EventKind["Start"] = 1] = "Start";
|
|
10
10
|
EventKind[EventKind["End"] = 2] = "End";
|
|
11
|
+
EventKind[EventKind["AtLineSelection"] = 3] = "AtLineSelection";
|
|
12
|
+
EventKind[EventKind["AtSelectionScreen"] = 4] = "AtSelectionScreen";
|
|
11
13
|
})(EventKind || (EventKind = {}));
|
|
12
14
|
class Rearranger {
|
|
13
15
|
run(type, node) {
|
|
@@ -33,13 +35,16 @@ class Rearranger {
|
|
|
33
35
|
// Check if there are any list event statements
|
|
34
36
|
const hasStartOfSelection = children.some(c => c instanceof core_1.Nodes.StatementNode && c.get() instanceof core_1.Statements.StartOfSelection);
|
|
35
37
|
const hasEndOfSelection = children.some(c => c instanceof core_1.Nodes.StatementNode && c.get() instanceof core_1.Statements.EndOfSelection);
|
|
36
|
-
|
|
38
|
+
const hasAtLineSelection = children.some(c => c instanceof core_1.Nodes.StatementNode && c.get() instanceof core_1.Statements.AtLineSelection);
|
|
39
|
+
const hasAtSelectionScreen = children.some(c => c instanceof core_1.Nodes.StatementNode && c.get() instanceof core_1.Statements.AtSelectionScreen);
|
|
40
|
+
if (!hasStartOfSelection && !hasEndOfSelection && !hasAtLineSelection && !hasAtSelectionScreen) {
|
|
37
41
|
return node;
|
|
38
42
|
}
|
|
39
43
|
// Split children into: preamble (before first event), event blocks (keyed by event type)
|
|
40
44
|
const preamble = [];
|
|
41
45
|
const startBlocks = [];
|
|
42
46
|
const endBlocks = [];
|
|
47
|
+
// AT LINE-SELECTION and AT SELECTION-SCREEN are interactive events, their blocks are discarded
|
|
43
48
|
let currentEvent = EventKind.None;
|
|
44
49
|
for (const child of children) {
|
|
45
50
|
if (child instanceof core_1.Nodes.StatementNode && child.get() instanceof core_1.Statements.StartOfSelection) {
|
|
@@ -50,6 +55,12 @@ class Rearranger {
|
|
|
50
55
|
currentEvent = EventKind.End;
|
|
51
56
|
endBlocks.push(child);
|
|
52
57
|
}
|
|
58
|
+
else if (child instanceof core_1.Nodes.StatementNode && child.get() instanceof core_1.Statements.AtLineSelection) {
|
|
59
|
+
currentEvent = EventKind.AtLineSelection;
|
|
60
|
+
}
|
|
61
|
+
else if (child instanceof core_1.Nodes.StatementNode && child.get() instanceof core_1.Statements.AtSelectionScreen) {
|
|
62
|
+
currentEvent = EventKind.AtSelectionScreen;
|
|
63
|
+
}
|
|
53
64
|
else {
|
|
54
65
|
switch (currentEvent) {
|
|
55
66
|
case EventKind.None:
|
|
@@ -61,12 +72,17 @@ class Rearranger {
|
|
|
61
72
|
case EventKind.End:
|
|
62
73
|
endBlocks.push(child);
|
|
63
74
|
break;
|
|
75
|
+
case EventKind.AtLineSelection:
|
|
76
|
+
case EventKind.AtSelectionScreen:
|
|
77
|
+
// discard: these are interactive events not executed in batch
|
|
78
|
+
break;
|
|
64
79
|
default:
|
|
65
80
|
break;
|
|
66
81
|
}
|
|
67
82
|
}
|
|
68
83
|
}
|
|
69
84
|
// Reassemble: preamble, then START-OF-SELECTION blocks, then END-OF-SELECTION blocks
|
|
85
|
+
// AT LINE-SELECTION and AT SELECTION-SCREEN blocks are omitted
|
|
70
86
|
const newChildren = [...preamble, ...startBlocks, ...endBlocks];
|
|
71
87
|
node.setChildren(newChildren);
|
|
72
88
|
return node;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as abaplint from "@abaplint/core";
|
|
2
|
+
import { Chunk } from "../chunk";
|
|
3
|
+
import { IStatementTranspiler } from "./_statement_transpiler";
|
|
4
|
+
export declare class AtLineSelectionTranspiler implements IStatementTranspiler {
|
|
5
|
+
transpile(_node: abaplint.Nodes.StatementNode): Chunk;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AtLineSelectionTranspiler = void 0;
|
|
4
|
+
const chunk_1 = require("../chunk");
|
|
5
|
+
class AtLineSelectionTranspiler {
|
|
6
|
+
transpile(_node) {
|
|
7
|
+
return new chunk_1.Chunk("");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.AtLineSelectionTranspiler = AtLineSelectionTranspiler;
|
|
11
|
+
//# sourceMappingURL=at_line_selection.js.map
|
|
@@ -4,7 +4,7 @@ exports.AtSelectionScreenTranspiler = void 0;
|
|
|
4
4
|
const chunk_1 = require("../chunk");
|
|
5
5
|
class AtSelectionScreenTranspiler {
|
|
6
6
|
transpile(_node, _traversal) {
|
|
7
|
-
return new chunk_1.Chunk(
|
|
7
|
+
return new chunk_1.Chunk(``);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.AtSelectionScreenTranspiler = AtSelectionScreenTranspiler;
|
|
@@ -137,6 +137,7 @@ export * from "./split";
|
|
|
137
137
|
export * from "./start_of_selection";
|
|
138
138
|
export * from "./submit";
|
|
139
139
|
export * from "./subtract";
|
|
140
|
+
export * from "./at_line_selection";
|
|
140
141
|
export * from "./syntax_check";
|
|
141
142
|
export * from "./system_call";
|
|
142
143
|
export * from "./tables";
|
|
@@ -153,6 +153,7 @@ __exportStar(require("./split"), exports);
|
|
|
153
153
|
__exportStar(require("./start_of_selection"), exports);
|
|
154
154
|
__exportStar(require("./submit"), exports);
|
|
155
155
|
__exportStar(require("./subtract"), exports);
|
|
156
|
+
__exportStar(require("./at_line_selection"), exports);
|
|
156
157
|
__exportStar(require("./syntax_check"), exports);
|
|
157
158
|
__exportStar(require("./system_call"), exports);
|
|
158
159
|
__exportStar(require("./tables"), exports);
|