@abaplint/core 2.119.54 → 2.119.56

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 (46) hide show
  1. package/build/abaplint.d.ts +20 -4
  2. package/build/src/abap/2_statements/combi.js +1 -1
  3. package/build/src/abap/2_statements/expand_macros.js +5 -2
  4. package/build/src/abap/2_statements/expressions/_derived_types.js +29 -29
  5. package/build/src/abap/2_statements/expressions/type_structure.js +4 -4
  6. package/build/src/abap/2_statements/expressions/type_table.js +1 -1
  7. package/build/src/abap/cross_include_macros.js +89 -0
  8. package/build/src/cds/cds_parser.js +6 -0
  9. package/build/src/cds/expressions/cds_aggregate.js +3 -5
  10. package/build/src/cds/expressions/cds_define_abstract.js +1 -1
  11. package/build/src/cds/expressions/cds_define_external_entity.js +20 -0
  12. package/build/src/cds/expressions/cds_define_hierarchy.js +7 -1
  13. package/build/src/cds/expressions/cds_define_projection.js +3 -1
  14. package/build/src/cds/expressions/cds_define_table_entity.js +19 -0
  15. package/build/src/cds/expressions/cds_define_view.js +2 -1
  16. package/build/src/cds/expressions/cds_element.js +4 -7
  17. package/build/src/cds/expressions/cds_extend_view.js +8 -3
  18. package/build/src/cds/expressions/cds_function.js +5 -4
  19. package/build/src/cds/expressions/cds_prefixed_name.js +2 -15
  20. package/build/src/cds/expressions/cds_provider_contract.js +1 -1
  21. package/build/src/cds/expressions/cds_select.js +5 -2
  22. package/build/src/cds/expressions/cds_source.js +6 -5
  23. package/build/src/cds/expressions/cds_string.js +1 -8
  24. package/build/src/cds/expressions/index.js +2 -0
  25. package/build/src/config.js +8 -3
  26. package/build/src/ddl/ddl_parser.js +89 -24
  27. package/build/src/ddl/expressions/ddl_aspect.js +18 -0
  28. package/build/src/ddl/expressions/ddl_clauses.js +27 -0
  29. package/build/src/ddl/expressions/ddl_extend.js +15 -0
  30. package/build/src/ddl/expressions/ddl_extend_type.js +18 -0
  31. package/build/src/ddl/expressions/ddl_include.js +4 -1
  32. package/build/src/ddl/expressions/ddl_literal.js +18 -0
  33. package/build/src/ddl/expressions/ddl_name.js +2 -1
  34. package/build/src/ddl/expressions/ddl_named_include.js +15 -0
  35. package/build/src/ddl/expressions/ddl_qualified_name.js +12 -0
  36. package/build/src/ddl/expressions/ddl_structure.js +6 -3
  37. package/build/src/ddl/expressions/ddl_structure_field.js +2 -1
  38. package/build/src/ddl/expressions/ddl_table.js +5 -1
  39. package/build/src/ddl/expressions/ddl_table_field.js +4 -1
  40. package/build/src/ddl/expressions/ddl_type.js +7 -1
  41. package/build/src/ddl/expressions/ddl_where.js +15 -0
  42. package/build/src/ddl/expressions/index.js +8 -0
  43. package/build/src/index.js +3 -2
  44. package/build/src/objects/data_definition.js +7 -0
  45. package/build/src/registry.js +4 -1
  46. package/package.json +1 -1
@@ -927,6 +927,10 @@ declare class CDSDefineCustom extends Expression {
927
927
  getRunnable(): IStatementRunnable;
928
928
  }
929
929
 
930
+ declare class CDSDefineExternalEntity extends Expression {
931
+ getRunnable(): IStatementRunnable;
932
+ }
933
+
930
934
  declare class CDSDefineHierarchy extends Expression {
931
935
  getRunnable(): IStatementRunnable;
932
936
  }
