@abaplint/core 2.120.2 → 2.120.4

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 (37) hide show
  1. package/build/abaplint.d.ts +11 -0
  2. package/build/src/abap/5_syntax/_procedural.js +22 -1
  3. package/build/src/abap/5_syntax/expressions/source.js +5 -2
  4. package/build/src/abap/5_syntax/statements/call_transformation.js +2 -1
  5. package/build/src/abap/5_syntax/statements/catch.js +28 -19
  6. package/build/src/abap/types/function_module_definition.js +4 -0
  7. package/build/src/abap/types/method_parameters.js +10 -4
  8. package/build/src/cds/expressions/cds_aggregate.js +1 -1
  9. package/build/src/cds/expressions/cds_annotation_simple.js +3 -2
  10. package/build/src/cds/expressions/cds_association.js +2 -2
  11. package/build/src/cds/expressions/cds_case.js +1 -1
  12. package/build/src/cds/expressions/cds_cast.js +1 -1
  13. package/build/src/cds/expressions/cds_composition.js +3 -2
  14. package/build/src/cds/expressions/cds_condition.js +1 -1
  15. package/build/src/cds/expressions/cds_define_custom.js +1 -1
  16. package/build/src/cds/expressions/cds_define_external_entity.js +2 -2
  17. package/build/src/cds/expressions/cds_define_hierarchy.js +2 -2
  18. package/build/src/cds/expressions/cds_define_projection.js +8 -3
  19. package/build/src/cds/expressions/cds_define_view.js +3 -3
  20. package/build/src/cds/expressions/cds_element.js +3 -3
  21. package/build/src/cds/expressions/cds_extend_view.js +12 -2
  22. package/build/src/cds/expressions/cds_function.js +2 -1
  23. package/build/src/cds/expressions/cds_function_input.js +3 -2
  24. package/build/src/cds/expressions/cds_name.js +6 -2
  25. package/build/src/cds/expressions/cds_parameters_select.js +2 -1
  26. package/build/src/cds/expressions/cds_paren_select.js +14 -0
  27. package/build/src/cds/expressions/cds_prefixed_name.js +8 -4
  28. package/build/src/cds/expressions/cds_relation.js +7 -2
  29. package/build/src/cds/expressions/cds_select.js +3 -2
  30. package/build/src/cds/expressions/cds_table_field.js +4 -5
  31. package/build/src/cds/expressions/cds_with_parameters.js +3 -1
  32. package/build/src/cds/expressions/index.js +1 -0
  33. package/build/src/objects/_abap_object.js +2 -2
  34. package/build/src/registry.js +1 -1
  35. package/build/src/rules/clear_exporting_parameters.js +24 -71
  36. package/build/src/rules/slow_parameter_passing.js +2 -1
  37. package/package.json +1 -1
@@ -1024,6 +1024,10 @@ declare class CDSParametersSelect extends Expression {
1024
1024
  getRunnable(): IStatementRunnable;
1025
1025
  }
1026
1026
 
1027
+ declare class CDSParenSelect extends Expression {
1028
+ getRunnable(): IStatementRunnable;
1029
+ }
1030
+
1027
1031
  export declare class CDSParser {
1028
1032
  parse(file: IFile | undefined): ExpressionNode | undefined;
1029
1033
  }
