@abaplint/core 2.113.95 → 2.113.97

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.
@@ -6,7 +6,8 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  const cds_annotation_array_1 = require("./cds_annotation_array");
7
7
  class CDSAnnotation extends combi_1.Expression {
8
8
  getRunnable() {
9
- return (0, combi_1.seq)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.star)((0, combi_1.seq)(".", (0, combi_1.regex)(/^\w+$/))), (0, combi_1.opt)(":"), (0, combi_1.opt)((0, combi_1.alt)(cds_annotation_array_1.CDSAnnotationArray, _1.CDSAnnotationObject, _1.CDSAnnotationSimple)));
9
+ const nameWithSlash = (0, combi_1.seq)((0, combi_1.regex)(/^\w+$/), (0, combi_1.star)((0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/))));
10
+ return (0, combi_1.seq)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.star)((0, combi_1.seq)(".", nameWithSlash)), (0, combi_1.opt)(":"), (0, combi_1.opt)((0, combi_1.alt)(cds_annotation_array_1.CDSAnnotationArray, _1.CDSAnnotationObject, _1.CDSAnnotationSimple)));
10
11
  }
11
12
  }
12
13
  exports.CDSAnnotation = CDSAnnotation;
@@ -13,7 +13,7 @@ class CDSArithmetics extends combi_1.Expression {
13
13
  const paren = (0, combi_1.seq)("(", val, (0, combi_1.plusPrio)(operatorValue), ")");
14
14
  const noParen = (0, combi_1.seq)(val, (0, combi_1.plusPrio)(operatorValue));
15
15
  // todo: this is pretty bad, it needs a rewrite
16
- return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.plusPrio)(operatorValue)), paren, noParen);
16
+ return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.starPrio)(operatorValue)), noParen);
17
17
  }
18
18
  }
19
19
  exports.CDSArithmetics = CDSArithmetics;
@@ -4,7 +4,7 @@ exports.CDSCardinality = void 0;
4
4
  const combi_1 = require("../../abap/2_statements/combi");
5
5
  class CDSCardinality extends combi_1.Expression {
6
6
  getRunnable() {
7
- const cardinality = (0, combi_1.seq)("[", (0, combi_1.alt)("0", "1"), (0, combi_1.opt)((0, combi_1.seq)(".", ".", (0, combi_1.alt)("0", "1", "*"))), "]");
7
+ const cardinality = (0, combi_1.seq)("[", (0, combi_1.alt)("0", "1", "*"), (0, combi_1.opt)((0, combi_1.seq)(".", ".", (0, combi_1.alt)("0", "1", "*"))), "]");
8
8
  return cardinality;
9
9
  }
10
10
  }
@@ -7,9 +7,10 @@ class CDSCase extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
9
9
  const value = (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, name);
10
- const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value);
11
- const complex = (0, combi_1.seq)((0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.optPrio)((0, combi_1.seq)("ELSE", value)));
12
- return (0, combi_1.seq)("CASE", (0, combi_1.altPrio)(complex, simple), "END");
10
+ const thenValue = (0, combi_1.altPrio)((0, combi_1.seq)("(", value, ")"), value);
11
+ const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", thenValue)));
12
+ const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", thenValue));
13
+ return (0, combi_1.seq)("CASE", (0, combi_1.altPrio)(complex, simple), (0, combi_1.optPrio)((0, combi_1.seq)("ELSE", value)), "END");
13
14
  }
14
15
  }
15
16
  exports.CDSCase = CDSCase;
@@ -9,9 +9,10 @@ class CDSCondition extends combi_1.Expression {
9
9
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", (0, combi_1.altPrio)(_1.CDSString, _1.CDSName))));
10
10
  const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSFunction, name);
11
11
  const operators = (0, combi_1.altPrio)("=", (0, combi_1.seq)("!", "="), (0, combi_1.seq)("<", ">"), (0, combi_1.seq)(">", "="), (0, combi_1.seq)("<", "="), "<", ">", "LIKE", "NOT LIKE");
12
- const compare = (0, combi_1.seq)(left, operators, (0, combi_1.altPrio)(left, cds_integer_1.CDSInteger));
13
- const is = (0, combi_1.seq)(left, "IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("INITIAL", "NULL"));
14
- const condition = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(compare, is));
12
+ const compare = (0, combi_1.seq)(operators, (0, combi_1.altPrio)(left, cds_integer_1.CDSInteger));
13
+ const is = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("INITIAL", "NULL"));
14
+ const between = (0, combi_1.seq)("BETWEEN", left, "AND", left);
15
+ const condition = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), left, (0, combi_1.altPrio)(compare, is, between));
15
16
  const paren = (0, combi_1.seq)("(", CDSCondition, ")");
16
17
  return (0, combi_1.seq)((0, combi_1.altPrio)(condition, paren), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.altPrio)("AND", "OR"), (0, combi_1.altPrio)(condition, paren))));
17
18
  }
@@ -7,7 +7,7 @@ const cds_name_1 = require("./cds_name");
7
7
  class CDSDefineTableFunction extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const methodName = (0, combi_1.seq)(cds_name_1.CDSName, "=", ">", cds_name_1.CDSName);