@@ -935,6 +939,10 @@ declare class CDSDefineProjection extends Expression {
935
939
  getRunnable(): IStatementRunnable;
936
940
  }
937
941
 
942
+ declare class CDSDefineTableEntity extends Expression {
943
+ getRunnable(): IStatementRunnable;
944
+ }
945
+
938
946
  declare class CDSDefineTableFunction extends Expression {
939
947
  getRunnable(): IStatementRunnable;
940
948
  }
@@ -1862,14 +1870,20 @@ declare class DDIC {
1862
1870
  }): AbstractType;
1863
1871
  }
1864
1872
 
1865
- declare enum DDLKind {
1873
+ export declare enum DDLKind {
1866
1874
  Structure = "structure",
1867
- Table = "table"
1875
+ Table = "table",
1876
+ Aspect = "aspect",
1877
+ ExtendType = "extend-type"
1868
1878
  }
1869
1879
 
1870
1880
  export declare class DDLParser {
1871
1881
  parse(file: IFile): IDDLParserResult | undefined;
1872
1882
  private parsedToResult;
1883
+ private compactTokens;
1884
+ private hasKey;
1885
+ private hasNotNull;
1886
+ private kindOf;
1873
1887
  }
1874
1888
 
1875
1889
  declare class DecFloat16Type extends AbstractType {
@@ -2734,8 +2748,10 @@ declare namespace ExpressionsCDS {
2734
2748
  CDSCondition,
2735
2749
  CDSDefineAbstract,
2736
2750
  CDSDefineCustom,
2751
+ CDSDefineExternalEntity,
2737
2752
  CDSDefineHierarchy,
2738
2753
  CDSDefineProjection,
2754
+ CDSDefineTableEntity,
2739
2755
  CDSDefineTableFunction,
2740
2756
  CDSDefineView,
2741
2757
  CDSElement,
@@ -3471,13 +3487,13 @@ declare interface IDDICReferences {
3471
3487
  }[];
3472
3488
  }
3473
3489
 
3474
- declare interface IDDLParserResult {
3490
+ export declare interface IDDLParserResult {
3475
3491
  name: string;
3476
3492
  kind: DDLKind;
3477
3493
  fields: IDDLParserResultField[];
3478
3494
  }
3479
3495
 
3480
- declare interface IDDLParserResultField {
3496
+ export declare interface IDDLParserResultField {
3481
3497
  key: boolean;
3482
3498
  name: string;
3483
3499
  type: string;
@@ -81,7 +81,7 @@ class Regex {
81
81
  return result;
82
82
  }
83
83
  railroad() {
84
- return "Railroad.Terminal(\"" + this.regexp.source.replace(/\\/g, "\\\\") + "\")";
84
+ return "Railroad.Terminal(\"" + this.regexp.source.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\")";
85
85
  }
86
86
  toStr() {
87
87
  return this.regexp.toString();
@@ -89,6 +89,9 @@ class ExpandMacros {
89
89
  this.globalMacros = globalMacros;
90
90
  this.reg = reg;
91
91
  }
92
+ listMacroNames() {
93
+ return this.macros.listMacroNames();
94
+ }
92
95
  find(statements, file, clear = true) {
93
96
  var _a, _b, _c;
94
97
  let nameToken = undefined;
@@ -142,7 +145,7 @@ class ExpandMacros {
142
145
  for (const statement of statements) {
143
146
  const type = statement.get();
144
147
  if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {
145
- const macroName = this.findName(statement.getTokens());
148
+ const macroName = ExpandMacros.findName(statement.getTokens());
146
149
  if (macroName && this.macros.isMacro(macroName)) {
147
150
  const filename = this.macros.getMacroFilename(macroName);
148
151
  if (filename) {
@@ -234,7 +237,7 @@ class ExpandMacros {
234
237
  }
235
238
  return result;
236
239
  }
237
- findName(tokens) {
240
+ static findName(tokens) {
238
241
  let macroName = undefined;
239
242
  let previous = undefined;
240
243
  for (const i of tokens) {
@@ -9,40 +9,40 @@ function commonDerivedTypes() {
9
9
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
10
10
  // more-specific keyword phrases (e.g. "FAILED LATE") must precede less-specific ones ("FAILED")
11
11
  return [
12
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity)),
13
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity)),
14
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity)),
15
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity)),
16
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity)),
17
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity)),
18
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity)),
19
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity)),
20
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity)),
21
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity)),
22
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity)),
23
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity)),
24
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity)),
25
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity)),
26
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity)),
27
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity)),
28
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity)),
29
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity)),
30
- (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity)),
31
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity)),
32
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity)),
33
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity)),
34
- (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity)),
12
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
13
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
14
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
15
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
16
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
17
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
18
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity), { also: combi_1.AlsoIn.OpenABAP }),
19
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity), { also: combi_1.AlsoIn.OpenABAP }),
20
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity), { also: combi_1.AlsoIn.OpenABAP }),
21
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }),
22
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
23
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
24
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
25
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
26
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
27
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
28
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
29
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
30
+ (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
31
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
32
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
33
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
34
+ (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
35
35
  (0, combi_1.seq)("READ IMPORT", entity),
36
36
  (0, combi_1.seq)("READ RESULT", entity),
37
- (0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity)),
37
+ (0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity), { also: combi_1.AlsoIn.OpenABAP }),
38
38
  (0, combi_1.seq)("CREATE", entity),