@@ -2767,6 +2771,7 @@ declare namespace ExpressionsCDS {
2767
2771
  CDSDefineProjection,
2768
2772
  CDSDefineTableEntity,
2769
2773
  CDSDefineTableFunction,
2774
+ CDSParenSelect,
2770
2775
  CDSDefineView,
2771
2776
  CDSElement,
2772
2777
  CDSExtendView,
@@ -3535,6 +3540,10 @@ export declare const enum IdentifierMeta {
3535
3540
  MethodExporting = "exporting",
3536
3541
  MethodChanging = "changing",
3537
3542
  MethodReturning = "returning",
3543
+ FunctionModuleImporting = "function_module_importing",
3544
+ FunctionModuleExporting = "function_module_exporting",
3545
+ FunctionModuleChanging = "function_module_changing",
3546
+ FunctionModuleTables = "function_module_tables",
3538
3547
  EventParameter = "event_parameter",
3539
3548
  FormParameter = "form_parameter",
3540
3549
  ReadOnly = "read_only",
@@ -3625,6 +3634,7 @@ declare interface IFunctionModuleParameter {
3625
3634
  type: string | undefined;
3626
3635
  optional: boolean;
3627
3636
  defaultValue: string | undefined;
3637
+ passByValue: boolean;
3628
3638
  }
3629
3639
 
3630
3640
  declare interface IGlobalConfig {
@@ -4882,6 +4892,7 @@ declare class MethodParameters_2 implements IMethodParameters {
4882
4892
  private checkDuplicateNames;
4883
4893
  private workaroundRAP;
4884
4894
  private add;
4895
+ private isPassByValue;
4885
4896
  }
4886
4897
 
4887
4898
  declare class MethodParamName extends Expression {
@@ -46,6 +46,7 @@ const basic_1 = require("../types/basic");
46
46
  const ddic_1 = require("../../ddic");
47
47
  const _object_oriented_1 = require("./_object_oriented");
48
48
  const _reference_1 = require("./_reference");
49
+ const tokens_1 = require("../1_lexer/tokens");
49
50
  class Procedural {
50
51
  constructor(reg, scope) {
51
52
  this.scope = scope;
@@ -225,7 +226,8 @@ class Procedural {
225
226
  continue;
226
227
  }
227
228
  else {
228
- const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);
229
+ const token = new tokens_1.Identifier(nameToken.getStart(), param.name);
230
+ const type = new _typed_identifier_1.TypedIdentifier(token, filename, found, this.functionModuleParameterMeta(param));
229
231
  if (ignoreIfAlreadyExists === true) {
230
232
  const exists = this.scope.findVariable(param.name);
231
233
  if (exists === undefined) {
@@ -239,6 +241,25 @@ class Procedural {
239
241
  }
240
242
  }
241
243
  }
244
+ functionModuleParameterMeta(param) {
245
+ const ret = [];
246
+ if (param.direction === types_1.FunctionModuleParameterDirection.importing) {
247
+ ret.push("function_module_importing" /* IdentifierMeta.FunctionModuleImporting */);
248
+ }
249
+ else if (param.direction === types_1.FunctionModuleParameterDirection.exporting) {
250
+ ret.push("function_module_exporting" /* IdentifierMeta.FunctionModuleExporting */);
251
+ }
252
+ else if (param.direction === types_1.FunctionModuleParameterDirection.changing) {
253
+ ret.push("function_module_changing" /* IdentifierMeta.FunctionModuleChanging */);
254
+ }
255
+ else if (param.direction === types_1.FunctionModuleParameterDirection.tables) {
256
+ ret.push("function_module_tables" /* IdentifierMeta.FunctionModuleTables */);
257
+ }
258
+ if (param.passByValue) {
259
+ ret.push("pass_by_value" /* IdentifierMeta.PassByValue */);
260
+ }
261
+ return ret;
262
+ }
242
263
  }
243
264
  exports.Procedural = Procedural;
244
265
  //# sourceMappingURL=_procedural.js.map
@@ -71,7 +71,7 @@ const assert_error_1 = require("../assert_error");
71
71
  */
72
72
  // TODO: refactor all these method parameters to objects, this is getting messy
73
73
  class Source {
74
- static runSyntax(node, input, targetType, writeReference = false, allowGenericDeference = false) {
74
+ static runSyntax(node, input, targetType, writeReference = false, allowGenericDeference = false, readReference = true) {
75
75
  var _a;
76
76
  if (node === undefined) {
77
77
  return undefined;
@@ -249,7 +249,10 @@ class Source {
249
249
  return undefined;
250
250
  }
251
251
  let context = new unknown_type_1.UnknownType("todo, Source type");
252
- const type = [_reference_1.ReferenceType.DataReadReference];
252
+ const type = [];
253
+ if (readReference) {
254
+ type.push(_reference_1.ReferenceType.DataReadReference);
255
+ }
253
256
  if (writeReference) {
254
257
  type.push(_reference_1.ReferenceType.DataWriteReference);
255
258
  }
@@ -45,7 +45,8 @@ class CallTransformation {
45
45
  const resultParameters = node.findExpressionAfterToken("RESULT");
46
46
  const resultSources = new Set((resultParameters === null || resultParameters === void 0 ? void 0 : resultParameters.findAllExpressions(Expressions.SimpleSource3)) || []);
47
47
  for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
48
- source_1.Source.runSyntax(s, input, undefined, resultSources.has(s));
48
+ const isResult = resultSources.has(s);
49
+ source_1.Source.runSyntax(s, input, undefined, isResult, false, isResult === false);
49
50
  }
50
51
  for (const d of node.findAllExpressions(Expressions.Dynamic)) {
51
52
  dynamic_1.Dynamic.runSyntax(d, input);
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Catch = void 0;
37
37
  const Expressions = __importStar(require("../../2_statements/expressions"));
38
38
  const _typed_identifier_1 = require("../../types/_typed_identifier");
39
- const unknown_type_1 = require("../../types/basic/unknown_type");
40
39
  const basic_1 = require("../../types/basic");
41
40
  const target_1 = require("../expressions/target");
42
41
  const _reference_1 = require("../_reference");
@@ -44,7 +43,7 @@ const _syntax_input_1 = require("../_syntax_input");
44
43
  const _type_utils_1 = require("../_type_utils");
45
44
  class Catch {
46
45
  runSyntax(node, input) {
47
- var _a, _b;
46
+ var _a;
48
47
  const names = new Set();
49
48
  for (const c of node.findDirectExpressions(Expressions.ClassName)) {
50
49
  const token = c.getFirstToken();
@@ -60,7 +59,6 @@ class Catch {
60
59
  else {
61
60
  const message = "CATCH, unknown class " + className;
62
61
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
63
- return;
64
62
  }
65
63
  if (names.has(className)) {
66
64
  const message = "Duplicate class name in CATCH: " + className;
@@ -70,23 +68,18 @@ class Catch {
70
68
  names.add(className);
71
69
  }
72
70
  const target = node.findDirectExpression(Expressions.Target);
73
- const firstClassName = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
74
71
  if (target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData)) {
75
- const token = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
76
- const found = input.scope.existsObject(firstClassName);
77
- if (token && firstClassName && (found === null || found === void 0 ? void 0 : found.id)) {
78
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, new basic_1.ObjectReferenceType(found.id), ["inline" /* IdentifierMeta.InlineDefinition */]);
79
- input.scope.addIdentifier(identifier);
80
- input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
81
- }
82
- else if (token && input.scope.getDDIC().inErrorNamespace(firstClassName) === false) {
83
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, basic_1.VoidType.get(firstClassName), ["inline" /* IdentifierMeta.InlineDefinition */]);
84
- input.scope.addIdentifier(identifier);
85
- input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
86
- }
87
- else if (token) {
88
- const message = "Catch, could not determine type for \"" + token.getStr() + "\"";
89
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, new unknown_type_1.UnknownType(message), ["inline" /* IdentifierMeta.InlineDefinition */]);
72
+ const token = (_a = target.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
73
+ if (token) {
74
+ const classNames = Array.from(names);
75
+ const unknownClass = classNames.find(name => input.scope.findClassDefinition(name) === undefined);
76
+ const commonSuperclass = unknownClass === undefined
77
+ ? this.findCommonSuperclass(classNames, input)
78
+ : undefined;
79
+ const type = commonSuperclass
80
+ ? new basic_1.ObjectReferenceType(commonSuperclass)
81
+ : basic_1.VoidType.get(unknownClass || classNames.join(" "));
82
+ const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
90
83
  input.scope.addIdentifier(identifier);
91
84
  input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
92
85
  }
@@ -110,6 +103,22 @@ class Catch {
110
103
  }
111
104
  }
112
105
  }
106
+ findCommonSuperclass(classNames, input) {
107
+ var _a;
108
+ const lineages = [];
109
+ for (const className of classNames) {
110
+ const lineage = [];
111
+ let current = input.scope.findClassDefinition(className);
112
+ const visited = new Set();
113
+ while (current && visited.has(current.getName().toUpperCase()) === false) {
114
+ lineage.push(current);
115
+ visited.add(current.getName().toUpperCase());
116
+ current = input.scope.findClassDefinition(current.getSuperClass());
117
+ }
118
+ lineages.push(lineage);
119
+ }
120
+ return (_a = lineages[0]) === null || _a === void 0 ? void 0 : _a.find(candidate => lineages.every(lineage => lineage.some(item => item.getName().toUpperCase() === candidate.getName().toUpperCase())));
121
+ }
113
122
  }
114
123
  exports.Catch = Catch;
115
124
  //# sourceMappingURL=catch.js.map
@@ -61,6 +61,7 @@ class FunctionModuleDefinition {
61
61
  type: param.TYP || param.DBFIELD,
62
62
  optional: param.OPTIONAL === "X",
63
63
  defaultValue: param.DEFAULT,
64
+ passByValue: param.REFERENCE !== "X",
64
65
  });
65
66
  }
66
67
  }
@@ -75,6 +76,7 @@ class FunctionModuleDefinition {
75
76
  type: param.TYP || param.DBFIELD,
76
77
  optional: param.OPTIONAL === "X",
77
78
  defaultValue: param.DEFAULT,
79
+ passByValue: param.REFERENCE !== "X",
78
80
  });
79
81
  }
80
82
  }
@@ -89,6 +91,7 @@ class FunctionModuleDefinition {
89
91
  type: param.TYP || param.DBFIELD,
90
92
  optional: true,
91
93
  defaultValue: undefined,
94
+ passByValue: param.REFERENCE !== "X",
92
95
  });
93
96
  }
94
97
  }
@@ -104,6 +107,7 @@ class FunctionModuleDefinition {
104
107
  type: param.DBSTRUCT || param.TYP,
105
108
  optional: param.OPTIONAL === "X",
106
109
  defaultValue: undefined,
110
+ passByValue: false,
107
111
  });
108
112
  }
109
113
  }
@@ -267,14 +267,14 @@ class MethodParameters {
267
267
  }
268
268
  }
