@abaplint/core 2.119.36 → 2.119.38

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 (41) hide show
  1. package/build/abaplint.d.ts +66 -5
  2. package/build/src/abap/1_lexer/lexer.js +10 -0
  3. package/build/src/abap/1_lexer/tokens/association_name.js +8 -0
  4. package/build/src/abap/1_lexer/tokens/index.js +1 -0
  5. package/build/src/abap/2_statements/_select_reclassify.js +7 -1
  6. package/build/src/abap/2_statements/expressions/eml_entity_path.js +12 -0
  7. package/build/src/abap/2_statements/expressions/entity_association.js +2 -1
  8. package/build/src/abap/2_statements/expressions/index.js +13 -2
  9. package/build/src/abap/2_statements/expressions/sql_association_entry.js +18 -0
  10. package/build/src/abap/2_statements/expressions/sql_associations_list.js +14 -0
  11. package/build/src/abap/2_statements/expressions/sql_case.js +1 -1
  12. package/build/src/abap/2_statements/expressions/sql_cds_parameters.js +1 -1
  13. package/build/src/abap/2_statements/expressions/sql_compare.js +3 -1
  14. package/build/src/abap/2_statements/expressions/sql_cte_associations.js +14 -0
  15. package/build/src/abap/2_statements/expressions/sql_cte_hierarchy.js +14 -0
  16. package/build/src/abap/2_statements/expressions/sql_field.js +2 -3
  17. package/build/src/abap/2_statements/expressions/sql_field_list_loop.js +2 -2
  18. package/build/src/abap/2_statements/expressions/sql_field_list_loop_greedy.js +2 -2
  19. package/build/src/abap/2_statements/expressions/sql_from_source.js +5 -1
  20. package/build/src/abap/2_statements/expressions/sql_hierarchy_accessor.js +19 -0
  21. package/build/src/abap/2_statements/expressions/sql_hierarchy_aggregate.js +22 -0
  22. package/build/src/abap/2_statements/expressions/sql_hierarchy_source.js +35 -0
  23. package/build/src/abap/2_statements/expressions/sql_path_cardinality.js +14 -0
  24. package/build/src/abap/2_statements/expressions/sql_path_for_column.js +18 -0
  25. package/build/src/abap/2_statements/expressions/sql_path_for_entity.js +14 -0
  26. package/build/src/abap/2_statements/expressions/sql_path_join_type.js +11 -0
  27. package/build/src/abap/2_statements/expressions/sql_path_segment.js +26 -0
  28. package/build/src/abap/2_statements/statements/commit_entities.js +1 -1
  29. package/build/src/abap/2_statements/statements/create_data.js +1 -1
  30. package/build/src/abap/2_statements/statements/end_test_seam.js +1 -1
  31. package/build/src/abap/2_statements/statements/get_permissions.js +1 -1
  32. package/build/src/abap/2_statements/statements/modify_entities.js +4 -4
  33. package/build/src/abap/2_statements/statements/read_entities.js +3 -3
  34. package/build/src/abap/2_statements/statements/test_seam.js +1 -1
  35. package/build/src/abap/2_statements/statements/with.js +2 -1
  36. package/build/src/abap/5_syntax/basic_types.js +44 -12
  37. package/build/src/abap/5_syntax/statements/move_corresponding.js +3 -1
  38. package/build/src/abap/5_syntax/syntax.js +4 -0
  39. package/build/src/registry.js +1 -1
  40. package/build/src/rules/dangerous_statement.js +13 -1
  41. package/package.json +1 -1
@@ -298,8 +298,7 @@ declare class AssignSource extends Expression {
298
298
  getRunnable(): IStatementRunnable;
299
299
  }
300
300
 