39
39
  (0, combi_1.seq)("DELETE", entity),
40
40
  (0, combi_1.seq)("UPDATE", entity),
41
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity)),
42
- (0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity)),
43
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity)),
44
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity)),
45
- (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity)),
41
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity), { also: combi_1.AlsoIn.OpenABAP }),
42
+ (0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity), { also: combi_1.AlsoIn.OpenABAP }),
43
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
44
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
45
+ (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity), { also: combi_1.AlsoIn.OpenABAP }),
46
46
  ];
47
47
  }
48
48
  function derivedTypesAlt(...extra) {
@@ -8,10 +8,10 @@ const _derived_types_1 = require("./_derived_types");
8
8
  class TypeStructure extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
11
- const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity)), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity)), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity)), (0, combi_1.seq)("PERMISSIONS REQUEST", _1.NamespaceSimpleName), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS RESULT", entity)), (0, combi_1.seq)("READ LINK", _1.EntityAssociation), (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName), (0, combi_1.seq)("EVENT", _1.EventName));
12
- const structure = (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("STRUCTURE FOR", derivedTypes));
13
- const response = (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)((0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED", _1.NamespaceSimpleName))));
14
- const request = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("REQUEST FOR", (0, combi_1.alt)("CHANGE", "DELETE"), _1.NamespaceSimpleName));
11
+ const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("PERMISSIONS REQUEST", _1.NamespaceSimpleName), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("READ LINK", _1.EntityAssociation), (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName), (0, combi_1.seq)("EVENT", _1.EventName));
12
+ const structure = (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("STRUCTURE FOR", derivedTypes), { also: combi_1.AlsoIn.OpenABAP });
13
+ const response = (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)((0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED", _1.NamespaceSimpleName))), { also: combi_1.AlsoIn.OpenABAP });
14
+ const request = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("REQUEST FOR", (0, combi_1.alt)("CHANGE", "DELETE"), _1.NamespaceSimpleName), { also: combi_1.AlsoIn.OpenABAP });
15
15
  return (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(structure, response, request), (0, combi_1.optPrio)("VALUE IS INITIAL"));
16
16
  }
17
17
  }
@@ -21,7 +21,7 @@ class TypeTable extends combi_1.Expression {
21
21
  const typetable = (0, combi_1.alt)(generic, (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))), (0, combi_1.optPrio)("VALUE IS INITIAL")));