269
269
  add(target, source, input, meta, abstractMethod) {
270
- var _a, _b;
270
+ var _a;
271
271
  for (const opt of source.findAllExpressions(Expressions.MethodParamOptional)) {
272
272
  const p = opt.findDirectExpression(Expressions.MethodParam);
273
273
  if (p === undefined) {
274
274
  continue;
275
275
  }
276
276
  const extraMeta = [];
277
- if (p.getFirstToken().getStr().toUpperCase() === "VALUE" && ((_a = p.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr()) === "(") {
277
+ if (this.isPassByValue(p)) {
278
278
  extraMeta.push("pass_by_value" /* IdentifierMeta.PassByValue */);
279
279
  }
280
280
  else if (meta.includes("importing" /* IdentifierMeta.MethodImporting */)) {
@@ -293,7 +293,7 @@ class MethodParameters {
293
293
  else if (opt.findFirstExpression(Expressions.Default)) {
294
294
  const name = target[target.length - 1].getName().toUpperCase();
295
295
  this.optional.push(name);
296
- const val = (_b = opt.findFirstExpression(Expressions.Default)) === null || _b === void 0 ? void 0 : _b.getLastChild();
296
+ const val = (_a = opt.findFirstExpression(Expressions.Default)) === null || _a === void 0 ? void 0 : _a.getLastChild();
297
297
  if (val && val instanceof nodes_1.ExpressionNode) {
298
298
  this.defaults[name] = val;
299
299
  }
@@ -304,9 +304,15 @@ class MethodParameters {
304
304
  }
305
305
  const params = source.findAllExpressions(Expressions.MethodParam);
306
306
  for (const param of params) {
307
- target.push(method_param_1.MethodParam.runSyntax(param, input, meta));
307
+ const extraMeta = this.isPassByValue(param) ? ["pass_by_value" /* IdentifierMeta.PassByValue */] : [];
308
+ target.push(method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]));
308
309
  }
309
310
  }
311
+ isPassByValue(param) {
312
+ var _a;
313
+ return param.getFirstToken().getStr().toUpperCase() === "VALUE"
314
+ && ((_a = param.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr()) === "(";
315
+ }
310
316
  }
311
317
  exports.MethodParameters = MethodParameters;
312
318
  //# sourceMappingURL=method_parameters.js.map
@@ -7,7 +7,7 @@ class CDSAggregate extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const fieldAsType = (0, combi_1.seq)(_1.CDSPrefixedName, "AS", _1.CDSType);
9
9
  const funcAsType = (0, combi_1.seq)(_1.CDSFunction, "AS", _1.CDSType);
10
- const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSCase, funcAsType, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*");
10
+ const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSCast, _1.CDSCase, funcAsType, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*");
11
11
  return (0, combi_1.seq)((0, combi_1.altPrio)("MAX", "MIN", "SUM", "AVG", "COUNT"), "(", (0, combi_1.optPrio)((0, combi_1.altPrio)("DISTINCT", "ALL")), value, (0, combi_1.opt)((0, combi_1.seq)("AS", _1.CDSType)), ")");
12
12
  }
13
13
  }
@@ -8,9 +8,10 @@ class CDSAnnotationSimple extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const ident = (0, combi_1.regex)(/^[\w_]+$/);
10
10
  // #(expr) where expr can be: identifier, dotted path, string, or concatenation with +
11
- const hashArg = (0, combi_1.altPrio)(_1.CDSString, cds_prefixed_name_1.CDSPrefixedName, ident);
11
+ const funcCall = (0, combi_1.seq)(ident, "(", (0, combi_1.altPrio)(_1.CDSString, cds_prefixed_name_1.CDSPrefixedName, ident), ")");
12
+ const hashArg = (0, combi_1.altPrio)(_1.CDSString, funcCall, cds_prefixed_name_1.CDSPrefixedName, ident);
12
13
  const hashExpr = (0, combi_1.seq)(hashArg, (0, combi_1.starPrio)((0, combi_1.seq)("+", hashArg)));
13
- const value = (0, combi_1.altPrio)(_1.CDSString, "true", "false", "null", (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)("#", "(", hashExpr, ")"), (0, combi_1.regex)(/^#[\w_]+$/));
14
+ const value = (0, combi_1.altPrio)(_1.CDSString, "true", "false", "null", (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+[eE]$/), (0, combi_1.altPrio)("+", "-"), (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+[eE]$/), (0, combi_1.altPrio)("+", "-"), (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)("#", "(", hashExpr, ")"), (0, combi_1.regex)(/^#[\w_]+$/));
14
15
  return value;
15
16
  }
16
17
  }
@@ -13,9 +13,9 @@ class CDSAssociation extends combi_1.Expression {
13
13
  const numericCardinality = (0, combi_1.seq)("[", cardNum, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", cardNum)), "]");
14
14
  // Text-based OF form: "association of one to many Target on ..." — text cardinality includes "TO"
15
15
  const ofTextSide = (0, combi_1.altPrio)((0, combi_1.seq)("EXACT", "ONE"), "ONE", "MANY");
16
- const ofTextForm = (0, combi_1.seq)("ASSOCIATION", "OF", ofTextSide, "TO", ofTextSide, _1.CDSRelation, "ON", _1.CDSCondition);
16
+ const ofTextForm = (0, combi_1.seq)("ASSOCIATION", "OF", ofTextSide, "TO", ofTextSide, _1.CDSRelation, "ON", _1.CDSCondition, (0, combi_1.opt)((0, combi_1.seq)("WITH", "DEFAULT", "FILTER", _1.CDSCondition)));
17
17
  // Numeric OF form: "association of [0..1] to Target on ..."
18
- const ofNumericForm = (0, combi_1.seq)("ASSOCIATION", "OF", numericCardinality, "TO", _1.CDSRelation, "ON", _1.CDSCondition);
18
+ const ofNumericForm = (0, combi_1.seq)("ASSOCIATION", "OF", numericCardinality, "TO", _1.CDSRelation, "ON", _1.CDSCondition, (0, combi_1.opt)((0, combi_1.seq)("WITH", "DEFAULT", "FILTER", _1.CDSCondition)));
19
19
  // "association [0..1] to Target as _Alias on condition" — standard form
20
20
  const parentForm = (0, combi_1.seq)("ASSOCIATION", "TO", "PARENT", _1.CDSRelation);
21
21
  const standardForm = (0, combi_1.seq)("ASSOCIATION", (0, combi_1.optPrio)(cds_cardinality_1.CDSCardinality), "TO", (0, combi_1.opt)((0, combi_1.altPrio)(textCardinality, "PARENT")), _1.CDSRelation, "ON", _1.CDSCondition, (0, combi_1.opt)((0, combi_1.seq)("WITH", "DEFAULT", "FILTER", _1.CDSCondition)));
@@ -11,7 +11,7 @@ class CDSCase extends combi_1.Expression {
11
11
  // CDSArithmetics is still tried after for arithmetic like (-1)*Amount or (2*A)-B.
12
12
  const caseParen = (0, combi_1.seq)("(", CDSCase, ")");
13
13
  const value = (0, combi_1.altPrio)(_1.CDSString, CDSCase, caseParen, _1.CDSArithmetics, _1.CDSCast, _1.CDSAggregate, _1.CDSArithParen, _1.CDSFunction, _1.CDSInteger, _1.CDSPrefixedName);
14
- const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSFunction, _1.CDSPrefixedName), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)));
14
+ const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSString, _1.CDSCast, _1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSFunction, _1.CDSPrefixedName), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)));
15
15
  const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value));
16
16
  return (0, combi_1.seq)("CASE", (0, combi_1.altPrio)(complex, simple), (0, combi_1.optPrio)((0, combi_1.seq)("ELSE", value)), "END");
17
17
  }
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSCast extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  // CDSArithmetics before CDSFunction/CDSAggregate: handles function()*n, cast()*n, sum()*n patterns
9
- const first = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSFunction, _1.CDSArithParen, _1.CDSCase, _1.CDSAggregate, CDSCast, _1.CDSString, _1.CDSPrefixedName, _1.CDSInteger);
9
+ const first = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSFunction, _1.CDSArithParen, _1.CDSCase, _1.CDSAggregate, CDSCast, _1.CDSInteger, _1.CDSString, _1.CDSPrefixedName);
10
10
  return (0, combi_1.seq)("CAST", "(", first, "AS", _1.CDSType, (0, combi_1.optPrio)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
11
11
  }
