@abaplint/cli 2.118.9 → 2.118.11

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 +111 -22
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -1736,6 +1736,7 @@ class AbstractToken {
1736
1736
  constructor(start, str) {
1737
1737
  this.start = start;
1738
1738
  this.str = str;
1739
+ this.strUpper = str.toUpperCase();
1739
1740
  }
1740
1741
  // special function, for debugging purposes, see https://github.com/abaplint/abaplint/pull/3137
1741
1742
  [Symbol.for("debug.description")]() {
@@ -1744,6 +1745,9 @@ class AbstractToken {
1744
1745
  getStr() {
1745
1746
  return this.str;
1746
1747
  }
1748
+ getUpperStr() {
1749
+ return this.strUpper;
1750
+ }
1747
1751
  getRow() {
1748
1752
  return this.start.getRow();
1749
1753
  }
@@ -2849,7 +2853,7 @@ class Word {
2849
2853
  const result = [];
2850
2854
  for (const input of r) {
2851
2855
  if (input.remainingLength() !== 0
2852
- && input.peek().getStr().toUpperCase() === this.s) {
2856
+ && input.peek().getUpperStr() === this.s) {
2853
2857
  // console.log("match, " + this.s + result.length);
2854
2858
  result.push(input.shift(new nodes_1.TokenNode(input.peek())));
2855
2859
  }
@@ -2868,7 +2872,7 @@ class Word {
2868
2872
  }
2869
2873
  class Token {
2870
2874
  constructor(s) {
2871
- this.name = s.toUpperCase();
2875
+ this.name = s;
2872
2876
  }
2873
2877
  listKeywords() {
2874
2878
  return [];
@@ -2880,7 +2884,7 @@ class Token {
2880
2884
  const result = [];
2881
2885
  for (const input of r) {
2882
2886
  if (input.remainingLength() !== 0
2883
- && input.peek().constructor.name.toUpperCase() === this.name) {
2887
+ && input.peek().constructor.name === this.name) {
2884
2888
  result.push(input.shift(new nodes_1.TokenNode(input.peek())));
2885
2889
  }
2886
2890
  }
@@ -3618,7 +3622,7 @@ function tok(t) {
3618
3622
  }
3619
3623
  const expressionSingletons = {};
3620
3624
  const stringSingletons = {};
3621
- function map(s) {
3625
+ function mapInput(s) {
3622
3626
  const type = typeof s;
3623
3627
  if (type === "string") {
3624
3628
  if (stringSingletons[s] === undefined) {
@@ -3640,48 +3644,48 @@ function map(s) {
3640
3644
  }
3641
3645
  }
3642
3646
  function seq(first, second, ...rest) {
3643
- const list = [map(first), map(second)];
3644
- list.push(...rest.map(map));
3647
+ const list = [mapInput(first), mapInput(second)];
3648
+ list.push(...rest.map(mapInput));
3645
3649
  return new Sequence(list);
3646
3650
  }
3647
3651
  function alt(first, second, ...rest) {
3648
- const list = [map(first), map(second)];
3649
- list.push(...rest.map(map));
3652
+ const list = [mapInput(first), mapInput(second)];
3653
+ list.push(...rest.map(mapInput));
3650
3654
  return new Alternative(list);
3651
3655
  }
3652
3656
  function altPrio(first, second, ...rest) {
3653
- const list = [map(first), map(second)];
3654
- list.push(...rest.map(map));
3657
+ const list = [mapInput(first), mapInput(second)];
3658
+ list.push(...rest.map(mapInput));
3655
3659
  return new AlternativePriority(list);
3656
3660
  }
3657
3661
  function opt(first) {
3658
- return new Optional(map(first));
3662
+ return new Optional(mapInput(first));
3659
3663
  }
3660
3664
  function optPrio(first) {
3661
- return new OptionalPriority(map(first));
3665
+ return new OptionalPriority(mapInput(first));
3662
3666
  }
3663
3667
  function per(first, second, ...rest) {
3664
- const list = [map(first), map(second)];
3665
- list.push(...rest.map(map));
3668
+ const list = [mapInput(first), mapInput(second)];
3669
+ list.push(...rest.map(mapInput));
3666
3670
  return new Permutation(list);
3667
3671
  }
3668
3672
  function star(first) {
3669
- return new Star(map(first));
3673
+ return new Star(mapInput(first));
3670
3674
  }
3671
3675
  function starPrio(first) {
3672
- return new StarPriority(map(first));
3676
+ return new StarPriority(mapInput(first));
3673
3677
  }
3674
3678
  function plus(first) {
3675
- return new Plus(map(first));
3679
+ return new Plus(mapInput(first));
3676
3680
  }
3677
3681
  function plusPrio(first) {
3678
- return new PlusPriority(map(first));
3682
+ return new PlusPriority(mapInput(first));
3679
3683
  }
3680
3684
  function ver(version, first, or) {
3681
- return new Vers(version, map(first), or);
3685
+ return new Vers(version, mapInput(first), or);
3682
3686
  }
3683
3687
  function verNot(version, first) {
3684
- return new VersNot(version, map(first));
3688
+ return new VersNot(version, mapInput(first));
3685
3689
  }
3686
3690
  function failCombinator() {
3687
3691
  return new FailCombinator();
@@ -36117,6 +36121,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
36117
36121
  exports.Data = void 0;
36118
36122
  const data_1 = __webpack_require__(/*! ../statements/data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/data.js");
36119
36123
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
36124
+ const identifier_1 = __webpack_require__(/*! ../../1_lexer/tokens/identifier */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/identifier.js");
36120
36125
  const type_1 = __webpack_require__(/*! ../statements/type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/type.js");
36121
36126
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
36122
36127
  const types_1 = __webpack_require__(/*! ./types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/structures/types.js");
@@ -36139,7 +36144,11 @@ class Data {
36139
36144
  this.runCommonPartSyntax(node, input);
36140
36145
  return undefined;
36141
36146
  }
36142
- const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();
36147
+ const nameExpr = node.findFirstExpression(Expressions.DefinitionName);
36148
+ let name = nameExpr.getFirstToken();
36149
+ if (nameExpr.countTokens() > 1) { // workaround for names with dashes
36150
+ name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());
36151
+ }
36143
36152
  let table = false;
36144
36153
  const values = {};
36145
36154
  const components = [];
@@ -53416,6 +53425,83 @@ exports.RenameMessageClass = RenameMessageClass;
53416
53425
 
53417
53426
  /***/ },
53418
53427
 
53428
+ /***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js"
53429
+ /*!********************************************************************************!*\
53430
+ !*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js ***!
53431
+ \********************************************************************************/
53432
+ (__unused_webpack_module, exports, __webpack_require__) {
53433
+
53434
+ "use strict";
53435
+
53436
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
53437
+ exports.RenameProgram = void 0;
53438
+ const Statements = __webpack_require__(/*! ../../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
53439
+ const Expressions = __webpack_require__(/*! ../../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
53440
+ const vscode_languageserver_types_1 = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/umd/main.js");
53441
+ const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/objects/index.js");
53442
+ const renamer_helper_1 = __webpack_require__(/*! ./renamer_helper */ "./node_modules/@abaplint/core/build/src/objects/rename/renamer_helper.js");
53443
+ const _lsp_utils_1 = __webpack_require__(/*! ../../lsp/_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
53444
+ const _abap_object_1 = __webpack_require__(/*! ../_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
53445
+ class RenameProgram {
53446
+ constructor(reg) {
53447
+ this.reg = reg;
53448
+ }
53449
+ buildEdits(obj, oldName, newName) {
53450
+ if (!(obj instanceof __1.Program)) {
53451
+ throw new Error("RenameProgram, not a program");
53452
+ }
53453
+ const main = obj.getMainABAPFile();
53454
+ if (main === undefined) {
53455
+ throw new Error(`Main file not found, ${obj.getType()} ${obj.getName()}`);
53456
+ }
53457
+ let changes = [];
53458
+ const helper = new renamer_helper_1.RenamerHelper(this.reg);
53459
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "NAME", oldName, newName));
53460
+ changes = changes.concat(helper.renameFiles(obj, oldName, newName));
53461
+ const edits = [];
53462
+ for (const s of main.getStatements()) {
53463
+ if (s.get() instanceof Statements.Report || s.get() instanceof Statements.Program) {
53464
+ const exp = s.findFirstExpression(Expressions.ReportName);
53465
+ if (exp) {
53466
+ edits.push(vscode_languageserver_types_1.TextEdit.replace(_lsp_utils_1.LSPUtils.tokenToRange(exp.getFirstToken()), newName.toLowerCase()));
53467
+ }
53468
+ }
53469
+ }
53470
+ if (edits.length > 0) {
53471
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: main.getFilename(), version: 1 }, edits));
53472
+ }
53473
+ // Rename INCLUDE statements in all ABAP objects
53474
+ for (const o of this.reg.getObjects()) {
53475
+ if (o instanceof _abap_object_1.ABAPObject && o !== obj) {
53476
+ for (const file of o.getABAPFiles()) {
53477
+ const includeEdits = [];
53478
+ for (const s of file.getStatements()) {
53479
+ if (s.get() instanceof Statements.Include ||
53480
+ s.get() instanceof Statements.Submit ||
53481
+ s.get() instanceof Statements.Perform) {
53482
+ for (const exp of s.findAllExpressions(Expressions.IncludeName)) {
53483
+ if (exp && exp.getFirstToken().getStr().toUpperCase() === oldName.toUpperCase()) {
53484
+ includeEdits.push(vscode_languageserver_types_1.TextEdit.replace(_lsp_utils_1.LSPUtils.tokenToRange(exp.getFirstToken()), newName.toLowerCase()));
53485
+ }
53486
+ }
53487
+ }
53488
+ }
53489
+ if (includeEdits.length > 0) {
53490
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: file.getFilename(), version: 1 }, includeEdits));
53491
+ }
53492
+ }
53493
+ }
53494
+ }
53495
+ return {
53496
+ documentChanges: changes,
53497
+ };
53498
+ }
53499
+ }
53500
+ exports.RenameProgram = RenameProgram;
53501
+ //# sourceMappingURL=rename_program.js.map
53502
+
53503
+ /***/ },
53504
+
53419
53505
  /***/ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js"
53420
53506
  /*!******************************************************************************!*\
53421
53507
  !*** ./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js ***!
@@ -53507,6 +53593,7 @@ const rename_data_element_1 = __webpack_require__(/*! ./rename_data_element */ "
53507
53593
  const rename_domain_1 = __webpack_require__(/*! ./rename_domain */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_domain.js");
53508
53594
  const rename_global_class_1 = __webpack_require__(/*! ./rename_global_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_global_class.js");
53509
53595
  const rename_global_interface_1 = __webpack_require__(/*! ./rename_global_interface */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_global_interface.js");
53596
+ const rename_program_1 = __webpack_require__(/*! ./rename_program */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_program.js");
53510
53597
  const rename_table_1 = __webpack_require__(/*! ./rename_table */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table.js");
53511
53598
  const rename_table_type_1 = __webpack_require__(/*! ./rename_table_type */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_table_type.js");
53512
53599
  const rename_message_class_1 = __webpack_require__(/*! ./rename_message_class */ "./node_modules/@abaplint/core/build/src/objects/rename/rename_message_class.js");
@@ -53561,6 +53648,8 @@ class Renamer {
53561
53648
  return new rename_table_type_1.RenameTableType(this.reg);
53562
53649
  case "INTF":
53563
53650
  return new rename_global_interface_1.RenameGlobalInterface(this.reg);
53651
+ case "PROG":
53652
+ return new rename_program_1.RenameProgram(this.reg);
53564
53653
  case "MSAG":
53565
53654
  return new rename_message_class_1.RenameMessageClass(this.reg);
53566
53655
  case "SICF":
@@ -56048,7 +56137,7 @@ class Registry {
56048
56137
  }
56049
56138
  static abaplintVersion() {
56050
56139
  // magic, see build script "version.sh"
56051
- return "2.118.9";
56140
+ return "2.118.11";
56052
56141
  }
56053
56142
  getDDICReferences() {
56054
56143
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.118.9",
3
+ "version": "2.118.11",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.118.9",
41
+ "@abaplint/core": "^2.118.11",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",