22
22
  const occurs = (0, combi_1.seq)("OCCURS", (0, combi_1.altPrio)(_1.Integer, field_chain_1.FieldChain));
23
23
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
24
- const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION IMPORT", entity)), (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("READ LINK", entity)), (0, combi_1.ver)(version_1.Release.v787, (0, combi_1.seq)("EVENT", entity)));
24
+ const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("READ LINK", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v787, (0, combi_1.seq)("EVENT", entity), { also: combi_1.AlsoIn.OpenABAP }));
25
25
  const derived = (0, combi_1.ver)(version_1.Release.v770, (0, combi_1.seq)("TABLE FOR", derivedTypes, (0, combi_1.optPrio)("VALUE IS INITIAL")), { also: combi_1.AlsoIn.OpenABAP });
26
26
  const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
27
27
  const oldLike = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CrossIncludeMacros = void 0;
4
+ const _abap_object_1 = require("../objects/_abap_object");
5
+ const program_1 = require("../objects/program");
6
+ const _statement_1 = require("./2_statements/statements/_statement");
7
+ const expand_macros_1 = require("./2_statements/expand_macros");
8
+ const include_graph_1 = require("../utils/include_graph");
9
+ // Macros can be defined in one include and used in a sibling include, connected
10
+ // via the main program. Objects are parsed in isolation, so the sibling include
11
+ // initially ends up with Unknown statements. This second pass finds the main
12
+ // program(s) for such includes, collects the macro definitions visible there,
13
+ // and re-parses the include with the macro names as extra global macros.
14
+ class CrossIncludeMacros {
15
+ constructor(reg) {
16
+ this.reg = reg;
17
+ }
18
+ run() {
19
+ const candidates = this.findCandidates();
20
+ if (candidates.length === 0) {
21
+ return;
22
+ }
23
+ const graph = new include_graph_1.IncludeGraph(this.reg);
24
+ const config = this.reg.getConfig();
25
+ const globalMacros = config.getSyntaxSetttings().globalMacros || [];
26
+ for (const prog of candidates) {
27
+ const mains = this.findMains(graph, prog);
28
+ if (mains.size === 0) {
29
+ continue;
30
+ }
31
+ const expand = new expand_macros_1.ExpandMacros(globalMacros, config.getRelease(), this.reg, config.getLanguageVersion());
32
+ for (const main of mains) {
33
+ for (const file of main.getABAPFiles()) {
34
+ // find() follows INCLUDE statements, so this collects macros from the full include chain
35
+ expand.find([...file.getStatements()], file, false);
36
+ }
37
+ }
38
+ const macroNames = expand.listMacroNames();
39
+ if (this.matchesUnknown(prog, new Set(macroNames))) {
40
+ prog.setDirty();
41
+ prog.parse(config.getRelease(), macroNames, this.reg, config.getLanguageVersion());
42
+ }
43
+ }
44
+ }
45
+ //////////////////////////////
46
+ findCandidates() {
47
+ const ret = [];
48
+ for (const obj of this.reg.getObjects()) {
49
+ if (!(obj instanceof program_1.Program) || obj.isInclude() === false) {
50
+ continue;
51
+ }
52
+ for (const file of obj.getABAPFiles()) {
53
+ if (file.getStatements().some(s => s.get() instanceof _statement_1.Unknown)) {
54
+ ret.push(obj);
55
+ break;
56
+ }
57
+ }
58
+ }
59
+ return ret;
60
+ }
61
+ findMains(graph, prog) {
62
+ var _a;
63
+ const ret = new Set();
64
+ const filename = (_a = prog.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename();
65
+ for (const mainFilename of graph.listMainForInclude(filename)) {
66
+ const file = this.reg.getFileByName(mainFilename);
67
+ const obj = file ? this.reg.findObjectForFile(file) : undefined;
68
+ if (obj instanceof _abap_object_1.ABAPObject) {
69
+ ret.add(obj);
70
+ }
71
+ }
72
+ return ret;
73
+ }
74
+ matchesUnknown(prog, macroNames) {
75
+ for (const file of prog.getABAPFiles()) {
76
+ for (const s of file.getStatements()) {
77
+ if (s.get() instanceof _statement_1.Unknown) {
78
+ const name = expand_macros_1.ExpandMacros.findName(s.getTokens());
79
+ if (name !== undefined && macroNames.has(name.toUpperCase())) {
80
+ return true;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ return false;
86
+ }
87
+ }
88
+ exports.CrossIncludeMacros = CrossIncludeMacros;
89
+ //# sourceMappingURL=cross_include_macros.js.map
@@ -70,6 +70,12 @@ class CDSParser {
70
70
  if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
71
71
  res = combi_1.Combi.run(new Expressions.CDSDefineHierarchy(), tokens, version_1.defaultRelease);
72
72
  }
73
+ if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
74
+ res = combi_1.Combi.run(new Expressions.CDSDefineExternalEntity(), tokens, version_1.defaultRelease);
75
+ }
76
+ if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
77
+ res = combi_1.Combi.run(new Expressions.CDSDefineTableEntity(), tokens, version_1.defaultRelease);
78
+ }
73
79
  if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
74
80
  return undefined;
75
81
  }
@@ -5,12 +5,10 @@ const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSAggregate extends combi_1.Expression {
7
7
  getRunnable() {
8
- // CDSPrefixedName handles dotted paths with path filters e.g. a._Assoc[filter].Field
9
- // CDSArithmetics handles expressions like sum(A + B), max(A * 100)
10
- // fieldAsType handles avg(field AS type) / sum(field AS type) — SAP inline type coercion
11
8
  const fieldAsType = (0, combi_1.seq)(_1.CDSPrefixedName, "AS", _1.CDSType);
12
- const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSCase, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*");
13
- 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, ")");
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, "*");
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)), ")");
14
12
  }