12
12
  }
@@ -7,8 +7,9 @@ const cds_cardinality_1 = require("./cds_cardinality");
7
7
  class CDSComposition extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const num = (0, combi_1.altPrio)("ONE", "MANY");
10
- // Text cardinality after OF: "of exact one to many", "of one to many", or bare "of many" / "of one"
11
- const textCardinality = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.opt)("EXACT"), num, "TO", num), (0, combi_1.seq)((0, combi_1.opt)("EXACT"), num));
10
+ const exactNum = (0, combi_1.seq)((0, combi_1.opt)("EXACT"), num);
11
+ // Text cardinality after OF: "of exact one to exact one", "of exact one to many", "of one to many", or bare "of many" / "of one"
12
+ const textCardinality = (0, combi_1.altPrio)((0, combi_1.seq)(exactNum, "TO", exactNum), (0, combi_1.seq)((0, combi_1.opt)("EXACT"), num));
12
13
  // Numeric cardinality [n..m] before OF: any non-negative integer or *
13
14
  const cardNum = (0, combi_1.altPrio)((0, combi_1.regex)(/^\d+$/), "*");
14
15
  const numericCardinality = (0, combi_1.seq)("[", cardNum, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", cardNum)), "]");
@@ -8,7 +8,7 @@ class CDSCondition extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  // CDSArithmetics before CDSCast/CDSFunction so cast(A)-cast(B) is handled as arithmetic, not two separate casts
10
10
  // CDSCase allows nested case expressions on either side of a comparison
11
- const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSArithmetics, _1.CDSCast, _1.CDSFunction, _1.CDSAggregate, _1.CDSCase, _1.CDSArithParen, _1.CDSPrefixedName);
11
+ const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSArithmetics, _1.CDSCast, _1.CDSFunction, _1.CDSAggregate, _1.CDSCase, _1.CDSArithParen, cds_integer_1.CDSInteger, _1.CDSPrefixedName);
12
12
  const nonLikeOperators = (0, combi_1.altPrio)("=", (0, combi_1.seq)("!", "="), (0, combi_1.seq)("<", ">"), (0, combi_1.seq)(">", "="), (0, combi_1.seq)("<", "="), "<", ">");
13
13
  const likeOperators = (0, combi_1.altPrio)("LIKE", "NOT LIKE");
14
14
  // Right side of comparison: simple values first, then parenthesized, then full arithmetic last.
@@ -9,7 +9,7 @@ class CDSDefineCustom extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const field = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
11
11
  const compsiOrAssoci = (0, combi_1.seq)(cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
12
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
12
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)((0, combi_1.str)("DEFINE")), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
13
13
  }
14
14
  }
15
15
  exports.CDSDefineCustom = CDSDefineCustom;
@@ -5,7 +5,7 @@ const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSDefineExternalEntity extends combi_1.Expression {
7
7
  getRunnable() {
8
- const extNameValue = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^"[^"]*"$/));
8
+ const extNameValue = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^"(?:[^"]|"")*"$/));
9
9
  const externalName = (0, combi_1.seq)("EXTERNAL", "NAME", extNameValue);
10
10
  const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
11
11
  const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, nullability, (0, combi_1.optPrio)(externalName), ";");
@@ -13,7 +13,7 @@ class CDSDefineExternalEntity extends combi_1.Expression {
13
13
  const body = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
14
14
  const externalEntity = (0, combi_1.seq)((0, combi_1.opt)("WRITABLE"), "EXTERNAL", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName), (0, combi_1.opt)(_1.CDSWithParameters));
15
15
  const staticEntity = (0, combi_1.seq)("STATIC", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName));
16
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))))), (0, combi_1.opt)(";"));
16
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))), (0, combi_1.optPrio)((0, combi_1.seq)("ON", "UNLINKED", (0, combi_1.altPrio)("FAIL", "IGNORE"))))), (0, combi_1.opt)(";"));
17
17
  }
18
18
  }
19
19
  exports.CDSDefineExternalEntity = CDSDefineExternalEntity;
@@ -11,10 +11,10 @@ class CDSDefineHierarchy extends combi_1.Expression {
11
11
  const siblingsOrder = (0, combi_1.seq)("SIBLINGS", "ORDER", "BY", siblingsOrderField, (0, combi_1.star)((0, combi_1.seq)(",", siblingsOrderField)));
12
12
  const directory = (0, combi_1.seq)("DIRECTORY", _1.CDSName, "FILTER", "BY", _1.CDSCondition);
13
13
  // DATE PERIOD: period from <field> to <field> [valid from :p to :p]
14
- const datePeriod = (0, combi_1.seq)("PERIOD", "FROM", _1.CDSName, "TO", _1.CDSName, (0, combi_1.opt)((0, combi_1.seq)("VALID", "FROM", _1.CDSPrefixedName, "TO", _1.CDSPrefixedName)));
14
+ const datePeriod = (0, combi_1.seq)("PERIOD", "FROM", _1.CDSName, "TO", _1.CDSName, (0, combi_1.opt)((0, combi_1.seq)("VALID", "FROM", (0, combi_1.altPrio)(_1.CDSString, _1.CDSPrefixedName), "TO", (0, combi_1.altPrio)(_1.CDSString, _1.CDSPrefixedName))));
15
15
  const depthValue = (0, combi_1.altPrio)(_1.CDSString, _1.CDSInteger, _1.CDSPrefixedName);
16
16
  const loadMode = (0, combi_1.altPrio)("BULK", "INCREMENTAL", _1.CDSPrefixedName);
17
- const hierarchyBody = (0, combi_1.seq)("SOURCE", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), "CHILD", "TO", "PARENT", "ASSOCIATION", _1.CDSName, (0, combi_1.opt)(directory), (0, combi_1.opt)(datePeriod), (0, combi_1.opt)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("LOAD", loadMode)), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED", (0, combi_1.seq)("LEAVES", (0, combi_1.optPrio)("ONLY"))))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", (0, combi_1.altPrio)("BREAKUP", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("GENERATE", "SPANTREE")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("ON", "OFF", "FORCE"))));
17
+ const hierarchyBody = (0, combi_1.seq)("SOURCE", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), "CHILD", "TO", "PARENT", "ASSOCIATION", _1.CDSName, (0, combi_1.opt)((0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.opt)(directory), datePeriod, (0, combi_1.opt)(directory)), (0, combi_1.seq)(datePeriod, (0, combi_1.opt)(directory)), directory)), (0, combi_1.opt)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("LOAD", loadMode)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED", (0, combi_1.seq)("LEAVES", (0, combi_1.optPrio)("ONLY"))))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", (0, combi_1.altPrio)("BREAKUP", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("GENERATE", "SPANTREE")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("ON", "OFF", "FORCE"))));
18
18
  return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), "HIERARCHY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "AS", "PARENT", "CHILD", "HIERARCHY", "(", hierarchyBody, ")", "{", (0, combi_1.seq)(field, (0, combi_1.star)((0, combi_1.seq)(",", field))), "}", (0, combi_1.opt)(";"));
19
19
  }
20
20
  }
@@ -6,9 +6,14 @@ const __1 = require("../..");
6
6
  const combi_1 = require("../../abap/2_statements/combi");
