@abaplint/transpiler 2.7.97 → 2.7.98
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/statements/create_data.js +3 -0
- package/build/src/statements/find.js +4 -1
- package/build/src/statements/insert_database.d.ts +1 -0
- package/build/src/statements/insert_database.js +11 -6
- package/build/src/statements/open_cursor.js +8 -1
- package/build/src/statements/replace.js +4 -1
- package/package.json +2 -2
|
@@ -46,6 +46,9 @@ class CreateDataTranspiler {
|
|
|
46
46
|
if (concat.includes(" TYPE LINE OF ")) {
|
|
47
47
|
options.push(`"typeLineOf": true`);
|
|
48
48
|
}
|
|
49
|
+
if (concat.includes(" REF TO ")) {
|
|
50
|
+
options.push(`"refTo": true`);
|
|
51
|
+
}
|
|
49
52
|
const handle = node.findExpressionAfterToken("HANDLE");
|
|
50
53
|
if (handle) {
|
|
51
54
|
const so = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Source));
|
|
@@ -5,7 +5,7 @@ const abaplint = require("@abaplint/core");
|
|
|
5
5
|
const chunk_1 = require("../chunk");
|
|
6
6
|
class FindTranspiler {
|
|
7
7
|
transpile(node, traversal) {
|
|
8
|
-
var _a;
|
|
8
|
+
var _a, _b;
|
|
9
9
|
const options = [];
|
|
10
10
|
let index = 1;
|
|
11
11
|
const sources = node.findDirectExpressions(abaplint.Expressions.Source);
|
|
@@ -13,6 +13,9 @@ class FindTranspiler {
|
|
|
13
13
|
if ((_a = node.findFirstExpression(abaplint.Expressions.FindType)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText("REGEX")) {
|
|
14
14
|
options.push("regex: " + source0);
|
|
15
15
|
}
|
|
16
|
+
else if ((_b = node.findFirstExpression(abaplint.Expressions.FindType)) === null || _b === void 0 ? void 0 : _b.findDirectTokenByText("PCRE")) {
|
|
17
|
+
options.push("pcre: " + source0);
|
|
18
|
+
}
|
|
16
19
|
else {
|
|
17
20
|
options.push("find: " + source0);
|
|
18
21
|
}
|
|
@@ -5,3 +5,4 @@ import { Chunk } from "../chunk";
|
|
|
5
5
|
export declare class InsertDatabaseTranspiler implements IStatementTranspiler {
|
|
6
6
|
transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
|
|
7
7
|
}
|
|
8
|
+
export declare function findConnection(connection: abaplint.Nodes.ExpressionNode): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InsertDatabaseTranspiler = void 0;
|
|
3
|
+
exports.findConnection = exports.InsertDatabaseTranspiler = void 0;
|
|
4
4
|
const abaplint = require("@abaplint/core");
|
|
5
5
|
const chunk_1 = require("../chunk");
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
@@ -29,15 +29,20 @@ class InsertDatabaseTranspiler {
|
|
|
29
29
|
}
|
|
30
30
|
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
31
31
|
if (connection) {
|
|
32
|
-
|
|
33
|
-
if (con === "DEFAULT_") {
|
|
34
|
-
// todo, workaround for replacing of keywords,
|
|
35
|
-
con = "DEFAULT";
|
|
36
|
-
}
|
|
32
|
+
const con = findConnection(connection);
|
|
37
33
|
options.push(`"connection": "${con}"`);
|
|
38
34
|
}
|
|
39
35
|
return new chunk_1.Chunk(`await abap.statements.insertDatabase(${table.getCode()}, {${options.join(", ")}});`);
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
exports.InsertDatabaseTranspiler = InsertDatabaseTranspiler;
|
|
39
|
+
function findConnection(connection) {
|
|
40
|
+
let con = connection.getLastToken().getStr().toUpperCase();
|
|
41
|
+
if (con === "DEFAULT_") {
|
|
42
|
+
// todo, workaround for replacing of keywords,
|
|
43
|
+
con = "DEFAULT";
|
|
44
|
+
}
|
|
45
|
+
return con;
|
|
46
|
+
}
|
|
47
|
+
exports.findConnection = findConnection;
|
|
43
48
|
//# sourceMappingURL=insert_database.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OpenCursorTranspiler = void 0;
|
|
4
4
|
const abaplint = require("@abaplint/core");
|
|
5
5
|
const chunk_1 = require("../chunk");
|
|
6
|
+
const insert_database_1 = require("./insert_database");
|
|
6
7
|
class OpenCursorTranspiler {
|
|
7
8
|
transpile(node, traversal) {
|
|
8
9
|
const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.SQLTarget)).getCode();
|
|
@@ -18,7 +19,13 @@ class OpenCursorTranspiler {
|
|
|
18
19
|
if (orderBy) {
|
|
19
20
|
select += "ORDER BY " + traversal.traverse(node).getCode();
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
const options = [];
|
|
23
|
+
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
24
|
+
if (connection) {
|
|
25
|
+
const con = (0, insert_database_1.findConnection)(connection);
|
|
26
|
+
options.push(`"connection": "${con}"`);
|
|
27
|
+
}
|
|
28
|
+
return new chunk_1.Chunk().append(`await abap.statements.openCursor(${target}, "${select}", {${options.join(", ")}});`, node, traversal);
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
exports.OpenCursorTranspiler = OpenCursorTranspiler;
|
|
@@ -32,7 +32,10 @@ class ReplaceTranspiler {
|
|
|
32
32
|
if (type === "REGEX") {
|
|
33
33
|
extra.push("regex: " + new expressions_1.SourceTranspiler().transpile(sources[0], traversal).getCode());
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
35
|
+
else if (type === "PCRE") {
|
|
36
|
+
extra.push("pcre: " + new expressions_1.SourceTranspiler().transpile(sources[0], traversal).getCode());
|
|
37
|
+
}
|
|
38
|
+
if (o === undefined && o === undefined && type !== "REGEX" && type !== "PCRE") {
|
|
36
39
|
extra.push("of: " + new expressions_1.SourceTranspiler().transpile(sources[0], traversal).getCode());
|
|
37
40
|
}
|
|
38
41
|
if (concat.includes(" IGNORING CASE")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.98",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "abaplint",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@abaplint/core": "^2.102.
|
|
32
|
+
"@abaplint/core": "^2.102.44",
|
|
33
33
|
"source-map": "^0.7.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|