301
- declare class AssociationName extends Expression {
302
- getRunnable(): IStatementRunnable;
301
+ declare class AssociationName extends Token {
303
302
  }
304
303
 
305
304
  declare class At implements IStructure {
@@ -2118,6 +2117,10 @@ declare class EmailTemplate extends AbstractObject {
2118
2117
  getDescription(): string | undefined;
2119
2118
  }
2120
2119
 
2120
+ declare class EMLEntityPath extends Expression {
2121
+ getRunnable(): IStatementRunnable;
2122
+ }
2123
+
2121
2124
  export declare class Empty implements IStatement {
2122
2125
  getMatcher(): IStatementRunnable;
2123
2126
  }
@@ -2409,7 +2412,7 @@ declare namespace Expressions {
2409
2412
  ArrowOrDash,
2410
2413
  Arrow,
2411
2414
  AssignSource,
2412
- AssociationName,
2415
+ EMLEntityPath,
2413
2416
  AttributeChain,
2414
2417
  AttributeName,
2415
2418
  BehaviorDefinitionName,
@@ -2547,6 +2550,11 @@ declare namespace Expressions {
2547
2550
  ReduceNext,
2548
2551
  ReportName,
2549
2552
  SelectCTE,
2553
+ SQLCTEAssociations,
2554
+ SQLCTEHierarchy,
2555
+ SQLHierarchySource,
2556
+ SQLHierarchyAccessor,
2557
+ SQLHierarchyAggregate,
2550
2558
  Select_3 as Select,
2551
2559
  SimpleFieldChain,
2552
2560
  SimpleFieldChain2,
@@ -2561,6 +2569,9 @@ declare namespace Expressions {
2561
2569
  SourceField,
2562
2570
  Source,
2563
2571
  SQLAggregation,
2572
+ SQLAssociationEntry,
2573
+ SQLAssociationsList,
2574
+ SQLPathSegment,
2564
2575
  SQLAliasField,
2565
2576
  SQLArithmeticOperator,
2566
2577
  SQLArithmetics,
@@ -2598,7 +2609,10 @@ declare namespace Expressions {
2598
2609
  SQLPackageSize,
2599
2610
  SQLOrderBy,
2600
2611
  SQLOver,
2601
- SQLPath,
2612
+ SQLPathCardinality,
2613
+ SQLPathForColumn,
2614
+ SQLPathForEntity,
2615
+ SQLPathJoinType,
2602
2616
  SQLPrivilegedAccess,
2603
2617
  SQLSetOp,
2604
2618
  SQLSetOpGroup,
@@ -6374,6 +6388,14 @@ declare class SQLAsName extends Expression {
6374
6388
  getRunnable(): IStatementRunnable;
6375
6389
  }
6376
6390
 
6391
+ declare class SQLAssociationEntry extends Expression {
6392
+ getRunnable(): IStatementRunnable;
6393
+ }
6394
+
6395
+ declare class SQLAssociationsList extends Expression {
6396
+ getRunnable(): IStatementRunnable;
6397
+ }
6398
+
6377
6399
  declare class SQLBypassingBuffer extends Expression {
6378
6400
  getRunnable(): IStatementRunnable;
6379
6401
  }
@@ -6402,6 +6424,14 @@ declare class SQLCond extends Expression {
6402
6424
  getRunnable(): IStatementRunnable;
6403
6425
  }
6404
6426
 
6427
+ declare class SQLCTEAssociations extends Expression {
6428
+ getRunnable(): IStatementRunnable;
6429
+ }
6430
+
6431
+ declare class SQLCTEHierarchy extends Expression {
6432
+ getRunnable(): IStatementRunnable;
6433
+ }
6434
+
6405
6435
  declare class SQLField extends Expression {
6406
6436
  getRunnable(): IStatementRunnable;
6407
6437
  }
@@ -6462,6 +6492,18 @@ declare class SQLHaving extends Expression {
6462
6492
  getRunnable(): IStatementRunnable;
6463
6493
  }
6464
6494
 
6495
+ declare class SQLHierarchyAccessor extends Expression {
6496
+ getRunnable(): IStatementRunnable;
6497
+ }
6498
+
6499
+ declare class SQLHierarchyAggregate extends Expression {
6500
+ getRunnable(): IStatementRunnable;
6501
+ }
6502
+
6503
+ declare class SQLHierarchySource extends Expression {
6504
+ getRunnable(): IStatementRunnable;
6505
+ }
6506
+
6465
6507
  declare class SQLHints extends Expression {
6466
6508
  getRunnable(): IStatementRunnable;
6467
6509
  }
@@ -6506,7 +6548,25 @@ declare class SQLPackageSize extends Expression {
6506
6548
  getRunnable(): IStatementRunnable;
6507
6549
  }
6508
6550
 
6509
- declare class SQLPath extends Expression {
6551
+ declare class SQLPathCardinality extends Expression {
6552
+ getRunnable(): IStatementRunnable;
6553
+ }
6554
+
6555
+ declare class SQLPathForColumn extends Expression {
6556
+ getRunnable(): IStatementRunnable;
6557
+ }
6558
+
6559
+ declare class SQLPathForEntity extends Expression {
6560
+ getRunnable(): IStatementRunnable;
6561
+ }
6562
+
6563
+ declare class SQLPathJoinType extends Expression {
6564
+ getRunnable(): IStatementRunnable;
6565
+ }
6566
+
6567
+ declare class SQLPathSegment extends Expression {
6568
+ private readonly nws;
6569
+ constructor(nws?: boolean);
6510
6570
  getRunnable(): IStatementRunnable;
6511
6571
  }
6512
6572
 
@@ -7402,6 +7462,7 @@ declare namespace Tokens {
7402
7462
  Colon,
7403
7463
  Comment_2 as Comment,
7404
7464
  Identifier_2 as Identifier,
7465
+ AssociationName,
7405
7466
  Pragma,
7406
7467
  Punctuation
7407
7468
  }
@@ -203,6 +203,15 @@ class Lexer {
203
203
  }
204
204
  }
205
205
  }
206
+ if (tok === undefined && this.m === ModeNormal && s.charAt(0) === "\\") {
207
+ const adj = this.stream.nextChar() === "" ? 1 : 0;
208
+ const prevOffset = this.stream.getOffset() - s.length - adj;
209
+ const prevChar = prevOffset >= 0 ? this.stream.getRaw().substr(prevOffset, 1) : "";
210
+ const whiteBeforeBackslash = prevChar === " " || prevChar === "\n" || prevChar === "\t" || prevChar === ":";
211
+ if (!whiteBeforeBackslash) {
212
+ tok = new tokens_1.AssociationName(pos, s);
213
+ }
214
+ }
206
215
  if (tok === undefined) {
207
216
  tok = new tokens_1.Identifier(pos, s);
208
217
  }
@@ -224,6 +233,7 @@ class Lexer {
224
233
  splits[")"] = true;
225
234
  splits["["] = true;
226
235
  splits["]"] = true;
236
+ splits["\\"] = true;
227
237
  splits["\t"] = true;
228
238
  splits["\n"] = true;
229
239
  const bufs = {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssociationName = void 0;
4
+ const abstract_token_1 = require("./abstract_token");
5
+ class AssociationName extends abstract_token_1.AbstractToken {
6
+ }
7
+ exports.AssociationName = AssociationName;
8
+ //# sourceMappingURL=association_name.js.map
@@ -58,6 +58,7 @@ __exportStar(require("./string_template_middle"), exports);
58
58
  __exportStar(require("./colon"), exports);
59
59
  __exportStar(require("./comment"), exports);
60
60
  __exportStar(require("./identifier"), exports);
61
+ __exportStar(require("./association_name"), exports);
61
62
  __exportStar(require("./pragma"), exports);
62
63
  __exportStar(require("./punctuation"), exports);
63
64
  //# sourceMappingURL=index.js.map
@@ -45,11 +45,17 @@ function containsAggregation(children) {
45
45
  continue;
46
46
  }
47
47
  if (child.get() instanceof Expressions.SQLAggregation) {
48
- return true;
48
+ if (child.findDirectExpression(Expressions.SQLOver) === undefined) {
49
+ return true;
50
+ }
51
+ continue;
49
52
  }
50
53
  if (child.get() instanceof Expressions.SQLSetOpGroup) {
51
54
  continue;
52
55
  }
56
+ if (child.get() instanceof Expressions.SQLFrom) {
57
+ continue;
58
+ }
53
59
  if (containsAggregation(child.getChildren())) {
54
60
  return true;
55
61
  }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMLEntityPath = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ class EMLEntityPath extends combi_1.Expression {
7
+ getRunnable() {
8
+ return (0, combi_1.plusPrio)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.AssociationName), (0, combi_1.regex)(/^\\[\w]+$/)));
9
+ }
10
+ }
11
+ exports.EMLEntityPath = EMLEntityPath;
12
+ //# sourceMappingURL=eml_entity_path.js.map
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EntityAssociation = void 0;
4
4
  const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
5
6
  class EntityAssociation extends combi_1.Expression {
6
7
  getRunnable() {
7
- return (0, combi_1.regex)(/^[\/\w]+(\\_|\\\\)[\/\_\w\\~]+$/);
8
+ return (0, combi_1.seq)((0, combi_1.regex)(/^[\/\w]+$/), (0, combi_1.plusPrio)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.AssociationName), (0, combi_1.regex)(/^\\[\w]+$/))));
8
9
  }
9
10
  }
10
11
  exports.EntityAssociation = EntityAssociation;
@@ -21,7 +21,7 @@ __exportStar(require("./arith_operator"), exports);
21
21
  __exportStar(require("./arrow_or_dash"), exports);
22
22
  __exportStar(require("./arrow"), exports);
23
23
  __exportStar(require("./assign_source"), exports);
24
- __exportStar(require("./association_name"), exports);
24
+ __exportStar(require("./eml_entity_path"), exports);
25
25
  __exportStar(require("./attribute_chain"), exports);
26
26
  __exportStar(require("./attribute_name"), exports);
27
27
  __exportStar(require("./behavior_definition_name"), exports);
@@ -160,6 +160,11 @@ __exportStar(require("./reduce_body"), exports);
160
160
  __exportStar(require("./reduce_next"), exports);
161
161
  __exportStar(require("./report_name"), exports);
162
162
  __exportStar(require("./select_cte"), exports);
163
+ __exportStar(require("./sql_cte_associations"), exports);
164
+ __exportStar(require("./sql_cte_hierarchy"), exports);
165
+ __exportStar(require("./sql_hierarchy_source"), exports);
166
+ __exportStar(require("./sql_hierarchy_accessor"), exports);
167
+ __exportStar(require("./sql_hierarchy_aggregate"), exports);
163
168
  __exportStar(require("./select"), exports);
164
169
  __exportStar(require("./simple_field_chain"), exports);
165
170
  __exportStar(require("./simple_field_chain2"), exports);
@@ -174,6 +179,9 @@ __exportStar(require("./source_field_symbol"), exports);
174
179
  __exportStar(require("./source_field"), exports);
175
180
  __exportStar(require("./source"), exports);
176
181
  __exportStar(require("./sql_aggregation"), exports);
182
+ __exportStar(require("./sql_association_entry"), exports);
183
+ __exportStar(require("./sql_associations_list"), exports);
184
+ __exportStar(require("./sql_path_segment"), exports);
177
185
  __exportStar(require("./sql_alias_field"), exports);
178
186
  __exportStar(require("./sql_arithmetic_operator"), exports);
179
187
  __exportStar(require("./sql_arithmetics"), exports);
@@ -212,7 +220,10 @@ __exportStar(require("./sql_package_size"), exports);
212
220
  __exportStar(require("./sql_order_by"), exports);
213
221
  __exportStar(require("./sql_over"), exports);
214
222
  __exportStar(require("./sql_over"), exports);
215
- __exportStar(require("./sql_path"), exports);
223
+ __exportStar(require("./sql_path_cardinality"), exports);
224
+ __exportStar(require("./sql_path_for_column"), exports);
225
+ __exportStar(require("./sql_path_for_entity"), exports);
226
+ __exportStar(require("./sql_path_join_type"), exports);
216
227
  __exportStar(require("./sql_privileged_access"), exports);
217
228
  __exportStar(require("./sql_set_op"), exports);
218
229
  __exportStar(require("./sql_set_op_group"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLAssociationEntry = void 0;
4
+ const combi_1 = require("../combi");
5
+ const sql_as_name_1 = require("./sql_as_name");
6
+ const sql_path_for_entity_1 = require("./sql_path_for_entity");
7
+ const with_name_1 = require("./with_name");
8
+ const database_table_1 = require("./database_table");
9
+ const version_1 = require("../../../version");
10
+ class SQLAssociationEntry extends combi_1.Expression {
11
+ getRunnable() {
12
+ const alias = (0, combi_1.seq)("AS", sql_as_name_1.SQLAsName);
13
+ const redirected = (0, combi_1.seq)("REDIRECTED TO", with_name_1.WithName, "VIA", database_table_1.DatabaseTable);
14
+ return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)(new sql_path_for_entity_1.SQLPathForEntity(), (0, combi_1.optPrio)(alias), (0, combi_1.optPrio)(redirected)));
15
+ }
16
+ }
17
+ exports.SQLAssociationEntry = SQLAssociationEntry;
18
+ //# sourceMappingURL=sql_association_entry.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLAssociationsList = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ const sql_association_entry_1 = require("./sql_association_entry");
7
+ const version_1 = require("../../../version");
8
+ class SQLAssociationsList extends combi_1.Expression {
9
+ getRunnable() {
10
+ return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), new sql_association_entry_1.SQLAssociationEntry(), (0, combi_1.star)((0, combi_1.seq)(",", new sql_association_entry_1.SQLAssociationEntry())), (0, combi_1.tok)(tokens_1.WParenRightW)));
11
+ }
12
+ }
13
+ exports.SQLAssociationsList = SQLAssociationsList;
14
+ //# sourceMappingURL=sql_associations_list.js.map
@@ -12,7 +12,7 @@ const sql_source_1 = require("./sql_source");
12
12
  class SQLCase extends combi_1.Expression {
13
13
  getRunnable() {
14
14
  const abap = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2);
15
- const field = (0, combi_1.altPrio)(_1.SQLAggregation, SQLCase, _1.SQLFunction, _1.SQLPath, sql_field_name_1.SQLFieldName, constant_1.Constant);
15
+ const field = (0, combi_1.altPrio)(_1.SQLAggregation, SQLCase, _1.SQLFunction, _1.SQLPathForColumn, sql_field_name_1.SQLFieldName, constant_1.Constant);
16
16
  const sub = (0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
17
17
  const source = (0, combi_1.altPrio)(SQLCase, _1.SQLAggregation, _1.SQLFunction, sql_field_name_1.SQLFieldName, sql_source_1.SQLSource, constant_1.Constant);
18
18
  const parenSource = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), source, (0, combi_1.tok)(tokens_1.WParenRightW));