7
7
  class CDSDefineProjection extends combi_1.Expression {
8
8
  getRunnable() {
9
- // redefine association _Assoc redirected to [composition child | parent] Entity
10
- const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSName, "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
11
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("TRANSIENT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
9
+ const redefineCard = (0, combi_1.altPrio)("EXACT ONE TO EXACT ONE", "EXACT ONE TO MANY", "EXACT ONE TO ONE", "MANY TO EXACT ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO EXACT ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY", _1.CDSInteger, "*");
10
+ const redefineAssocFilter = (0, combi_1.seq)("[", (0, combi_1.optPrio)((0, combi_1.seq)(redefineCard, ":")), _1.CDSCondition, "]");
11
+ const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSPrefixedName, (0, combi_1.optPrio)(redefineAssocFilter), (0, combi_1.opt)(_1.CDSAs), "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
12
+ const typedLiteralVal = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
13
+ const aspectValue = (0, combi_1.altPrio)(typedLiteralVal, _1.CDSString, _1.CDSPrefixedName);
14
+ const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", aspectValue);
15
+ const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")", (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
16
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("TRANSIENT"), (0, combi_1.opt)("ROOT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.starPrio)(bindAspect), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
12
17
  }
13
18
  }
14
19
  exports.CDSDefineProjection = CDSDefineProjection;
@@ -10,9 +10,9 @@ const cds_with_parameters_1 = require("./cds_with_parameters");
10
10
  class CDSDefineView extends combi_1.Expression {
11
11
  getRunnable() {
12
12
  const columnAlias = (0, combi_1.seq)("(", cds_name_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(",", cds_name_1.CDSName)), ")");
13
- const parenSelect = (0, combi_1.seq)("(", cds_select_1.CDSSelect, ")");
14
- const unionBranch = (0, combi_1.altPrio)(parenSelect, cds_select_1.CDSSelect);
15
- const topLevelSelect = (0, combi_1.altPrio)((0, combi_1.seq)(parenSelect, (0, combi_1.star)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch)))), cds_select_1.CDSSelect);
13
+ const unionBranch = (0, combi_1.altPrio)(_1.CDSParenSelect, cds_select_1.CDSSelect);
14
+ const unionOps = (0, combi_1.star)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch)));
15
+ const topLevelSelect = (0, combi_1.altPrio)((0, combi_1.seq)(_1.CDSParenSelect, unionOps), (0, combi_1.seq)(cds_select_1.CDSSelect, unionOps));
16
16
  return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("WRITABLE"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), cds_name_1.CDSName, (0, combi_1.opt)(columnAlias), (0, combi_1.opt)(cds_with_parameters_1.CDSWithParameters), "AS", topLevelSelect, (0, combi_1.opt)((0, combi_1.seq)("WITH", "HIERARCHY", cds_name_1.CDSName)), (0, combi_1.opt)(";"));
17
17
  }
18
18
  }
@@ -7,16 +7,16 @@ 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
- const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName);
10
+ const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName, (0, combi_1.optPrio)(_1.CDSParametersSelect));
11
11
  const colonThing = (0, combi_1.seq)(":", (0, combi_1.altPrio)(_1.CDSType, _1.CDSName, "LOCALIZED"));
12
12
  const extensionWildcard = (0, combi_1.seq)("$extension", ".", "*");
13
13
  const excludingNames = (0, combi_1.seq)(_1.CDSName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSName)));
14
14
  const excluding = (0, combi_1.seq)("EXCLUDING", "{", excludingNames, "}");
15
- const includeElement = (0, combi_1.seq)("INCLUDE", _1.CDSPrefixedName, (0, combi_1.optPrio)(excluding), (0, combi_1.optPrio)("SIGNATURE ONLY"));
15
+ const includeElement = (0, combi_1.seq)("INCLUDE", (0, combi_1.stopBefore1)("AS", "KEY", "VIRTUAL", "}"), _1.CDSPrefixedName, (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("SIGNATURE ONLY", (0, combi_1.optPrio)(excluding)), (0, combi_1.seq)(excluding, (0, combi_1.optPrio)("SIGNATURE ONLY")))));
16
16
  const typedVirtual = (0, combi_1.seq)("VIRTUAL", _1.CDSName, ":", _1.CDSType);
17
17
  const pathSegment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(_1.CDSString, _1.CDSName, "*"), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.CDSParametersSelect, _1.CDSParameters)));
18
18
  const funcWithPath = (0, combi_1.seq)(_1.CDSFunction, (0, combi_1.plusPrio)(pathSegment));
19
- 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);
19
+ 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, ")"), _1.CDSInteger, (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))));
20
20
  const elementBody = (0, combi_1.altPrio)(typedVirtual, (0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
21
21
  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));
22
22
  }
@@ -7,10 +7,20 @@ class CDSExtendView extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const namedot = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)), (0, combi_1.optPrio)(_1.CDSAs));
9
9
  const valueNested = (0, combi_1.seq)("{", namedot, (0, combi_1.star)((0, combi_1.seq)(",", namedot)), "}");
10
- const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSPrefixedName, (0, combi_1.optPrio)((0, combi_1.seq)("[", _1.CDSCondition, "]")), (0, combi_1.opt)(_1.CDSAs), "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
10
+ const redefineCard = (0, combi_1.altPrio)("EXACT ONE TO EXACT ONE", "EXACT ONE TO MANY", "EXACT ONE TO ONE", "MANY TO EXACT ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO EXACT ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY", _1.CDSInteger, "*");
11
+ const redefineAssocFilter = (0, combi_1.seq)("[", (0, combi_1.optPrio)((0, combi_1.seq)(redefineCard, ":")), _1.CDSCondition, "]");
12
+ const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSPrefixedName, (0, combi_1.optPrio)(redefineAssocFilter), (0, combi_1.opt)(_1.CDSAs), "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
11
13
  const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
12
14
  const elementNested = (0, combi_1.seq)("{", (0, combi_1.altPrio)("*", elementList), "}");
13
- const extendView = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("EXTEND VIEW"), (0, combi_1.opt)((0, combi_1.str)("ENTITY")), _1.CDSName, (0, combi_1.str)("WITH"), (0, combi_1.opt)(_1.CDSName), (0, combi_1.star)(redefineAssoc), (0, combi_1.star)(_1.CDSAssociation), (0, combi_1.altPrio)(elementNested, valueNested), (0, combi_1.opt)(";"));
15
+ const unionElemList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
16
+ const unionBranchBody = (0, combi_1.seq)((0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), "{", (0, combi_1.altPrio)("*", unionElemList), "}", (0, combi_1.optPrio)(_1.CDSGroupBy));
17
+ const parenUnionBody = (0, combi_1.seq)("(", (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), "{", (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), "}", (0, combi_1.star)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), "{", (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), "}")), ")");
18
+ const unionSuffix = (0, combi_1.seq)((0, combi_1.optPrio)(_1.CDSGroupBy), (0, combi_1.star)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), (0, combi_1.altPrio)(parenUnionBody, unionBranchBody))));
19
+ const typedLiteralVal = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
20
+ const aspectValue = (0, combi_1.altPrio)(typedLiteralVal, _1.CDSString, _1.CDSPrefixedName);
21
+ const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", aspectValue);
22
+ const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")", (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
23
+ const extendView = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("EXTEND VIEW"), (0, combi_1.opt)((0, combi_1.str)("ENTITY")), _1.CDSName, (0, combi_1.str)("WITH"), (0, combi_1.opt)(_1.CDSName), (0, combi_1.star)(redefineAssoc), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), (0, combi_1.starPrio)(bindAspect), (0, combi_1.altPrio)(parenUnionBody, elementNested, valueNested), unionSuffix, (0, combi_1.opt)(";"));
14
24
  const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, ";");
