@abaplint/core 2.113.96 → 2.113.98

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.
@@ -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;
@@ -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;
@@ -7,11 +7,12 @@ const cds_integer_1 = require("./cds_integer");
7
7
  class CDSCondition extends combi_1.Expression {
8
8
  getRunnable() {
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
- const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSFunction, name);
10
+ const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSFunction, _1.CDSAggregate, 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, (0, combi_1.optPrio)(_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;
@@ -34,6 +34,13 @@ class CDSFunction extends combi_1.Expression {
34
34
  const abap_system_timezone = (0, combi_1.seq)("ABAP_SYSTEM_TIMEZONE", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
35
35
  const abap_user_timezone = (0, combi_1.seq)("ABAP_USER_TIMEZONE", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
36
36
  const mod = (0, combi_1.seq)("MOD", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
37
+ const replace = (0, combi_1.seq)("REPLACE", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
38
+ const lpad = (0, combi_1.seq)("LPAD", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
39
+ const rpad = (0, combi_1.seq)("RPAD", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
40
+ const instr = (0, combi_1.seq)("INSTR", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
41
+ const length = (0, combi_1.seq)("LENGTH", "(", _1.CDSFunctionInput, ")");
42
+ const ltrim = (0, combi_1.seq)("LTRIM", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
43
+ const rtrim = (0, combi_1.seq)("RTRIM", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
37
44
  const left = (0, combi_1.seq)("LEFT", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
38
45
  const right = (0, combi_1.seq)("RIGHT", "(", _1.CDSFunctionInput, ",", _1.CDSFunctionInput, ")");
39
46
  const conversionInput = (0, combi_1.seq)(_1.CDSName, "=", ">", _1.CDSFunctionInput);
@@ -41,7 +48,7 @@ class CDSFunction extends combi_1.Expression {
41
48
  const unitConversion = (0, combi_1.seq)("UNIT_CONVERSION", "(", conversionInputs, ")");
42
49
  const currencyConversion = (0, combi_1.seq)("CURRENCY_CONVERSION", "(", conversionInputs, ")");
43
50
  const decimalShift = (0, combi_1.seq)("DECIMAL_SHIFT", "(", conversionInputs, ")");
44
- return (0, combi_1.altPrio)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, upper, lower, abs, ceil, floor, round, div, division, concat_with_space, dats_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp, mod, left, right, unitConversion, currencyConversion, decimalShift);
51
+ return (0, combi_1.altPrio)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, upper, lower, abs, ceil, floor, round, div, division, concat_with_space, dats_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp, mod, left, right, lpad, rpad, instr, length, ltrim, rtrim, replace, unitConversion, currencyConversion, decimalShift);
45
52
  }
46
53
  }
47
54
  exports.CDSFunction = CDSFunction;
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.96";
70
+ return "2.113.98";
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;
@@ -37,7 +37,9 @@ class CDSParserError {
37
37
  const hasError = object.hasParserError();
38
38
  const file = object.findSourceFile();
39
39
  if (hasError === true && file) {
40
- issues.push(issue_1.Issue.atRow(file, 1, "CDS Parser error", this.getMetadata().key, this.getConfig().severity));
40
+ const empty = file.getRaw().length === 0 ? ", empty file" : "";
41
+ const message = "CDS Parser error" + empty;
42
+ issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.getConfig().severity));
41
43
  }
42
44
  }
43
45
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.96",
3
+ "version": "2.113.98",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",