@@ -8,7 +8,7 @@ const field_chain_1 = require("./field_chain");
8
8
  class SQLCDSParameters extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const param = (0, combi_1.seq)(_1.Field, "=", (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), field_chain_1.FieldChain), _1.Constant));
11
- return (0, combi_1.seq)("(", param, (0, combi_1.starPrio)((0, combi_1.seq)(",", param)), ")");
11
+ return (0, combi_1.seq)((0, combi_1.alt)((0, combi_1.tok)(tokens_1.ParenLeft), (0, combi_1.tok)(tokens_1.ParenLeftW)), param, (0, combi_1.starPrio)((0, combi_1.seq)(",", param)), (0, combi_1.alt)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)));
12
12
  }
13
13
  }
14
14
  exports.SQLCDSParameters = SQLCDSParameters;
@@ -20,7 +20,9 @@ class SQLCompare extends combi_1.Expression {
20
20
  const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), version_1.Version.OpenABAP);
21
21
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
22
22
  const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)), version_1.Version.OpenABAP);
23
- const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLCase, _1.SQLAggregation, _1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, _1.SQLCase, _1.SQLAggregation, _1.SQLFunction, (0, combi_1.seq)(source, (0, combi_1.optPrio)(arith)))), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul));
23
+ const lhs = (0, combi_1.altPrio)(_1.SQLCase, _1.SQLAggregation, _1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPathForColumn, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at);
24
+ const rhs = (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, _1.SQLCase, _1.SQLAggregation, _1.SQLFunction, (0, combi_1.seq)(source, (0, combi_1.optPrio)(arith)))), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul);
25
+ const rett = (0, combi_1.seq)(lhs, rhs);
24
26
  const exists = (0, combi_1.seq)("EXISTS", (0, combi_1.altPrio)(subSelect, simpleSubSelect));
25
27
  return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
26
28
  }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLCTEAssociations = void 0;
4
+ const combi_1 = require("../combi");
5
+ const sql_associations_list_1 = require("./sql_associations_list");
6
+ const dynamic_1 = require("./dynamic");
7
+ const version_1 = require("../../../version");
8
+ class SQLCTEAssociations extends combi_1.Expression {
9
+ getRunnable() {
10
+ return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("ASSOCIATIONS", (0, combi_1.altPrio)(new sql_associations_list_1.SQLAssociationsList(), dynamic_1.Dynamic)));
11
+ }
12
+ }
13
+ exports.SQLCTEAssociations = SQLCTEAssociations;
14
+ //# sourceMappingURL=sql_cte_associations.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLCTEHierarchy = void 0;
4
+ const combi_1 = require("../combi");
5
+ const sql_as_name_1 = require("./sql_as_name");
6
+ const sql_cte_associations_1 = require("./sql_cte_associations");
7
+ const version_1 = require("../../../version");
8
+ class SQLCTEHierarchy extends combi_1.Expression {
9
+ getRunnable() {
10
+ return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("HIERARCHY", sql_as_name_1.SQLAsName, (0, combi_1.optPrio)((0, combi_1.seq)("WITH", sql_cte_associations_1.SQLCTEAssociations))));
11
+ }
12
+ }
13
+ exports.SQLCTEHierarchy = SQLCTEHierarchy;
14
+ //# sourceMappingURL=sql_cte_hierarchy.js.map
@@ -6,14 +6,14 @@ const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
7
  const tokens_1 = require("../../1_lexer/tokens");
8
8
  const sql_function_1 = require("./sql_function");
9
- const sql_path_1 = require("./sql_path");
9
+ const sql_path_for_column_1 = require("./sql_path_for_column");
10
10
  class SQLField extends combi_1.Expression {
11
11
  getRunnable() {
12
12
  const atParen = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.SimpleFieldChain2, (0, combi_1.tok)(tokens_1.WParenRightW));
13
13
  const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleFieldChain2, atParen)), version_1.Version.OpenABAP);
14
14
  const as = (0, combi_1.seq)("AS", _1.SQLAsName);
15
15
  const parenFieldName = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFieldName, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)));