15
25
  const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
16
26
  const entityBody = (0, combi_1.seq)("{", (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp)), "}");
@@ -58,6 +58,7 @@ class CDSFunction extends combi_1.Expression {
58
58
  const occurrencesRegexpr = (0, combi_1.seq)("OCCURRENCES_REGEXPR", "(", conversionInputs, ")");
59
59
  const substrRegexpr = (0, combi_1.seq)("SUBSTR_REGEXPR", "(", conversionInputs, ")");
60
60
  const locateRegexpr = (0, combi_1.seq)("LOCATE_REGEXPR", "(", conversionInputs, ")");
61
+ const sqrt = (0, combi_1.seq)("SQRT", "(", _1.CDSFunctionInput, ")");
61
62
  const extFuncName = (0, combi_1.regex)(/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/i);
62
63
  const genericArgs = (0, combi_1.seq)(_1.CDSFunctionInput, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSFunctionInput)));
63
64
  const namedArgValue = (0, combi_1.altPrio)((0, combi_1.seq)("INTERVAL", _1.CDSFunctionInput, _1.CDSName), _1.CDSFunctionInput, _1.CDSName);
@@ -65,7 +66,7 @@ class CDSFunction extends combi_1.Expression {
65
66
  const namedArgColon = (0, combi_1.seq)(_1.CDSName, ":", namedArgValue);
66
67
  const namedArgs = (0, combi_1.seq)((0, combi_1.altPrio)(namedArgArrow, namedArgColon), (0, combi_1.starPrio)((0, combi_1.seq)(",", (0, combi_1.altPrio)(namedArgArrow, namedArgColon))));
67
68
  const genericFunc = (0, combi_1.seq)(extFuncName, "(", (0, combi_1.optPrio)((0, combi_1.altPrio)(namedArgs, genericArgs)), ")");
68
- 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, tims_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, utcl_current, 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, fltp_to_dec, ratioOf, replaceRegexpr, matchesRegexpr, occurrencesRegexpr, substrRegexpr, locateRegexpr, curr_to_decfloat_amount, genericFunc);
69
+ 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, tims_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, utcl_current, 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, fltp_to_dec, ratioOf, replaceRegexpr, matchesRegexpr, occurrencesRegexpr, substrRegexpr, locateRegexpr, curr_to_decfloat_amount, sqrt, genericFunc);
69
70
  }
70
71
  }
71
72
  exports.CDSFunction = CDSFunction;
@@ -5,8 +5,9 @@ const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSFunctionInput extends combi_1.Expression {
7
7
  getRunnable() {
8
- const input = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSCast, _1.CDSFunction, _1.CDSCase, _1.CDSString, _1.CDSPrefixedName, _1.CDSInteger);
9
- return input;
8
+ const positional = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSCast, _1.CDSFunction, _1.CDSCase, _1.CDSString, _1.CDSPrefixedName, _1.CDSInteger);
9
+ const named = (0, combi_1.seq)(_1.CDSName, "=", ">", positional);
10
+ return (0, combi_1.altPrio)(named, positional);
10
11
  }
11
12
  }
12
13
  exports.CDSFunctionInput = CDSFunctionInput;
@@ -2,10 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CDSName = void 0;
4
4
  const combi_1 = require("../../abap/2_statements/combi");
5
+ const KEYWORDS = ["AS", "ON", "WHERE", "WITH", "UNION", "GROUP", "HAVING",
6
+ "AND", "OR", "BETWEEN", "LIKE", "IN", "EXISTS",
7
+ "WHEN", "THEN", "ELSE", "END", "CASE", "CAST"];
5
8
  class CDSName extends combi_1.Expression {
6
9
  getRunnable() {
7
- const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
8
- 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_]+$/)));
10
+ const word = (0, combi_1.regex)(/^\$?#?[\w_]+$/);
11
+ const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w]+$/), "/", (0, combi_1.stopBefore1)(...KEYWORDS), (0, combi_1.regex)(/^[\w_]+$/));
12
+ return (0, combi_1.altPrio)((0, combi_1.regex)(/^"(?:[^"]|"")*"$/), (0, combi_1.seq)((0, combi_1.optPrio)(":"), slashName), (0, combi_1.seq)((0, combi_1.optPrio)(":"), word));
9
13
  }
10
14
  }
11
15
  exports.CDSName = CDSName;
@@ -6,7 +6,8 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSParametersSelect extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
9
- const value = (0, combi_1.alt)(_1.CDSInteger, name, _1.CDSString);
9
+ const typedLiteral = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
10
+ const value = (0, combi_1.altPrio)(typedLiteral, _1.CDSInteger, name, _1.CDSString);
10
11
  const colonPair = (0, combi_1.seq)(name, ":", value, (0, combi_1.optPrio)("DEFAULT"));
11
12
  const arrowPair = (0, combi_1.seq)(name, "=", ">", value);
12
13
  const nameValue = (0, combi_1.altPrio)(colonPair, arrowPair);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSParenSelect = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSParenSelect extends combi_1.Expression {
7
+ getRunnable() {
8
+ const unionBranch = (0, combi_1.altPrio)(CDSParenSelect, _1.CDSSelect);
9
+ const unionOps = (0, combi_1.star)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch)));
10
+ return (0, combi_1.seq)("(", (0, combi_1.altPrio)((0, combi_1.seq)(CDSParenSelect, unionOps), (0, combi_1.seq)(_1.CDSSelect, unionOps)), ")");
11
+ }
12
+ }
13
+ exports.CDSParenSelect = CDSParenSelect;
14
+ //# sourceMappingURL=cds_paren_select.js.map
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CDSPrefixedName = void 0;
4
4
  const combi_1 = require("../../abap/2_statements/combi");
5
5
  const cds_name_1 = require("./cds_name");
6
+ const cds_integer_1 = require("./cds_integer");
6
7
  const cds_parameters_1 = require("./cds_parameters");
7
8
  const cds_parameters_select_1 = require("./cds_parameters_select");
8
9
  const cds_condition_1 = require("./cds_condition");
9
- const cds_integer_1 = require("./cds_integer");
10
10
  const cds_string_1 = require("./cds_string");
