@abaplint/cli 2.101.11 → 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 +64 -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
  },
@@ -21624,7 +21624,7 @@ class TypeUtils {
21624
21624
  return false;
21625
21625
  }
21626
21626
  isAssignableStrict(source, target) {
21627
- var _a, _b, _c, _d, _e;
21627
+ var _a, _b, _c, _d, _e, _f;
21628
21628
  /*
21629
21629
  console.dir(source);
21630
21630
  console.dir(target);
@@ -21663,8 +21663,14 @@ class TypeUtils {
21663
21663
  return false;
21664
21664
  }
21665
21665
  }
21666
- else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
21667
- 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
+ }
21668
21674
  return false;
21669
21675
  }
21670
21676
  return true;
@@ -21687,6 +21693,11 @@ class TypeUtils {
21687
21693
  return false;
21688
21694
  }
21689
21695
  }
21696
+ else if (source instanceof basic_1.XStringType) {
21697
+ if (target instanceof basic_1.CLikeType) {
21698
+ return false;
21699
+ }
21700
+ }
21690
21701
  return this.isAssignable(source, target);
21691
21702
  }
21692
21703
  isAssignable(source, target) {
@@ -23315,6 +23326,9 @@ class Constant {
23315
23326
  }
23316
23327
  return new basic_1.CharacterType(len, { derivedFromConstant: true });
23317
23328
  }
23329
+ else if (node.getFirstToken().getStr().startsWith("`")) {
23330
+ return new basic_1.StringType({ qualifiedName: "STRING", derivedFromConstant: true });
23331
+ }
23318
23332
  else {
23319
23333
  return new basic_1.StringType({ qualifiedName: "STRING" });
23320
23334
  }
@@ -28610,10 +28624,15 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
28610
28624
  const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
28611
28625
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
28612
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");
28613
28628
  class GetBit {
28614
28629
  runSyntax(node, scope, filename) {
28630
+ let lastType = undefined;
28615
28631
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28616
- 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");
28617
28636
  }
28618
28637
  for (const t of node.findDirectExpressions(Expressions.Target)) {
28619
28638
  const inline = t === null || t === void 0 ? void 0 : t.findDirectExpression(Expressions.InlineData);
@@ -30488,13 +30507,17 @@ exports.SetBit = void 0;
30488
30507
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
30489
30508
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
30490
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");
30491
30511
  class SetBit {
30492
30512
  runSyntax(node, scope, filename) {
30493
30513
  for (const s of node.findDirectExpressions(Expressions.Source)) {
30494
30514
  new source_1.Source().runSyntax(s, scope, filename);
30495
30515
  }
30496
30516
  for (const t of node.findDirectExpressions(Expressions.Target)) {
30497
- 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
+ }
30498
30521
  }
30499
30522
  }
30500
30523
  }
@@ -48161,7 +48184,7 @@ class Registry {
48161
48184
  }
48162
48185
  static abaplintVersion() {
48163
48186
  // magic, see build script "version.sh"
48164
- return "2.101.11";
48187
+ return "2.101.12";
48165
48188
  }
48166
48189
  getDDICReferences() {
48167
48190
  return this.ddicReferences;
@@ -53250,6 +53273,10 @@ Make sure to test the downported code, it might not always be completely correct
53250
53273
  if (found) {
53251
53274
  return found;
53252
53275
  }
53276
+ found = this.downportReadTable(high, lowFile, highSyntax);
53277
+ if (found) {
53278
+ return found;
53279
+ }
53253
53280
  return undefined;
53254
53281
  }
53255
53282
  //////////////////////////////////////////
@@ -53545,6 +53572,22 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
53545
53572
  }
53546
53573
  return undefined;
53547
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
+ }
53548
53591
  replaceInsertExpression(high, lowFile, highSyntax) {
53549
53592
  if (!(high.get() instanceof Statements.InsertInternal)) {
53550
53593
  return undefined;
@@ -70647,7 +70690,7 @@ function readDocType(xmlData, i){
70647
70690
  i += 7;
70648
70691
  [entityName, val,i] = readEntityExp(xmlData,i+1);
70649
70692
  if(val.indexOf("&") === -1) //Parameter entities are not supported
70650
- entities[ entityName ] = {
70693
+ entities[ validateEntityName(entityName) ] = {
70651
70694
  regx : RegExp( `&${entityName};`,"g"),
70652
70695
  val: val
70653
70696
  };
@@ -70768,6 +70811,18 @@ function isNotation(xmlData, i){
70768
70811
  return false
70769
70812
  }
70770
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
+
70771
70826
  module.exports = readDocType;
70772
70827
 
70773
70828
  /***/ }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.11",
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.11",
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": {}