@abaplint/transpiler-cli 2.7.27 → 2.7.29

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/bundle.js +67 -32
  2. package/package.json +6 -6
package/build/bundle.js CHANGED
@@ -6125,7 +6125,7 @@ const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint
6125
6125
  const sql_arithmetics_1 = __webpack_require__(/*! ./sql_arithmetics */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_arithmetics.js");
6126
6126
  class SQLAggregation extends combi_1.Expression {
6127
6127
  getRunnable() {
6128
- const f = (0, combi_1.altPrio)(sql_arithmetics_1.SQLArithmetics, dynamic_1.Dynamic, _1.SQLFunction);
6128
+ const f = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), (0, combi_1.altPrio)(sql_arithmetics_1.SQLArithmetics, dynamic_1.Dynamic, _1.SQLFunction));
6129
6129
  const fparen = (0, combi_1.seq)("(", _1.Field, ")");
6130
6130
  const count = (0, combi_1.seq)("COUNT", (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenLeft), (0, combi_1.tok)(tokens_1.ParenLeftW)), (0, combi_1.optPrio)("DISTINCT"), (0, combi_1.altPrio)("*", _1.Field, fparen), ")");
6131
6131
  const max = (0, combi_1.seq)("MAX", (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenLeft), (0, combi_1.tok)(tokens_1.ParenLeftW)), f, ")");
@@ -12407,7 +12407,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
12407
12407
  const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
12408
12408
  class InsertReport {
12409
12409
  getMatcher() {
12410
- const options = (0, combi_1.per)((0, combi_1.seq)("STATE", expressions_1.Source), (0, combi_1.seq)("EXTENSION TYPE", expressions_1.Source), (0, combi_1.seq)("DIRECTORY ENTRY", expressions_1.Source), (0, combi_1.seq)("UNICODE ENABLING", expressions_1.Source), (0, combi_1.seq)("PROGRAM TYPE", expressions_1.Source), (0, combi_1.seq)("VERSION", expressions_1.Source), (0, combi_1.seq)("FIXED-POINT ARITHMETIC", expressions_1.Source), "KEEPING DIRECTORY ENTRY");
12410
+ const options = (0, combi_1.per)((0, combi_1.seq)("STATE", expressions_1.Source), (0, combi_1.seq)("EXTENSION TYPE", expressions_1.Source), (0, combi_1.seq)("DIRECTORY ENTRY", expressions_1.Source), (0, combi_1.seq)("UNICODE ENABLING", expressions_1.Source), (0, combi_1.seq)("PROGRAM TYPE", expressions_1.Source), (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("VERSION", expressions_1.Source)), (0, combi_1.seq)("FIXED-POINT ARITHMETIC", expressions_1.Source), "KEEPING DIRECTORY ENTRY");
12411
12411
  const ret = (0, combi_1.seq)("INSERT REPORT", expressions_1.Source, "FROM", expressions_1.Source, (0, combi_1.opt)(options));
12412
12412
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
12413
12413
  }
@@ -20721,6 +20721,9 @@ class TypeUtils {
20721
20721
  }
20722
20722
  return source.getLength() === target.getLength();
20723
20723
  }
