@abaplint/cli 2.119.58 → 2.119.59

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 +34 -11
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -11174,6 +11174,7 @@ const expand_macros_1 = __webpack_require__(/*! ./expand_macros */ "../core/buil
11174
11174
  const tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
11175
11175
  const _select_reclassify_1 = __webpack_require__(/*! ./_select_reclassify */ "../core/build/src/abap/2_statements/_select_reclassify.js");
11176
11176
  exports.STATEMENT_MAX_TOKENS = 20000;
11177
+ const EMPTY_PRAGMAS = Object.freeze([]);
11177
11178
  class StatementMap {
11178
11179
  constructor() {
11179
11180
  this.map = {};
@@ -11372,9 +11373,19 @@ class StatementParser {
11372
11373
  return statement;
11373
11374
  }
11374
11375
  removePragma(tokens) {
11376
+ let hasPragma = false;
11377
+ // skip the last token as it is the punctuation
11378
+ for (let i = 0; i < tokens.length - 1; i++) {
11379
+ if (tokens[i] instanceof Tokens.Pragma) {
11380
+ hasPragma = true;
11381
+ break;
11382
+ }
11383
+ }
11384
+ if (hasPragma === false) {
11385
+ return { tokens: tokens.slice(0, tokens.length - 1), pragmas: EMPTY_PRAGMAS };
11386
+ }
11375
11387
  const result = [];
11376
11388
  const pragmas = [];
11377
- // skip the last token as it is the punctuation
11378
11389
  for (let i = 0; i < tokens.length - 1; i++) {
11379
11390
  const t = tokens[i];
11380
11391
  if (t instanceof Tokens.Pragma) {
@@ -47928,6 +47939,7 @@ const _abstract_node_1 = __webpack_require__(/*! ./_abstract_node */ "../core/bu
47928
47939
  class ExpressionNode extends _abstract_node_1.AbstractNode {
47929
47940
  constructor(expression) {
47930
47941
  super();
47942
+ this.tokenCount = 0;
47931
47943
  this.expression = expression;
47932
47944
  }
47933
47945
  addChild(_n) {
@@ -47936,12 +47948,15 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
47936
47948
  get() {
47937
47949
  return this.expression;
47938
47950
  }
47939
- countTokens() {
47940
- let ret = 0;
47941
- for (const c of this.getChildren()) {
47942
- ret = ret + c.countTokens();
47951
+ setChildren(children) {
47952
+ super.setChildren(children);
47953
+ for (const child of this.getChildren()) {
47954
+ this.tokenCount = this.tokenCount + child.countTokens();
47943
47955
  }
47944
- return ret;
47956
+ return this;
47957
+ }
47958
+ countTokens() {
47959
+ return this.tokenCount;
47945
47960
  }
47946
47961
  getFirstToken() {
47947
47962
  for (const child of this.getChildren()) {
@@ -50944,6 +50959,7 @@ class ClassDefinition extends _identifier_1.Identifier {
50944
50959
  // perform checks after everything has been initialized
50945
50960
  this.checkMethodsFromSuperClasses(input);
50946
50961
  this.checkMethodNameLength(input);
50962
+ this.checkClassConstructorStatic(input);
50947
50963
  }
50948
50964
  getFriends() {
50949
50965
  return this.friends;
@@ -51007,6 +51023,13 @@ class ClassDefinition extends _identifier_1.Identifier {
51007
51023
  }
51008
51024
  }
51009
51025
  }
51026
+ checkClassConstructorStatic(input) {
51027
+ for (const m of this.methodDefs.getAll()) {
51028
+ if (m.getName().toUpperCase() === "CLASS_CONSTRUCTOR" && m.isStatic() === false) {
51029
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, m.getToken(), "CLASS_CONSTRUCTOR must be static"));
51030
+ }
51031
+ }
51032
+ }
51010
51033
  checkMethodsFromSuperClasses(input) {
51011
51034
  var _a;
51012
51035
  const scope = input.scope;
@@ -53634,7 +53657,7 @@ const cds_name_1 = __webpack_require__(/*! ./cds_name */ "../core/build/src/cds/
53634
53657
  class CDSDefineTableFunction extends combi_1.Expression {
53635
53658
  getRunnable() {
53636
53659
  const methodName = (0, combi_1.seq)(cds_name_1.CDSName, "=", ">", cds_name_1.CDSName);
53637
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE TABLE FUNCTION"), cds_name_1.CDSName, (0, combi_1.optPrio)(_1.CDSWithParameters), (0, combi_1.str)("RETURNS {"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), cds_name_1.CDSName, ":", _1.CDSType, ";")), (0, combi_1.str)("} IMPLEMENTED BY METHOD"), methodName, (0, combi_1.opt)(";"));
53660
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE TABLE FUNCTION"), cds_name_1.CDSName, (0, combi_1.optPrio)(_1.CDSWithParameters), (0, combi_1.str)("RETURNS {"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), cds_name_1.CDSName, ":", _1.CDSType, (0, combi_1.star)(_1.CDSAnnotation), ";")), (0, combi_1.str)("} IMPLEMENTED BY METHOD"), methodName, (0, combi_1.opt)(";"));
53638
53661
  }
53639
53662
  }
53640
53663
  exports.CDSDefineTableFunction = CDSDefineTableFunction;
@@ -53699,7 +53722,7 @@ class CDSElement extends combi_1.Expression {
53699
53722
  const funcWithPath = (0, combi_1.seq)(_1.CDSFunction, (0, combi_1.plusPrio)(pathSegment));
53700
53723
  const body = (0, combi_1.altPrio)(extensionWildcard, includeElement, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, funcWithPath, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))), _1.CDSInteger);
53701
53724
  const elementBody = (0, combi_1.altPrio)(typedVirtual, (0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
53702
- return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), elementBody, (0, combi_1.optPrio)(cds_as_1.CDSAs));
53725
+ return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), elementBody, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.starPrio)(_1.CDSAnnotation));
53703
53726
  }
53704
53727
  }
53705
53728
  exports.CDSElement = CDSElement;
@@ -53968,7 +53991,7 @@ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../cor
53968
53991
  class CDSName extends combi_1.Expression {
53969
53992
  getRunnable() {
53970
53993
  const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
53971
- return (0, combi_1.seq)((0, combi_1.optPrio)(":"), (0, combi_1.optPrio)(pre), (0, combi_1.regex)(/^\$?#?[\w_]+$/));
53994
+ return (0, combi_1.altPrio)((0, combi_1.regex)(/^"(?:[^"]|"")*"$/), (0, combi_1.seq)((0, combi_1.optPrio)(":"), (0, combi_1.optPrio)(pre), (0, combi_1.regex)(/^\$?#?[\w_]+$/)));
53972
53995
  }
53973
53996
  }
53974
53997
  exports.CDSName = CDSName;
@@ -54183,7 +54206,7 @@ exports.CDSString = void 0;
54183
54206
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54184
54207
  class CDSString extends combi_1.Expression {
54185
54208
  getRunnable() {
54186
- const reg = (0, combi_1.regex)(/^(?:'(?:[^'\\]|''|\\'|\\\\|\\(?!'))*'|"(?:[^"\\]|""|\\"|\\\\|\\(?!"))*")$/);
54209
+ const reg = (0, combi_1.regex)(/^'(?:[^'\\]|''|\\'|\\\\|\\(?!'))*'$/);
54187
54210
  const abapTypeName = (0, combi_1.regex)(/^(?:int[1-9]|int8|sstring|sstr|char|numc|dats|datn|tims|timn|utcl|utclong|fltp|decfloat\d+|dec|string|rawstring|rstr|raw|xstring|clnt|lang|unit|cuky|curr|quan|geom_ewkb|d34n|d16n|d34d|d16d|d34s|d16s|d34r|d16r|d|t|p|n|c|x|f)$/i);
54188
54211
  const abap = (0, combi_1.seq)("abap", ".", abapTypeName, (0, combi_1.optPrio)((0, combi_1.seq)("(", (0, combi_1.regex)(/^\d+$/), ")")), reg);
54189
54212
  return (0, combi_1.altPrio)(abap, reg);
@@ -68684,7 +68707,7 @@ class Registry {
68684
68707
  }
68685
68708
  static abaplintVersion() {
68686
68709
  // magic, see build script "version.js"
68687
- return "2.119.58";
68710
+ return "2.119.59";
68688
68711
  }
68689
68712
  getDDICReferences() {
68690
68713
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.58",
3
+ "version": "2.119.59",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.119.58",
42
+ "@abaplint/core": "^2.119.59",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",