10
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE TABLE FUNCTION"), cds_name_1.CDSName, _1.CDSWithParameters, (0, combi_1.str)("RETURNS {"), (0, combi_1.plus)((0, combi_1.seq)(cds_name_1.CDSName, ":", _1.CDSType, ";")), (0, combi_1.str)("} IMPLEMENTED BY METHOD"), methodName, (0, combi_1.opt)(";"));
10
+ 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.optPrio)("KEY"), cds_name_1.CDSName, ":", _1.CDSType, ";")), (0, combi_1.str)("} IMPLEMENTED BY METHOD"), methodName, (0, combi_1.opt)(";"));
11
11
  }
12
12
  }
13
13
  exports.CDSDefineTableFunction = CDSDefineTableFunction;
@@ -7,7 +7,7 @@ const cds_as_1 = require("./cds_as");
7
7
  const cds_cast_1 = require("./cds_cast");
8
8
  class CDSElement extends combi_1.Expression {
9
9
  getRunnable() {
10
- return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSArithmetics, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)(_1.CDSName, ": REDIRECTED TO", (0, combi_1.opt)((0, combi_1.alt)("PARENT", "COMPOSITION CHILD")), _1.CDSName), _1.CDSPrefixedName, (0, combi_1.regex)(/^\d+$/)), (0, combi_1.opt)(cds_as_1.CDSAs));
10
+ return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSArithmetics, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSName, ": REDIRECTED TO", (0, combi_1.opt)((0, combi_1.alt)("PARENT", "COMPOSITION CHILD")), _1.CDSName), _1.CDSPrefixedName, (0, combi_1.regex)(/^\d+$/)), (0, combi_1.opt)(cds_as_1.CDSAs));
11
11
  }
12
12
  }
13
13
  exports.CDSElement = CDSElement;
@@ -9,8 +9,9 @@ class CDSSelect extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const fields = (0, combi_1.seq)((0, combi_1.star)((0, combi_1.seq)(_1.CDSElement, ",")), _1.CDSElement);
11
11
  const distinct = (0, combi_1.str)("DISTINCT");
12
- const elements = (0, combi_1.seq)((0, combi_1.str)("{"), _1.CDSElement, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.str)("}"));
13
- return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)(fields), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)(_1.CDSComposition), (0, combi_1.star)(cds_association_1.CDSAssociation), (0, combi_1.star)(_1.CDSComposition), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere), (0, combi_1.optPrio)(_1.CDSGroupBy), (0, combi_1.optPrio)(_1.CDSHaving), (0, combi_1.optPrio)((0, combi_1.seq)("UNION", (0, combi_1.optPrio)("ALL"), CDSSelect)));
12
+ const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSElement)));
13
+ const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
14
+ return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)((0, combi_1.alt)("*", fields)), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)(_1.CDSComposition), (0, combi_1.star)(cds_association_1.CDSAssociation), (0, combi_1.star)(_1.CDSComposition), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere), (0, combi_1.optPrio)(_1.CDSGroupBy), (0, combi_1.optPrio)(_1.CDSHaving), (0, combi_1.optPrio)((0, combi_1.seq)("UNION", (0, combi_1.optPrio)("ALL"), CDSSelect)));
14
15
  }
15
16
  }
16
17
  exports.CDSSelect = CDSSelect;
@@ -5,7 +5,7 @@ const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSWithParameters extends combi_1.Expression {
7
7
  getRunnable() {
8
- const param = (0, combi_1.seq)(_1.CDSName, ":", _1.CDSType);
8
+ const param = (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), _1.CDSName, ":", _1.CDSType);
9
9
  return (0, combi_1.seq)("WITH PARAMETERS", param, (0, combi_1.star)((0, combi_1.seq)(",", param)));
10
10
  }
11
11
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.95";
70
+ return "2.113.97";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -6,6 +6,7 @@ const _irule_1 = require("./_irule");
6
6
  const version_1 = require("../version");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const objects_1 = require("../objects");
9
+ const expressions_1 = require("../cds/expressions");
9
10
  class CDSLegacyViewConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  }
11
12
  exports.CDSLegacyViewConf = CDSLegacyViewConf;
@@ -42,19 +43,17 @@ v755 and up`,
42
43
  && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {
43
44
  return [];
44
45
  }
45
- if (o.getType() !== "DDLS") {
46
+ if (o.getType() !== "DDLS" || !(o instanceof objects_1.DataDefinition)) {
46
47
  return [];
47
48
  }
48
- if (o instanceof objects_1.DataDefinition) {
49
- const tree = o.getTree();
50
- if (tree === undefined) {
51
- return []; // parser error
52
- }
53
- if (tree.findDirectTokenByText("ENTITY") === undefined) {
54
- const file = o.findSourceFile();
55
- if (file) {
56
- issues.push(issue_1.Issue.atRow(file, 1, "CDS Legacy View", this.getMetadata().key, this.getConfig().severity));
57
- }
49
+ const tree = o.getTree();
50
+ if (tree === undefined) {
51
+ return []; // parser error
52
+ }
53
+ if (tree.get() instanceof expressions_1.CDSDefineView && tree.findDirectTokenByText("ENTITY") === undefined) {
54
+ const file = o.findSourceFile();
55
+ if (file) {
56
+ issues.push(issue_1.Issue.atRow(file, 1, "CDS Legacy View", this.getMetadata().key, this.getConfig().severity));
58
57
  }
59
58
  }
60
59
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.95",
3
+ "version": "2.113.97",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -56,7 +56,7 @@
56
56
  "@types/node": "^22.10.7",
57
57
  "chai": "^4.5.0",
58
58
  "eslint": "^9.18.0",
59
- "mocha": "^11.0.1",
59
+ "mocha": "^11.1.0",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "^2.3.0",