15
13
  }
16
14
  exports.CDSAggregate = CDSAggregate;
@@ -8,7 +8,7 @@ class CDSDefineAbstract extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", _1.CDSType, ";");
10
10
  const compsiOrAssoci = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
11
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "ABSTRACT", "ENTITY", cds_name_1.CDSName, (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.alt)(field, compsiOrAssoci)), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
11
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "ABSTRACT", "ENTITY", cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.alt)(field, compsiOrAssoci)), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
12
12
  }
13
13
  }
14
14
  exports.CDSDefineAbstract = CDSDefineAbstract;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSDefineExternalEntity = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSDefineExternalEntity extends combi_1.Expression {
7
+ getRunnable() {
8
+ const extNameValue = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^"[^"]*"$/));
9
+ const externalName = (0, combi_1.seq)("EXTERNAL", "NAME", extNameValue);
10
+ const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
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), ";");
12
+ const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
13
+ const body = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
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
+ 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), "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)(";"));
17
+ }
18
+ }
19
+ exports.CDSDefineExternalEntity = CDSDefineExternalEntity;
20
+ //# sourceMappingURL=cds_define_external_entity.js.map
@@ -10,7 +10,13 @@ class CDSDefineHierarchy extends combi_1.Expression {
10
10
  const siblingsOrderField = (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(sortDirection));
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
- 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)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", _1.CDSInteger)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED"))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", "BREAKUP")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("FORCE", "NONE", "EMPTY", "OFF"))));
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)));
15
+ // DEPTH accepts an integer literal or a parameter reference (:param)
16
+ const depthValue = (0, combi_1.altPrio)(_1.CDSInteger, _1.CDSPrefixedName);
17
+ // LOAD mode: BULK, INCREMENTAL, or a parameter reference ($parameters.p_load)
18
+ const loadMode = (0, combi_1.altPrio)("BULK", "INCREMENTAL", _1.CDSPrefixedName);
19
+ 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)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (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"))));
14
20
  return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "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)(";"));
15
21
  }
