@abaplint/cli 2.119.60 → 2.119.61

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 +75 -28
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -2396,24 +2396,14 @@ class Expression {
2396
2396
  for (const input of r) {
2397
2397
  const temp = this.runnable.run([input]);
2398
2398
  for (const t of temp) {
2399
- let consumed = input.remainingLength() - t.remainingLength();
2399
+ const consumed = input.remainingLength() - t.remainingLength();
2400
2400
  if (consumed > 0) {
2401
- const originalLength = t.getNodes().length;
2402
- const children = [];
2403
- while (consumed > 0) {
2404
- const sub = t.popNode();
2405
- if (sub) {
2406
- children.push(sub);
2407
- consumed = consumed - sub.countTokens();
2408
- }
2409
- }
2410
2401
  const re = new nodes_1.ExpressionNode(this);
2411
- re.setChildren(children.reverse());
2412
- const n = t.getNodes().slice(0, originalLength - consumed);
2413
- n.push(re);
2414
- t.setNodes(n);
2402
+ results.push(t.wrapConsumed(consumed, re));
2403
+ }
2404
+ else {
2405
+ results.push(t);
2415
2406
  }
2416
- results.push(t);
2417
2407
  }
2418
2408
  }
2419
2409
  // console.dir(results);
@@ -11140,11 +11130,17 @@ class Result {
11140
11130
  // nodes: matched tokens
11141
11131
  this.tokens = tokens;
11142
11132
  this.tokenIndex = tokenIndex;
11143
- this.nodes = nodes;
11144
- if (this.nodes === undefined) {
11145
- this.nodes = [];
11133
+ this.nodeCount = 0;
11134
+ if (nodes !== undefined) {
11135
+ this.setNodes(nodes);
11146
11136
  }
11147
11137
  }
11138
+ static fromChain(tokens, tokenIndex, nodes, nodeCount) {
11139
+ const ret = new Result(tokens, tokenIndex);
11140
+ ret.nodes = nodes;
11141
+ ret.nodeCount = nodeCount;
11142
+ return ret;
11143
+ }
11148
11144
  peek() {
11149
11145
  return this.tokens[this.tokenIndex];
11150
11146
  }
@@ -11152,18 +11148,54 @@ class Result {
11152
11148
  return this.tokens[this.tokenIndex + offset];
11153
11149
  }
11154
11150
  shift(node) {
11155
- const cp = this.nodes.slice();
11156
- cp.push(node);
11157
- return new Result(this.tokens, this.tokenIndex + 1, cp);
11151
+ return Result.fromChain(this.tokens, this.tokenIndex + 1, { node, previous: this.nodes }, this.nodeCount + 1);
11152
+ }
11153
+ wrapConsumed(consumedTokens, node) {
11154
+ let current = this.nodes;
11155
+ let currentCount = this.nodeCount;
11156
+ const children = [];
11157
+ while (consumedTokens > 0) {
11158
+ if (current === undefined) {
11159
+ break;
11160
+ }
11161
+ children.push(current.node);
11162
+ consumedTokens = consumedTokens - current.node.countTokens();
11163
+ current = current.previous;
11164
+ currentCount--;
11165
+ }
11166
+ node.setChildren(children.reverse());
11167
+ this.nodes = { node, previous: current };
11168
+ this.nodeCount = currentCount + 1;
11169
+ return this;
11158
11170
  }
11159
11171
  popNode() {
11160
- return this.nodes.pop();
11172
+ if (this.nodes === undefined) {
11173
+ return undefined;
11174
+ }
11175
+ const ret = this.nodes.node;
11176
+ this.nodes = this.nodes.previous;
11177
+ this.nodeCount--;
11178
+ return ret;
11161
11179
  }
11162
11180
  getNodes() {
11163
- return this.nodes;
11181
+ const ret = new Array(this.nodeCount);
11182
+ let current = this.nodes;
11183
+ for (let index = this.nodeCount - 1; index >= 0; index--) {
11184
+ if (current === undefined) {
11185
+ break;
11186
+ }
11187
+ ret[index] = current.node;
11188
+ current = current.previous;
11189
+ }
11190
+ return ret;
11164
11191
  }
11165
11192
  setNodes(n) {
11166
- this.nodes = n;
11193
+ this.nodes = undefined;
11194
+ this.nodeCount = 0;
11195
+ for (const node of n) {
11196
+ this.nodes = { node, previous: this.nodes };
11197
+ this.nodeCount++;
11198
+ }
11167
11199
  }
11168
11200
  getTokens() {
11169
11201
  return this.tokens;
@@ -38955,18 +38987,25 @@ class DeleteInternal {
38955
38987
  let targetType = undefined;
38956
38988
  const target = node.findDirectExpression(Expressions.Target);
38957
38989
  if (target) {
38990
+ const targetName = target.concatTokens();
38958
38991
  let tabl = undefined;
38959
- const localVariable = input.scope.findVariable(target.concatTokens());
38992
+ const localVariable = input.scope.findVariable(targetName);
38960
38993
  if (localVariable === undefined && node.getChildren().length === 5 && node.getChildren()[2].concatTokens().toUpperCase() === "FROM") {
38961
38994
  // it might be a database table
38962
- const found = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(target.concatTokens());
38995
+ const found = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(targetName);
38963
38996
  if ((found === null || found === void 0 ? void 0 : found.object) !== undefined) {
38964
38997
  tabl = found;
38965
38998
  input.scope.getDDICReferences().addUsing(input.scope.getParentObj(), { object: tabl.object });
38966
38999
  }
38967
39000
  }
38968
39001
  if (tabl === undefined) {
38969
- targetType = target_1.Target.runSyntax(target, input);
39002
+ const ambigiousVoids = input.scope.getRegistry().getConfig().getSyntaxSetttings().ambigiousVoids || [];
39003
+ if (ambigiousVoids.some(name => name.toUpperCase() === targetName.toUpperCase())) {
39004
+ targetType = basic_1.VoidType.get(targetName);
39005
+ }
39006
+ else {
39007
+ targetType = target_1.Target.runSyntax(target, input);
39008
+ }
38970
39009
  if (node.findDirectTokenByText("TABLE") === undefined
38971
39010
  && node.findDirectTokenByText("ADJACENT") === undefined
38972
39011
  && (node.findDirectTokenByText("FROM") || node.findDirectTokenByText("INDEX"))
@@ -54533,6 +54572,7 @@ class Config {
54533
54572
  languageVersion: langVer,
54534
54573
  errorNamespace: "^(Z|Y|LCL\_|TY\_|LIF\_)",
54535
54574
  globalConstants: [],
54575
+ ambigiousVoids: [],
54536
54576
  globalMacros: [],
54537
54577
  },
54538
54578
  rules: rules,
@@ -54583,6 +54623,12 @@ class Config {
54583
54623
  // remove duplicates,
54584
54624
  this.config.syntax.globalConstants = [...new Set(this.config.syntax.globalConstants)];
54585
54625
  }
54626
+ if (this.config.syntax.ambigiousVoids === undefined) {
54627
+ this.config.syntax.ambigiousVoids = [];
54628
+ }
54629
+ else {
54630
+ this.config.syntax.ambigiousVoids = [...new Set(this.config.syntax.ambigiousVoids)];
54631
+ }
54586
54632
  if (this.config.global.skipIncludesWithoutMain === undefined) {
54587
54633
  this.config.global.skipIncludesWithoutMain = false;
54588
54634
  }
@@ -68768,7 +68814,7 @@ class Registry {
68768
68814
  }
68769
68815
  static abaplintVersion() {
68770
68816
  // magic, see build script "version.js"
68771
- return "2.119.60";
68817
+ return "2.119.61";
68772
68818
  }
68773
68819
  getDDICReferences() {
68774
68820
  return this.ddicReferences;
@@ -75519,6 +75565,7 @@ Make sure to test the downported code, it might not always be completely correct
75519
75565
  const lowConfig = this.lowReg.getConfig().get();
75520
75566
  highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;
75521
75567
  highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;
75568
+ highConfig.syntax.ambigiousVoids = lowConfig.syntax.ambigiousVoids;
75522
75569
  highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;
75523
75570
  this.highReg = new registry_1.Registry();
75524
75571
  for (const o of this.lowReg.getObjects()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.60",
3
+ "version": "2.119.61",
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.119.60",
42
+ "@abaplint/core": "^2.119.61",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",