16
- const fieldNoAgg = (0, combi_1.altPrio)(_1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant, parenFieldName);
16
+ const fieldNoAgg = (0, combi_1.altPrio)(_1.SQLCase, sql_function_1.SQLFunction, sql_path_for_column_1.SQLPathForColumn, _1.SQLFieldName, abap, _1.Constant, parenFieldName);
17
17
  const field = (0, combi_1.altPrio)(_1.SQLAggregation, fieldNoAgg);
18
18
  const parenField = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), field, (0, combi_1.tok)(tokens_1.WParenRightW));
19
19
  const parenFieldNoAgg = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), fieldNoAgg, (0, combi_1.tok)(tokens_1.WParenRightW));
@@ -24,7 +24,6 @@ class SQLField extends combi_1.Expression {
24
24
  const arith = (0, combi_1.altPrio)(arithWithAgg, arithNoAgg);
25
25
  const arithSequence = (0, combi_1.seq)((0, combi_1.optPrio)("-"), field, (0, combi_1.optPrio)(arith));
26
26
  const parenArithSequence = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.optPrio)("-"), arithSequence, (0, combi_1.tok)(tokens_1.WParenRightW));
27
- // allows (a-b)*(c-d) — paren groups as operands, defined after parenArithSequence
28
27
  const subExtWithAgg = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.altPrio)(parenArithSequence, parenField, field)));
29
28
  const subExtNoAgg = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.altPrio)(parenArithSequence, parenFieldNoAgg, fieldNoAgg)));
30
29
  const arithExt = (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v754, subExtWithAgg), (0, combi_1.ver)(version_1.Version.v740sp05, subExtNoAgg));
@@ -4,7 +4,7 @@ exports.SQLFieldListLoop = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
- const sql_path_1 = require("./sql_path");
7
+ const sql_path_for_column_1 = require("./sql_path_for_column");
8
8
  const tokens_1 = require("../../1_lexer/tokens");
9
9
  // loop must include one field from the database table
10
10
  class SQLFieldListLoop extends combi_1.Expression {
@@ -13,7 +13,7 @@ class SQLFieldListLoop extends combi_1.Expression {
13
13
  const as = (0, combi_1.seq)("AS", _1.SQLAsName);
14
14
  const someField = (0, combi_1.seq)(_1.SQLField, comma);
15
15
  const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2), version_1.Version.OpenABAP);
16
- const fieldList = (0, combi_1.seq)((0, combi_1.star)(someField), (0, combi_1.alt)(_1.SQLFieldName, abap, sql_path_1.SQLPath, _1.Constant), (0, combi_1.optPrio)(as), comma, (0, combi_1.star)(someField));
16
+ const fieldList = (0, combi_1.seq)((0, combi_1.star)(someField), (0, combi_1.alt)(_1.SQLFieldName, abap, sql_path_for_column_1.SQLPathForColumn, _1.Constant), (0, combi_1.optPrio)(as), comma, (0, combi_1.star)(someField));
17
17
  const fields = (0, combi_1.alt)("*", _1.Dynamic, fieldList);
18
18
  return fields;
19
19
  }
@@ -4,14 +4,14 @@ exports.SQLFieldListLoopGreedy = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
- const sql_path_1 = require("./sql_path");
7
+ const sql_path_for_column_1 = require("./sql_path_for_column");
8
8
  const tokens_1 = require("../../1_lexer/tokens");
9
9
  class SQLFieldListLoopGreedy extends combi_1.Expression {
10
10
  getRunnable() {
11
11
  const comma = (0, combi_1.opt)((0, combi_1.ver)(version_1.Version.v740sp05, ",", version_1.Version.OpenABAP));
12
12
  const as = (0, combi_1.seq)("AS", _1.SQLAsName);
13
13
  const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2), version_1.Version.OpenABAP);
14
- const entry = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLField, abap, sql_path_1.SQLPath, _1.SQLFieldName, _1.Constant), (0, combi_1.optPrio)(as), comma);
14
+ const entry = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLField, abap, sql_path_for_column_1.SQLPathForColumn, _1.SQLFieldName, _1.Constant), (0, combi_1.optPrio)(as), comma);
15
15
  const fieldList = (0, combi_1.plusPrio)(entry);
16
16
  return (0, combi_1.altPrio)("*", _1.Dynamic, fieldList);
17
17
  }
@@ -6,13 +6,17 @@ const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
7
  const tokens_1 = require("../../1_lexer/tokens");
8
8
  const with_name_1 = require("./with_name");