16
22
  }
@@ -6,7 +6,9 @@ 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
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "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)(_1.CDSAssociation), (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
+ // 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), "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)(";"));
10
12
  }
11
13
  }
12
14
  exports.CDSDefineProjection = CDSDefineProjection;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSDefineTableEntity = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSDefineTableEntity extends combi_1.Expression {
7
+ getRunnable() {
8
+ const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
9
+ 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, ";");
10
+ const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
11
+ const inlineBody = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
12
+ const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
13
+ const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
14
+ const selectBody = (0, combi_1.seq)("AS", "SELECT", "FROM", _1.CDSSource, (0, combi_1.star)(_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, _1.CDSAssociation)), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere));
15
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "TABLE", "ENTITY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.str)("{"), inlineBody, (0, combi_1.str)("}")), selectBody), (0, combi_1.opt)(";"));
16
+ }
17
+ }
18
+ exports.CDSDefineTableEntity = CDSDefineTableEntity;
19
+ //# sourceMappingURL=cds_define_table_entity.js.map
@@ -10,7 +10,8 @@ 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
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), "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", cds_select_1.CDSSelect, (0, combi_1.opt)(";"));
13
+ 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", cds_select_1.CDSSelect, (0, combi_1.opt)((0, combi_1.seq)("WITH", "HIERARCHY", cds_name_1.CDSName)), // post-select WITH HIERARCHY clause
14
+ (0, combi_1.opt)(";"));
14
15
  }
15
16
  }
16
17
  exports.CDSDefineView = CDSDefineView;
@@ -9,14 +9,11 @@ class CDSElement extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName);
11
11
  const colonThing = (0, combi_1.seq)(":", (0, combi_1.altPrio)(_1.CDSType, _1.CDSName, "LOCALIZED"));
12
- // $extension.* — extension field wildcard
13
12
  const extensionWildcard = (0, combi_1.seq)("$extension", ".", "*");
14
- const body = (0, combi_1.altPrio)(extensionWildcard, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, _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);
15
- // KEY/VIRTUAL keyword handling via altPrio:
16
- // - Try keyword form first: if keyword consumed but body fails (e.g. "virtual.Field"),
17
- // altPrio backtracks to plain body (which handles "virtual" as a datasource alias prefix).
18
- // - This gives exactly 1 state in all cases (no exponential blowup from opt()).
19
- const elementBody = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
13
+ const includeElement = (0, combi_1.seq)("INCLUDE", _1.CDSPrefixedName);
14
+ const typedVirtual = (0, combi_1.seq)("VIRTUAL", _1.CDSName, ":", _1.CDSType);
15
+ const body = (0, combi_1.altPrio)(extensionWildcard, includeElement, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, _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);
16
+ const elementBody = (0, combi_1.altPrio)(typedVirtual, (0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
20
17
  return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), elementBody, (0, combi_1.optPrio)(cds_as_1.CDSAs));
21
18
  }
22
19
  }
@@ -3,12 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CDSExtendView = void 0;
4
4
  const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
- const cds_name_1 = require("./cds_name");
7
6
  class CDSExtendView extends combi_1.Expression {
8
7
  getRunnable() {
9
- const namedot = (0, combi_1.seq)(cds_name_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", cds_name_1.CDSName)), (0, combi_1.optPrio)(_1.CDSAs));
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));
10
9
  const valueNested = (0, combi_1.seq)("{", namedot, (0, combi_1.star)((0, combi_1.seq)(",", namedot)), "}");
11
- return (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")), cds_name_1.CDSName, (0, combi_1.str)("WITH"), (0, combi_1.opt)(cds_name_1.CDSName), valueNested, (0, combi_1.opt)(";"));
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);
11
+ 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), valueNested, (0, combi_1.opt)(";"));
12
+ 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, ";");
13
+ const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
14
+ const entityBody = (0, combi_1.seq)("{", (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp)), "}");
15
+ const extendAbstractOrCustom = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "EXTEND", (0, combi_1.alt)("ABSTRACT", "CUSTOM"), "ENTITY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "WITH", entityBody, (0, combi_1.opt)(";"));
16
+ return (0, combi_1.alt)(extendAbstractOrCustom, extendView);
12
17
  }
