@abaplint/cli 2.101.10 → 2.101.12

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 +65 -9
  2. package/package.json +5 -5
package/build/cli.js CHANGED
@@ -14704,7 +14704,7 @@ class ReadTable {
14704
14704
  const from = (0, combi_1.seq)("FROM", expressions_1.Source);
14705
14705
  const fields = (0, combi_1.plus)((0, combi_1.alt)((0, combi_1.seq)("INTO", (0, combi_1.failStar)()), expressions_1.FieldSub));
14706
14706
  const perm = (0, combi_1.per)((0, combi_1.alt)(index, key, from), expressions_1.ReadTableTarget, using, comparing, "CASTING", "TRANSPORTING ALL FIELDS", (0, combi_1.seq)("TRANSPORTING", (0, combi_1.altPrio)(expressions_1.Dynamic, fields)), "BINARY SEARCH");
14707
- return (0, combi_1.seq)("READ TABLE", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.SimpleSource2), (0, combi_1.opt)(perm));
14707
+ return (0, combi_1.seq)("READ TABLE", (0, combi_1.alt)(expressions_1.SimpleSource2, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source)), (0, combi_1.opt)(perm));
14708
14708
  }
14709
14709
  }
14710
14710
  exports.ReadTable = ReadTable;
@@ -20405,7 +20405,7 @@ BuiltIn.methods = [
20405
20405
  {
20406
20406
  name: "XSTRLEN",
20407
20407
  mandatory: {
20408
- "val": new basic_1.XStringType(),
20408
+ "val": new basic_1.XSequenceType(),
20409
20409
  },
20410
20410
  return: new basic_1.IntegerType(),
20411
20411
  },
@@ -21474,6 +21474,7 @@ class TypeUtils {
21474
21474
  || type instanceof basic_1.UnknownType
21475
21475
  || type instanceof basic_1.NumericType
21476
21476
  || type instanceof basic_1.IntegerType
21477
+ || type instanceof basic_1.Integer8Type
21477
21478
  || type instanceof basic_1.SimpleType
21478
21479
  || type instanceof basic_1.FloatType
21479
21480
  || type instanceof basic_1.FloatingPointType
@@ -21623,7 +21624,7 @@ class TypeUtils {
21623
21624
  return false;
21624
21625
  }
21625
21626
  isAssignableStrict(source, target) {
21626
- var _a, _b, _c, _d, _e;
21627
+ var _a, _b, _c, _d, _e, _f;
21627
21628
  /*
21628
21629
  console.dir(source);
21629
21630
  console.dir(target);
@@ -21662,8 +21663,14 @@ class TypeUtils {
21662
21663
  return false;
21663
21664
  }
21664
21665
  }
21665
- else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
21666
- if (this.structureContainsString(target)) {
21666
+ else if (source instanceof basic_1.StringType) {
21667
+ if (target instanceof basic_1.StructureType && this.structureContainsString(target)) {
21668
+ return false;
21669
+ }
21670
+ else if (target instanceof basic_1.XSequenceType) {
21671
+ if (((_f = source.getAbstractTypeData()) === null || _f === void 0 ? void 0 : _f.derivedFromConstant) === true) {
21672
+ return true;
21673
+ }
21667
21674
  return false;
21668
21675
  }
21669
21676
  return true;
@@ -21686,6 +21693,11 @@ class TypeUtils {
21686
21693
  return false;
21687
21694
  }
21688
21695
  }
21696
+ else if (source instanceof basic_1.XStringType) {
21697
+ if (target instanceof basic_1.CLikeType) {
21698
+ return false;
21699
+ }
21700
+ }
21689
21701
  return this.isAssignable(source, target);
21690
21702
  }
21691
21703
  isAssignable(source, target) {
@@ -23314,6 +23326,9 @@ class Constant {
23314
23326
  }
23315
23327
  return new basic_1.CharacterType(len, { derivedFromConstant: true });
23316
23328
  }
23329
+ else if (node.getFirstToken().getStr().startsWith("`")) {
23330
+ return new basic_1.StringType({ qualifiedName: "STRING", derivedFromConstant: true });
23331
+ }
23317
23332
  else {
23318
23333
  return new basic_1.StringType({ qualifiedName: "STRING" });
23319
23334
  }
@@ -28609,10 +28624,15 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
28609
28624
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
28610
28625
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28611
28626
  const inline_data_1 = __webpack_require__(/*! ../expressions/inline_data */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js");
28627
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28612
28628
  class GetBit {
28613
28629
  runSyntax(node, scope, filename) {
28630
+ let lastType = undefined;
28614
28631
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28615
- new source_1.Source().runSyntax(s, scope, filename);
28632
+ lastType = new source_1.Source().runSyntax(s, scope, filename);
28633
+ }
28634
+ if (lastType && new _type_utils_1.TypeUtils(scope).isHexLike(lastType) === false) {
28635
+ throw new Error("Input must be byte-like");
28616
28636
  }
28617
28637
  for (const t of node.findDirectExpressions(Expressions.Target)) {
28618
28638
  const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);
@@ -30487,13 +30507,17 @@ exports.SetBit = void 0;
30487
30507
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
30488
30508
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
30489
30509
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
30510
+ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
30490
30511
  class SetBit {
30491
30512
  runSyntax(node, scope, filename) {
30492
30513
  for (const s of node.findDirectExpressions(Expressions.Source)) {
30493
30514
  new source_1.Source().runSyntax(s, scope, filename);
30494
30515
  }
30495
30516
  for (const t of node.findDirectExpressions(Expressions.Target)) {
30496
- new target_1.Target().runSyntax(t, scope, filename);
30517
+ const typ = new target_1.Target().runSyntax(t, scope, filename);
30518
+ if (typ && new _type_utils_1.TypeUtils(scope).isHexLike(typ) === false) {
30519
+ throw new Error("Input must be byte-like");
30520
+ }
30497
30521
  }
30498
30522
  }
30499
30523
  }
@@ -48160,7 +48184,7 @@ class Registry {
48160
48184
  }
48161
48185
  static abaplintVersion() {
48162
48186
  // magic, see build script "version.sh"
48163
- return "2.101.10";
48187
+ return "2.101.12";
48164
48188
  }
48165
48189
  getDDICReferences() {
48166
48190
  return this.ddicReferences;
@@ -53249,6 +53273,10 @@ Make sure to test the downported code, it might not always be completely correct
53249
53273
  if (found) {
53250
53274
  return found;
53251
53275
  }
53276
+ found = this.downportReadTable(high, lowFile, highSyntax);
53277
+ if (found) {
53278
+ return found;
53279
+ }
53252
53280
  return undefined;
53253
53281
  }
53254
53282
  //////////////////////////////////////////
@@ -53544,6 +53572,22 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
53544
53572
  }
53545
53573
  return undefined;
53546
53574
  }
53575
+ downportReadTable(high, lowFile, highSyntax) {
53576
+ if (!(high.get() instanceof Statements.ReadTable)) {
53577
+ return undefined;
53578
+ }
53579
+ const source = high.findExpressionAfterToken("TABLE");
53580
+ if ((source === null || source === void 0 ? void 0 : source.get()) instanceof Expressions.Source) {
53581
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
53582
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
53583
+ const firstToken = high.getFirstToken();
53584
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA(${uniqueName}) = ${source.concatTokens()}.\n` + indentation);
53585
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
53586
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
53587
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline table source", this.getMetadata().key, this.conf.severity, fix);
53588
+ }
53589
+ return undefined;
53590
+ }
53547
53591
  replaceInsertExpression(high, lowFile, highSyntax) {
53548
53592
  if (!(high.get() instanceof Statements.InsertInternal)) {
53549
53593
  return undefined;
@@ -70646,7 +70690,7 @@ function readDocType(xmlData, i){
70646
70690
  i += 7;
70647
70691
  [entityName, val,i] = readEntityExp(xmlData,i+1);
70648
70692
  if(val.indexOf("&") === -1) //Parameter entities are not supported
70649
- entities[ entityName ] = {
70693
+ entities[ validateEntityName(entityName) ] = {
70650
70694
  regx : RegExp( `&${entityName};`,"g"),
70651
70695
  val: val
70652
70696
  };
@@ -70767,6 +70811,18 @@ function isNotation(xmlData, i){
70767
70811
  return false
70768
70812
  }
70769
70813
 
70814
+ //an entity name should not contains special characters that may be used in regex
70815
+ //Eg !?\\\/[]$%{}^&*()<>
70816
+ const specialChar = "!?\\\/[]$%{}^&*()<>";
70817
+
70818
+ function validateEntityName(name){
70819
+ for (let i = 0; i < specialChar.length; i++) {
70820
+ const ch = specialChar[i];
70821
+ if(name.indexOf(ch) !== -1) throw new Error(`Invalid character ${ch} in entity name`);
70822
+ }
70823
+ return name;
70824
+ }
70825
+
70770
70826
  module.exports = readDocType;
70771
70827
 
70772
70828
  /***/ }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.10",
3
+ "version": "2.101.12",
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.101.10",
41
+ "@abaplint/core": "^2.101.12",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
@@ -47,16 +47,16 @@
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.2.0",
50
- "eslint": "^8.41.0",
50
+ "eslint": "^8.42.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
- "memfs": "^3.5.1",
53
+ "memfs": "^3.5.2",
54
54
  "minimist": "^1.2.8",
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.1.3",
58
58
  "webpack": "^5.85.0",
59
- "webpack-cli": "^5.1.1",
59
+ "webpack-cli": "^5.1.3",
60
60
  "xml-js": "^1.6.11"
61
61
  },
62
62
  "dependencies": {}