9
+ const sql_path_for_entity_1 = require("./sql_path_for_entity");
10
+ const sql_hierarchy_source_1 = require("./sql_hierarchy_source");
11
+ const sql_hierarchy_accessor_1 = require("./sql_hierarchy_accessor");
12
+ const sql_hierarchy_aggregate_1 = require("./sql_hierarchy_aggregate");
9
13
  class SQLFromSource extends combi_1.Expression {
10
14
  getRunnable() {
11
15
  // https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-752-open_sql.htm#!ABAP_MODIFICATION_1@1@
12
16
  const tab = (0, combi_1.ver)(version_1.Version.v752, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.FieldChain), version_1.Version.OpenABAP);
13
17
  const aas = (0, combi_1.seq)("AS", _1.SQLAsName);
14
18
  const privileged = (0, combi_1.ver)(version_1.Version.v752, (0, combi_1.seq)("WITH", _1.SQLPrivilegedAccess));
15
- return (0, combi_1.seq)((0, combi_1.altPrio)(with_name_1.WithName, (0, combi_1.seq)(_1.DatabaseTable, (0, combi_1.optPrio)(_1.SQLCDSParameters)), tab), (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(aas));
19
+ return (0, combi_1.seq)((0, combi_1.altPrio)(new sql_hierarchy_aggregate_1.SQLHierarchyAggregate(), new sql_hierarchy_accessor_1.SQLHierarchyAccessor(), new sql_hierarchy_source_1.SQLHierarchySource(), (0, combi_1.seq)(with_name_1.WithName, (0, combi_1.optPrio)(new sql_path_for_entity_1.SQLPathForEntity())), (0, combi_1.seq)(_1.DatabaseTable, (0, combi_1.optPrio)(_1.SQLCDSParameters), (0, combi_1.optPrio)(new sql_path_for_entity_1.SQLPathForEntity())), tab), (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(aas));
16
20
  }
17
21
  }
18
22
  exports.SQLFromSource = SQLFromSource;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLHierarchyAccessor = void 0;
4
+ const combi_1 = require("../combi");
5
+ const version_1 = require("../../../version");
6
+ const tokens_1 = require("../../1_lexer/tokens");
7
+ const _1 = require(".");
8
+ class SQLHierarchyAccessor extends combi_1.Expression {
9
+ getRunnable() {
10
+ const distanceTo = (0, combi_1.seq)("TO", _1.SQLSource);
11
+ const distanceFrom = (0, combi_1.seq)("FROM", _1.SQLSource, (0, combi_1.optPrio)(distanceTo));
12
+ const distance = (0, combi_1.seq)("DISTANCE", (0, combi_1.altPrio)(distanceFrom, distanceTo));
13
+ const accessor = (0, combi_1.seq)("SOURCE", _1.DatabaseTable, "START", "WHERE", _1.SQLCond, (0, combi_1.optPrio)(distance));
14
+ const name = (0, combi_1.altPrio)("HIERARCHY_DESCENDANTS", "HIERARCHY_ANCESTORS", "HIERARCHY_SIBLINGS");
15
+ return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)(name, (0, combi_1.tok)(tokens_1.ParenLeftW), accessor, (0, combi_1.tok)(tokens_1.WParenRightW)));
16
+ }
17
+ }
18
+ exports.SQLHierarchyAccessor = SQLHierarchyAccessor;
19
+ //# sourceMappingURL=sql_hierarchy_accessor.js.map
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLHierarchyAggregate = void 0;
4
+ const combi_1 = require("../combi");
5
+ const version_1 = require("../../../version");
6
+ const tokens_1 = require("../../1_lexer/tokens");
7
+ const _1 = require(".");
8
+ class SQLHierarchyAggregate extends combi_1.Expression {
9
+ getRunnable() {
10
+ const startWhere = (0, combi_1.seq)("START", "WHERE", _1.SQLCond);
11
+ const join = (0, combi_1.seq)("JOIN", _1.DatabaseTable, "ON", _1.SQLCond);
12
+ const measureItem = (0, combi_1.seq)(_1.SQLAggregation, "AS", _1.SQLAsName);
13
+ const measures = (0, combi_1.seq)("MEASURES", measureItem, (0, combi_1.star)((0, combi_1.seq)(",", measureItem)));
14
+ const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
15
+ const withEntry = (0, combi_1.altPrio)("SUBTOTAL", "BALANCE", (0, combi_1.seq)("NOT", "MATCHED"), "TOTAL");
16
+ const aggregate = (0, combi_1.seq)("SOURCE", _1.DatabaseTable, (0, combi_1.optPrio)(startWhere), (0, combi_1.optPrio)(join), measures, (0, combi_1.optPrio)(where), (0, combi_1.optPrio)((0, combi_1.seq)("WITH", withEntry, (0, combi_1.star)((0, combi_1.seq)("WITH", withEntry)))));
17
+ const name = (0, combi_1.altPrio)("HIERARCHY_DESCENDANTS_AGGREGATE", "HIERARCHY_ANCESTORS_AGGREGATE");
18
+ return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)(name, (0, combi_1.tok)(tokens_1.ParenLeftW), aggregate, (0, combi_1.tok)(tokens_1.WParenRightW)));
19
+ }
20
+ }
21
+ exports.SQLHierarchyAggregate = SQLHierarchyAggregate;
22
+ //# sourceMappingURL=sql_hierarchy_aggregate.js.map
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLHierarchySource = void 0;
4
+ const combi_1 = require("../combi");
5
+ const version_1 = require("../../../version");
6
+ const tokens_1 = require("../../1_lexer/tokens");
7
+ const _1 = require(".");
8
+ class SQLHierarchySource extends combi_1.Expression {
9
+ getRunnable() {
10
+ const orderDir = (0, combi_1.optPrio)((0, combi_1.altPrio)("ASCENDING", "DESCENDING"));
11
+ const orderFieldName = (0, combi_1.regex)(/^(?!(?:DEPTH|MULTIPLE|ORPHAN|CACHE|CYCLE|LOAD|GENERATE|RETAIN|DEPTH)$)(\/\w+\/)?(\*?\w+~(\/\w+\/)?(\w+|\*)|\w+)$/i);
12
+ const orderField = (0, combi_1.seq)(orderFieldName, orderDir, (0, combi_1.optPrio)(","));
13
+ const siblingsOrderBy = (0, combi_1.seq)("SIBLINGS", "ORDER", "BY", (0, combi_1.altPrio)("PRIMARY KEY", _1.Dynamic, (0, combi_1.seq)(orderField, (0, combi_1.starPrio)(orderField))));
14
+ const cache = (0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("FORCE", "OFF", "ON"));
15
+ const retainNulls = (0, combi_1.seq)("RETAIN", "NULLS", _1.SQLSource);
16
+ const cycle = (0, combi_1.seq)("CYCLE", (0, combi_1.altPrio)("BREAKUP", "ERROR"));
17
+ const multipleParents = (0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)((0, combi_1.seq)("NOT", "ALLOWED"), (0, combi_1.seq)("LEAVES", "ONLY"), "ALLOWED"));
18
+ const orphan = (0, combi_1.seq)("ORPHAN", (0, combi_1.altPrio)("IGNORE", "ERROR", "ROOT"));
19
+ const depth = (0, combi_1.seq)("DEPTH", _1.SQLSource);
20
+ const load = (0, combi_1.seq)("LOAD", (0, combi_1.altPrio)("INCREMENTAL", "BULK", _1.SQLSource));
21
+ const generateSpantree = (0, combi_1.seq)("GENERATE", "SPANTREE");
22
+ const startWhere = (0, combi_1.seq)("START", "WHERE", _1.SQLCond);
23
+ const period = (0, combi_1.seq)("PERIOD", "FROM", _1.SQLFieldName, "TO", _1.SQLFieldName);
24
+ const valid = (0, combi_1.seq)("VALID", "FROM", _1.SQLSource, "TO", _1.SQLSource);
25
+ const association = (0, combi_1.seq)("CHILD", "TO", "PARENT", "ASSOCIATION", _1.SQLFieldName);
26
+ const sourceTable = (0, combi_1.seq)((0, combi_1.altPrio)(_1.WithName, _1.DatabaseTable), (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.SQLAsName)));
27
+ const levelColumn = _1.SQLFieldName;
28
+ const levels = (0, combi_1.seq)("LEVELS", (0, combi_1.tok)(tokens_1.WParenLeftW), levelColumn, (0, combi_1.star)((0, combi_1.seq)(",", levelColumn)), (0, combi_1.tok)(tokens_1.WParenRightW));
29
+ const leveledGenerator = (0, combi_1.seq)(levels, (0, combi_1.optPrio)(siblingsOrderBy), (0, combi_1.optPrio)(cache), (0, combi_1.optPrio)(retainNulls));
30
+ const generator = (0, combi_1.seq)(association, (0, combi_1.optPrio)((0, combi_1.seq)(period, valid)), startWhere, (0, combi_1.optPrio)(siblingsOrderBy), (0, combi_1.optPrio)(depth), (0, combi_1.optPrio)(multipleParents), (0, combi_1.optPrio)(orphan), (0, combi_1.optPrio)(cache), (0, combi_1.optPrio)(cycle), (0, combi_1.optPrio)(load), (0, combi_1.optPrio)(generateSpantree));
31
+ return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("HIERARCHY", (0, combi_1.tok)(tokens_1.ParenLeftW), "SOURCE", sourceTable, (0, combi_1.altPrio)(leveledGenerator, generator), (0, combi_1.tok)(tokens_1.WParenRightW)));
32
+ }
33
+ }
34
+ exports.SQLHierarchySource = SQLHierarchySource;
35
+ //# sourceMappingURL=sql_hierarchy_source.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLPathCardinality = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ class SQLPathCardinality extends combi_1.Expression {
7
+ getRunnable() {
8
+ const exact = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.regex)(/^\d+$/), (0, combi_1.tok)(tokens_1.WParenRightW));
9
+ const many = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), "*", (0, combi_1.tok)(tokens_1.WParenRightW));
10
+ return (0, combi_1.altPrio)(exact, many);
11
+ }
12
+ }
13
+ exports.SQLPathCardinality = SQLPathCardinality;
14
+ //# sourceMappingURL=sql_path_cardinality.js.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLPathForColumn = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ const sql_path_segment_1 = require("./sql_path_segment");
7
+ const field_1 = require("./field");
8
+ const version_1 = require("../../../version");
9
+ class SQLPathForColumn extends combi_1.Expression {
10
+ getRunnable() {
11
+ const tablePrefix = (0, combi_1.regex)(/^(\/\w+\/)?\w+~$/);
12
+ const withPrefix = (0, combi_1.seq)(tablePrefix, (0, combi_1.plus)(new sql_path_segment_1.SQLPathSegment(true)), (0, combi_1.tok)(tokens_1.Dash), field_1.Field);
13
+ const standalone = (0, combi_1.seq)((0, combi_1.plus)(new sql_path_segment_1.SQLPathSegment()), (0, combi_1.tok)(tokens_1.Dash), field_1.Field);
14
+ return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.altPrio)(withPrefix, standalone));
15
+ }
16
+ }
17
+ exports.SQLPathForColumn = SQLPathForColumn;
18
+ //# sourceMappingURL=sql_path_for_column.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLPathForEntity = void 0;
4
+ const combi_1 = require("../combi");
5
+ const sql_path_segment_1 = require("./sql_path_segment");
6
+ const database_table_1 = require("./database_table");
7
+ const version_1 = require("../../../version");
8
+ class SQLPathForEntity extends combi_1.Expression {
9
+ getRunnable() {
10
+ return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.optPrio)(database_table_1.DatabaseTable), (0, combi_1.plus)(new sql_path_segment_1.SQLPathSegment())));
11
+ }
12
+ }
13
+ exports.SQLPathForEntity = SQLPathForEntity;
14
+ //# sourceMappingURL=sql_path_for_entity.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLPathJoinType = void 0;
4
+ const combi_1 = require("../combi");
5
+ class SQLPathJoinType extends combi_1.Expression {
6
+ getRunnable() {
7
+ return (0, combi_1.altPrio)("EXACT ONE TO ONE", "ONE TO ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO MANY", "LEFT OUTER", "RIGHT OUTER", "INNER");
8
+ }
9
+ }
10
+ exports.SQLPathJoinType = SQLPathJoinType;
11
+ //# sourceMappingURL=sql_path_join_type.js.map
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLPathSegment = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ const sql_cds_parameters_1 = require("./sql_cds_parameters");
7
+ const sql_cond_1 = require("./sql_cond");
8
+ const sql_path_cardinality_1 = require("./sql_path_cardinality");
9
+ const sql_path_join_type_1 = require("./sql_path_join_type");
10
+ const version_1 = require("../../../version");
11
+ class SQLPathSegment extends combi_1.Expression {
12
+ constructor(nws = false) {
13
+ super();
14
+ this.nws = nws;
15
+ }
16
+ getRunnable() {
17
+ const filter = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.BracketLeftW), (0, combi_1.optPrio)(sql_path_cardinality_1.SQLPathCardinality), (0, combi_1.optPrio)(sql_path_join_type_1.SQLPathJoinType), (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.optPrio)("WHERE"), sql_cond_1.SQLCond)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WBracketRightW), (0, combi_1.tok)(tokens_1.WBracketRight))));
18
+ const params = (0, combi_1.ver)(version_1.Version.v751, sql_cds_parameters_1.SQLCDSParameters);
19
+ const name = this.nws
20
+ ? (0, combi_1.tok)(tokens_1.AssociationName)
21
+ : (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.AssociationName), (0, combi_1.regex)(/^\\[\w]+$/));
22
+ return (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)(params, (0, combi_1.optPrio)(filter)), filter))));
23
+ }
24
+ }
25
+ exports.SQLPathSegment = SQLPathSegment;
26
+ //# sourceMappingURL=sql_path_segment.js.map
@@ -10,7 +10,7 @@ class CommitEntities {
10
10
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
11
11
  const responses = (0, combi_1.seq)("RESPONSES", failed, reported);
12
12
  const s = (0, combi_1.seq)("COMMIT ENTITIES", (0, combi_1.optPrio)("IN SIMULATION MODE"), (0, combi_1.opt)(responses), (0, combi_1.opt)((0, combi_1.seq)("RESPONSE OF", expressions_1.NamespaceSimpleName, (0, combi_1.per)(failed, reported))));
13
- return (0, combi_1.ver)(version_1.Version.v754, s);
13
+ return (0, combi_1.ver)(version_1.Version.v754, s, version_1.Version.OpenABAP);
14
14
  }
