@abaplint/core 2.94.7 → 2.94.9

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 (116) hide show
  1. package/README.md +6 -6
  2. package/adhoc/lexer_performance.ts +16 -17
  3. package/adhoc/parser_performance.ts +18 -0
  4. package/build/abaplint.d.ts +1 -1
  5. package/build/adhoc/lexer_performance.js +2 -3
  6. package/build/adhoc/parser_performance.d.ts +1 -0
  7. package/build/adhoc/parser_performance.js +18 -0
  8. package/build/src/abap/1_lexer/lexer.js +74 -68
  9. package/build/src/abap/2_statements/combi.js +3 -3
  10. package/build/src/abap/2_statements/expressions/data_definition.js +2 -2
  11. package/build/src/abap/2_statements/statements/assign.js +2 -2
  12. package/build/src/abap/2_statements/statements/break.js +1 -1
  13. package/build/src/abap/2_statements/statements/call_function.js +2 -2
  14. package/build/src/abap/2_statements/statements/class_data_begin.js +1 -1
  15. package/build/src/abap/2_statements/statements/class_data_end.js +1 -1
  16. package/build/src/abap/2_statements/statements/class_deferred.js +1 -2
  17. package/build/src/abap/2_statements/statements/class_definition.js +4 -4
  18. package/build/src/abap/2_statements/statements/class_local_friends.js +1 -2
  19. package/build/src/abap/2_statements/statements/clear.js +2 -2
  20. package/build/src/abap/2_statements/statements/concatenate.js +1 -1
  21. package/build/src/abap/2_statements/statements/data_end.js +1 -1
  22. package/build/src/abap/2_statements/statements/delete_database.js +3 -3
  23. package/build/src/abap/2_statements/statements/events.js +1 -1
  24. package/build/src/abap/2_statements/statements/find.js +2 -2
  25. package/build/src/abap/2_statements/statements/modify_line.js +1 -1
  26. package/build/src/abap/2_statements/statements/raise.js +1 -1
  27. package/build/src/abap/2_statements/statements/replace.js +2 -2
  28. package/build/src/abap/2_statements/statements/search.js +1 -1
  29. package/build/src/abap/2_statements/statements/sort.js +1 -1
  30. package/build/src/abap/2_statements/statements/translate.js +2 -2
  31. package/build/src/abap/flow/flow_graph.js +7 -7
  32. package/build/src/index.js +3 -1
  33. package/build/src/lsp/help.js +7 -7
  34. package/build/src/registry.js +1 -1
  35. package/build/src/rules/7bit_ascii.js +2 -2
  36. package/build/src/rules/abapdoc.js +3 -3
  37. package/build/src/rules/align_parameters.js +39 -39
  38. package/build/src/rules/ambiguous_statement.js +5 -5
  39. package/build/src/rules/avoid_use.js +8 -8
  40. package/build/src/rules/begin_end_names.js +4 -4
  41. package/build/src/rules/begin_single_include.js +12 -12
  42. package/build/src/rules/call_transaction_authority_check.js +3 -3
  43. package/build/src/rules/cds_comment_style.js +4 -4
  44. package/build/src/rules/cds_legacy_view.js +4 -4
  45. package/build/src/rules/chain_mainly_declarations.js +4 -4
  46. package/build/src/rules/change_if_to_case.js +8 -8
  47. package/build/src/rules/check_abstract.js +2 -2
  48. package/build/src/rules/check_comments.js +4 -4
  49. package/build/src/rules/check_include.js +3 -3
  50. package/build/src/rules/check_subrc.js +8 -8
  51. package/build/src/rules/classic_exceptions_overlap.js +8 -8
  52. package/build/src/rules/commented_code.js +1 -1
  53. package/build/src/rules/constructor_visibility_public.js +4 -4
  54. package/build/src/rules/contains_tab.js +2 -2
  55. package/build/src/rules/cyclic_oo.js +2 -2
  56. package/build/src/rules/dangerous_statement.js +1 -1
  57. package/build/src/rules/definitions_top.js +2 -2
  58. package/build/src/rules/downport.js +83 -83
  59. package/build/src/rules/exit_or_check.js +3 -3
  60. package/build/src/rules/exporting.js +1 -1
  61. package/build/src/rules/forbidden_identifier.js +1 -1
  62. package/build/src/rules/forbidden_void_type.js +2 -2
  63. package/build/src/rules/functional_writing.js +17 -17
  64. package/build/src/rules/global_class.js +8 -8
  65. package/build/src/rules/identical_conditions.js +2 -2
  66. package/build/src/rules/identical_contents.js +14 -14
  67. package/build/src/rules/identical_descriptions.js +6 -6
  68. package/build/src/rules/if_in_if.js +26 -26
  69. package/build/src/rules/implement_methods.js +3 -3
  70. package/build/src/rules/in_statement_indentation.js +11 -11
  71. package/build/src/rules/intf_referencing_clas.js +3 -3
  72. package/build/src/rules/line_break_style.js +2 -2
  73. package/build/src/rules/line_length.js +1 -1
  74. package/build/src/rules/line_only_punc.js +1 -1
  75. package/build/src/rules/local_variable_names.js +2 -2
  76. package/build/src/rules/main_file_contents.js +4 -4
  77. package/build/src/rules/many_parentheses.js +10 -10
  78. package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
  79. package/build/src/rules/max_one_statement.js +5 -5
  80. package/build/src/rules/method_overwrites_builtin.js +2 -2
  81. package/build/src/rules/nesting.js +1 -1
  82. package/build/src/rules/no_chained_assignment.js +1 -1
  83. package/build/src/rules/no_external_form_calls.js +2 -2
  84. package/build/src/rules/no_inline_in_optional_branches.js +11 -11
  85. package/build/src/rules/no_public_attributes.js +1 -1
  86. package/build/src/rules/no_yoda_conditions.js +4 -4
  87. package/build/src/rules/nrob_consistency.js +2 -2
  88. package/build/src/rules/obsolete_statement.js +42 -42
  89. package/build/src/rules/omit_parameter_name.js +3 -3
  90. package/build/src/rules/omit_receiving.js +13 -13
  91. package/build/src/rules/parser_702_chaining.js +2 -2
  92. package/build/src/rules/parser_error.js +2 -2
  93. package/build/src/rules/parser_missing_space.js +1 -1
  94. package/build/src/rules/prefer_inline.js +16 -16
  95. package/build/src/rules/prefer_is_not.js +7 -7
  96. package/build/src/rules/prefer_raise_exception_new.js +3 -3
  97. package/build/src/rules/prefer_returning_to_exporting.js +1 -1
  98. package/build/src/rules/prefer_xsdbool.js +2 -2
  99. package/build/src/rules/remove_descriptions.js +4 -4
  100. package/build/src/rules/rfc_error_handling.js +9 -9
  101. package/build/src/rules/select_add_order_by.js +5 -5
  102. package/build/src/rules/select_performance.js +5 -5
  103. package/build/src/rules/sicf_consistency.js +2 -2
  104. package/build/src/rules/space_before_dot.js +2 -2
  105. package/build/src/rules/start_at_tab.js +1 -1
  106. package/build/src/rules/sy_modification.js +4 -4
  107. package/build/src/rules/tabl_enhancement_category.js +2 -2
  108. package/build/src/rules/unnecessary_pragma.js +22 -22
  109. package/build/src/rules/unnecessary_return.js +5 -5
  110. package/build/src/rules/unused_methods.js +9 -9
  111. package/build/src/rules/unused_variables.js +6 -6
  112. package/build/src/rules/use_bool_expression.js +8 -8
  113. package/build/src/rules/use_line_exists.js +6 -6
  114. package/build/src/rules/use_new.js +4 -4
  115. package/build/src/rules/when_others_last.js +6 -6
  116. package/package.json +67 -66
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # @abaplint/core
2
-
3
- [abaplint](https://abaplint.org/) core library
4
-
5
- Exposes functionality like the parser and rules, which can be used in other projects.
6
-
1
+ # @abaplint/core
2
+
3
+ [abaplint](https://abaplint.org/) core library
4
+
5
+ Exposes functionality like the parser and rules, which can be used in other projects.
6
+
7
7
  For more information see https://github.com/abaplint/abaplint
@@ -1,17 +1,16 @@
1
- import {MemoryFile} from "../src";
2
- import {Lexer} from "../src/abap/1_lexer/lexer";
3
- import * as fs from "fs";
4
-
5
- console.log("========================");
6
- const file = new MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
7
-
8
- let total = 0;
9
- for (let i = 0; i < 10; i++) {
10
- const before = Date.now();
11
- const result = new Lexer().run(file);
12
- const runtime = Date.now() - before;
13
- console.log("Runtime: " + runtime + "ms");
14
- total += runtime;
15
- console.log("Tokens: " + result.tokens.length);
16
- }
17
- console.log("Total: " + total);
1
+ import {MemoryFile} from "../src";
2
+ import {Lexer} from "../src/abap/1_lexer/lexer";
3
+ import * as fs from "fs";
4
+
5
+ console.log("========================");
6
+ const file = new MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
7
+
8
+ let total = 0;
9
+ for (let i = 0; i < 10; i++) {
10
+ const before = Date.now();
11
+ const result = new Lexer().run(file);
12
+ const runtime = Date.now() - before;
13
+ console.log("Runtime: " + runtime + "ms, Tokens: " + result.tokens.length);
14
+ total += runtime;
15
+ }
16
+ console.log("Total: " + total + "ms");
@@ -0,0 +1,18 @@
1
+ import {MemoryFile, Version} from "../src";
2
+ import {Lexer} from "../src/abap/1_lexer/lexer";
3
+ import * as fs from "fs";
4
+ import {StatementParser} from "../src/abap/2_statements/statement_parser";
5
+
6
+ console.log("========================");
7
+ const file = new MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
8
+
9
+ const lexerResult = new Lexer().run(file);
10
+
11
+ let total = 0;
12
+ for (let i = 0; i < 4; i++) {
13
+ const before = Date.now();
14
+ new StatementParser(Version.v702).run([lexerResult], []);
15
+ const runtime = Date.now() - before;
16
+ total += runtime;
17
+ }
18
+ console.log("Total: " + total + "ms");
@@ -4746,7 +4746,7 @@ export declare class RulesRunner {
4746
4746
  excludeIssues(issues: Issue[]): Issue[];
4747
4747
  }
4748
4748
 
4749
- declare enum RuleTag {
4749
+ export declare enum RuleTag {
4750
4750
  Experimental = "Experimental",
4751
4751
  DeprecationCandidate = "DeprecationCandidate",
4752
4752
  Upport = "Upport",
@@ -10,9 +10,8 @@ for (let i = 0; i < 10; i++) {
10
10
  const before = Date.now();
11
11
  const result = new lexer_1.Lexer().run(file);
12
12
  const runtime = Date.now() - before;
13
- console.log("Runtime: " + runtime + "ms");
13
+ console.log("Runtime: " + runtime + "ms, Tokens: " + result.tokens.length);
14
14
  total += runtime;
15
- console.log("Tokens: " + result.tokens.length);
16
15
  }
17
- console.log("Total: " + total);
16
+ console.log("Total: " + total + "ms");
18
17
  //# sourceMappingURL=lexer_performance.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const src_1 = require("../src");
4
+ const lexer_1 = require("../src/abap/1_lexer/lexer");
5
+ const fs = require("fs");
6
+ const statement_parser_1 = require("../src/abap/2_statements/statement_parser");
7
+ console.log("========================");
8
+ const file = new src_1.MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
9
+ const lexerResult = new lexer_1.Lexer().run(file);
10
+ let total = 0;
11
+ for (let i = 0; i < 4; i++) {
12
+ const before = Date.now();
13
+ new statement_parser_1.StatementParser(src_1.Version.v702).run([lexerResult], []);
14
+ const runtime = Date.now() - before;
15
+ total += runtime;
16
+ }
17
+ console.log("Total: " + total + "ms");
18
+ //# sourceMappingURL=parser_performance.js.map
@@ -9,6 +9,7 @@ class Buffer {
9
9
  }
10
10
  add(s) {
11
11
  this.buf = this.buf + s;
12
+ return this.buf;
12
13
  }
13
14
  get() {
14
15
  return this.buf;
@@ -300,39 +301,82 @@ class Lexer {
300
301
  process(raw) {
301
302
  this.stream = new Stream(raw.replace(/\r/g, ""));
302
303
  this.buffer = new Buffer();
304
+ const splits = {};
305
+ splits[" "] = true;
306
+ splits[":"] = true;
307
+ splits["."] = true;
308
+ splits[","] = true;
309
+ splits["-"] = true;
310
+ splits["+"] = true;
311
+ splits["("] = true;
312
+ splits[")"] = true;
313
+ splits["["] = true;
314
+ splits["]"] = true;
315
+ splits["\t"] = true;
316
+ splits["\n"] = true;
317
+ const bufs = {};
318
+ bufs["."] = true;
319
+ bufs[","] = true;
320
+ bufs[":"] = true;
321
+ bufs["("] = true;
322
+ bufs[")"] = true;
323
+ bufs["["] = true;
324
+ bufs["]"] = true;
325
+ bufs["+"] = true;
326
+ bufs["@"] = true;
303
327
  for (;;) {
304
328
  const current = this.stream.currentChar();
305
- this.buffer.add(current);
306
- const buf = this.buffer.get();
329
+ const buf = this.buffer.add(current);
307
330
  const ahead = this.stream.nextChar();
308
331
  const aahead = this.stream.nextNextChar();
309
- const prev = this.stream.prevChar();
310
- if (ahead === "'" && this.m === this.ModeNormal) {
311
- // start string
312
- this.add();
313
- this.m = this.ModeStr;
314
- }
315
- else if ((ahead === "|" || ahead === "}")
316
- && this.m === this.ModeNormal) {
317
- // start template
318
- this.add();
319
- this.m = this.ModeTemplate;
320
- }
321
- else if (ahead === "`" && this.m === this.ModeNormal) {
322
- // start ping
323
- this.add();
324
- this.m = this.ModePing;
325
- }
326
- else if (aahead === "##" && this.m === this.ModeNormal) {
327
- // start pragma
328
- this.add();
329
- this.m = this.ModePragma;
330
- }
331
- else if ((ahead === "\"" || (ahead === "*" && current === "\n"))
332
- && this.m === this.ModeNormal) {
333
- // start comment
334
- this.add();
335
- this.m = this.ModeComment;
332
+ if (this.m === this.ModeNormal) {
333
+ if (ahead === "'") {
334
+ // start string
335
+ this.add();
336
+ this.m = this.ModeStr;
337
+ }
338
+ else if (ahead === "|" || ahead === "}") {
339
+ // start template
340
+ this.add();
341
+ this.m = this.ModeTemplate;
342
+ }
343
+ else if (ahead === "`") {
344
+ // start ping
345
+ this.add();
346
+ this.m = this.ModePing;
347
+ }
348
+ else if (aahead === "##") {
349
+ // start pragma
350
+ this.add();
351
+ this.m = this.ModePragma;
352
+ }
353
+ else if (ahead === "\""
354
+ || (ahead === "*" && current === "\n")) {
355
+ // start comment
356
+ this.add();
357
+ this.m = this.ModeComment;
358
+ }
359
+ else if (splits[ahead]) {
360
+ this.add();
361
+ }
362
+ else if (ahead === "@" && buf.trim().length === 0) {
363
+ this.add();
364
+ }
365
+ else if (aahead === "->"
366
+ || aahead === "=>") {
367
+ this.add();
368
+ }
369
+ else if (current === ">"
370
+ && ahead !== " "
371
+ && (this.stream.prevChar() === "-" || this.stream.prevChar() === "=")) {
372
+ // arrows
373
+ this.add();
374
+ }
375
+ else if (buf.length === 1
376
+ && (bufs[buf]
377
+ || (buf === "-" && ahead !== ">"))) {
378
+ this.add();
379
+ }
336
380
  }
337
381
  else if (this.m === this.ModePragma && (ahead === "," || ahead === ":" || ahead === "." || ahead === " " || ahead === "\n")) {
338
382
  // end of pragma
@@ -357,7 +401,7 @@ class Lexer {
357
401
  else if (this.m === this.ModeTemplate
358
402
  && buf.length > 1
359
403
  && (current === "|" || current === "{")
360
- && (prev !== "\\" || this.stream.prevPrevChar() === "\\\\")) {
404
+ && (this.stream.prevChar() !== "\\" || this.stream.prevPrevChar() === "\\\\")) {
361
405
  // end of template
362
406
  this.add();
363
407
  this.m = this.ModeNormal;
@@ -377,24 +421,6 @@ class Lexer {
377
421
  this.m = this.ModeNormal;
378
422
  }
379
423
  }
380
- else if (this.m === this.ModeNormal
381
- && (ahead === " "
382
- || ahead === ":"
383
- || ahead === "."
384
- || ahead === ","
385
- || ahead === "-"
386
- || ahead === "+"
387
- || ahead === "("
388
- || ahead === ")"
389
- || ahead === "["
390
- || ahead === "]"
391
- || (ahead === "@" && buf.trim().length === 0)
392
- || aahead === "->"
393
- || aahead === "=>"
394
- || ahead === "\t"
395
- || ahead === "\n")) {
396
- this.add();
397
- }
398
424
  else if (ahead === "\n" && this.m !== this.ModeTemplate) {
399
425
  this.add();
400
426
  this.m = this.ModeNormal;
@@ -402,26 +428,6 @@ class Lexer {
402
428
  else if (this.m === this.ModeTemplate && current === "\n") {
403
429
  this.add();
404
430
  }
405
- else if (current === ">"
406
- && (prev === "-" || prev === "=")
407
- && ahead !== " "
408
- && this.m === this.ModeNormal) {
409
- // arrows
410
- this.add();
411
- }
412
- else if (this.m === this.ModeNormal
413
- && (buf === "."
414
- || buf === ","
415
- || buf === ":"
416
- || buf === "("
417
- || buf === ")"
418
- || buf === "["
419
- || buf === "]"
420
- || buf === "+"
421
- || buf === "@"
422
- || (buf === "-" && ahead !== ">"))) {
423
- this.add();
424
- }
425
431
  if (!this.stream.advance()) {
426
432
  break;
427
433
  }
@@ -301,7 +301,7 @@ class Star {
301
301
  return [""];
302
302
  }
303
303
  }
304
- class StarPrioroity {
304
+ class StarPriority {
305
305
  constructor(sta) {
306
306
  this.sta = sta;
307
307
  }
@@ -373,7 +373,7 @@ class Plus {
373
373
  class PlusPriority {
374
374
  constructor(plu) {
375
375
  this.plu = plu;
376
- this.sub = new Sequence([this.plu, new StarPrioroity(this.plu)]);
376
+ this.sub = new Sequence([this.plu, new StarPriority(this.plu)]);
377
377
  }
378
378
  listKeywords() {
379
379
  return this.plu.listKeywords();
@@ -866,7 +866,7 @@ function star(first) {
866
866
  }
867
867
  exports.star = star;
868
868
  function starPrio(first) {
869
- return new StarPrioroity(map(first));
869
+ return new StarPriority(map(first));
870
870
  }
871
871
  exports.starPrio = starPrio;
872
872
  function plus(first) {
@@ -6,8 +6,8 @@ const Expressions = require(".");
6
6
  class DataDefinition extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const simple = (0, combi_1.opt)((0, combi_1.per)("READ-ONLY", Expressions.Type, Expressions.Length, Expressions.Decimals, Expressions.Value));
9
- const table = (0, combi_1.seq)(Expressions.TypeTable, (0, combi_1.opt)("READ-ONLY"));
10
- return (0, combi_1.seq)(Expressions.DefinitionName, (0, combi_1.opt)(Expressions.ConstantFieldLength), (0, combi_1.alt)(simple, table));
9
+ const table = (0, combi_1.seq)(Expressions.TypeTable, (0, combi_1.optPrio)("READ-ONLY"));
10
+ return (0, combi_1.seq)(Expressions.DefinitionName, (0, combi_1.optPrio)(Expressions.ConstantFieldLength), (0, combi_1.alt)(simple, table));
11
11
  }
12
12
  }
13
13
  exports.DataDefinition = DataDefinition;
@@ -5,8 +5,8 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class Assign {
7
7
  getMatcher() {
8
- const type = (0, combi_1.seq)("TYPE", (0, combi_1.alt)(expressions_1.Dynamic, expressions_1.TypeName));
9
- const like = (0, combi_1.seq)("LIKE", (0, combi_1.alt)(expressions_1.Dynamic, expressions_1.Source));
8
+ const type = (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(expressions_1.Dynamic, expressions_1.TypeName));
9
+ const like = (0, combi_1.seq)("LIKE", (0, combi_1.altPrio)(expressions_1.Dynamic, expressions_1.Source));
10
10
  const handle = (0, combi_1.seq)("TYPE HANDLE", expressions_1.Source);
11
11
  const range = (0, combi_1.seq)("RANGE", expressions_1.Source);
12
12
  const decimals = (0, combi_1.seq)("DECIMALS", expressions_1.Source);
@@ -7,7 +7,7 @@ const version_1 = require("../../../version");
7
7
  class Break {
8
8
  getMatcher() {
9
9
  const next = (0, combi_1.str)("AT NEXT APPLICATION STATEMENT");
10
- const ret = (0, combi_1.alt)((0, combi_1.seq)("BREAK-POINT", (0, combi_1.opt)((0, combi_1.alt)(next, expressions_1.Source))), (0, combi_1.seq)("BREAK", expressions_1.FieldSub));
10
+ const ret = (0, combi_1.altPrio)((0, combi_1.seq)("BREAK-POINT", (0, combi_1.optPrio)((0, combi_1.altPrio)(next, expressions_1.Source))), (0, combi_1.seq)("BREAK", expressions_1.FieldSub));
11
11
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
12
12
  }
13
13
  }
@@ -9,14 +9,14 @@ class CallFunction {
9
9
  const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
10
10
  const update = (0, combi_1.str)("IN UPDATE TASK");
11
11
  const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
12
- const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.alt)("TASK", unit)));
12
+ const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
13
13
  const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
14
14
  const performing = (0, combi_1.seq)("PERFORMING", expressions_1.FormName, "ON END OF TASK");
15
15
  const separate = (0, combi_1.str)("AS SEPARATE UNIT");
16
16
  const keeping = (0, combi_1.str)("KEEPING LOGICAL UNIT OF WORK");
17
17
  const options = (0, combi_1.per)(starting, update, background, expressions_1.Destination, calling, performing, separate, keeping);
18
18
  const dynamic = (0, combi_1.seq)("PARAMETER-TABLE", expressions_1.Source, (0, combi_1.opt)((0, combi_1.seq)("EXCEPTION-TABLE", expressions_1.Source)));
19
- const call = (0, combi_1.seq)("CALL", (0, combi_1.alt)("FUNCTION", (0, combi_1.verNot)(version_1.Version.Cloud, "CUSTOMER-FUNCTION")), expressions_1.FunctionName, (0, combi_1.opt)(options), (0, combi_1.alt)(expressions_1.FunctionParameters, dynamic));
19
+ const call = (0, combi_1.seq)("CALL", (0, combi_1.altPrio)("FUNCTION", (0, combi_1.verNot)(version_1.Version.Cloud, "CUSTOMER-FUNCTION")), expressions_1.FunctionName, (0, combi_1.opt)(options), (0, combi_1.alt)(expressions_1.FunctionParameters, dynamic));
20
20
  return call;
21
21
  }
22
22
  }
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
6
6
  class ClassDataBegin {
7
7
  getMatcher() {
8
8
  const occurs = (0, combi_1.seq)("OCCURS", expressions_1.Integer);
9
- const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.opt)("COMMON PART"), expressions_1.NamespaceSimpleName, (0, combi_1.opt)("READ-ONLY"), (0, combi_1.opt)(occurs));
9
+ const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.optPrio)("COMMON PART"), expressions_1.NamespaceSimpleName, (0, combi_1.optPrio)("READ-ONLY"), (0, combi_1.optPrio)(occurs));
10
10
  return (0, combi_1.seq)("CLASS-DATA", structure);
11
11
  }
12
12
  }
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
6
6
  class ClassDataEnd {
7
7
  getMatcher() {
8
8
  const common = (0, combi_1.seq)("COMMON PART", (0, combi_1.optPrio)(expressions_1.NamespaceSimpleName));
9
- const structure = (0, combi_1.seq)("END OF", (0, combi_1.alt)(common, expressions_1.NamespaceSimpleName));
9
+ const structure = (0, combi_1.seq)("END OF", (0, combi_1.altPrio)(common, expressions_1.NamespaceSimpleName));
10
10
  return (0, combi_1.seq)("CLASS-DATA", structure);
11
11
  }
12
12
  }
@@ -5,8 +5,7 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class ClassDeferred {
7
7
  getMatcher() {
8
- const def = (0, combi_1.seq)("DEFERRED", (0, combi_1.opt)("PUBLIC"));
9
- return (0, combi_1.seq)("CLASS", expressions_1.ClassName, (0, combi_1.str)("DEFINITION"), def);
8
+ return (0, combi_1.seq)("CLASS", expressions_1.ClassName, "DEFINITION DEFERRED", (0, combi_1.optPrio)("PUBLIC"));
10
9
  }
11
10
  }
12
11
  exports.ClassDeferred = ClassDeferred;
@@ -6,13 +6,13 @@ const expressions_1 = require("../expressions");
6
6
  const version_1 = require("../../../version");
7
7
  class ClassDefinition {
8
8
  getMatcher() {
9
- const create = (0, combi_1.seq)("CREATE", (0, combi_1.alt)("PUBLIC", "PROTECTED", "PRIVATE"));
10
- const level = (0, combi_1.alt)("CRITICAL", "HARMLESS", "DANGEROUS");
9
+ const create = (0, combi_1.seq)("CREATE", (0, combi_1.altPrio)("PUBLIC", "PROTECTED", "PRIVATE"));
10
+ const level = (0, combi_1.altPrio)("CRITICAL", "HARMLESS", "DANGEROUS");
11
11
  const risk = (0, combi_1.seq)("RISK LEVEL", level);
12
- const time = (0, combi_1.alt)("LONG", "MEDIUM", "SHORT");
12
+ const time = (0, combi_1.altPrio)("LONG", "MEDIUM", "SHORT");
13
13
  const duration = (0, combi_1.seq)("DURATION", time);
14
14
  const blah = (0, combi_1.per)(expressions_1.ClassGlobal, expressions_1.ClassFinal, "ABSTRACT", (0, combi_1.seq)("INHERITING FROM", expressions_1.SuperClassName), create, "FOR TESTING", risk, "SHARED MEMORY ENABLED", duration, (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("FOR BEHAVIOR OF", expressions_1.NamespaceSimpleName)), expressions_1.ClassFriends);
15
- const def = (0, combi_1.seq)("DEFINITION", (0, combi_1.opt)(blah));
15
+ const def = (0, combi_1.seq)("DEFINITION", (0, combi_1.optPrio)(blah));
16
16
  return (0, combi_1.seq)("CLASS", expressions_1.ClassName, def);
17
17
  }
18
18
  }
@@ -5,8 +5,7 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class ClassLocalFriends {
7
7
  getMatcher() {
8
- const local = (0, combi_1.seq)("LOCAL FRIENDS", (0, combi_1.plus)(expressions_1.ClassName));
9
- return (0, combi_1.seq)("CLASS", expressions_1.ClassName, "DEFINITION", local);
8
+ return (0, combi_1.seq)("CLASS", expressions_1.ClassName, "DEFINITION LOCAL FRIENDS", (0, combi_1.plusPrio)(expressions_1.ClassName));
10
9
  }
11
10
  }
12
11
  exports.ClassLocalFriends = ClassLocalFriends;
@@ -6,8 +6,8 @@ const expressions_1 = require("../expressions");
6
6
  class Clear {
7
7
  getMatcher() {
8
8
  const wit = (0, combi_1.seq)("WITH", expressions_1.Source);
9
- const mode = (0, combi_1.alt)("IN CHARACTER MODE", "IN BYTE MODE");
10
- return (0, combi_1.seq)("CLEAR", expressions_1.Target, (0, combi_1.opt)(wit), (0, combi_1.opt)(mode));
9
+ const mode = (0, combi_1.altPrio)("IN CHARACTER MODE", "IN BYTE MODE");
10
+ return (0, combi_1.seq)("CLEAR", expressions_1.Target, (0, combi_1.optPrio)(wit), (0, combi_1.optPrio)(mode));
11
11
  }
12
12
  }
13
13
  exports.Clear = Clear;
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class Concatenate {
7
7
  getMatcher() {
8
- const mode = (0, combi_1.seq)("IN", (0, combi_1.alt)("BYTE", "CHARACTER"), "MODE");
8
+ const mode = (0, combi_1.seq)("IN", (0, combi_1.altPrio)("BYTE", "CHARACTER"), "MODE");
9
9
  const blanks = (0, combi_1.str)("RESPECTING BLANKS");
10
10
  const sep = (0, combi_1.seq)("SEPARATED BY", expressions_1.Source);
11
11
  const options = (0, combi_1.per)(mode, blanks, sep);
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
6
6
  class DataEnd {
7
7
  getMatcher() {
8
8
  const common = (0, combi_1.seq)("COMMON PART", (0, combi_1.optPrio)(expressions_1.DefinitionName));
9
- const structure = (0, combi_1.seq)("END OF", (0, combi_1.alt)(common, expressions_1.DefinitionName));
9
+ const structure = (0, combi_1.seq)("END OF", (0, combi_1.altPrio)(common, expressions_1.DefinitionName));
10
10
  const valid = (0, combi_1.seq)("VALID BETWEEN", expressions_1.ComponentName, "AND", expressions_1.ComponentName);
11
11
  return (0, combi_1.seq)("DATA", structure, (0, combi_1.optPrio)(valid));
12
12
  }
@@ -6,10 +6,10 @@ const expressions_1 = require("../expressions");
6
6
  const sql_client_1 = require("../expressions/sql_client");
7
7
  class DeleteDatabase {
8
8
  getMatcher() {
9
- const where = (0, combi_1.seq)("WHERE", (0, combi_1.alt)(expressions_1.SQLCond, expressions_1.Dynamic));
9
+ const where = (0, combi_1.seq)("WHERE", (0, combi_1.altPrio)(expressions_1.SQLCond, expressions_1.Dynamic));
10
10
  const from = (0, combi_1.seq)("FROM", expressions_1.DatabaseTable, (0, combi_1.optPrio)(sql_client_1.SQLClient), (0, combi_1.optPrio)(expressions_1.DatabaseConnection), (0, combi_1.opt)(where));
11
- const table = (0, combi_1.seq)(expressions_1.DatabaseTable, (0, combi_1.optPrio)(sql_client_1.SQLClient), (0, combi_1.opt)(expressions_1.DatabaseConnection), "FROM", (0, combi_1.opt)("TABLE"), expressions_1.SQLSourceSimple);
12
- const ret = (0, combi_1.seq)("DELETE", (0, combi_1.alt)(from, table));
11
+ const table = (0, combi_1.seq)(expressions_1.DatabaseTable, (0, combi_1.optPrio)(sql_client_1.SQLClient), (0, combi_1.optPrio)(expressions_1.DatabaseConnection), "FROM", (0, combi_1.opt)("TABLE"), expressions_1.SQLSourceSimple);
12
+ const ret = (0, combi_1.seq)("DELETE", (0, combi_1.altPrio)(from, table));
13
13
  return ret;
14
14
  }
15
15
  }
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
6
6
  class Events {
7
7
  getMatcher() {
8
8
  const exporting = (0, combi_1.seq)("EXPORTING", (0, combi_1.plus)(expressions_1.MethodParamOptional));
9
- return (0, combi_1.seq)((0, combi_1.alt)("CLASS-EVENTS", "EVENTS"), expressions_1.EventName, (0, combi_1.opt)(exporting));
9
+ return (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-EVENTS", "EVENTS"), expressions_1.EventName, (0, combi_1.optPrio)(exporting));
10
10
  }
11
11
  }
12
12
  exports.Events = Events;
@@ -8,8 +8,8 @@ class Find {
8
8
  // SUBMATCHES handling is a workaround
9
9
  const options = (0, combi_1.per)("IGNORING CASE", "RESPECTING CASE", "IN BYTE MODE", "IN CHARACTER MODE", (0, combi_1.seq)("OF", expressions_1.Source), (0, combi_1.seq)("FROM", expressions_1.Source), (0, combi_1.seq)("TO", expressions_1.Source), (0, combi_1.seq)("MATCH OFFSET", expressions_1.Target), (0, combi_1.seq)("MATCH LINE", expressions_1.Target), (0, combi_1.seq)("MATCH COUNT", expressions_1.Target), (0, combi_1.seq)("MATCH LENGTH", expressions_1.Target), (0, combi_1.seq)("LENGTH", expressions_1.Source), (0, combi_1.seq)("RESULTS", expressions_1.Target), (0, combi_1.seq)("SUBMATCHES", expressions_1.Target), (0, combi_1.seq)("SUBMATCHES", expressions_1.Target, expressions_1.Target), (0, combi_1.seq)("SUBMATCHES", (0, combi_1.plus)(expressions_1.Target)));
10
10
  const sectionLength = (0, combi_1.seq)("SECTION LENGTH", expressions_1.Source, "OF");
11
- const before = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("TABLE", "SECTION OFFSET", sectionLength)), expressions_1.Source);
12
- const ret = (0, combi_1.seq)("FIND", (0, combi_1.opt)((0, combi_1.alt)("FIRST OCCURRENCE OF", "ALL OCCURRENCES OF")), expressions_1.FindType, expressions_1.Source, "IN", before, (0, combi_1.opt)(options));
11
+ const before = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("TABLE", "SECTION OFFSET", sectionLength)), expressions_1.Source);
12
+ const ret = (0, combi_1.seq)("FIND", (0, combi_1.opt)((0, combi_1.altPrio)("FIRST OCCURRENCE OF", "ALL OCCURRENCES OF")), expressions_1.FindType, expressions_1.Source, "IN", before, (0, combi_1.opt)(options));
13
13
  return ret;
14
14
  }
15
15
  }
@@ -18,7 +18,7 @@ class ModifyLine {
18
18
  const onOff = (0, combi_1.alt)("ON", "OFF");
19
19
  const intensified = (0, combi_1.seq)("INTENSIFIED", onOff);
20
20
  const options = (0, combi_1.per)(index, value, format, page, lineFormat, lineValue, ocp, intensified, expressions_1.Color);
21
- const ret = (0, combi_1.seq)("MODIFY", (0, combi_1.alt)("CURRENT LINE", (0, combi_1.seq)("LINE", expressions_1.Source)), (0, combi_1.opt)(options));
21
+ const ret = (0, combi_1.seq)("MODIFY", (0, combi_1.altPrio)("CURRENT LINE", (0, combi_1.seq)("LINE", expressions_1.Source)), (0, combi_1.opt)(options));
22
22
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
23
23
  }
24
24
  }
@@ -10,7 +10,7 @@ class Raise {
10
10
  const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", (0, combi_1.altPrio)(expressions_1.MessageNumber, expressions_1.Source), (0, combi_1.optPrio)(expressions_1.RaiseWith));
11
11
  const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
12
12
  const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
13
- const pre = (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION"), "SHORTDUMP");
13
+ const pre = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION"), "SHORTDUMP");
14
14
  const clas = (0, combi_1.seq)(pre, (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
15
15
  const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.ExceptionName));
16
16
  return ret;
@@ -9,12 +9,12 @@ class Replace {
9
9
  const offset = (0, combi_1.seq)("OFFSET", expressions_1.Source);
10
10
  const section = (0, combi_1.seq)((0, combi_1.opt)("IN"), "SECTION", (0, combi_1.per)(offset, length), "OF", expressions_1.Target);
11
11
  const source = (0, combi_1.seq)((0, combi_1.opt)("OF"), expressions_1.FindType, expressions_1.Source);
12
- const cas = (0, combi_1.alt)("IGNORING CASE", "RESPECTING CASE");
12
+ const cas = (0, combi_1.altPrio)("IGNORING CASE", "RESPECTING CASE");
13
13
  const repl = (0, combi_1.seq)("REPLACEMENT COUNT", expressions_1.Target);
14
14
  const replo = (0, combi_1.seq)("REPLACEMENT OFFSET", expressions_1.Target);
15
15
  const repll = (0, combi_1.seq)("REPLACEMENT LENGTH", expressions_1.Target);
16
16
  const repli = (0, combi_1.seq)("REPLACEMENT LINE", expressions_1.Target);
17
- const occ = (0, combi_1.alt)("ALL OCCURRENCES", "ALL OCCURENCES", "FIRST OCCURENCE", "FIRST OCCURRENCE");
17
+ const occ = (0, combi_1.altPrio)("ALL OCCURRENCES", "ALL OCCURENCES", "FIRST OCCURENCE", "FIRST OCCURRENCE");
18
18
  const mode = (0, combi_1.alt)("IN CHARACTER MODE", "IN BYTE MODE");
19
19
  const wit = (0, combi_1.seq)("WITH", expressions_1.Source);
20
20
  const into = (0, combi_1.seq)("INTO", expressions_1.Target);
@@ -9,7 +9,7 @@ class Search {
9
9
  const starting = (0, combi_1.seq)("STARTING AT", expressions_1.Source);
10
10
  const ending = (0, combi_1.seq)("ENDING AT", expressions_1.Source);
11
11
  const mark = (0, combi_1.str)("AND MARK");
12
- const mode = (0, combi_1.alt)("IN BYTE MODE", "IN CHARACTER MODE");
12
+ const mode = (0, combi_1.altPrio)("IN BYTE MODE", "IN CHARACTER MODE");
13
13
  const ret = (0, combi_1.seq)("SEARCH", expressions_1.Source, "FOR", expressions_1.Source, (0, combi_1.opt)((0, combi_1.per)(mode, starting, ending, mark)));
14
14
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
15
15
  }
@@ -11,7 +11,7 @@ class Sort {
11
11
  const fields = (0, combi_1.plus)((0, combi_1.seq)(sel, (0, combi_1.optPrio)(text), (0, combi_1.optPrio)(order), (0, combi_1.optPrio)(text)));
12
12
  const by = (0, combi_1.seq)("BY", fields);
13
13
  const normal = (0, combi_1.seq)(expressions_1.Target, (0, combi_1.opt)((0, combi_1.per)(order, by, "STABLE", text)));
14
- const target = (0, combi_1.alt)(normal, text);
14
+ const target = (0, combi_1.altPrio)(text, normal);
15
15
  return (0, combi_1.seq)("SORT", target);
16
16
  }
17
17
  }
@@ -5,9 +5,9 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class Translate {
7
7
  getMatcher() {
8
- const cas = (0, combi_1.seq)("TO", (0, combi_1.alt)("UPPER", "LOWER"), "CASE");
8
+ const cas = (0, combi_1.seq)("TO", (0, combi_1.altPrio)("UPPER", "LOWER"), "CASE");
9
9
  const using = (0, combi_1.seq)("USING", expressions_1.Source);
10
- return (0, combi_1.seq)("TRANSLATE", expressions_1.Target, (0, combi_1.alt)(cas, using));
10
+ return (0, combi_1.seq)("TRANSLATE", expressions_1.Target, (0, combi_1.altPrio)(cas, using));
11
11
  }
12
12
  }
13
13
  exports.Translate = Translate;
@@ -84,13 +84,13 @@ class FlowGraph {
84
84
  this.label = label;
85
85
  }
86
86
  toDigraph() {
87
- return `digraph G {
88
- labelloc="t";
89
- label="${this.label}";
90
- graph [fontname = "helvetica"];
91
- node [fontname = "helvetica", shape="box"];
92
- edge [fontname = "helvetica"];
93
- ${this.toTextEdges()}
87
+ return `digraph G {
88
+ labelloc="t";
89
+ label="${this.label}";
90
+ graph [fontname = "helvetica"];
91
+ node [fontname = "helvetica", shape="box"];
92
+ edge [fontname = "helvetica"];
93
+ ${this.toTextEdges()}
94
94
  }`;
95
95
  }
96
96
  listSources(node) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
3
+ exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
4
4
  const issue_1 = require("./issue");
5
5
  Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
6
6
  const config_1 = require("./config");
@@ -94,4 +94,6 @@ const cds_parser_1 = require("./cds/cds_parser");
94
94
  Object.defineProperty(exports, "CDSParser", { enumerable: true, get: function () { return cds_parser_1.CDSParser; } });
95
95
  const rules_runner_1 = require("./rules_runner");
96
96
  Object.defineProperty(exports, "RulesRunner", { enumerable: true, get: function () { return rules_runner_1.RulesRunner; } });
97
+ const _irule_1 = require("./rules/_irule");
98
+ Object.defineProperty(exports, "RuleTag", { enumerable: true, get: function () { return _irule_1.RuleTag; } });
97
99
  //# sourceMappingURL=index.js.map