13
18
  }
14
19
  exports.CDSExtendView = CDSExtendView;
@@ -58,12 +58,13 @@ 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
- // Generic fallback: user-defined/extension functions like GET_NUMERIC_VALUE(arg).
62
- // Use a regex that excludes CDS keywords that would otherwise be matched by CDSName.
63
- // Must contain at least one underscore to distinguish from keywords (e.g. GET_NUMERIC_VALUE).
64
61
  const extFuncName = (0, combi_1.regex)(/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/i);
65
62
  const genericArgs = (0, combi_1.seq)(_1.CDSFunctionInput, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSFunctionInput)));
66
- const genericFunc = (0, combi_1.seq)(extFuncName, "(", genericArgs, ")");
63
+ const namedArgValue = (0, combi_1.altPrio)((0, combi_1.seq)("INTERVAL", _1.CDSFunctionInput, _1.CDSName), _1.CDSFunctionInput, _1.CDSName);
64
+ const namedArgArrow = (0, combi_1.seq)(_1.CDSName, "=", ">", namedArgValue);
65
+ const namedArgColon = (0, combi_1.seq)(_1.CDSName, ":", namedArgValue);
66
+ 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
+ const genericFunc = (0, combi_1.seq)(extFuncName, "(", (0, combi_1.optPrio)((0, combi_1.altPrio)(namedArgs, genericArgs)), ")");
67
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);
68
69
  }
69
70
  }
@@ -10,31 +10,18 @@ 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() {
13
- // Path filter variants:
14
- // [inner], [left outer], [cross] — join-type redirect
15
- // [1:left outer], [1:inner] — cardinality + join-type
16
- // [1: condition] — cardinality + filter condition
17
- // [condition] — filter condition only
18
13
  const joinType = (0, combi_1.altPrio)("LEFT OUTER", "INNER", "CROSS");
19
14
  const joinRedirect = (0, combi_1.seq)("[", joinType, "]");
20
- // Cardinality spec: integer or * (e.g. [*:inner], [1:inner])
21
15
  const cardSpec = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
22
16
  const cardinalityJoin = (0, combi_1.seq)("[", cardSpec, ":", joinType, "]");
23
- // [1: left outer where condition] — cardinality + join-type + WHERE filter
24
17
  const cardinalityJoinWhere = (0, combi_1.seq)("[", cardSpec, ":", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
25
- // [left outer where condition] — join-type + WHERE filter (no cardinality prefix)
26
18
  const joinWhere = (0, combi_1.seq)("[", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
27
- // Text cardinality forms: [to one: cond], [to many: cond]
28
- const textCard = (0, combi_1.altPrio)("TO ONE", "TO MANY");
29
- const textCardFilter = (0, combi_1.seq)("[", textCard, ":", cds_condition_1.CDSCondition, "]");
30
- // Numeric range cardinality: [0..1: cond], [1..1: cond], [0..*: cond], [n..m: cond]
19
+ const textCard = (0, combi_1.altPrio)("TO EXACT ONE", "TO ONE", "TO MANY");
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))), "]");
31
21
  const cardNum = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
32
22
  const rangeCard = (0, combi_1.seq)(cds_integer_1.CDSInteger, ".", ".", cardNum);
33
23
  const rangeCardFilter = (0, combi_1.seq)("[", rangeCard, ":", cds_condition_1.CDSCondition, "]");
34
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, "]"));
35
- // Each dotted segment may have its own path filter: A[cond].B[cond].C
36
- // The final segment may also be a string literal: #enum.'value'
37
- // A segment may have a parameterized call: _Assoc( P_Key : value ) or _Assoc[filter]
38
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));
39
26
  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));