15
15
  }
16
16
  exports.CommitEntities = CommitEntities;
@@ -15,7 +15,7 @@ class CreateData {
15
15
  const initial = (0, combi_1.seq)("INITIAL SIZE", expressions_1.Source);
16
16
  const decimals = (0, combi_1.seq)("DECIMALS", expressions_1.Source);
17
17
  const uniq = (0, combi_1.alt)("UNIQUE", "NON-UNIQUE");
18
- const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY");
18
+ const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY", version_1.Version.OpenABAP);
19
19
  const def = (0, combi_1.seq)((0, combi_1.opt)(uniq), (0, combi_1.alt)("DEFAULT KEY", emptyKey));
20
20
  const kdef = (0, combi_1.seq)((0, combi_1.opt)(uniq), "KEY", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.Field), expressions_1.Dynamic));
21
21
  const key = (0, combi_1.seq)("WITH", (0, combi_1.alt)(def, kdef));
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const version_1 = require("../../../version");
6
6
  class EndTestSeam {
7
7
  getMatcher() {
8
- return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.str)("END-TEST-SEAM"));
8
+ return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.str)("END-TEST-SEAM"), version_1.Version.OpenABAP);
9
9
  }
10
10
  }
11
11
  exports.EndTestSeam = EndTestSeam;
@@ -9,7 +9,7 @@ class GetPermissions {
9
9
  const type = (0, combi_1.altPrio)("GLOBAL AUTHORIZATION", "INSTANCE");
10
10
  const from = (0, combi_1.seq)("FROM", expressions_1.Source);
11
11
  const s = (0, combi_1.seq)("GET PERMISSIONS ONLY", type, "ENTITY", expressions_1.SimpleName, (0, combi_1.optPrio)(from), "REQUEST", expressions_1.Source, "RESULT", expressions_1.Target, "FAILED", expressions_1.Target, "REPORTED", expressions_1.Target);
12
- return (0, combi_1.ver)(version_1.Version.v754, s);
12
+ return (0, combi_1.ver)(version_1.Version.v754, s, version_1.Version.OpenABAP);
13
13
  }
14
14
  }
15
15
  exports.GetPermissions = GetPermissions;
