@abaplint/transpiler-cli 2.13.67 → 2.13.69
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 +94 -2
- package/package.json +2 -2
package/build/bundle.js
CHANGED
|
@@ -106897,6 +106897,8 @@ const field_chain_1 = __webpack_require__(/*! ./field_chain */ "./node_modules/@
|
|
|
106897
106897
|
const sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_name.js");
|
|
106898
106898
|
const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
|
|
106899
106899
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js");
|
|
106900
|
+
const sql_field_list_1 = __webpack_require__(/*! ./sql_field_list */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_field_list.js");
|
|
106901
|
+
const sql_from_1 = __webpack_require__(/*! ./sql_from */ "./node_modules/@abaplint/transpiler/build/src/expressions/sql_from.js");
|
|
106900
106902
|
class SQLCondTranspiler {
|
|
106901
106903
|
transpile(node, traversal, table) {
|
|
106902
106904
|
let ret = "";
|
|
@@ -106926,6 +106928,9 @@ class SQLCondTranspiler {
|
|
|
106926
106928
|
else if (c.findDirectExpression(abaplint.Expressions.SQLIn)) {
|
|
106927
106929
|
ret += this.sqlIn(c, traversal, traversal.getFilename(), table);
|
|
106928
106930
|
}
|
|
106931
|
+
else if (this.findSubselect(c)) {
|
|
106932
|
+
ret += this.subselectCondition(c, traversal, table);
|
|
106933
|
+
}
|
|
106929
106934
|
else {
|
|
106930
106935
|
ret += this.basicCondition(c, traversal, traversal.getFilename(), table);
|
|
106931
106936
|
}
|
|
@@ -106944,14 +106949,22 @@ class SQLCondTranspiler {
|
|
|
106944
106949
|
const fieldName = c.findDirectExpression(abaplint.Expressions.SQLFieldName)
|
|
106945
106950
|
|| c.findDirectExpression(abaplint.Expressions.SQLAliasField);
|
|
106946
106951
|
const sqlin = c.findDirectExpression(abaplint.Expressions.SQLIn);
|
|
106947
|
-
const
|
|
106948
|
-
if (fieldName === undefined || sqlin === undefined
|
|
106952
|
+
const subselect = sqlin === undefined ? undefined : this.findSubselect(sqlin);
|
|
106953
|
+
if (fieldName === undefined || sqlin === undefined) {
|
|
106949
106954
|
throw new Error("SQL Condition, transpiler todo, " + c.concatTokens());
|
|
106950
106955
|
}
|
|
106951
106956
|
let pre = "";
|
|
106952
106957
|
if (c.concatTokens().toUpperCase().includes(" NOT IN ")) {
|
|
106953
106958
|
pre = "NOT ";
|
|
106954
106959
|
}
|
|
106960
|
+
if (subselect) {
|
|
106961
|
+
const field = new sql_field_name_1.SQLFieldNameTranspiler().transpile(fieldName, traversal).getCode();
|
|
106962
|
+
return `${field} ${pre}IN ${this.sqlSubselect(subselect, traversal, table)}`;
|
|
106963
|
+
}
|
|
106964
|
+
const source = c.findFirstExpression(abaplint.Expressions.SimpleSource3);
|
|
106965
|
+
if (source === undefined) {
|
|
106966
|
+
throw new Error("SQL Condition, transpiler todo, " + c.concatTokens());
|
|
106967
|
+
}
|
|
106955
106968
|
if (sqlin.getChildren().length === 2) {
|
|
106956
106969
|
const s = new source_1.SourceTranspiler().transpile(source, traversal).getCode();
|
|
106957
106970
|
return `${pre}" + abap.expandIN("${fieldName.concatTokens()}", ${s}) + "`;
|
|
@@ -106969,6 +106982,10 @@ class SQLCondTranspiler {
|
|
|
106969
106982
|
}
|
|
106970
106983
|
basicCondition(c, traversal, filename, table) {
|
|
106971
106984
|
let ret = "";
|
|
106985
|
+
const subselect = this.findSubselect(c);
|
|
106986
|
+
if (subselect) {
|
|
106987
|
+
return this.subselectCondition(c, traversal, table);
|
|
106988
|
+
}
|
|
106972
106989
|
if (c.getChildren().length !== 3) {
|
|
106973
106990
|
return this.basicConditionNew(c, traversal, filename, table);
|
|
106974
106991
|
}
|
|
@@ -106997,6 +107014,59 @@ class SQLCondTranspiler {
|
|
|
106997
107014
|
ret += this.sqlSource(source, traversal, filename, table);
|
|
106998
107015
|
return ret;
|
|
106999
107016
|
}
|
|
107017
|
+
subselectCondition(c, traversal, table) {
|
|
107018
|
+
const subselect = this.findSubselect(c);
|
|
107019
|
+
if (subselect === undefined) {
|
|
107020
|
+
throw new Error("SQL Condition, subselect not found, " + c.concatTokens());
|
|
107021
|
+
}
|
|
107022
|
+
const fieldNameExpression = c.findDirectExpression(abaplint.Expressions.SQLFieldName)
|
|
107023
|
+
|| c.findDirectExpression(abaplint.Expressions.SQLAliasField);
|
|
107024
|
+
const operator = c.findDirectExpression(abaplint.Expressions.SQLCompareOperator);
|
|
107025
|
+
if (fieldNameExpression && operator) {
|
|
107026
|
+
const fieldName = new sql_field_name_1.SQLFieldNameTranspiler().transpile(fieldNameExpression, traversal).getCode();
|
|
107027
|
+
const quantifier = c.getChildren().find(child => child instanceof abaplint.Nodes.TokenNode
|
|
107028
|
+
&& ["ALL", "ANY", "SOME"].includes(child.getFirstToken().getStr().toUpperCase()));
|
|
107029
|
+
const suffix = quantifier ? " " + quantifier.concatTokens() : "";
|
|
107030
|
+
return `${fieldName} ${this.sqlOperator(operator.concatTokens())}${suffix} ${this.sqlSubselect(subselect, traversal, table)}`;
|
|
107031
|
+
}
|
|
107032
|
+
if (c.findDirectTokenByText("EXISTS")) {
|
|
107033
|
+
const not = c.findDirectTokenByText("NOT") ? "NOT " : "";
|
|
107034
|
+
return `${not}EXISTS ${this.sqlSubselect(subselect, traversal, table)}`;
|
|
107035
|
+
}
|
|
107036
|
+
throw new Error("SQL Condition, unsupported subselect, " + c.concatTokens());
|
|
107037
|
+
}
|
|
107038
|
+
findSubselect(node) {
|
|
107039
|
+
const grouped = node.findDirectExpression(abaplint.Expressions.SQLSetOpGroup);
|
|
107040
|
+
if (grouped) {
|
|
107041
|
+
return grouped;
|
|
107042
|
+
}
|
|
107043
|
+
// Older parser releases represent the scalar form as an inline sequence
|
|
107044
|
+
// instead of wrapping it in SQLSetOpGroup.
|
|
107045
|
+
if (node.getTokens().some(token => token.getStr().toUpperCase() === "SELECT")) {
|
|
107046
|
+
return node;
|
|
107047
|
+
}
|
|
107048
|
+
return undefined;
|
|
107049
|
+
}
|
|
107050
|
+
sqlSubselect(node, traversal, table) {
|
|
107051
|
+
const fieldList = node.findFirstExpression(abaplint.Expressions.SQLFieldList);
|
|
107052
|
+
const from = node.findFirstExpression(abaplint.Expressions.SQLFrom);
|
|
107053
|
+
if (fieldList === undefined || from === undefined) {
|
|
107054
|
+
throw new Error("SQL Condition, malformed subselect, " + node.concatTokens());
|
|
107055
|
+
}
|
|
107056
|
+
const tokens = node.getTokens();
|
|
107057
|
+
const selectIndex = tokens.findIndex(token => token.getStr().toUpperCase() === "SELECT");
|
|
107058
|
+
const distinct = selectIndex >= 0 && tokens[selectIndex + 1]?.getStr().toUpperCase() === "DISTINCT";
|
|
107059
|
+
let ret = `(SELECT${distinct ? " DISTINCT" : ""} `;
|
|
107060
|
+
ret += new sql_field_list_1.SQLFieldListTranspiler().transpile(fieldList, traversal).getCode();
|
|
107061
|
+
ret += " " + new sql_from_1.SQLFromTranspiler().transpile(from, traversal).getCode().trim();
|
|
107062
|
+
const where = node.findFirstExpression(abaplint.Expressions.SQLCond);
|
|
107063
|
+
if (where) {
|
|
107064
|
+
const subTable = from.findFirstExpression(abaplint.Expressions.DatabaseTable);
|
|
107065
|
+
const conditionTable = subTable ? traversal.findTable(subTable.concatTokens()) : table;
|
|
107066
|
+
ret += " WHERE " + new SQLCondTranspiler().transpile(where, traversal, conditionTable).getCode();
|
|
107067
|
+
}
|
|
107068
|
+
return ret + ")";
|
|
107069
|
+
}
|
|
107000
107070
|
sqlSource(source, traversal, filename, table) {
|
|
107001
107071
|
let ret = "";
|
|
107002
107072
|
const simple = source.findDirectExpression(abaplint.Expressions.SimpleSource3);
|
|
@@ -115197,6 +115267,7 @@ __exportStar(__webpack_require__(/*! ./split */ "./node_modules/@abaplint/transp
|
|
|
115197
115267
|
__exportStar(__webpack_require__(/*! ./start_of_selection */ "./node_modules/@abaplint/transpiler/build/src/statements/start_of_selection.js"), exports);
|
|
115198
115268
|
__exportStar(__webpack_require__(/*! ./load_of_program */ "./node_modules/@abaplint/transpiler/build/src/statements/load_of_program.js"), exports);
|
|
115199
115269
|
__exportStar(__webpack_require__(/*! ./stop */ "./node_modules/@abaplint/transpiler/build/src/statements/stop.js"), exports);
|
|
115270
|
+
__exportStar(__webpack_require__(/*! ./sum */ "./node_modules/@abaplint/transpiler/build/src/statements/sum.js"), exports);
|
|
115200
115271
|
__exportStar(__webpack_require__(/*! ./submit */ "./node_modules/@abaplint/transpiler/build/src/statements/submit.js"), exports);
|
|
115201
115272
|
__exportStar(__webpack_require__(/*! ./subtract */ "./node_modules/@abaplint/transpiler/build/src/statements/subtract.js"), exports);
|
|
115202
115273
|
__exportStar(__webpack_require__(/*! ./at_line_selection */ "./node_modules/@abaplint/transpiler/build/src/statements/at_line_selection.js"), exports);
|
|
@@ -119081,6 +119152,27 @@ exports.SubtractTranspiler = SubtractTranspiler;
|
|
|
119081
119152
|
|
|
119082
119153
|
/***/ },
|
|
119083
119154
|
|
|
119155
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/sum.js"
|
|
119156
|
+
/*!***********************************************************************!*\
|
|
119157
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/sum.js ***!
|
|
119158
|
+
\***********************************************************************/
|
|
119159
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
119160
|
+
|
|
119161
|
+
"use strict";
|
|
119162
|
+
|
|
119163
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
119164
|
+
exports.SumTranspiler = void 0;
|
|
119165
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
119166
|
+
class SumTranspiler {
|
|
119167
|
+
transpile(_node, _traversal) {
|
|
119168
|
+
return new chunk_1.Chunk(`throw new Error("SUM, not supported, transpiler");`);
|
|
119169
|
+
}
|
|
119170
|
+
}
|
|
119171
|
+
exports.SumTranspiler = SumTranspiler;
|
|
119172
|
+
//# sourceMappingURL=sum.js.map
|
|
119173
|
+
|
|
119174
|
+
/***/ },
|
|
119175
|
+
|
|
119084
119176
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/syntax_check.js"
|
|
119085
119177
|
/*!********************************************************************************!*\
|
|
119086
119178
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/syntax_check.js ***!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.69",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@abaplint/core": "^2.120.42",
|
|
31
|
-
"@abaplint/transpiler": "^2.13.
|
|
31
|
+
"@abaplint/transpiler": "^2.13.69",
|
|
32
32
|
"@types/glob": "^8.1.0",
|
|
33
33
|
"@types/node": "^24.13.3",
|
|
34
34
|
"@types/progress": "^2.0.7",
|