@abaplint/cli 2.102.48 → 2.102.50

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.
Files changed (2) hide show
  1. package/build/cli.js +131 -22
  2. package/package.json +6 -6
package/build/cli.js CHANGED
@@ -5236,6 +5236,7 @@ __exportStar(__webpack_require__(/*! ./sql_group_by */ "./node_modules/@abaplint
5236
5236
  __exportStar(__webpack_require__(/*! ./sql_having */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_having.js"), exports);
5237
5237
  __exportStar(__webpack_require__(/*! ./sql_hints */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_hints.js"), exports);
5238
5238
  __exportStar(__webpack_require__(/*! ./sql_in */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_in.js"), exports);
5239
+ __exportStar(__webpack_require__(/*! ./sql_into_list */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_list.js"), exports);
5239
5240
  __exportStar(__webpack_require__(/*! ./sql_into_structure */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js"), exports);
5240
5241
  __exportStar(__webpack_require__(/*! ./sql_into_table */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_table.js"), exports);
5241
5242
  __exportStar(__webpack_require__(/*! ./sql_join */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_join.js"), exports);
@@ -6721,13 +6722,13 @@ const sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ "./node_mod
6721
6722
  const sql_up_to_1 = __webpack_require__(/*! ./sql_up_to */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_up_to.js");
6722
6723
  class Select extends combi_1.Expression {
6723
6724
  getRunnable() {
6724
- const into = (0, combi_1.altPrio)(_1.SQLIntoTable, sql_into_structure_1.SQLIntoStructure);
6725
+ const into = (0, combi_1.altPrio)(_1.SQLIntoTable, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
6725
6726
  const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
6726
6727
  const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource));
6727
6728
  const bypass = (0, combi_1.str)("BYPASSING BUFFER");
6728
6729
  const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields);
6729
6730
  const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset, _1.SQLClient, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection);
6730
- const permSingle = (0, combi_1.per)(_1.SQLFrom, sql_into_structure_1.SQLIntoStructure, where, _1.SQLClient, bypass, fields, _1.DatabaseConnection);
6731
+ const permSingle = (0, combi_1.per)(_1.SQLFrom, (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList), where, _1.SQLClient, bypass, fields, _1.DatabaseConnection);
6731
6732
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), sql_field_name_1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW));
6732
6733
  const fieldList = (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.SQLFieldList, paren));
6733
6734
  const single = (0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE"), fieldList, permSingle);
@@ -6767,8 +6768,9 @@ class SelectLoop extends combi_1.Expression {
6767
6768
  const pack = (0, combi_1.seq)("PACKAGE SIZE", _1.SQLSource);
6768
6769
  const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom)));
6769
6770
  const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable);
6770
- const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, packTab));
6771
- const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields), where, sql_into_structure_1.SQLIntoStructure, sql_up_to_1.SQLUpTo);
6771
+ const into = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
6772
+ const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, into, packTab));
6773
+ const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields), where, into, sql_up_to_1.SQLUpTo);
6772
6774
  const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
6773
6775
  return ret;
6774
6776
  }
@@ -7750,6 +7752,30 @@ exports.SQLIn = SQLIn;
7750
7752
 
7751
7753
  /***/ }),
7752
7754
 
7755
+ /***/ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_list.js":
7756
+ /*!**********************************************************************************************!*\
7757
+ !*** ./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_list.js ***!
7758
+ \**********************************************************************************************/
7759
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7760
+
7761
+ "use strict";
7762
+
7763
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
7764
+ exports.SQLIntoList = void 0;
7765
+ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
7766
+ const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
7767
+ const paren_left_1 = __webpack_require__(/*! ../../1_lexer/tokens/paren_left */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/paren_left.js");
7768
+ class SQLIntoList extends combi_1.Expression {
7769
+ getRunnable() {
7770
+ const intoList = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(paren_left_1.WParenLeft), (0, combi_1.tok)(paren_left_1.WParenLeftW)), (0, combi_1.starPrio)((0, combi_1.seq)(_1.SQLTarget, ",")), _1.SQLTarget, ")");
7771
+ return (0, combi_1.seq)("INTO", intoList);
7772
+ }
7773
+ }
7774
+ exports.SQLIntoList = SQLIntoList;
7775
+ //# sourceMappingURL=sql_into_list.js.map
7776
+
7777
+ /***/ }),
7778
+
7753
7779
  /***/ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js":