@@ -8,7 +8,7 @@ class ModifyEntities {
8
8
  getMatcher() {
9
9
  const withh = (0, combi_1.seq)("WITH", expressions_1.Source);
10
10
  const fieldsWith = (0, combi_1.seq)("FIELDS (", (0, combi_1.plus)(expressions_1.SimpleName), ")", withh);
11
- const by = (0, combi_1.seq)("BY", expressions_1.AssociationName);
11
+ const by = (0, combi_1.seq)("BY", expressions_1.EMLEntityPath);
12
12
  const relating = (0, combi_1.seq)("RELATING TO", expressions_1.NamespaceSimpleName, "BY", expressions_1.NamespaceSimpleName);
13
13
  const execute = (0, combi_1.seq)("EXECUTE", expressions_1.NamespaceSimpleName, "FROM", expressions_1.Source);
14
14
  const create = (0, combi_1.seq)("CREATE", (0, combi_1.opt)(by), "FROM", expressions_1.Source, (0, combi_1.opt)(relating));
@@ -23,9 +23,9 @@ class ModifyEntities {
23
23
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
24
24
  const end = (0, combi_1.optPrio)((0, combi_1.per)(failed, result, mapped, reported));
25
25
  const entities = (0, combi_1.seq)((0, combi_1.optPrio)("AUGMENTING"), "ENTITIES OF", expressions_1.NamespaceSimpleName, (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.plusPrio)((0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(operation))));
26
- const create2 = (0, combi_1.seq)("CREATE", fieldsWith, (0, combi_1.opt)((0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, fieldsWith)));
27
- const create3 = (0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, fieldsWith);
28
- const create4 = (0, combi_1.seq)("CREATE FROM", expressions_1.Source, (0, combi_1.plus)((0, combi_1.seq)("CREATE BY", expressions_1.AssociationName, "FROM", expressions_1.Source)));
26
+ const create2 = (0, combi_1.seq)("CREATE", fieldsWith, (0, combi_1.opt)((0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, fieldsWith)));
27
+ const create3 = (0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, fieldsWith);
28
+ const create4 = (0, combi_1.seq)("CREATE FROM", expressions_1.Source, (0, combi_1.plus)((0, combi_1.seq)("CREATE BY", expressions_1.EMLEntityPath, "FROM", expressions_1.Source)));
29
29
  const entity = (0, combi_1.seq)("ENTITY", (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.alt)(execute, create, updateFields, deleteFrom, updateSetFields, updateFrom, create2, create3, create4));
30
30
  return (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("MODIFY", (0, combi_1.alt)(entities, entity), end), version_1.Version.OpenABAP);
31
31
  }
@@ -13,11 +13,11 @@ class ReadEntities {
13
13
  const result = (0, combi_1.seq)("RESULT", expressions_1.Target);
14
14
  const failed = (0, combi_1.seq)("FAILED", expressions_1.Target);
15
15
  const reported = (0, combi_1.seq)("REPORTED", expressions_1.Target);
16
- const foo = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.seq)("BY", expressions_1.AssociationName)), (0, combi_1.alt)(fields, from, all), (0, combi_1.optPrio)(result));
16
+ const foo = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.seq)("BY", expressions_1.EMLEntityPath)), (0, combi_1.alt)(fields, from, all), (0, combi_1.optPrio)(result));
17
17
  const entity = (0, combi_1.seq)("ENTITY", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(foo));
18
18
  const s = (0, combi_1.seq)("ENTITIES OF", expressions_1.NamespaceSimpleName, (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.plus)(entity), (0, combi_1.optPrio)((0, combi_1.seq)("LINK", expressions_1.Target)), (0, combi_1.optPrio)((0, combi_1.per)(failed, reported)));
19
- const byall = (0, combi_1.seq)("BY", expressions_1.AssociationName, all);
20
- const by = (0, combi_1.seq)("BY", expressions_1.AssociationName, fields);
19
+ const byall = (0, combi_1.seq)("BY", expressions_1.EMLEntityPath, all);
20
+ const by = (0, combi_1.seq)("BY", expressions_1.EMLEntityPath, fields);
21
21
  const sub = (0, combi_1.seq)((0, combi_1.alt)(all, fields, from, by, byall), result);
22
22
  const single = (0, combi_1.seq)("ENTITY", (0, combi_1.opt)("IN LOCAL MODE"), (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.plus)(sub), (0, combi_1.optPrio)(failed), (0, combi_1.optPrio)(reported));
23
23
  return (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("READ", (0, combi_1.alt)(s, single)), version_1.Version.OpenABAP);
@@ -6,7 +6,7 @@ const expressions_1 = require("../expressions");
6
6
  const version_1 = require("../../../version");
7
7
  class TestSeam {
8
8
  getMatcher() {
9
- return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("TEST-SEAM", expressions_1.TestSeamName));
9
+ return (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("TEST-SEAM", expressions_1.TestSeamName), version_1.Version.OpenABAP);
10
10
  }
11
11
  }
12
12
  exports.TestSeam = TestSeam;
@@ -7,7 +7,8 @@ const expressions_1 = require("../expressions");
7
7
  const tokens_1 = require("../../1_lexer/tokens");
8
8
  class With {
9
9
  getMatcher() {
10
- const cte = (0, combi_1.seq)(expressions_1.WithName, "AS", (0, combi_1.tok)(tokens_1.WParenLeftW), expressions_1.SelectCTE, (0, combi_1.tok)(tokens_1.WParenRightW));
10
+ const exposing = (0, combi_1.optPrio)((0, combi_1.seq)("WITH", (0, combi_1.altPrio)(new expressions_1.SQLCTEHierarchy(), expressions_1.SQLCTEAssociations)));
11
+ const cte = (0, combi_1.seq)(expressions_1.WithName, "AS", (0, combi_1.tok)(tokens_1.WParenLeftW), expressions_1.SelectCTE, (0, combi_1.tok)(tokens_1.WParenRightW), exposing);
11
12
  return (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("WITH", cte, (0, combi_1.star)((0, combi_1.seq)(",", cte)), expressions_1.Select));
12
13
  }
13
14
  }
@@ -480,16 +480,16 @@ class BasicTypes {
480
480
  options.primaryKey.type = basic_1.TableAccessType.standard;
481
481
  return new Types.TableType(structure, options);
482
482
  }