11
11
  class CDSPrefixedName extends combi_1.Expression {
12
12
  getRunnable() {
@@ -16,13 +16,17 @@ class CDSPrefixedName extends combi_1.Expression {
16
16
  const cardinalityJoin = (0, combi_1.seq)("[", cardSpec, ":", joinType, "]");
17
17
  const cardinalityJoinWhere = (0, combi_1.seq)("[", cardSpec, ":", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
18
18
  const joinWhere = (0, combi_1.seq)("[", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
19
- const textCard = (0, combi_1.altPrio)("MANY TO EXACT ONE", "MANY TO ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY");
19
+ const textCard = (0, combi_1.altPrio)("EXACT ONE TO EXACT ONE", "EXACT ONE TO MANY", "EXACT ONE TO ONE", "MANY TO EXACT ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO EXACT ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY");
20
20
  const textCardFilter = (0, combi_1.seq)("[", textCard, (0, combi_1.optPrio)((0, combi_1.seq)(":", (0, combi_1.altPrio)((0, combi_1.seq)(joinType, "WHERE", cds_condition_1.CDSCondition), joinType, cds_condition_1.CDSCondition))), "]");
21
21
  const cardNum = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
22
22
  const rangeCard = (0, combi_1.seq)(cds_integer_1.CDSInteger, ".", ".", cardNum);
23
23
  const rangeCardFilter = (0, combi_1.seq)("[", rangeCard, ":", cds_condition_1.CDSCondition, "]");
24
- const pathFilter = (0, combi_1.altPrio)(cardinalityJoinWhere, joinWhere, cardinalityJoin, joinRedirect, textCardFilter, rangeCardFilter, (0, combi_1.seq)("[", cardSpec, ":", cds_condition_1.CDSCondition, "]"), (0, combi_1.seq)("[", cds_condition_1.CDSCondition, "]"));
25
- const segment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(cds_string_1.CDSString, cds_name_1.CDSName, "*"), (0, combi_1.optPrio)((0, combi_1.altPrio)(cds_parameters_select_1.CDSParametersSelect, cds_parameters_1.CDSParameters)), (0, combi_1.optPrio)(pathFilter));
24
+ const rangeOnly = (0, combi_1.seq)("[", rangeCard, "]");
25
+ const numToText = (0, combi_1.seq)(cds_integer_1.CDSInteger, (0, combi_1.altPrio)("TO EXACT ONE", "TO ONE", "TO MANY"));
26
+ const numTextCardFilter = (0, combi_1.seq)("[", numToText, (0, combi_1.optPrio)((0, combi_1.seq)(":", cds_condition_1.CDSCondition)), "]");
27
+ const numToNum = (0, combi_1.seq)("[", cds_integer_1.CDSInteger, "TO", cds_integer_1.CDSInteger, (0, combi_1.optPrio)((0, combi_1.seq)(":", cds_condition_1.CDSCondition)), "]");
28
+ const pathFilter = (0, combi_1.altPrio)(cardinalityJoinWhere, joinWhere, cardinalityJoin, joinRedirect, numToNum, numTextCardFilter, textCardFilter, rangeCardFilter, rangeOnly, (0, combi_1.seq)("[", cardSpec, ":", cds_condition_1.CDSCondition, "]"), (0, combi_1.seq)("[", cardSpec, "]"), (0, combi_1.seq)("[", cds_condition_1.CDSCondition, "]"));
29
+ const segment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(cds_string_1.CDSString, cds_integer_1.CDSInteger, cds_name_1.CDSName, "*"), (0, combi_1.optPrio)((0, combi_1.altPrio)(cds_parameters_select_1.CDSParametersSelect, cds_parameters_1.CDSParameters)), (0, combi_1.optPrio)(pathFilter));
26
30
  return (0, combi_1.seq)(cds_name_1.CDSName, (0, combi_1.optPrio)((0, combi_1.altPrio)(cds_parameters_1.CDSParameters, cds_parameters_select_1.CDSParametersSelect)), (0, combi_1.optPrio)(pathFilter), (0, combi_1.star)(segment));
27
31
  }
28
32
  }
@@ -3,10 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CDSRelation = void 0;
4
4
  const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
+ const KEYWORDS = ["AS", "ON", "WHERE", "WITH", "UNION", "GROUP", "HAVING",
7
+ "AND", "OR", "BETWEEN", "LIKE", "IN", "EXISTS",
8
+ "WHEN", "THEN", "ELSE", "END", "CASE", "CAST"];
6
9
  class CDSRelation extends combi_1.Expression {
7
10
  getRunnable() {
8
- const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
9
- return (0, combi_1.seq)((0, combi_1.opt)(pre), (0, combi_1.regex)(/^[\w_]+$/), (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs));
11
+ const word = (0, combi_1.regex)(/^[\w_]+$/);
12
+ const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w]+$/), "/", (0, combi_1.stopBefore1)(...KEYWORDS), (0, combi_1.regex)(/^[\w_]+$/));
13
+ const name = (0, combi_1.altPrio)(slashName, word);
14
+ return (0, combi_1.seq)(name, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs));
10
15
  }
11
16
  }
12
17
  exports.CDSRelation = CDSRelation;
@@ -7,11 +7,12 @@ const cds_association_1 = require("./cds_association");
7
7
  const cds_join_1 = require("./cds_join");
8
8
  class CDSSelect extends combi_1.Expression {
9
9
  getRunnable() {
10
- const fields = (0, combi_1.seq)((0, combi_1.star)((0, combi_1.seq)(_1.CDSElement, ",")), _1.CDSElement);
10
+ const fields = (0, combi_1.seq)((0, combi_1.stopBefore1)("FROM"), (0, combi_1.star)((0, combi_1.seq)(_1.CDSElement, ",")), _1.CDSElement);
11
11
  const distinct = (0, combi_1.str)("DISTINCT");
12
12
  const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
13
13
  const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
14
- const aspectValue = (0, combi_1.altPrio)(_1.CDSString, _1.CDSPrefixedName);
14
+ const typedLiteralVal = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
15
+ const aspectValue = (0, combi_1.altPrio)(typedLiteralVal, _1.CDSString, _1.CDSPrefixedName);
15
16
  const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", aspectValue);
16
17
  const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")", (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
17
18
  const parenSelect = (0, combi_1.seq)("(", CDSSelect, ")");
@@ -3,16 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CDSTableField = void 0;
4
4
  const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
- // A single field or association/composition inside a `define table entity { ... }`
7
- // inline body. Wraps annotations + name + type together so tooling can iterate
8
- // per-field with associated field-level annotations (matches the CDSElement
9
- // shape used for select-list elements).
10
6
  class CDSTableField extends combi_1.Expression {
11
7
  getRunnable() {
12
8
  const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
9
+ const excludingNames = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSName)));
10
+ const excluding = (0, combi_1.seq)("EXCLUDING", "{", excludingNames, "}");
11
+ const includeField = (0, combi_1.seq)("INCLUDE", _1.CDSPrefixedName, (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.str)("SIGNATURE ONLY"), (0, combi_1.optPrio)(excluding)), (0, combi_1.seq)(excluding, (0, combi_1.optPrio)((0, combi_1.str)("SIGNATURE ONLY"))))));
13
12
  const field = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, nullability);
14
13
  const assocOrComp = (0, combi_1.seq)(_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation));
15
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, assocOrComp), ";");
14
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.altPrio)(includeField, assocOrComp, field), ";");
16
15
  }
17
16
  }
18
17
  exports.CDSTableField = CDSTableField;
@@ -5,7 +5,9 @@ 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)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", _1.CDSType, (0, combi_1.star)(_1.CDSAnnotation));
8
+ const extNameValue = (0, combi_1.altPrio)(_1.CDSName, (0, combi_1.regex)(/^"(?:[^"]|"")*"$/));
9
+ const externalName = (0, combi_1.seq)("EXTERNAL", "NAME", extNameValue);
10
+ const param = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", _1.CDSType, (0, combi_1.opt)(externalName), (0, combi_1.star)(_1.CDSAnnotation));
9
11
  return (0, combi_1.seq)("WITH PARAMETERS", param, (0, combi_1.star)((0, combi_1.seq)(",", param)));
10
12
  }
11
13
  }
@@ -36,6 +36,7 @@ __exportStar(require("./cds_define_hierarchy"), exports);
36
36
  __exportStar(require("./cds_define_projection"), exports);
37
37
  __exportStar(require("./cds_define_table_entity"), exports);
38
38
  __exportStar(require("./cds_define_table_function"), exports);
39
+ __exportStar(require("./cds_paren_select"), exports);
39
40
  __exportStar(require("./cds_define_view"), exports);
40
41
  __exportStar(require("./cds_element"), exports);
41
42
  __exportStar(require("./cds_extend_view"), exports);
@@ -56,10 +56,10 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
56
56
  return undefined;
57
57
  }
