@abaplint/cli 2.120.56 → 2.120.57

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 +48 -7
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -6484,7 +6484,8 @@ const Expressions = __importStar(__webpack_require__(/*! . */ "../core/build/src
6484
6484
  const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
6485
6485
  class MethodDefReturning extends combi_1.Expression {
6486
6486
  getRunnable() {
6487
- const value = (0, combi_1.seq)("VALUE", (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
6487
+ // see MethodParam: the lexer gives "!VALUE" as one Identifier
6488
+ const value = (0, combi_1.seq)((0, combi_1.altPrio)("VALUE", "!VALUE"), (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
6488
6489
  return (0, combi_1.seq)("RETURNING", value, Expressions.TypeParam);
6489
6490
  }
6490
6491
  }
@@ -6562,8 +6563,11 @@ const Expressions = __importStar(__webpack_require__(/*! . */ "../core/build/src
6562
6563
  const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
6563
6564
  class MethodParam extends combi_1.Expression {
6564
6565
  getRunnable() {
6565
- const ref = (0, combi_1.seq)("REFERENCE", (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
6566
- const value = (0, combi_1.seq)("VALUE", (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
6566
+ // The escape is part of the token: the lexer gives "!VALUE" as a single
6567
+ // Identifier, so a literal "VALUE" cannot match it and the whole METHODS
6568
+ // statement falls back to Unknown.
6569
+ const ref = (0, combi_1.seq)((0, combi_1.altPrio)("REFERENCE", "!REFERENCE"), (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
6570
+ const value = (0, combi_1.seq)((0, combi_1.altPrio)("VALUE", "!VALUE"), (0, combi_1.tok)(tokens_1.ParenLeft), Expressions.MethodParamName, (0, combi_1.tok)(tokens_1.ParenRightW));
6567
6571
  const fieldsOrValue = (0, combi_1.seq)((0, combi_1.altPrio)(value, ref, Expressions.MethodParamName), Expressions.TypeParam);
6568
6572
  return fieldsOrValue;
6569
6573
  }
@@ -11547,6 +11551,10 @@ class StatementParser {
11547
11551
  let add = [];
11548
11552
  let pre = [];
11549
11553
  let colon = undefined;
11554
+ // inside EXEC SQL and an AMDP body a colon reads a host variable, ":lv_a",
11555
+ // and is not the chaining marker; recognized here because nativeSQL() runs
11556
+ // afterwards and can only re-wrap what this has already cut
11557
+ let native = false;
11550
11558
  for (const token of wa.tokens) {
11551
11559
  if (token instanceof Tokens.Comment) {
11552
11560
  wa.statements.push(new nodes_1.StatementNode(new _statement_1.Comment()).setChildren(this.tokensToNodes([token])));
@@ -11556,6 +11564,7 @@ class StatementParser {
11556
11564
  const str = token.getStr();
11557
11565
  if (str.length === 1) {
11558
11566
  if (str === ".") {
11567
+ native = this.nativeAfter(native, add, colon);
11559
11568
  wa.addUnknown(pre, add, colon);
11560
11569
  add = [];
11561
11570
  pre = [];
@@ -11565,13 +11574,13 @@ class StatementParser {
11565
11574
  wa.addUnknown(pre, add, colon);
11566
11575
  add = [];
11567
11576
  }
11568
- else if (str === ":" && colon === undefined) {
11577
+ else if (str === ":" && colon === undefined && native === false) {
11569
11578
  colon = token;
11570
11579
  add.pop(); // do not add colon token to statement
11571
11580
  pre.push(...add);
11572
11581
  add = [];
11573
11582
  }
11574
- else if (str === ":") {
11583
+ else if (str === ":" && native === false) {
11575
11584
  add.pop(); // do not add colon token to statement
11576
11585
  }
11577
11586
  }
@@ -11580,6 +11589,36 @@ class StatementParser {
11580
11589
  wa.addUnknown(pre, add, colon);
11581
11590
  }
11582
11591
  }
11592
+ /** whether the statement that just ended opens or closes a region where a
11593
+ * colon belongs to the statement rather than chaining it */
11594
+ nativeAfter(native, tokens, colon) {
11595
+ // a pragma sits between the closing keyword and the period, so it is left
11596
+ // out before the last word is read: "ENDEXEC ##NEEDED." closes the region
11597
+ const words = tokens.filter(t => !(t instanceof Tokens.Pragma)).map(t => t.getStr().toUpperCase());
11598
+ // a native body usually arrives as one blob terminated by its own closing
11599
+ // keyword, so the terminator is the word before the period
11600
+ if (words[words.length - 2] === "ENDEXEC" || words[words.length - 2] === "ENDMETHOD") {
11601
+ return false;
11602
+ }
11603
+ if (colon !== undefined) {
11604
+ // a fragment of a chain cannot OPEN a region: it is only part of a
11605
+ // statement, and taking "DATA: lv_a TYPE i, exec sql." for one would
11606
+ // turn chaining off for the rest of the file
11607
+ return native;
11608
+ }
11609
+ if (words[0] === "EXEC" && words[1] === "SQL") {
11610
+ return true;
11611
+ }
11612
+ // "BY DATABASE" as well as LANGUAGE, and not LANGUAGE alone: a method
11613
+ // may be NAMED language
11614
+ if (words[0] === "METHOD"
11615
+ && words.includes("BY")
11616
+ && words.includes("DATABASE")
11617
+ && words.includes("LANGUAGE")) {
11618
+ return true;
11619
+ }
11620
+ return native;
11621
+ }
11583
11622
  }
11584
11623
  exports.StatementParser = StatementParser;
11585
11624
  //# sourceMappingURL=statement_parser.js.map
@@ -53956,7 +53995,9 @@ class MethodParameters {
53956
53995
  }
53957
53996
  isPassByValue(param) {
53958
53997
  var _a;
53959
- return param.getFirstToken().getStr().toUpperCase() === "VALUE"
53998
+ // "!" is the identifier escape, generated code has eg. "IMPORTING !VALUE(iv_foo)"
53999
+ const first = param.getFirstToken().getStr().toUpperCase();
54000
+ return (first === "VALUE" || first === "!VALUE")
53960
54001
  && ((_a = param.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr()) === "(";
53961
54002
  }
53962
54003
  }
@@ -70644,7 +70685,7 @@ class Registry {
70644
70685
  }
70645
70686
  static abaplintVersion() {
70646
70687
  // magic, see build script "version.js"
70647
- return "2.120.56";
70688
+ return "2.120.57";
70648
70689
  }
70649
70690
  getDDICReferences() {
70650
70691
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.56",
3
+ "version": "2.120.57",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.56",
42
+ "@abaplint/core": "^2.120.57",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",