483
- else if (typename && (text.startsWith("TYPE TABLE FOR CREATE ")
484
- || text.startsWith("TYPE TABLE FOR READ ")
485
- || text.startsWith("TYPE TABLE FOR DELETE ")
486
- || text.startsWith("TYPE TABLE FOR UPDATE "))) {
483
+ else if (typename && this.isRAPTableFor(text)) {
487
484
  const name = typename.concatTokens();
488
485
  const ddlsName = this.getRAPBaseEntityName(name);
489
486
  const type = (_d = this.input.scope.getDDIC().lookupDDLS(ddlsName)) === null || _d === void 0 ? void 0 : _d.type;
490
487
  if (type) {
491
488
  return new Types.TableType(basic_1.VoidType.get("RAP-TODO"), options);
492
489
  }
490
+ else if (this.isRAPDerivedEntityName(name)) {
491
+ return Types.VoidType.get(name);
492
+ }
493
493
  else if (this.input.scope.getDDIC().inErrorNamespace(ddlsName)) {
494
494
  return new Types.UnknownType(`DDLS ${ddlsName} not found`);
495
495
  }
@@ -501,7 +501,7 @@ class BasicTypes {
501
501
  return this.parseType(node, name);
502
502
  }
503
503
  parseType(node, qualifiedName) {
504
- var _a, _b, _c, _d, _e, _f, _g, _h;
504
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
505
505
  const typeName = node.findFirstExpression(Expressions.TypeName);
506
506
  let text = (_a = node.findFirstExpression(Expressions.Type)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
507
507
  if (text === undefined) {
@@ -514,7 +514,10 @@ class BasicTypes {
514
514
  }
515
515
  }
516
516
  if (text === undefined) {
517
- text = (_d = node.findFirstExpression(Expressions.FormParamType)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();
517
+ text = (_d = node.findFirstExpression(Expressions.TypeStructure)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();
518
+ }
519
+ if (text === undefined) {
520
+ text = (_e = node.findFirstExpression(Expressions.FormParamType)) === null || _e === void 0 ? void 0 : _e.concatTokens().toUpperCase();
518
521
  }
519
522
  if (text === undefined
520
523
  && node.get() instanceof Statements.Parameter
@@ -525,8 +528,11 @@ class BasicTypes {
525
528
  text = "TYPE";
526
529
  }
527
530
  let found = undefined;
528
- if (text.startsWith("LIKE LINE OF ")) {
529
- const name = (_e = node.findFirstExpression(Expressions.FieldChain)) === null || _e === void 0 ? void 0 : _e.concatTokens();
531
+ if (this.isRAPTypeStructure(text)) {
532
+ return Types.VoidType.get((_f = node.findFirstExpression(Expressions.TypeStructure)) === null || _f === void 0 ? void 0 : _f.concatTokens());
533
+ }
534
+ else if (text.startsWith("LIKE LINE OF ")) {
535
+ const name = (_g = node.findFirstExpression(Expressions.FieldChain)) === null || _g === void 0 ? void 0 : _g.concatTokens();
530
536
  let e = node.findFirstExpression(Expressions.Type);
531
537
  if (e === undefined) {
532
538
  e = node.findFirstExpression(Expressions.FormParamType);
@@ -549,7 +555,7 @@ class BasicTypes {
549
555
  }
550
556
  }
551
557
  else if (text.startsWith("LIKE REF TO ")) {
552
- const name = (_f = node.findFirstExpression(Expressions.FieldChain)) === null || _f === void 0 ? void 0 : _f.concatTokens();
558
+ const name = (_h = node.findFirstExpression(Expressions.FieldChain)) === null || _h === void 0 ? void 0 : _h.concatTokens();
553
559
  const type = this.resolveLikeName(node.findFirstExpression(Expressions.Type), false);
554
560
  if (type === undefined) {
555
561
  return new Types.UnknownType("Type error, could not resolve \"" + name + "\", parseType");
@@ -640,7 +646,7 @@ class BasicTypes {
640
646
  }
641
647
  }
642
648
  if (text.includes(" WITH INDICATORS ")) {
643
- const componentName = (_h = (_g = node.findFirstExpression(Expressions.Type)) === null || _g === void 0 ? void 0 : _g.findDirectExpression(Expressions.ComponentName)) === null || _h === void 0 ? void 0 : _h.concatTokens().toUpperCase();
649
+ const componentName = (_k = (_j = node.findFirstExpression(Expressions.Type)) === null || _j === void 0 ? void 0 : _j.findDirectExpression(Expressions.ComponentName)) === null || _k === void 0 ? void 0 : _k.concatTokens().toUpperCase();
644
650
  if (componentName === undefined) {
645
651
  throw new Error("parseType, componentName expected");
646
652
  }
@@ -666,12 +672,38 @@ class BasicTypes {
666
672
  getRAPBaseEntityName(name) {
667
673
  const association = name.indexOf("\\_");
668
674
  const path = name.indexOf("\\\\");
669
- if (association === -1 && path === -1) {
675
+ const action = name.indexOf("~");
676
+ if (association === -1 && path === -1 && action === -1) {
670
677
  return name;
671
678
  }
672
- const splitAt = association === -1 ? path : path === -1 ? association : Math.min(association, path);
679
+ const candidates = [association, path, action].filter(i => i !== -1);
680
+ const splitAt = Math.min(...candidates);
673
681
  return name.substring(0, splitAt);
674
682
  }
683
+ isRAPDerivedEntityName(name) {
684
+ return name.includes("\\") || name.includes("~");
685
+ }
686
+ isRAPTableFor(text) {
687
+ return text.startsWith("TYPE TABLE FOR ACTION IMPORT ")
688
+ || text.startsWith("TYPE TABLE FOR ACTION RESULT ")
689
+ || text.startsWith("TYPE TABLE FOR CREATE ")
690
+ || text.startsWith("TYPE TABLE FOR DELETE ")
691
+ || text.startsWith("TYPE TABLE FOR DETERMINATION ")
692
+ || text.startsWith("TYPE TABLE FOR EVENT ")
693
+ || text.startsWith("TYPE TABLE FOR FAILED ")
694
+ || text.startsWith("TYPE TABLE FOR FAILED EARLY ")
695
+ || text.startsWith("TYPE TABLE FOR LOCK ")
696
+ || text.startsWith("TYPE TABLE FOR READ ")
697
+ || text.startsWith("TYPE TABLE FOR READ IMPORT ")
698
+ || text.startsWith("TYPE TABLE FOR READ RESULT ")
699
+ || text.startsWith("TYPE TABLE FOR REPORTED EARLY ")
700
+ || text.startsWith("TYPE TABLE FOR UPDATE ");
701
+ }
702
+ isRAPTypeStructure(text) {
703
+ return text.startsWith("TYPE STRUCTURE FOR ")
704
+ || text.startsWith("TYPE RESPONSE FOR ")
705
+ || text.startsWith("TYPE REQUEST FOR CHANGE ");
706
+ }
675
707
  // todo, rewrite this method
676
708
  resolveTypeChain(expr) {
677
709
  var _a, _b, _c, _d;
@@ -51,7 +51,9 @@ class MoveCorresponding {
51
51
  }
52
52
  const sourceType = source_1.Source.runSyntax(s, input);
53
53
  const targetType = target_1.Target.runSyntax(t, input);
54
- if (input.scope.getVersion() < version_1.Version.v740sp05 && input.scope.getVersion() !== version_1.Version.Cloud) {
54
+ if (input.scope.getVersion() < version_1.Version.v740sp05
55
+ && input.scope.getVersion() !== version_1.Version.Cloud
56
+ && input.scope.getVersion() !== version_1.Version.OpenABAP) {
55
57
  if (sourceType instanceof basic_1.TableType && sourceType.isWithHeader() === false) {
56
58
  const message = "MOVE-CORRESPONDING with tables possible from v740sp05";
57
59
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
@@ -480,6 +480,10 @@ class SyntaxLogic {
480
480
  this.scope.addList(values);
481
481
  return true;
482
482
  }
483
+ else if (stru instanceof Structures.TestInjection) {
484
+ // todo: skipped for now
485
+ return true;
486
+ }
483
487
  return false;
484
488
  }
485
489
  updateScopeStatement(node) {
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.js"
77
- return "2.119.36";
77
+ return "2.119.38";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -61,6 +61,8 @@ class DangerousStatementConf extends _basic_rule_config_1.BasicRuleConfig {
61
61
  this.exportDynpro = true;
62
62
  /** Finds instances of dynamic SQL: SELECT, UPDATE, DELETE, INSERT, MODIFY */
63
63
  this.dynamicSQL = true;
64
+ /** Ignore dynamic SQL in IF_RAP_QUERY_PROVIDER~SELECT implementations */
65
+ this.ignoreRAPQueryProvider = true;
64
66
  }
65
67
  }
66
68
  exports.DangerousStatementConf = DangerousStatementConf;
@@ -89,9 +91,19 @@ dynamic SQL can potentially create SQL injection problems`,
89
91
  this.conf = conf;
90
92
  }
91
93
  runParsed(file) {
94
+ var _a;
92
95
  const issues = [];
96
+ let ignoreDynamicSQL = false;
93
97
  for (const statementNode of file.getStatements()) {
94
98
  const statement = statementNode.get();
99
+ if (statement instanceof Statements.MethodImplementation) {
100
+ const methodName = (_a = statementNode.findFirstExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
101
+ ignoreDynamicSQL = this.conf.ignoreRAPQueryProvider === true
102
+ && methodName === "IF_RAP_QUERY_PROVIDER~SELECT";
103
+ }
104
+ else if (statement instanceof Statements.EndMethod) {
105
+ ignoreDynamicSQL = false;
106
+ }
95
107
  let message = undefined;
96
108
  if (this.conf.execSQL && statement instanceof Statements.ExecSQL) {
97
109
  message = "EXEC SQL";
@@ -132,7 +144,7 @@ dynamic SQL can potentially create SQL injection problems`,
132
144
  if (message) {
133
145
  issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));
134
146
  }
135
- if (this.conf.dynamicSQL) {
147
+ if (this.conf.dynamicSQL && ignoreDynamicSQL === false) {
136
148
  message = this.findDynamicSQL(statementNode);
137
149
  if (message) {
138
150
  issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.36",
3
+ "version": "2.119.38",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",