@abaplint/cli 2.113.103 → 2.113.105

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 +67 -61
  2. package/package.json +5 -5
package/build/cli.js CHANGED
@@ -25093,7 +25093,7 @@ const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/c
25093
25093
  const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/let.js");
25094
25094
  const cond_1 = __webpack_require__(/*! ./cond */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/cond.js");
25095
25095
  class CondBody {
25096
- runSyntax(node, input) {
25096
+ runSyntax(node, input, targetType) {
25097
25097
  if (node === undefined) {
25098
25098
  return undefined;
25099
25099
  }
@@ -25108,10 +25108,10 @@ class CondBody {
25108
25108
  let type = undefined;
25109
25109
  for (const s of node.findDirectExpressions(Expressions.Source)) {
25110
25110
  if (type === undefined) {
25111
- type = new source_1.Source().runSyntax(s, input);
25111
+ type = new source_1.Source().runSyntax(s, input, targetType);
25112
25112
  }
25113
25113
  else {
25114
- new source_1.Source().runSyntax(s, input);
25114
+ new source_1.Source().runSyntax(s, input, targetType);
25115
25115
  }
25116
25116
  }
25117
25117
  if (scoped === true) {
@@ -27801,7 +27801,7 @@ class Source {
27801
27801
  case "COND":
27802
27802
  {
27803
27803
  const foundType = this.determineType(node, input, targetType);
27804
- const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), input);
27804
+ const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), input, foundType);
27805
27805
  if (foundType === undefined || foundType.isGeneric()) {
27806
27806
  this.addIfInferred(node, input, bodyType);
27807
27807
  }
@@ -45412,8 +45412,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
45412
45412
  exports.Symbols = void 0;
45413
45413
  /* eslint-disable max-len */
45414
45414
  const LServer = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/umd/main.js");
45415
+ const _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ "./node_modules/@abaplint/core/build/src/abap/4_file_information/_identifier.js");
45415
45416
  const _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
45416
45417
  const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
45418
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
45419
+ const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
45417
45420
  class Symbols {
45418
45421
  constructor(reg) {
45419
45422
  this.reg = reg;
@@ -45426,6 +45429,7 @@ class Symbols {
45426
45429
  const ret = [];
45427
45430
  ret.push(...this.outputClasses(file));
45428
45431
  ret.push(...this.outputForms(file));
45432
+ ret.push(...this.outputModules(file));
45429
45433
  return ret;
45430
45434
  }
45431
45435
  selectionRange(identifier) {
@@ -45466,6 +45470,22 @@ class Symbols {
45466
45470
  }
45467
45471
  return ret;
45468
45472
  }
45473
+ outputModules(file) {
45474
+ var _a;
45475
+ const ret = [];
45476
+ for (const statement of file.getStatements()) {
45477
+ if (statement.get() instanceof Statements.Module) {
45478
+ const nameToken = (_a = statement.findFirstExpression(Expressions.FormName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
45479
+ if (nameToken === undefined) {
45480
+ continue;
45481
+ }
45482
+ const identifier = new _identifier_1.Identifier(nameToken, file.getFilename());
45483
+ const symbol = this.newSymbol(identifier, LServer.SymbolKind.Module, []);
45484
+ ret.push(symbol);
45485
+ }
45486
+ }
45487
+ return ret;
45488
+ }
45469
45489
  outputClasses(file) {
45470
45490
  const ret = [];
45471
45491
  for (const cla of file.getInfo().listClassDefinitions()) {
@@ -53830,7 +53850,7 @@ class Registry {
53830
53850
  }
53831
53851
  static abaplintVersion() {
53832
53852
  // magic, see build script "version.sh"
53833
- return "2.113.103";
53853
+ return "2.113.105";
53834
53854
  }
53835
53855
  getDDICReferences() {
53836
53856
  return this.ddicReferences;
@@ -87202,80 +87222,73 @@ ProgressBar.prototype.terminate = function () {
87202
87222
  /***/ ((module) => {
87203
87223
 
87204
87224
  const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
87205
- const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
87206
- // const octRegex = /0x[a-z0-9]+/;
87225
+ const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
87226
+ // const octRegex = /^0x[a-z0-9]+/;
87207
87227
  // const binRegex = /0x[a-z0-9]+/;
87208
87228
 
87209
-
87210
- //polyfill
87211
- if (!Number.parseInt && window.parseInt) {
87212
- Number.parseInt = window.parseInt;
87213
- }
87214
- if (!Number.parseFloat && window.parseFloat) {
87215
- Number.parseFloat = window.parseFloat;
87216
- }
87217
-
87218
-
87229
+
87219
87230
  const consider = {
87220
87231
  hex : true,
87232
+ // oct: false,
87221
87233
  leadingZeros: true,
87222
87234
  decimalPoint: "\.",
87223
- eNotation: true
87235
+ eNotation: true,
87224
87236
  //skipLike: /regex/
87225
87237
  };
87226
87238
 
87227
87239
  function toNumber(str, options = {}){
87228
- // const options = Object.assign({}, consider);
87229
- // if(opt.leadingZeros === false){
87230
- // options.leadingZeros = false;
87231
- // }else if(opt.hex === false){
87232
- // options.hex = false;
87233
- // }
87234
-
87235
87240
  options = Object.assign({}, consider, options );
87236
87241
  if(!str || typeof str !== "string" ) return str;
87237
87242
 
87238
87243
  let trimmedStr = str.trim();
87239
- // if(trimmedStr === "0.0") return 0;
87240
- // else if(trimmedStr === "+0.0") return 0;
87241
- // else if(trimmedStr === "-0.0") return -0;
87242
-
87244
+
87243
87245
  if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
87246
+ else if(str==="0") return 0;
87244
87247
  else if (options.hex && hexRegex.test(trimmedStr)) {
87245
- return Number.parseInt(trimmedStr, 16);
87246
- // } else if (options.parseOct && octRegex.test(str)) {
87248
+ return parse_int(trimmedStr, 16);
87249
+ // }else if (options.oct && octRegex.test(str)) {
87247
87250
  // return Number.parseInt(val, 8);
87251
+ }else if (trimmedStr.search(/[eE]/)!== -1) { //eNotation
87252
+ const notation = trimmedStr.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
87253
+ // +00.123 => [ , '+', '00', '.123', ..
87254
+ if(notation){
87255
+ // console.log(notation)
87256
+ if(options.leadingZeros){ //accept with leading zeros
87257
+ trimmedStr = (notation[1] || "") + notation[3];
87258
+ }else{
87259
+ if(notation[2] === "0" && notation[3][0]=== "."){ //valid number
87260
+ }else{
87261
+ return str;
87262
+ }
87263
+ }
87264
+ return options.eNotation ? Number(trimmedStr) : str;
87265
+ }else{
87266
+ return str;
87267
+ }
87248
87268
  // }else if (options.parseBin && binRegex.test(str)) {
87249
87269
  // return Number.parseInt(val, 2);
87250
87270
  }else{
87251
87271
  //separate negative sign, leading zeros, and rest number
87252
87272
  const match = numRegex.exec(trimmedStr);
87273
+ // +00.123 => [ , '+', '00', '.123', ..
87253
87274
  if(match){
87254
87275
  const sign = match[1];
87255
87276
  const leadingZeros = match[2];
87256
87277
  let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
87257
87278
  //trim ending zeros for floating number
87258
87279
 
87259
- const eNotation = match[4] || match[6];
87260
87280
  if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
87261
87281
  else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
87282
+ else if(options.leadingZeros && leadingZeros===str) return 0; //00
87283
+
87262
87284
  else{//no leading zeros or leading zeros are allowed
87263
87285
  const num = Number(trimmedStr);
87264
87286
  const numStr = "" + num;
87287
+
87265
87288
  if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
87266
87289
  if(options.eNotation) return num;
87267
87290
  else return str;
87268
- }else if(eNotation){ //given number has enotation
87269
- if(options.eNotation) return num;
87270
- else return str;
87271
87291
  }else if(trimmedStr.indexOf(".") !== -1){ //floating number
87272
- // const decimalPart = match[5].substr(1);
87273
- // const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
87274
-
87275
-
87276
- // const p = numStr.indexOf(".");
87277
- // const givenIntPart = numStr.substr(0,p);
87278
- // const givenDecPart = numStr.substr(p+1);
87279
87292
  if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
87280
87293
  else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
87281
87294
  else if( sign && numStr === "-"+numTrimmedByZeros) return num;
@@ -87283,26 +87296,11 @@ function toNumber(str, options = {}){
87283
87296
  }
87284
87297
 
87285
87298
  if(leadingZeros){
87286
- // if(numTrimmedByZeros === numStr){
87287
- // if(options.leadingZeros) return num;
87288
- // else return str;
87289
- // }else return str;
87290
- if(numTrimmedByZeros === numStr) return num;
87291
- else if(sign+numTrimmedByZeros === numStr) return num;
87292
- else return str;
87299
+ return (numTrimmedByZeros === numStr) || (sign+numTrimmedByZeros === numStr) ? num : str
87300
+ }else {
87301
+ return (trimmedStr === numStr) || (trimmedStr === sign+numStr) ? num : str
87293
87302
  }
87294
-
87295
- if(trimmedStr === numStr) return num;
87296
- else if(trimmedStr === sign+numStr) return num;
87297
- // else{
87298
- // //number with +/- sign
87299
- // trimmedStr.test(/[-+][0-9]);
87300
-
87301
- // }
87302
- return str;
87303
87303
  }
87304
- // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
87305
-
87306
87304
  }else{ //non-numeric string
87307
87305
  return str;
87308
87306
  }
@@ -87324,8 +87322,16 @@ function trimZeros(numStr){
87324
87322
  }
87325
87323
  return numStr;
87326
87324
  }
87327
- module.exports = toNumber
87328
87325
 
87326
+ function parse_int(numStr, base){
87327
+ //polyfill
87328
+ if(parseInt) return parseInt(numStr, base);
87329
+ else if(Number.parseInt) return Number.parseInt(numStr, base);
87330
+ else if(window && window.parseInt) return window.parseInt(numStr, base);
87331
+ else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")
87332
+ }
87333
+
87334
+ module.exports = toNumber;
87329
87335
 
87330
87336
  /***/ }),
87331
87337
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.103",
3
+ "version": "2.113.105",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,23 +38,23 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.113.103",
41
+ "@abaplint/core": "^2.113.105",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",
46
- "@types/node": "^22.13.4",
46
+ "@types/node": "^22.13.9",
47
47
  "@types/progress": "^2.0.7",
48
48
  "chai": "^4.5.0",
49
49
  "chalk": "^5.4.1",
50
- "eslint": "^9.20.1",
50
+ "eslint": "^9.21.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
53
  "memfs": "^4.17.0",
54
54
  "minimist": "^1.2.8",
55
55
  "mocha": "^11.1.0",
56
56
  "progress": "^2.0.3",
57
- "typescript": "^5.7.3",
57
+ "typescript": "^5.8.2",
58
58
  "webpack": "^5.98.0",
59
59
  "webpack-cli": "^6.0.1",
60
60
  "xml-js": "^1.6.11"