7754
7780
  /*!***************************************************************************************************!*\
7755
7781
  !*** ./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js ***!
@@ -7762,12 +7788,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
7762
7788
  exports.SQLIntoStructure = void 0;
7763
7789
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
7764
7790
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
7765
- const paren_left_1 = __webpack_require__(/*! ../../1_lexer/tokens/paren_left */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/paren_left.js");
7766
7791
  class SQLIntoStructure extends combi_1.Expression {
7767
7792
  getRunnable() {
7768
- const intoList = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(paren_left_1.WParenLeft), (0, combi_1.tok)(paren_left_1.WParenLeftW)), (0, combi_1.starPrio)((0, combi_1.seq)(_1.SQLTarget, ",")), _1.SQLTarget, ")");
7769
7793
  const intoSimple = (0, combi_1.seq)((0, combi_1.optPrio)("CORRESPONDING FIELDS OF"), _1.SQLTarget);
7770
- return (0, combi_1.seq)("INTO", (0, combi_1.altPrio)(intoList, intoSimple));
7794
+ return (0, combi_1.seq)("INTO", intoSimple);
7771
7795
  }
7772
7796
  }
7773
7797
  exports.SQLIntoStructure = SQLIntoStructure;
@@ -12015,7 +12039,7 @@ const sql_into_structure_1 = __webpack_require__(/*! ../expressions/sql_into_str
12015
12039
  class FetchNextCursor {
12016
12040
  getMatcher() {
12017
12041
  const size = (0, combi_1.seq)("PACKAGE SIZE", expressions_1.SQLSourceSimple);
12018
- const ret = (0, combi_1.seq)("FETCH NEXT CURSOR", expressions_1.SQLSourceSimple, (0, combi_1.alt)(sql_into_structure_1.SQLIntoStructure, expressions_1.SQLIntoTable), (0, combi_1.optPrio)(size));
12042
+ const ret = (0, combi_1.seq)("FETCH NEXT CURSOR", expressions_1.SQLSourceSimple, (0, combi_1.alt)(sql_into_structure_1.SQLIntoStructure, expressions_1.SQLIntoTable, expressions_1.SQLIntoList), (0, combi_1.optPrio)(size));
12019
12043
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
12020
12044
  }
12021
12045
  }
@@ -25563,6 +25587,7 @@ const sql_for_all_entries_1 = __webpack_require__(/*! ./sql_for_all_entries */ "
25563
25587
  const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
25564
25588
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
25565
25589
  const sql_compare_1 = __webpack_require__(/*! ./sql_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_compare.js");
25590
+ const isSimple = /^\w+$/;
25566
25591
  class Select {
25567
25592
  runSyntax(node, scope, filename, skipImplicitInto = false) {
25568
25593
  var _a, _b;
@@ -25575,10 +25600,7 @@ class Select {
25575
25600
  throw new Error(`fields missing`);
25576
25601
  }
25577
25602
  this.checkFields(fields, dbSources, scope);
25578
- for (const inline of node.findAllExpressions(Expressions.InlineData)) {
25579
- // todo, for now these are voided
25580
- new inline_data_1.InlineData().runSyntax(inline, scope, filename, this.buildType(fields));
25581
- }
25603
+ this.handleInto(node, scope, filename, fields, dbSources);
25582
25604
  const fae = node.findDirectExpression(Expressions.SQLForAllEntries);
25583
25605
  if (fae) {
25584
25606
  scope.push(_scope_type_1.ScopeType.OpenSQL, "SELECT", token.getStart(), filename);
@@ -25590,6 +25612,7 @@ class Select {
25590
25612
  // check implicit into, the target field is implict equal to the table name
25591
25613
  if (skipImplicitInto === false
25592
25614
  && node.findDirectExpression(Expressions.SQLIntoTable) === undefined
25615
+ && node.findDirectExpression(Expressions.SQLIntoList) === undefined
25593
25616
  && node.findDirectExpression(Expressions.SQLIntoStructure) === undefined) {
25594
25617
  const fields = (_a = node.findFirstExpression(Expressions.SQLAggregation)) === null || _a === void 0 ? void 0 : _a.concatTokens();
25595
25618
  const c = new RegExp(/^count\(\s*\*\s*\)$/, "i");
@@ -25621,6 +25644,54 @@ class Select {
25621
25644
  scope.pop(node.getLastToken().getEnd());
25622
25645
  }
25623
25646
  }
25647
+ handleInto(node, scope, filename, fields, dbSources) {
25648
+ const intoTable = node.findDirectExpression(Expressions.SQLIntoTable);
25649
+ if (intoTable) {
25650
+ const inline = intoTable.findFirstExpression(Expressions.InlineData);
25651
+ if (inline) {
25652
+ new inline_data_1.InlineData().runSyntax(inline, scope, filename, this.buildTableType(fields, dbSources, scope));
25653
+ }
25654
+ }
25655
+ const intoStructure = node.findDirectExpression(Expressions.SQLIntoStructure);
25656
+ if (intoStructure) {
25657
+ for (const inline of intoStructure.findAllExpressions(Expressions.InlineData)) {
25658
+ // todo, for now these are voided
25659
+ new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.VoidType("SELECT_todo"));
25660
+ }
25661
+ }
25662
+ const intoList = node.findDirectExpression(Expressions.SQLIntoList);
25663
+ if (intoList) {
25664
+ const isDynamic = fields.length === 1 && fields[0].expression.findDirectExpression(Expressions.Dynamic) !== undefined;
25665
+ const targets = intoList.findDirectExpressions(Expressions.SQLTarget);
25666
+ if (targets.length !== fields.length && isDynamic !== true) {
25667
+ throw new Error(`number of fields selected vs list does not match`);
25668
+ }
25669
+ for (let i = 0; i < targets.length; i++) {
25670
+ const target = targets[i];
25671
+ const field = fields[i];
25672
+ const inline = target.findFirstExpression(Expressions.InlineData);
25673
+ if (inline) {
25674
+ if (isDynamic) {
25675
+ throw new Error(`dynamic field list, inlining not possible`);
25676
+ }
25677
+ if (isSimple.test(field.code) && dbSources.length === 1 && dbSources[0] !== undefined) {
25678
+ const dbType = dbSources[0].parseType(scope.getRegistry());
25679
+ let type = new basic_1.VoidType("SELECT_todo");
25680
+ if (dbType instanceof basic_1.StructureType) {
25681
+ type = dbType.getComponentByName(field.code);
25682
+ if (type === undefined) {
25683
+ throw new Error(`handleInto, internal error, should be checked earlier`);
25684
+ }
25685
+ }
25686
+ new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);
25687
+ }
25688
+ else {
25689
+ new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.VoidType("SELECT_todo"));
25690
+ }
25691
+ }
25692
+ }
25693
+ }
25694
+ }
25624
25695
  checkFields(fields, dbSources, scope) {
25625
25696
  if (dbSources.length > 1) {
25626
25697
  return;
@@ -25637,7 +25708,6 @@ class Select {
25637
25708
  if (!(type instanceof basic_1.StructureType)) {
25638
25709
  throw new Error("checkFields, expected structure, " + type.constructor.name);
25639
25710
  }
25640
- const isSimple = /^\w+$/;
25641
25711
  for (const field of fields) {
25642
25712
  if (field.code === "*") {
25643
25713
  continue;
@@ -25647,21 +25717,44 @@ class Select {
25647
25717
  }
25648
25718
  }
25649
25719
  }
25650
- buildType(_fields) {
25720
+ buildTableType(fields, dbSources, scope) {
25721
+ if (dbSources.length !== 1) {
25722
+ return new basic_1.VoidType("SELECT_todo");
25723
+ }
25724
+ if (dbSources[0] === undefined) {
25725
+ // then its a voided table
25726
+ return new basic_1.VoidType("SELECT_todo");
25727
+ }
25728
+ const dbType = dbSources[0].parseType(scope.getRegistry());
25729
+ if (!(dbType instanceof basic_1.StructureType)) {
25730
+ return new basic_1.VoidType("SELECT_todo");
25731
+ }
25732
+ if (fields.length === 1 && fields[0].code === "*") {
25733
+ return new basic_1.TableType(dbType, { withHeader: false, keyType: basic_1.TableKeyType.default }, undefined);
25734
+ }
25735
+ const allFieldsSimple = fields.every(f => isSimple.test(f.code));
25736
+ if (allFieldsSimple === true) {
25737
+ const components = [];
25738
+ for (const field of fields) {
25739
+ const type = dbType.getComponentByName(field.code);
25740
+ if (type === undefined) {
25741
+ return new basic_1.VoidType("SELECT_todo");
25742
+ }
25743
+ components.push({ name: field.code, type });
25744
+ }
25745
+ return new basic_1.TableType(new basic_1.StructureType(components), { withHeader: false, keyType: basic_1.TableKeyType.default }, undefined);
25746
+ }
25651
25747
  return new basic_1.VoidType("SELECT_todo");
25652
25748
  }
25653
25749
  findFields(node) {
25654
25750
  var _a;
25655
25751
  let expr = undefined;
25656
25752
  const ret = [];
25657
- expr = node.findDirectExpression(Expressions.SQLFieldList);
25753
+ expr = node.findFirstExpression(Expressions.SQLFieldList);
25658
25754
  if (expr === undefined) {
25659
- expr = node.findDirectExpression(Expressions.SQLFields);
25755
+ expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
25660
25756
  }
25661
- if (expr === undefined) {
25662
- node.findDirectExpression(Expressions.SQLFieldName);
25663
- }
25664
- for (const field of (expr === null || expr === void 0 ? void 0 : expr.findAllExpressions(Expressions.SQLField)) || []) {
25757
+ for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
25665
25758
  let code = field.concatTokens().toUpperCase();
25666
25759
  const as = ((_a = field.findDirectExpression(Expressions.SQLAsName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
25667
25760
  if (as !== "") {
@@ -33638,6 +33731,20 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
33638
33731
  }
33639
33732
  return ret;
33640
33733
  }
33734
+ findDirectExpressionsMulti(type) {
33735
+ const ret = [];
33736
+ for (const child of this.getChildren()) {
33737
+ if (child instanceof ExpressionNode) {
33738
+ for (const t of type) {
33739
+ if (child.get() instanceof t) {
33740
+ ret.push(child);
33741
+ break;
33742
+ }
33743
+ }
33744
+ }
33745
+ }
33746
+ return ret;
33747
+ }
33641
33748
  findDirectTokenByText(text) {
33642
33749
  for (const child of this.getChildren()) {
33643
33750
  if (child instanceof token_node_1.TokenNode && child.get().getStr().toUpperCase() === text.toUpperCase()) {
@@ -49038,7 +49145,7 @@ class Registry {
49038
49145
  }
49039
49146
  static abaplintVersion() {
49040
49147
  // magic, see build script "version.sh"
49041
- return "2.102.48";
49148
+ return "2.102.50";
49042
49149
  }
49043
49150
  getDDICReferences() {
49044
49151
  return this.ddicReferences;
@@ -60811,7 +60918,7 @@ ENDIF.
60811
60918
  }
60812
60919
  ////////////////////
60813
60920
  analyzeInto(file, m) {
60814
- const into = m.findFirstExpression(Expressions.SQLIntoStructure);
60921
+ const into = m.findFirstExpression(Expressions.SQLIntoList);
60815
60922
  if (into === undefined) {
60816
60923
  return [];
60817
60924
  }
@@ -63061,6 +63168,7 @@ ENDIF.`,
63061
63168
  if (this.conf.selectWithoutInto
63062
63169
  && (sta instanceof Statements.Select || sta instanceof Statements.SelectLoop)
63063
63170
  && staNode.findFirstExpression(Expressions.SQLIntoStructure) === undefined
63171
+ && staNode.findFirstExpression(Expressions.SQLIntoList) === undefined
63064
63172
  && staNode.findFirstExpression(Expressions.SQLIntoTable) === undefined) {
63065
63173
  const concat = (_a = staNode.findFirstExpression(Expressions.SQLFieldList)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
63066
63174
  if (concat !== "COUNT(*)" && concat !== "COUNT( * )") {
@@ -66984,6 +67092,7 @@ Activates from v750 and up`,
66984
67092
  const where = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLCond);
66985
67093
  const order = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLOrderBy);
66986
67094
  const into = (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoStructure))
67095
+ || (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoList))
66987
67096
  || (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoTable));
66988
67097
  if (into === undefined || where === undefined) {
66989
67098
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.48",
3
+ "version": "2.102.50",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,14 +38,14 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.48",
41
+ "@abaplint/core": "^2.102.50",
42
42
  "@types/chai": "^4.3.6",
43
43
  "@types/glob": "^7.2.0",
44
- "@types/minimist": "^1.2.2",
45
- "@types/mocha": "^10.0.1",
46
- "@types/node": "^20.7.0",
44
+ "@types/minimist": "^1.2.3",
45
+ "@types/mocha": "^10.0.2",
46
+ "@types/node": "^20.7.1",
47
47
  "@types/progress": "^2.0.5",
48
- "chai": "^4.3.8",
48
+ "chai": "^4.3.9",
49
49
  "chalk": "^5.3.0",
50
50
  "eslint": "^8.50.0",
51
51
  "glob": "^7.2.3",