40
27
  }
@@ -4,7 +4,7 @@ exports.CDSProviderContract = void 0;
4
4
  const combi_1 = require("../../abap/2_statements/combi");
5
5
  class CDSProviderContract extends combi_1.Expression {
6
6
  getRunnable() {
7
- return (0, combi_1.seq)("PROVIDER CONTRACT", (0, combi_1.alt)("TRANSACTIONAL_QUERY", "TRANSACTIONAL_INTERFACE", "ANALYTICAL_QUERY"));
7
+ return (0, combi_1.seq)("PROVIDER CONTRACT", (0, combi_1.alt)("TRANSACTIONAL_QUERY", "TRANSACTIONAL_INTERFACE", "ANALYTICAL_QUERY", "SQL_QUERY", "STRUCTURED_QUERY"));
8
8
  }
9
9
  }
10
10
  exports.CDSProviderContract = CDSProviderContract;
@@ -9,10 +9,13 @@ 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
- // elem (,elem)* [,] — handles separator commas and optional trailing comma
13
12
  const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
14
13
  const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
15
- return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)((0, combi_1.altPrio)("*", fields)), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, cds_association_1.CDSAssociation)), (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.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.optPrio)("ALL"), CDSSelect), (0, combi_1.seq)("EXCEPT", CDSSelect), (0, combi_1.seq)("INTERSECT", CDSSelect))));
14
+ const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", _1.CDSPrefixedName);
15
+ const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")");
16
+ const parenSelect = (0, combi_1.seq)("(", CDSSelect, ")");
17
+ const unionBranch = (0, combi_1.altPrio)(parenSelect, CDSSelect);
18
+ return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)((0, combi_1.altPrio)("*", fields)), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, cds_association_1.CDSAssociation)), (0, combi_1.optPrio)(bindAspect), (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.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.optPrio)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch))));
16
19
  }
17
20
  }
18
21
  exports.CDSSelect = CDSSelect;
@@ -5,13 +5,14 @@ const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSSource extends combi_1.Expression {
7
7
  getRunnable() {
8
- // Static where filter in FROM: SomeTable [Field = 'Value']
9
8
  const staticFilter = (0, combi_1.seq)("[", _1.CDSCondition, "]");
10
- const singleSource = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)(_1.CDSParametersSelect), (0, combi_1.optPrio)(staticFilter), (0, combi_1.opt)((0, combi_1.altPrio)(_1.CDSAs, _1.CDSName)));
11
- // FROM ( src [JOIN src ON cond]* ) — parenthesized join chain, arbitrarily nested
12
- // CDSSource is self-referential here to handle: (((T1 join T2) join T3) join T4)
9
+ // Dotted path: T._Assoc association path as FROM source
10
+ const dottedName = (0, combi_1.seq)(_1.CDSName, ".", _1.CDSName);
11
+ const namedSource = (0, combi_1.altPrio)(dottedName, _1.CDSName);
12
+ const singleSource = (0, combi_1.seq)(namedSource, (0, combi_1.optPrio)(_1.CDSParametersSelect), (0, combi_1.optPrio)(staticFilter), (0, combi_1.opt)((0, combi_1.altPrio)(_1.CDSAs, _1.CDSName)));
13
+ const funcSingleSource = (0, combi_1.seq)(_1.CDSFunction, (0, combi_1.opt)((0, combi_1.altPrio)(_1.CDSAs, _1.CDSName)));
13
14
  const parenSource = (0, combi_1.seq)("(", (0, combi_1.altPrio)(CDSSource, singleSource), (0, combi_1.star)(_1.CDSJoin), ")");
14
- return (0, combi_1.altPrio)(parenSource, singleSource);
15
+ return (0, combi_1.altPrio)(parenSource, funcSingleSource, singleSource);
15
16
  }
16
17
  }
17
18
  exports.CDSSource = CDSSource;