58
58
  getMainABAPFile() {
59
- // todo, uris, https://github.com/abaplint/abaplint/issues/673
60
59
  const search = this.getName().replace(/\//g, "#").toLowerCase() + "." + this.getType().toLowerCase() + ".abap";
60
+ const encodedSearch = search.replace(/#/g, "%23");
61
61
  for (const file of this.getABAPFiles()) {
62
- if (file.getFilename().endsWith(search)) {
62
+ if (file.getFilename().endsWith(search) || file.getFilename().endsWith(encodedSearch)) {
63
63
  return file;
64
64
  }
65
65
  }
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.2";
78
+ return "2.120.4";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.ClearExportingParameters = exports.ClearExportingParametersConf = void 0;
37
4
  const issue_1 = require("../issue");
@@ -40,12 +7,11 @@ const _irule_1 = require("./_irule");
40
7
  const syntax_1 = require("../abap/5_syntax/syntax");
41
8
  const _abap_object_1 = require("../objects/_abap_object");
42
9
  const _scope_type_1 = require("../abap/5_syntax/_scope_type");
10
+ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
43
11
  const objects_1 = require("../objects");
44
12
  const _reference_1 = require("../abap/5_syntax/_reference");
45
13
  const basic_1 = require("../abap/types/basic");
46
14
  const _statement_1 = require("../abap/2_statements/statements/_statement");
47
- const edit_helper_1 = require("../edit_helper");
48
- const Expressions = __importStar(require("../abap/2_statements/expressions"));
49
15
  class ClearExportingParametersConf extends _basic_rule_config_1.BasicRuleConfig {
50
16
  constructor() {
51
17
  super(...arguments);
@@ -78,7 +44,7 @@ Reading and writing the parameter in the same statement (e.g. "ev_result = ev_re
78
44
  as the source is evaluated before the parameter is assigned.
79
45
  Objects containing parser or syntax errors are not reported.
80
46
 
81
- Only class and interface method implementations are checked, function module parameters are currently not supported.`,
47
+ Class and interface method implementations and function modules are checked.`,
82
48
  tags: [_irule_1.RuleTag.Styleguide],
83
49
  badExample: `CLASS lcl DEFINITION.
84
50
  PUBLIC SECTION.
@@ -134,19 +100,20 @@ ENDCLASS.`,
134
100
  return issues;
135
101
  }
136
102
  traverse(node, obj, issues) {
137
- if (node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {
138
- this.checkMethod(node, obj, issues);
103
+ if (node.getIdentifier().stype === _scope_type_1.ScopeType.Method
104
+ || node.getIdentifier().stype === _scope_type_1.ScopeType.FunctionModule) {
105
+ this.checkProcedure(node, obj, issues);
139
106
  }
140
107
  for (const child of node.getChildren()) {
141
108
  this.traverse(child, obj, issues);
142
109
  }
143
110
  }
144
- checkMethod(node, obj, issues) {
145
- const parameters = this.findExportingByReference(node, obj);
111
+ checkProcedure(node, obj, issues) {
112
+ const references = this.collectReferences(node);
113
+ const parameters = this.findExportingByReference(node, references);
146
114
  if (parameters.length === 0) {
147
115
  return;
148
116
  }
149
- const references = this.collectReferences(node);
150
117
  for (const parameter of parameters) {
151
118
  const issue = this.checkParameter(parameter, references, obj);
152
119
  if (issue !== undefined) {
@@ -154,52 +121,36 @@ ENDCLASS.`,
154
121
  }
155
122
  }
156
123
  }
157
- findExportingByReference(node, obj) {
124
+ findExportingByReference(node, references) {
158
125
  var _a;
159
126
  const ret = [];
160
- const vars = node.getData().vars;
161
- for (const name in vars) {
162
- const parameter = vars[name];
127
+ const candidates = new Set(Object.values(node.getData().vars));
128
+ for (const reference of references) {
129
+ if (reference.resolved instanceof _typed_identifier_1.TypedIdentifier) {
130
+ candidates.add(reference.resolved);
131
+ }
132
+ }
133
+ for (const parameter of candidates) {
163
134
  const meta = parameter.getMeta();
164
- if (meta.includes("exporting" /* IdentifierMeta.MethodExporting */) === false
135
+ const exporting = meta.includes("exporting" /* IdentifierMeta.MethodExporting */)
136
+ || meta.includes("function_module_exporting" /* IdentifierMeta.FunctionModuleExporting */);
137
+ if (exporting === false
165
138
  || meta.includes("pass_by_value" /* IdentifierMeta.PassByValue */) === true) {
166
139
  continue;
167
140
  }
168
- else if ((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.some(s => s.toUpperCase() === name.toUpperCase())) {
141
+ else if ((_a = this.conf.skipNames) === null || _a === void 0 ? void 0 : _a.some(s => s.toUpperCase() === parameter.getName().toUpperCase())) {
169
142
  continue;
170
143
  }
171
144
  const type = parameter.getType();
172
145
  if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
173
146
  continue; // e.g. RAP magic parameters, or unresolved types
174
147
  }
175
- else if (this.isPassByValue(parameter, obj) === true) {
176
- continue; // VALUE(..) parameters are always initialized
177
- }
178
148
  ret.push(parameter);
179
149
  }
180
150
  return ret;
181
151
  }
182
- isPassByValue(parameter, obj) {
183
- var _a;
184
- // the PassByValue meta is not set for EXPORTING parameters, so determine it from the definition
185
- const file = obj.getABAPFileByName(parameter.getFilename());
186
- if (file === undefined) {
187
- return false;
188
- }
189
- const statement = edit_helper_1.EditHelper.findStatement(parameter.getToken(), file);
190
- if (statement === undefined) {
191
- return false;
192
- }
193
- for (const param of statement.findAllExpressions(Expressions.MethodParam)) {
194
- const nameToken = (_a = param.findFirstExpression(Expressions.MethodParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
195
- if (nameToken !== undefined && nameToken.getStart().equals(parameter.getStart())) {
196
- return param.getFirstToken().getStr().toUpperCase() === "VALUE";
197
- }
198
- }
199
- return false;
200
- }
201
152
  collectReferences(node) {
202
- // methods do not nest, so all descendant scopes (FOR, LET, ...) belong to this method
153
+ // procedures do not nest, so all descendant scopes (FOR, LET, ...) belong to this procedure
203
154
  const ret = [...node.getData().references];
204
155
  for (const child of node.getChildren()) {
205
156
  ret.push(...this.collectReferences(child));
@@ -210,7 +161,9 @@ ENDCLASS.`,
210
161
  let firstRead = undefined;
211
162
  let earliestWrite = undefined;
212
163
  for (const reference of references) {
213
- if (reference.resolved === undefined || parameter.equals(reference.resolved) === false) {
164
+ if (reference.resolved === undefined
165
+ || parameter.equals(reference.resolved) === false
166
+ || parameter.getName().toUpperCase() !== reference.resolved.getName().toUpperCase()) {
214
167
  continue;
215
168
  }
216
169
  const pos = reference.position.getStart();
@@ -69,7 +69,8 @@ ENDCLASS.`,
69
69
  }
70
70
  for (const v in vars) {
71
71
  const id = vars[v];
72
- if (id.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */) === false) {
72
+ if (id.getMeta().includes("importing" /* IdentifierMeta.MethodImporting */) === false
73
+ || id.getMeta().includes("pass_by_value" /* IdentifierMeta.PassByValue */) === false) {
73
74
  continue;
74
75
  }
75
76
  else if (this.reg.isFileDependency(id.getFilename()) === true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.120.2",
3
+ "version": "2.120.4",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",