@abaplint/cli 2.113.104 → 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 +47 -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
  }
@@ -53850,7 +53850,7 @@ class Registry {
53850
53850
  }
53851
53851
  static abaplintVersion() {
53852
53852
  // magic, see build script "version.sh"
53853
- return "2.113.104";
53853
+ return "2.113.105";
53854
53854
  }
53855
53855
  getDDICReferences() {
53856
53856
  return this.ddicReferences;
@@ -87222,80 +87222,73 @@ ProgressBar.prototype.terminate = function () {
87222
87222
  /***/ ((module) => {
87223
87223
 
87224
87224
  const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
87225
- const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
87226
- // const octRegex = /0x[a-z0-9]+/;
87225
+ const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
87226
+ // const octRegex = /^0x[a-z0-9]+/;
87227
87227
  // const binRegex = /0x[a-z0-9]+/;
87228
87228
 
87229
-
87230
- //polyfill
87231
- if (!Number.parseInt && window.parseInt) {
87232
- Number.parseInt = window.parseInt;
87233
- }
87234
- if (!Number.parseFloat && window.parseFloat) {
87235
- Number.parseFloat = window.parseFloat;
87236
- }
87237
-
87238
-
87229
+
87239
87230
  const consider = {
87240
87231
  hex : true,
87232
+ // oct: false,
87241
87233
  leadingZeros: true,
87242
87234
  decimalPoint: "\.",
87243
- eNotation: true
87235
+ eNotation: true,
87244
87236
  //skipLike: /regex/
87245
87237
  };
87246
87238
 
87247
87239
  function toNumber(str, options = {}){
87248
- // const options = Object.assign({}, consider);
87249
- // if(opt.leadingZeros === false){
87250
- // options.leadingZeros = false;
87251
- // }else if(opt.hex === false){
87252
- // options.hex = false;
87253
- // }
87254
-
87255
87240
  options = Object.assign({}, consider, options );
87256
87241
  if(!str || typeof str !== "string" ) return str;
87257
87242
 
87258
87243
  let trimmedStr = str.trim();
87259
- // if(trimmedStr === "0.0") return 0;
87260
- // else if(trimmedStr === "+0.0") return 0;
87261
- // else if(trimmedStr === "-0.0") return -0;
87262
-
87244
+
87263
87245
  if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
87246
+ else if(str==="0") return 0;
87264
87247
  else if (options.hex && hexRegex.test(trimmedStr)) {
87265
- return Number.parseInt(trimmedStr, 16);
87266
- // } else if (options.parseOct && octRegex.test(str)) {
87248
+ return parse_int(trimmedStr, 16);
87249
+ // }else if (options.oct && octRegex.test(str)) {
87267
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
+ }
87268
87268
  // }else if (options.parseBin && binRegex.test(str)) {
87269
87269
  // return Number.parseInt(val, 2);
87270
87270
  }else{
87271
87271
  //separate negative sign, leading zeros, and rest number
87272
87272
  const match = numRegex.exec(trimmedStr);
87273
+ // +00.123 => [ , '+', '00', '.123', ..
87273
87274
  if(match){
87274
87275
  const sign = match[1];
87275
87276
  const leadingZeros = match[2];
87276
87277
  let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
87277
87278
  //trim ending zeros for floating number
87278
87279
 
87279
- const eNotation = match[4] || match[6];
87280
87280
  if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
87281
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
+
87282
87284
  else{//no leading zeros or leading zeros are allowed
87283
87285
  const num = Number(trimmedStr);
87284
87286
  const numStr = "" + num;
87287
+
87285
87288
  if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
87286
87289
  if(options.eNotation) return num;
87287
87290
  else return str;
87288
- }else if(eNotation){ //given number has enotation
87289
- if(options.eNotation) return num;
87290
- else return str;
87291
87291
  }else if(trimmedStr.indexOf(".") !== -1){ //floating number
87292
- // const decimalPart = match[5].substr(1);
87293
- // const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
87294
-
87295
-
87296
- // const p = numStr.indexOf(".");
87297
- // const givenIntPart = numStr.substr(0,p);
87298
- // const givenDecPart = numStr.substr(p+1);
87299
87292
  if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
87300
87293
  else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
87301
87294
  else if( sign && numStr === "-"+numTrimmedByZeros) return num;
@@ -87303,26 +87296,11 @@ function toNumber(str, options = {}){
87303
87296
  }
87304
87297
 
87305
87298
  if(leadingZeros){
87306
- // if(numTrimmedByZeros === numStr){
87307
- // if(options.leadingZeros) return num;
87308
- // else return str;
87309
- // }else return str;
87310
- if(numTrimmedByZeros === numStr) return num;
87311
- else if(sign+numTrimmedByZeros === numStr) return num;
87312
- else return str;
87299
+ return (numTrimmedByZeros === numStr) || (sign+numTrimmedByZeros === numStr) ? num : str
87300
+ }else {
87301
+ return (trimmedStr === numStr) || (trimmedStr === sign+numStr) ? num : str
87313
87302
  }
87314
-
87315
- if(trimmedStr === numStr) return num;
87316
- else if(trimmedStr === sign+numStr) return num;
87317
- // else{
87318
- // //number with +/- sign
87319
- // trimmedStr.test(/[-+][0-9]);
87320
-
87321
- // }
87322
- return str;
87323
87303
  }
87324
- // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
87325
-
87326
87304
  }else{ //non-numeric string
87327
87305
  return str;
87328
87306
  }
@@ -87344,8 +87322,16 @@ function trimZeros(numStr){
87344
87322
  }
87345
87323
  return numStr;
87346
87324
  }
87347
- module.exports = toNumber
87348
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;
87349
87335
 
87350
87336
  /***/ }),
87351
87337
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.104",
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.104",
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"