20724
+ else if (target instanceof basic_1.XStringType) {
20725
+ return false;
20726
+ }
20724
20727
  else if (target instanceof basic_1.IntegerType) {
20725
20728
  if (((_e = source.getAbstractTypeData()) === null || _e === void 0 ? void 0 : _e.derivedFromConstant) === true) {
20726
20729
  return true;
@@ -24600,6 +24603,8 @@ class Source {
24600
24603
  switch (tok) {
24601
24604
  case "(":
24602
24605
  case "-":
24606
+ case "+":
24607
+ case "BIT":
24603
24608
  break;
24604
24609
  case "BOOLC":
24605
24610
  {
@@ -40015,7 +40020,11 @@ class Hover {
40015
40020
  return { kind: LServer.MarkupKind.Markdown, value: "String Template" };
40016
40021
  }
40017
40022
  else if (found.token instanceof Tokens.Comment) {
40018
- return { kind: LServer.MarkupKind.Markdown, value: "Comment" };
40023
+ let type = "Comment";
40024
+ if (found.token.getStr().startsWith(`"!`)) {
40025
+ type = "ABAP Doc Comment";
40026
+ }
40027
+ return { kind: LServer.MarkupKind.Markdown, value: type };
40019
40028
  }
40020
40029
  const lookup = _lookup_1.LSPLookup.lookup(found, this.reg, obj);
40021
40030
  if (lookup === null || lookup === void 0 ? void 0 : lookup.hover) {
@@ -47506,7 +47515,7 @@ class Registry {
47506
47515
  }
47507
47516
  static abaplintVersion() {
47508
47517
  // magic, see build script "version.sh"
47509
- return "2.101.25";
47518
+ return "2.101.29";
47510
47519
  }
47511
47520
  getDDICReferences() {
47512
47521
  return this.ddicReferences;
@@ -47824,7 +47833,9 @@ class SevenBitAscii {
47824
47833
  shortDescription: `Only allow characters from the 7bit ASCII set.`,
47825
47834
  extendedInformation: `https://docs.abapopenchecks.org/checks/05/
47826
47835
 
47827
- Checkes files with extension ".abap" and ".asddls"`,
47836
+ https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_guidl.htm
47837
+
47838
+ Checkes files with extensions ".abap" and ".asddls"`,
47828
47839
  tags: [_irule_1.RuleTag.SingleFile],
47829
47840
  };
47830
47841
  }
@@ -50609,12 +50620,14 @@ class ClassicExceptionsOverlap extends _abap_rule_1.ABAPRule {
50609
50620
  shortDescription: `Find overlapping classic exceptions`,
50610
50621
  extendedInformation: `When debugging its typically good to know exactly which exception is caught`,
50611
50622
  tags: [_irule_1.RuleTag.SingleFile],
50612
- badExample: ` EXCEPTIONS
50623
+ badExample: `CALL FUNCTION 'SOMETHING'
50624
+ EXCEPTIONS
50613
50625
  system_failure = 1 MESSAGE lv_message
50614
50626
  communication_failure = 1 MESSAGE lv_message
50615
50627
  resource_failure = 1
50616
50628
  OTHERS = 1.`,
50617
- goodExample: ` EXCEPTIONS
50629
+ goodExample: `CALL FUNCTION 'SOMETHING'
50630
+ EXCEPTIONS
50618
50631
  system_failure = 1 MESSAGE lv_message
50619
50632
  communication_failure = 2 MESSAGE lv_message
50620
50633
  resource_failure = 3
@@ -53712,15 +53725,12 @@ ${indentation}${uniqueName}`;
53712
53725
  if (!(low.get() instanceof _statement_1.Unknown)) {
53713
53726
  return undefined;
53714
53727
  }
53715
- else if (!(high.get() instanceof Statements.Move)) {
53716
- return undefined;
53717
- }
53718
53728
  for (const child of high.findAllExpressionsRecursive(Expressions.StringTemplate)) {
53719
53729
  const templateTokens = child.getChildren();
53720
53730
  if (templateTokens.length !== 3
53721
53731
  || templateTokens[0].getFirstToken().getStr() !== "|{"
53722
53732
  || templateTokens[2].getFirstToken().getStr() !== "}|") {
53723
- return undefined;
53733
+ continue;
53724
53734
  }
53725
53735
  const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
53726
53736
  const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
@@ -60099,7 +60109,7 @@ class MSAGConsistency {
60099
60109
  key: "msag_consistency",
60100
60110
  title: "MSAG consistency check",
60101
60111
  shortDescription: `Checks the validity of messages in message classes`,
60102
- extendedInformation: `Message numbers must be 3 digits, and message text must not be empty`,
60112
+ extendedInformation: `Message numbers must be 3 digits, message text must not be empty, no message number duplicates`,
60103
60113
  };
60104
60114
  }
60105
60115
  getDescription(reason) {
@@ -60119,6 +60129,7 @@ class MSAGConsistency {
60119
60129
  if (!(obj instanceof objects_1.MessageClass)) {
60120
60130
  return [];
60121
60131
  }
60132
+ const numbers = new Set();
60122
60133
  for (const message of obj.getMessages()) {
60123
60134
  // todo, get the right positions in xml file
60124
60135
  if (!message.getNumber().match(/\d\d\d/)) {
@@ -60133,6 +60144,16 @@ class MSAGConsistency {
60133
60144
  const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
60134
60145
  issues.push(issue);
60135
60146
  }
60147
+ const num = message.getNumber();
60148
+ if (numbers.has(num)) {
60149
+ const text = "Duplicate message number " + num;
60150
+ const position = new position_1.Position(1, 1);
60151
+ const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
60152
+ issues.push(issue);
60153
+ }
60154
+ else {
60155
+ numbers.add(num);
60156
+ }
60136
60157
  }
60137
60158
  return issues;
60138
60159
  }
@@ -61261,6 +61282,16 @@ POSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.ht
61261
61282
  OCCURENCES: check for OCCURENCES vs OCCURRENCES
61262
61283
 
61263
61284
  CLIENT SPECIFIED, from 754: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapselect_client_obsolete.htm`,
61285
+ badExample: `REFRESH itab.
61286
+
61287
+ COMPUTE foo = 2 + 2.
61288
+
61289
+ MULTIPLY lv_foo BY 2.
61290
+
61291
+ INTERFACE intf LOAD.
61292
+
61293
+ IF foo IS SUPPLIED.
61294
+ ENDIF.`,
61264
61295
  };
61265
61296
  }
61266
61297
  getConfig() {
@@ -62380,6 +62411,8 @@ class PreferCorresponding extends _abap_rule_1.ABAPRule {
62380
62411
  shortDescription: `Prefer corresponding( ) to MOVE-CORRESPONDING, from v740sp05 and up`,
62381
62412
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-language-constructs`,
62382
62413
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide],
62414
+ badExample: `MOVE-CORRESPONDING foo TO bar.`,
62415
+ goodExample: `bar = CORRESPONDING #( foo ).`,
62383
62416
  };
62384
62417
  }
62385
62418
  getConfig() {
@@ -64228,7 +64261,10 @@ class ShortCase extends _abap_rule_1.ABAPRule {
64228
64261
  key: "short_case",
64229
64262
  title: "Short CASE",
64230
64263
  shortDescription: `Checks for CASE statements which have fewer than the specified number of branches`,
64264
+ extendedInformation: `Short CASE constructs can be changed to IF`,
64231
64265
  tags: [_irule_1.RuleTag.SingleFile],
64266
+ badExample: "CASE moo.\nWHEN 'X'.\nENDCASE.",
64267
+ goodExample: "IF moo = 'X'.\nENDIF.",
64232
64268
  };
64233
64269
  }
64234
64270
  getMessage() {
@@ -65363,8 +65399,7 @@ class SyModification extends _abap_rule_1.ABAPRule {
65363
65399
 
65364
65400
  Changes to SY-TVAR* fields are not reported`,
65365
65401
  tags: [_irule_1.RuleTag.SingleFile],
65366
- badExample: `
65367
- sy-uname = 2.
65402
+ badExample: `sy-uname = 2.
65368
65403
  sy = sy.`,
65369
65404
  };
65370
65405
  }
@@ -65555,8 +65590,10 @@ class TypeFormParameters extends _abap_rule_1.ABAPRule {
65555
65590
  title: "Type FORM parameters",
65556
65591
  shortDescription: `Checks for untyped FORM parameters`,
65557
65592
  tags: [_irule_1.RuleTag.SingleFile],
65558
- badExample: `FORM foo USING bar.`,
65559
- goodExample: `FORM foo USING bar TYPE string.`,
65593
+ badExample: `FORM foo USING bar.
65594
+ ENDFORM.`,
65595
+ goodExample: `FORM foo USING bar TYPE string.
65596
+ ENDFORM.`,
65560
65597
  };
65561
65598
  }
65562
65599
  getDescription(parameterName) {
@@ -66382,13 +66419,13 @@ class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
66382
66419
  shortDescription: `Finds unnecessary RETURN statements`,
66383
66420
  extendedInformation: `Finds unnecessary RETURN statements`,
66384
66421
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
66385
- badExample: `METHOD hello.
66386
- ...
66422
+ badExample: `FORM hello1.
66423
+ WRITE 'world'.
66387
66424
  RETURN.
66388
- ENDMETHOD.`,
66389
- goodExample: `METHOD hello.
66390
- ...
66391
- ENDMETHOD.`,
66425
+ ENDFORM.`,
66426
+ goodExample: `FORM hello2.
66427
+ WRITE 'world'.
66428
+ ENDFORM.`,
66392
66429
  };
66393
66430
  }
66394
66431
  getConfig() {
@@ -82087,7 +82124,9 @@ module.exports = toXml;
82087
82124
  /*!*********************************************************************!*\
82088
82125
  !*** ./node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js ***!
82089
82126
  \*********************************************************************/
82090
- /***/ ((module) => {
82127
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
82128
+
82129
+ const util = __webpack_require__(/*! ../util */ "./node_modules/fast-xml-parser/src/util.js");
82091
82130
 
82092
82131
  //TODO: handle comments
82093
82132
  function readDocType(xmlData, i){
@@ -82231,20 +82270,16 @@ function isNotation(xmlData, i){
82231
82270
  return false
82232
82271
  }
82233
82272
 
82234
- //an entity name should not contains special characters that may be used in regex
82235
- //Eg !?\\\/[]$%{}^&*()<>
82236
- const specialChar = "!?\\\/[]$%{}^&*()<>|+";
82237
-
82238
82273
  function validateEntityName(name){
82239
- for (let i = 0; i < specialChar.length; i++) {
82240
- const ch = specialChar[i];
82241
- if(name.indexOf(ch) !== -1) throw new Error(`Invalid character ${ch} in entity name`);
82242
- }
82243
- return name;
82274
+ if (util.isName(name))
82275
+ return name;
82276
+ else
82277
+ throw new Error(`Invalid entity name ${name}`);
82244
82278
  }
82245
82279
 
82246
82280
  module.exports = readDocType;
82247
82281
 
82282
+
82248
82283
  /***/ }),
82249
82284
 
82250
82285
  /***/ "./node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.7.27",
3
+ "version": "2.7.29",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,15 +26,15 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.7.27",
29
+ "@abaplint/transpiler": "^2.7.29",
30
30
  "@types/glob": "^7.2.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.5",
33
- "@types/node": "^20.3.1",
34
- "@abaplint/core": "^2.101.25",
33
+ "@types/node": "^20.3.3",
34
+ "@abaplint/core": "^2.101.29",
35
35
  "progress": "^2.0.3",
36
- "webpack": "^5.88.0",
36
+ "webpack": "^5.88.1",
37
37
  "webpack-cli": "^5.1.4",
38
- "typescript": "^5.1.3"
38
+ "typescript": "^5.1.6"
39
39
  }
40
40
  }