@abaplint/cli 2.120.3 → 2.120.5

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 (2) hide show
  1. package/build/cli.js +237 -133
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -30015,7 +30015,7 @@ class CondBody {
30015
30015
  type = source_1.Source.runSyntax(s, input, targetType);
30016
30016
  }
30017
30017
  else {
30018
- source_1.Source.runSyntax(s, input, targetType);
30018
+ source_1.Source.runSyntax(s, input, targetType !== null && targetType !== void 0 ? targetType : type);
30019
30019
  }
30020
30020
  }
30021
30021
  if (scoped === true) {
@@ -34038,7 +34038,7 @@ const assert_error_1 = __webpack_require__(/*! ../assert_error */ "../core/build
34038
34038
  */
34039
34039
  // TODO: refactor all these method parameters to objects, this is getting messy
34040
34040
  class Source {
34041
- static runSyntax(node, input, targetType, writeReference = false, allowGenericDeference = false) {
34041
+ static runSyntax(node, input, targetType, writeReference = false, allowGenericDeference = false, readReference = true) {
34042
34042
  var _a;
34043
34043
  if (node === undefined) {
34044
34044
  return undefined;
@@ -34084,7 +34084,7 @@ class Source {
34084
34084
  case "SWITCH":
34085
34085
  {
34086
34086
  const foundType = this.determineType(node, input, targetType);
34087
- const bodyType = switch_body_1.SwitchBody.runSyntax(node.findDirectExpression(Expressions.SwitchBody), input);
34087
+ const bodyType = switch_body_1.SwitchBody.runSyntax(node.findDirectExpression(Expressions.SwitchBody), input, foundType);
34088
34088
  if (foundType === undefined || foundType.isGeneric()) {
34089
34089
  this.addIfInferred(node, input, bodyType);
34090
34090
  }
@@ -34216,7 +34216,10 @@ class Source {
34216
34216
  return undefined;
34217
34217
  }
34218
34218
  let context = new unknown_type_1.UnknownType("todo, Source type");
34219
- const type = [_reference_1.ReferenceType.DataReadReference];
34219
+ const type = [];
34220
+ if (readReference) {
34221
+ type.push(_reference_1.ReferenceType.DataReadReference);
34222
+ }
34220
34223
  if (writeReference) {
34221
34224
  type.push(_reference_1.ReferenceType.DataWriteReference);
34222
34225
  }
@@ -35163,7 +35166,7 @@ const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_s
35163
35166
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
35164
35167
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
35165
35168
  class SwitchBody {
35166
- static runSyntax(node, input) {
35169
+ static runSyntax(node, input, targetType) {
35167
35170
  if (node === undefined) {
35168
35171
  return;
35169
35172
  }
@@ -35173,12 +35176,12 @@ class SwitchBody {
35173
35176
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
35174
35177
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
35175
35178
  }
35176
- const type = source_1.Source.runSyntax(thenSource, input);
35179
+ const type = source_1.Source.runSyntax(thenSource, input, targetType);
35177
35180
  for (const s of node.findDirectExpressions(Expressions.Source)) {
35178
35181
  if (s === thenSource) {
35179
35182
  continue;
35180
35183
  }
35181
- source_1.Source.runSyntax(s, input);
35184
+ source_1.Source.runSyntax(s, input, targetType !== null && targetType !== void 0 ? targetType : type);
35182
35185
  }
35183
35186
  return type;
35184
35187
  }
@@ -37152,7 +37155,8 @@ class CallTransformation {
37152
37155
  const resultParameters = node.findExpressionAfterToken("RESULT");
37153
37156
  const resultSources = new Set((resultParameters === null || resultParameters === void 0 ? void 0 : resultParameters.findAllExpressions(Expressions.SimpleSource3)) || []);
37154
37157
  for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
37155
- source_1.Source.runSyntax(s, input, undefined, resultSources.has(s));
37158
+ const isResult = resultSources.has(s);
37159
+ source_1.Source.runSyntax(s, input, undefined, isResult, false, isResult === false);
37156
37160
  }
37157
37161
  for (const d of node.findAllExpressions(Expressions.Dynamic)) {
37158
37162
  dynamic_1.Dynamic.runSyntax(d, input);
@@ -37334,7 +37338,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
37334
37338
  exports.Catch = void 0;
37335
37339
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
37336
37340
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
37337
- const unknown_type_1 = __webpack_require__(/*! ../../types/basic/unknown_type */ "../core/build/src/abap/types/basic/unknown_type.js");
37338
37341
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
37339
37342
  const target_1 = __webpack_require__(/*! ../expressions/target */ "../core/build/src/abap/5_syntax/expressions/target.js");
37340
37343
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
@@ -37342,7 +37345,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
37342
37345
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
37343
37346
  class Catch {
37344
37347
  runSyntax(node, input) {
37345
- var _a, _b;
37348
+ var _a;
37346
37349
  const names = new Set();
37347
37350
  for (const c of node.findDirectExpressions(Expressions.ClassName)) {
37348
37351
  const token = c.getFirstToken();
@@ -37358,7 +37361,6 @@ class Catch {
37358
37361
  else {
37359
37362
  const message = "CATCH, unknown class " + className;
37360
37363
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
37361
- return;
37362
37364
  }
37363
37365
  if (names.has(className)) {
37364
37366
  const message = "Duplicate class name in CATCH: " + className;
@@ -37368,23 +37370,18 @@ class Catch {
37368
37370
  names.add(className);
37369
37371
  }
37370
37372
  const target = node.findDirectExpression(Expressions.Target);
37371
- const firstClassName = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
37372
37373
  if (target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData)) {
37373
- const token = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
37374
- const found = input.scope.existsObject(firstClassName);
37375
- if (token && firstClassName && (found === null || found === void 0 ? void 0 : found.id)) {
37376
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, new basic_1.ObjectReferenceType(found.id), ["inline" /* IdentifierMeta.InlineDefinition */]);
37377
- input.scope.addIdentifier(identifier);
37378
- input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
37379
- }
37380
- else if (token && input.scope.getDDIC().inErrorNamespace(firstClassName) === false) {
37381
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, basic_1.VoidType.get(firstClassName), ["inline" /* IdentifierMeta.InlineDefinition */]);
37382
- input.scope.addIdentifier(identifier);
37383
- input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
37384
- }
37385
- else if (token) {
37386
- const message = "Catch, could not determine type for \"" + token.getStr() + "\"";
37387
- const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, new unknown_type_1.UnknownType(message), ["inline" /* IdentifierMeta.InlineDefinition */]);
37374
+ const token = (_a = target.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
37375
+ if (token) {
37376
+ const classNames = Array.from(names);
37377
+ const unknownClass = classNames.find(name => input.scope.findClassDefinition(name) === undefined);
37378
+ const commonSuperclass = unknownClass === undefined
37379
+ ? this.findCommonSuperclass(classNames, input)
37380
+ : undefined;
37381
+ const type = commonSuperclass
37382
+ ? new basic_1.ObjectReferenceType(commonSuperclass)
37383
+ : basic_1.VoidType.get(unknownClass || classNames.join(" "));
37384
+ const identifier = new _typed_identifier_1.TypedIdentifier(token, input.filename, type, ["inline" /* IdentifierMeta.InlineDefinition */]);
37388
37385
  input.scope.addIdentifier(identifier);
37389
37386
  input.scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, input.filename);
37390
37387
  }
@@ -37408,6 +37405,22 @@ class Catch {
37408
37405
  }
37409
37406
  }
37410
37407
  }
37408
+ findCommonSuperclass(classNames, input) {
37409
+ var _a;
37410
+ const lineages = [];
37411
+ for (const className of classNames) {
37412
+ const lineage = [];
37413
+ let current = input.scope.findClassDefinition(className);
37414
+ const visited = new Set();
37415
+ while (current && visited.has(current.getName().toUpperCase()) === false) {
37416
+ lineage.push(current);
37417
+ visited.add(current.getName().toUpperCase());
37418
+ current = input.scope.findClassDefinition(current.getSuperClass());
37419
+ }
37420
+ lineages.push(lineage);
37421
+ }
37422
+ return (_a = lineages[0]) === null || _a === void 0 ? void 0 : _a.find(candidate => lineages.every(lineage => lineage.some(item => item.getName().toUpperCase() === candidate.getName().toUpperCase())));
37423
+ }
37411
37424
  }
37412
37425
  exports.Catch = Catch;
37413
37426
  //# sourceMappingURL=catch.js.map
@@ -38300,6 +38313,10 @@ class Constant {
38300
38313
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), message));
38301
38314
  return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, basic_2.VoidType.get(_syntax_input_1.CheckSyntaxKey), meta, val);
38302
38315
  }
38316
+ if (this.isNameTooLong(found.getName())) {
38317
+ const message = "CONSTANTS name too long, " + found.getName();
38318
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, found.getToken(), message));
38319
+ }
38303
38320
  return new _typed_identifier_1.TypedIdentifier(found.getToken(), input.filename, found.getType(), meta, val);
38304
38321
  }
38305
38322
  const fallback = node.findFirstExpression(Expressions.DefinitionName);
@@ -38308,10 +38325,17 @@ class Constant {
38308
38325
  const message = "not possible to have a name with only digits";
38309
38326
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fallback.getFirstToken(), message));
38310
38327
  }
38328
+ if (this.isNameTooLong(fallback.concatTokens())) {
38329
+ const message = "CONSTANTS name too long, " + fallback.concatTokens();
38330
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, fallback.getFirstToken(), message));
38331
+ }
38311
38332
  return new _typed_identifier_1.TypedIdentifier(fallback.getFirstToken(), input.filename, new basic_1.UnknownType("constant, fallback"));
38312
38333
  }
38313
38334
  throw new assert_error_1.AssertError("Statement Constant: unexpected structure");
38314
38335
  }
38336
+ isNameTooLong(name) {
38337
+ return name.length > 30;
38338
+ }
38315
38339
  isOnlyDigits(name) {
38316
38340
  return /^[0-9]+$/.test(name);
38317
38341
  }
@@ -38902,6 +38926,10 @@ class Data {
38902
38926
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), message));
38903
38927
  return new _typed_identifier_1.TypedIdentifier(id.getToken(), input.filename, basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey));
38904
38928
  }
38929
+ if (id && this.isNameTooLong(id.getName())) {
38930
+ const message = "DATA name too long, " + id.getName();
38931
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, id.getToken(), message));
38932
+ }
38905
38933
  if ((id === null || id === void 0 ? void 0 : id.getType().isGeneric()) === true
38906
38934
  && (id === null || id === void 0 ? void 0 : id.getType().containsVoid()) === false) {
38907
38935
  const message = "DATA definition cannot be generic, " + (name === null || name === void 0 ? void 0 : name.concatTokens());
@@ -38915,10 +38943,17 @@ class Data {
38915
38943
  const message = "not possible to have a name with only digits";
38916
38944
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name.getFirstToken(), message));
38917
38945
  }
38946
+ if (this.isNameTooLong(name.concatTokens())) {
38947
+ const message = "DATA name too long, " + name.concatTokens();
38948
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, name.getFirstToken(), message));
38949
+ }
38918
38950
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, new unknown_type_1.UnknownType("data, fallback"));
38919
38951
  }
38920
38952
  return undefined;
38921
38953
  }
38954
+ isNameTooLong(name) {
38955
+ return name.length > 30;
38956
+ }
38922
38957
  isOnlyDigits(name) {
38923
38958
  return /^[0-9]+$/.test(name);
38924
38959
  }
@@ -47535,16 +47570,17 @@ class SyntaxLogic {
47535
47570
  this.reg = reg;
47536
47571
  this.issues = [];
47537
47572
  this.object = object;
47538
- this.scope = _current_scope_1.CurrentScope.buildDefault(this.reg, object);
47539
- this.helpers = {
47540
- oooc: new _object_oriented_1.ObjectOriented(this.scope),
47541
- proc: new _procedural_1.Procedural(this.reg, this.scope),
47542
- };
47543
47573
  }
47544
47574
  run() {
47545
47575
  if (this.object.syntaxResult !== undefined) {
47546
47576
  return this.object.syntaxResult;
47547
47577
  }
47578
+ // the scope is built here instead of in the constructor, cached results must stay cheap
47579
+ this.scope = _current_scope_1.CurrentScope.buildDefault(this.reg, this.object);
47580
+ this.helpers = {
47581
+ oooc: new _object_oriented_1.ObjectOriented(this.scope),
47582
+ proc: new _procedural_1.Procedural(this.reg, this.scope),
47583
+ };
47548
47584
  this.issues = [];
47549
47585
  this.reg.getDDICReferences().clear(this.object);
47550
47586
  this.reg.getMSAGReferences().clear(this.object);
@@ -53276,7 +53312,7 @@ class CDSAggregate extends combi_1.Expression {
53276
53312
  getRunnable() {
53277
53313
  const fieldAsType = (0, combi_1.seq)(_1.CDSPrefixedName, "AS", _1.CDSType);
53278
53314
  const funcAsType = (0, combi_1.seq)(_1.CDSFunction, "AS", _1.CDSType);
53279
- const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSCase, funcAsType, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*");
53315
+ const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSCast, _1.CDSCase, funcAsType, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*");
53280
53316
  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)), ")");
53281
53317
  }
53282
53318
  }
@@ -53401,9 +53437,10 @@ class CDSAnnotationSimple extends combi_1.Expression {
53401
53437
  getRunnable() {
53402
53438
  const ident = (0, combi_1.regex)(/^[\w_]+$/);
53403
53439
  // #(expr) where expr can be: identifier, dotted path, string, or concatenation with +
53404
- const hashArg = (0, combi_1.altPrio)(_1.CDSString, cds_prefixed_name_1.CDSPrefixedName, ident);
53440
+ const funcCall = (0, combi_1.seq)(ident, "(", (0, combi_1.altPrio)(_1.CDSString, cds_prefixed_name_1.CDSPrefixedName, ident), ")");
53441
+ const hashArg = (0, combi_1.altPrio)(_1.CDSString, funcCall, cds_prefixed_name_1.CDSPrefixedName, ident);
53405
53442
  const hashExpr = (0, combi_1.seq)(hashArg, (0, combi_1.starPrio)((0, combi_1.seq)("+", hashArg)));
53406
- const value = (0, combi_1.altPrio)(_1.CDSString, "true", "false", "null", (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)("#", "(", hashExpr, ")"), (0, combi_1.regex)(/^#[\w_]+$/));
53443
+ const value = (0, combi_1.altPrio)(_1.CDSString, "true", "false", "null", (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+[eE]$/), (0, combi_1.altPrio)("+", "-"), (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+[eE]$/), (0, combi_1.altPrio)("+", "-"), (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)("-", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)("#", "(", hashExpr, ")"), (0, combi_1.regex)(/^#[\w_]+$/));
53407
53444
  return value;
53408
53445
  }
53409
53446
  }
@@ -53561,9 +53598,9 @@ class CDSAssociation extends combi_1.Expression {
53561
53598
  const numericCardinality = (0, combi_1.seq)("[", cardNum, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", cardNum)), "]");
53562
53599
  // Text-based OF form: "association of one to many Target on ..." — text cardinality includes "TO"
53563
53600
  const ofTextSide = (0, combi_1.altPrio)((0, combi_1.seq)("EXACT", "ONE"), "ONE", "MANY");
53564
- const ofTextForm = (0, combi_1.seq)("ASSOCIATION", "OF", ofTextSide, "TO", ofTextSide, _1.CDSRelation, "ON", _1.CDSCondition);
53601
+ const ofTextForm = (0, combi_1.seq)("ASSOCIATION", "OF", ofTextSide, "TO", ofTextSide, _1.CDSRelation, "ON", _1.CDSCondition, (0, combi_1.opt)((0, combi_1.seq)("WITH", "DEFAULT", "FILTER", _1.CDSCondition)));
53565
53602
  // Numeric OF form: "association of [0..1] to Target on ..."
53566
- const ofNumericForm = (0, combi_1.seq)("ASSOCIATION", "OF", numericCardinality, "TO", _1.CDSRelation, "ON", _1.CDSCondition);
53603
+ const ofNumericForm = (0, combi_1.seq)("ASSOCIATION", "OF", numericCardinality, "TO", _1.CDSRelation, "ON", _1.CDSCondition, (0, combi_1.opt)((0, combi_1.seq)("WITH", "DEFAULT", "FILTER", _1.CDSCondition)));
53567
53604
  // "association [0..1] to Target as _Alias on condition" — standard form
53568
53605
  const parentForm = (0, combi_1.seq)("ASSOCIATION", "TO", "PARENT", _1.CDSRelation);
53569
53606
  const standardForm = (0, combi_1.seq)("ASSOCIATION", (0, combi_1.optPrio)(cds_cardinality_1.CDSCardinality), "TO", (0, combi_1.opt)((0, combi_1.altPrio)(textCardinality, "PARENT")), _1.CDSRelation, "ON", _1.CDSCondition, (0, combi_1.opt)((0, combi_1.seq)("WITH", "DEFAULT", "FILTER", _1.CDSCondition)));
@@ -53621,7 +53658,7 @@ class CDSCase extends combi_1.Expression {
53621
53658
  // CDSArithmetics is still tried after for arithmetic like (-1)*Amount or (2*A)-B.
53622
53659
  const caseParen = (0, combi_1.seq)("(", CDSCase, ")");
53623
53660
  const value = (0, combi_1.altPrio)(_1.CDSString, CDSCase, caseParen, _1.CDSArithmetics, _1.CDSCast, _1.CDSAggregate, _1.CDSArithParen, _1.CDSFunction, _1.CDSInteger, _1.CDSPrefixedName);
53624
- const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSFunction, _1.CDSPrefixedName), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)));
53661
+ const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSString, _1.CDSCast, _1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSFunction, _1.CDSPrefixedName), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)));
53625
53662
  const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value));
53626
53663
  return (0, combi_1.seq)("CASE", (0, combi_1.altPrio)(complex, simple), (0, combi_1.optPrio)((0, combi_1.seq)("ELSE", value)), "END");
53627
53664
  }
@@ -53646,7 +53683,7 @@ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../cor
53646
53683
  class CDSCast extends combi_1.Expression {
53647
53684
  getRunnable() {
53648
53685
  // CDSArithmetics before CDSFunction/CDSAggregate: handles function()*n, cast()*n, sum()*n patterns
53649
- const first = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSFunction, _1.CDSArithParen, _1.CDSCase, _1.CDSAggregate, CDSCast, _1.CDSString, _1.CDSPrefixedName, _1.CDSInteger);
53686
+ const first = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSFunction, _1.CDSArithParen, _1.CDSCase, _1.CDSAggregate, CDSCast, _1.CDSInteger, _1.CDSString, _1.CDSPrefixedName);
53650
53687
  return (0, combi_1.seq)("CAST", "(", first, "AS", _1.CDSType, (0, combi_1.optPrio)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
53651
53688
  }
53652
53689
  }
@@ -53671,8 +53708,9 @@ const cds_cardinality_1 = __webpack_require__(/*! ./cds_cardinality */ "../core/
53671
53708
  class CDSComposition extends combi_1.Expression {
53672
53709
  getRunnable() {
53673
53710
  const num = (0, combi_1.altPrio)("ONE", "MANY");
53674
- // Text cardinality after OF: "of exact one to many", "of one to many", or bare "of many" / "of one"
53675
- const textCardinality = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.opt)("EXACT"), num, "TO", num), (0, combi_1.seq)((0, combi_1.opt)("EXACT"), num));
53711
+ const exactNum = (0, combi_1.seq)((0, combi_1.opt)("EXACT"), num);
53712
+ // Text cardinality after OF: "of exact one to exact one", "of exact one to many", "of one to many", or bare "of many" / "of one"
53713
+ const textCardinality = (0, combi_1.altPrio)((0, combi_1.seq)(exactNum, "TO", exactNum), (0, combi_1.seq)((0, combi_1.opt)("EXACT"), num));
53676
53714
  // Numeric cardinality [n..m] before OF: any non-negative integer or *
53677
53715
  const cardNum = (0, combi_1.altPrio)((0, combi_1.regex)(/^\d+$/), "*");
53678
53716
  const numericCardinality = (0, combi_1.seq)("[", cardNum, (0, combi_1.optPrio)((0, combi_1.seq)(".", ".", cardNum)), "]");
@@ -53701,7 +53739,7 @@ class CDSCondition extends combi_1.Expression {
53701
53739
  getRunnable() {
53702
53740
  // CDSArithmetics before CDSCast/CDSFunction so cast(A)-cast(B) is handled as arithmetic, not two separate casts
53703
53741
  // CDSCase allows nested case expressions on either side of a comparison
53704
- const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSArithmetics, _1.CDSCast, _1.CDSFunction, _1.CDSAggregate, _1.CDSCase, _1.CDSArithParen, _1.CDSPrefixedName);
53742
+ const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSArithmetics, _1.CDSCast, _1.CDSFunction, _1.CDSAggregate, _1.CDSCase, _1.CDSArithParen, cds_integer_1.CDSInteger, _1.CDSPrefixedName);
53705
53743
  const nonLikeOperators = (0, combi_1.altPrio)("=", (0, combi_1.seq)("!", "="), (0, combi_1.seq)("<", ">"), (0, combi_1.seq)(">", "="), (0, combi_1.seq)("<", "="), "<", ">");
53706
53744
  const likeOperators = (0, combi_1.altPrio)("LIKE", "NOT LIKE");
53707
53745
  // Right side of comparison: simple values first, then parenthesized, then full arithmetic last.
@@ -53765,7 +53803,7 @@ class CDSDefineCustom extends combi_1.Expression {
53765
53803
  getRunnable() {
53766
53804
  const field = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
53767
53805
  const compsiOrAssoci = (0, combi_1.seq)(cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
53768
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
53806
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)((0, combi_1.str)("DEFINE")), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
53769
53807
  }
53770
53808
  }
53771
53809
  exports.CDSDefineCustom = CDSDefineCustom;
@@ -53787,7 +53825,7 @@ const _1 = __webpack_require__(/*! . */ "../core/build/src/cds/expressions/index
53787
53825
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
53788
53826
  class CDSDefineExternalEntity extends combi_1.Expression {
53789
53827
  getRunnable() {
53790
- const extNameValue = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^"[^"]*"$/));
53828
+ const extNameValue = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^"(?:[^"]|"")*"$/));
53791
53829
  const externalName = (0, combi_1.seq)("EXTERNAL", "NAME", extNameValue);
53792
53830
  const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
53793
53831
  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), ";");
@@ -53795,7 +53833,7 @@ class CDSDefineExternalEntity extends combi_1.Expression {
53795
53833
  const body = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
53796
53834
  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));
53797
53835
  const staticEntity = (0, combi_1.seq)("STATIC", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName));
53798
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))))), (0, combi_1.opt)(";"));
53836
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))), (0, combi_1.optPrio)((0, combi_1.seq)("ON", "UNLINKED", (0, combi_1.altPrio)("FAIL", "IGNORE"))))), (0, combi_1.opt)(";"));
53799
53837
  }
53800
53838
  }
53801
53839
  exports.CDSDefineExternalEntity = CDSDefineExternalEntity;
@@ -53823,10 +53861,10 @@ class CDSDefineHierarchy extends combi_1.Expression {
53823
53861
  const siblingsOrder = (0, combi_1.seq)("SIBLINGS", "ORDER", "BY", siblingsOrderField, (0, combi_1.star)((0, combi_1.seq)(",", siblingsOrderField)));
53824
53862
  const directory = (0, combi_1.seq)("DIRECTORY", _1.CDSName, "FILTER", "BY", _1.CDSCondition);
53825
53863
  // DATE PERIOD: period from <field> to <field> [valid from :p to :p]
53826
- 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)));
53864
+ const datePeriod = (0, combi_1.seq)("PERIOD", "FROM", _1.CDSName, "TO", _1.CDSName, (0, combi_1.opt)((0, combi_1.seq)("VALID", "FROM", (0, combi_1.altPrio)(_1.CDSString, _1.CDSPrefixedName), "TO", (0, combi_1.altPrio)(_1.CDSString, _1.CDSPrefixedName))));
53827
53865
  const depthValue = (0, combi_1.altPrio)(_1.CDSString, _1.CDSInteger, _1.CDSPrefixedName);
53828
53866
  const loadMode = (0, combi_1.altPrio)("BULK", "INCREMENTAL", _1.CDSPrefixedName);
53829
- const hierarchyBody = (0, combi_1.seq)("SOURCE", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), "CHILD", "TO", "PARENT", "ASSOCIATION", _1.CDSName, (0, combi_1.opt)(directory), (0, combi_1.opt)(datePeriod), (0, combi_1.opt)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("LOAD", loadMode)), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED", (0, combi_1.seq)("LEAVES", (0, combi_1.optPrio)("ONLY"))))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", (0, combi_1.altPrio)("BREAKUP", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("GENERATE", "SPANTREE")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("ON", "OFF", "FORCE"))));
53867
+ const hierarchyBody = (0, combi_1.seq)("SOURCE", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), "CHILD", "TO", "PARENT", "ASSOCIATION", _1.CDSName, (0, combi_1.opt)((0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.opt)(directory), datePeriod, (0, combi_1.opt)(directory)), (0, combi_1.seq)(datePeriod, (0, combi_1.opt)(directory)), directory)), (0, combi_1.opt)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("LOAD", loadMode)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED", (0, combi_1.seq)("LEAVES", (0, combi_1.optPrio)("ONLY"))))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", (0, combi_1.altPrio)("BREAKUP", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("GENERATE", "SPANTREE")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("ON", "OFF", "FORCE"))));
53830
53868
  return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), "HIERARCHY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "AS", "PARENT", "CHILD", "HIERARCHY", "(", hierarchyBody, ")", "{", (0, combi_1.seq)(field, (0, combi_1.star)((0, combi_1.seq)(",", field))), "}", (0, combi_1.opt)(";"));
53831
53869
  }
53832
53870
  }
@@ -53850,9 +53888,14 @@ const __1 = __webpack_require__(/*! ../.. */ "../core/build/src/index.js");
53850
53888
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
53851
53889
  class CDSDefineProjection extends combi_1.Expression {
53852
53890
  getRunnable() {
53853
- // redefine association _Assoc redirected to [composition child | parent] Entity
53854
- 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);
53855
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("TRANSIENT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
53891
+ const redefineCard = (0, combi_1.altPrio)("EXACT ONE TO EXACT ONE", "EXACT ONE TO MANY", "EXACT ONE TO ONE", "MANY TO EXACT ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO EXACT ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY", _1.CDSInteger, "*");
53892
+ const redefineAssocFilter = (0, combi_1.seq)("[", (0, combi_1.optPrio)((0, combi_1.seq)(redefineCard, ":")), _1.CDSCondition, "]");
53893
+ const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSPrefixedName, (0, combi_1.optPrio)(redefineAssocFilter), (0, combi_1.opt)(_1.CDSAs), "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
53894
+ const typedLiteralVal = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
53895
+ const aspectValue = (0, combi_1.altPrio)(typedLiteralVal, _1.CDSString, _1.CDSPrefixedName);
53896
+ const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", aspectValue);
53897
+ const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")", (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
53898
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("TRANSIENT"), (0, combi_1.opt)("ROOT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.starPrio)(bindAspect), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
53856
53899
  }
53857
53900
  }
53858
53901
  exports.CDSDefineProjection = CDSDefineProjection;
@@ -53932,9 +53975,9 @@ const cds_with_parameters_1 = __webpack_require__(/*! ./cds_with_parameters */ "
53932
53975
  class CDSDefineView extends combi_1.Expression {
53933
53976
  getRunnable() {
53934
53977
  const columnAlias = (0, combi_1.seq)("(", cds_name_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(",", cds_name_1.CDSName)), ")");
53935
- const parenSelect = (0, combi_1.seq)("(", cds_select_1.CDSSelect, ")");
53936
- const unionBranch = (0, combi_1.altPrio)(parenSelect, cds_select_1.CDSSelect);
53937
- const topLevelSelect = (0, combi_1.altPrio)((0, combi_1.seq)(parenSelect, (0, combi_1.star)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch)))), cds_select_1.CDSSelect);
53978
+ const unionBranch = (0, combi_1.altPrio)(_1.CDSParenSelect, cds_select_1.CDSSelect);
53979
+ const unionOps = (0, combi_1.star)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch)));
53980
+ const topLevelSelect = (0, combi_1.altPrio)((0, combi_1.seq)(_1.CDSParenSelect, unionOps), (0, combi_1.seq)(cds_select_1.CDSSelect, unionOps));
53938
53981
  return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("WRITABLE"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), cds_name_1.CDSName, (0, combi_1.opt)(columnAlias), (0, combi_1.opt)(cds_with_parameters_1.CDSWithParameters), "AS", topLevelSelect, (0, combi_1.opt)((0, combi_1.seq)("WITH", "HIERARCHY", cds_name_1.CDSName)), (0, combi_1.opt)(";"));
53939
53982
  }
53940
53983
  }
@@ -53959,16 +54002,16 @@ const cds_as_1 = __webpack_require__(/*! ./cds_as */ "../core/build/src/cds/expr
53959
54002
  const cds_cast_1 = __webpack_require__(/*! ./cds_cast */ "../core/build/src/cds/expressions/cds_cast.js");
53960
54003
  class CDSElement extends combi_1.Expression {
53961
54004
  getRunnable() {
53962
- const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName);
54005
+ const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName, (0, combi_1.optPrio)(_1.CDSParametersSelect));
53963
54006
  const colonThing = (0, combi_1.seq)(":", (0, combi_1.altPrio)(_1.CDSType, _1.CDSName, "LOCALIZED"));
53964
54007
  const extensionWildcard = (0, combi_1.seq)("$extension", ".", "*");
53965
54008
  const excludingNames = (0, combi_1.seq)(_1.CDSName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSName)));
53966
54009
  const excluding = (0, combi_1.seq)("EXCLUDING", "{", excludingNames, "}");
53967
- const includeElement = (0, combi_1.seq)("INCLUDE", _1.CDSPrefixedName, (0, combi_1.optPrio)(excluding), (0, combi_1.optPrio)("SIGNATURE ONLY"));
54010
+ const includeElement = (0, combi_1.seq)("INCLUDE", (0, combi_1.stopBefore1)("AS", "KEY", "VIRTUAL", "}"), _1.CDSPrefixedName, (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("SIGNATURE ONLY", (0, combi_1.optPrio)(excluding)), (0, combi_1.seq)(excluding, (0, combi_1.optPrio)("SIGNATURE ONLY")))));
53968
54011
  const typedVirtual = (0, combi_1.seq)("VIRTUAL", _1.CDSName, ":", _1.CDSType);
53969
54012
  const pathSegment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(_1.CDSString, _1.CDSName, "*"), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.CDSParametersSelect, _1.CDSParameters)));
53970
54013
  const funcWithPath = (0, combi_1.seq)(_1.CDSFunction, (0, combi_1.plusPrio)(pathSegment));
53971
- const body = (0, combi_1.altPrio)(extensionWildcard, includeElement, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, funcWithPath, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))), _1.CDSInteger);
54014
+ const body = (0, combi_1.altPrio)(extensionWildcard, includeElement, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, funcWithPath, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), _1.CDSInteger, (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))));
53972
54015
  const elementBody = (0, combi_1.altPrio)(typedVirtual, (0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
53973
54016
  return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), elementBody, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.starPrio)(_1.CDSAnnotation));
53974
54017
  }
@@ -53994,10 +54037,20 @@ class CDSExtendView extends combi_1.Expression {
53994
54037
  getRunnable() {
53995
54038
  const namedot = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)), (0, combi_1.optPrio)(_1.CDSAs));
53996
54039
  const valueNested = (0, combi_1.seq)("{", namedot, (0, combi_1.star)((0, combi_1.seq)(",", namedot)), "}");
53997
- 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);
54040
+ const redefineCard = (0, combi_1.altPrio)("EXACT ONE TO EXACT ONE", "EXACT ONE TO MANY", "EXACT ONE TO ONE", "MANY TO EXACT ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO EXACT ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY", _1.CDSInteger, "*");
54041
+ const redefineAssocFilter = (0, combi_1.seq)("[", (0, combi_1.optPrio)((0, combi_1.seq)(redefineCard, ":")), _1.CDSCondition, "]");
54042
+ const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSPrefixedName, (0, combi_1.optPrio)(redefineAssocFilter), (0, combi_1.opt)(_1.CDSAs), "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
53998
54043
  const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
53999
54044
  const elementNested = (0, combi_1.seq)("{", (0, combi_1.altPrio)("*", elementList), "}");
54000
- const extendView = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("EXTEND VIEW"), (0, combi_1.opt)((0, combi_1.str)("ENTITY")), _1.CDSName, (0, combi_1.str)("WITH"), (0, combi_1.opt)(_1.CDSName), (0, combi_1.star)(redefineAssoc), (0, combi_1.star)(_1.CDSAssociation), (0, combi_1.altPrio)(elementNested, valueNested), (0, combi_1.opt)(";"));
54045
+ const unionElemList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
54046
+ const unionBranchBody = (0, combi_1.seq)((0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), "{", (0, combi_1.altPrio)("*", unionElemList), "}", (0, combi_1.optPrio)(_1.CDSGroupBy));
54047
+ const parenUnionBody = (0, combi_1.seq)("(", (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), "{", (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), "}", (0, combi_1.star)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), "{", (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), "}")), ")");
54048
+ const unionSuffix = (0, combi_1.seq)((0, combi_1.optPrio)(_1.CDSGroupBy), (0, combi_1.star)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), (0, combi_1.altPrio)(parenUnionBody, unionBranchBody))));
54049
+ const typedLiteralVal = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
54050
+ const aspectValue = (0, combi_1.altPrio)(typedLiteralVal, _1.CDSString, _1.CDSPrefixedName);
54051
+ const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", aspectValue);
54052
+ const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")", (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
54053
+ const extendView = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("EXTEND VIEW"), (0, combi_1.opt)((0, combi_1.str)("ENTITY")), _1.CDSName, (0, combi_1.str)("WITH"), (0, combi_1.opt)(_1.CDSName), (0, combi_1.star)(redefineAssoc), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, _1.CDSComposition)), (0, combi_1.starPrio)(bindAspect), (0, combi_1.altPrio)(parenUnionBody, elementNested, valueNested), unionSuffix, (0, combi_1.opt)(";"));
54001
54054
  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, ";");
54002
54055
  const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
54003
54056
  const entityBody = (0, combi_1.seq)("{", (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp)), "}");
@@ -54077,6 +54130,7 @@ class CDSFunction extends combi_1.Expression {
54077
54130
  const occurrencesRegexpr = (0, combi_1.seq)("OCCURRENCES_REGEXPR", "(", conversionInputs, ")");
54078
54131
  const substrRegexpr = (0, combi_1.seq)("SUBSTR_REGEXPR", "(", conversionInputs, ")");
54079
54132
  const locateRegexpr = (0, combi_1.seq)("LOCATE_REGEXPR", "(", conversionInputs, ")");
54133
+ const sqrt = (0, combi_1.seq)("SQRT", "(", _1.CDSFunctionInput, ")");
54080
54134
  const extFuncName = (0, combi_1.regex)(/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/i);
54081
54135
  const genericArgs = (0, combi_1.seq)(_1.CDSFunctionInput, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSFunctionInput)));
54082
54136
  const namedArgValue = (0, combi_1.altPrio)((0, combi_1.seq)("INTERVAL", _1.CDSFunctionInput, _1.CDSName), _1.CDSFunctionInput, _1.CDSName);
@@ -54084,7 +54138,7 @@ class CDSFunction extends combi_1.Expression {
54084
54138
  const namedArgColon = (0, combi_1.seq)(_1.CDSName, ":", namedArgValue);
54085
54139
  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))));
54086
54140
  const genericFunc = (0, combi_1.seq)(extFuncName, "(", (0, combi_1.optPrio)((0, combi_1.altPrio)(namedArgs, genericArgs)), ")");
54087
- 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);
54141
+ return (0, combi_1.altPrio)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, upper, lower, abs, ceil, floor, round, div, division, concat_with_space, dats_is_valid, tims_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, utcl_current, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp, mod, left, right, lpad, rpad, instr, length, ltrim, rtrim, replace, unitConversion, currencyConversion, decimalShift, fltp_to_dec, ratioOf, replaceRegexpr, matchesRegexpr, occurrencesRegexpr, substrRegexpr, locateRegexpr, curr_to_decfloat_amount, sqrt, genericFunc);
54088
54142
  }
54089
54143
  }
54090
54144
  exports.CDSFunction = CDSFunction;
@@ -54106,8 +54160,9 @@ const _1 = __webpack_require__(/*! . */ "../core/build/src/cds/expressions/index
54106
54160
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54107
54161
  class CDSFunctionInput extends combi_1.Expression {
54108
54162
  getRunnable() {
54109
- const input = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSCast, _1.CDSFunction, _1.CDSCase, _1.CDSString, _1.CDSPrefixedName, _1.CDSInteger);
54110
- return input;
54163
+ const positional = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSArithParen, _1.CDSAggregate, _1.CDSCast, _1.CDSFunction, _1.CDSCase, _1.CDSString, _1.CDSPrefixedName, _1.CDSInteger);
54164
+ const named = (0, combi_1.seq)(_1.CDSName, "=", ">", positional);
54165
+ return (0, combi_1.altPrio)(named, positional);
54111
54166
  }
54112
54167
  }
54113
54168
  exports.CDSFunctionInput = CDSFunctionInput;
@@ -54236,10 +54291,14 @@ exports.CDSJoin = CDSJoin;
54236
54291
  Object.defineProperty(exports, "__esModule", ({ value: true }));
54237
54292
  exports.CDSName = void 0;
54238
54293
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54294
+ const KEYWORDS = ["AS", "ON", "WHERE", "WITH", "UNION", "GROUP", "HAVING",
54295
+ "AND", "OR", "BETWEEN", "LIKE", "IN", "EXISTS",
54296
+ "WHEN", "THEN", "ELSE", "END", "CASE", "CAST"];
54239
54297
  class CDSName extends combi_1.Expression {
54240
54298
  getRunnable() {
54241
- const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
54242
- return (0, combi_1.altPrio)((0, combi_1.regex)(/^"(?:[^"]|"")*"$/), (0, combi_1.seq)((0, combi_1.optPrio)(":"), (0, combi_1.optPrio)(pre), (0, combi_1.regex)(/^\$?#?[\w_]+$/)));
54299
+ const word = (0, combi_1.regex)(/^\$?#?[\w_]+$/);
54300
+ const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w]+$/), "/", (0, combi_1.stopBefore1)(...KEYWORDS), (0, combi_1.regex)(/^[\w_]+$/));
54301
+ return (0, combi_1.altPrio)((0, combi_1.regex)(/^"(?:[^"]|"")*"$/), (0, combi_1.seq)((0, combi_1.optPrio)(":"), slashName), (0, combi_1.seq)((0, combi_1.optPrio)(":"), word));
54243
54302
  }
54244
54303
  }
54245
54304
  exports.CDSName = CDSName;
@@ -54286,7 +54345,8 @@ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../cor
54286
54345
  class CDSParametersSelect extends combi_1.Expression {
54287
54346
  getRunnable() {
54288
54347
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
54289
- const value = (0, combi_1.alt)(_1.CDSInteger, name, _1.CDSString);
54348
+ const typedLiteral = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
54349
+ const value = (0, combi_1.altPrio)(typedLiteral, _1.CDSInteger, name, _1.CDSString);
54290
54350
  const colonPair = (0, combi_1.seq)(name, ":", value, (0, combi_1.optPrio)("DEFAULT"));
54291
54351
  const arrowPair = (0, combi_1.seq)(name, "=", ">", value);
54292
54352
  const nameValue = (0, combi_1.altPrio)(colonPair, arrowPair);
@@ -54298,6 +54358,30 @@ exports.CDSParametersSelect = CDSParametersSelect;
54298
54358
 
54299
54359
  /***/ },
54300
54360
 
54361
+ /***/ "../core/build/src/cds/expressions/cds_paren_select.js"
54362
+ /*!*************************************************************!*\
54363
+ !*** ../core/build/src/cds/expressions/cds_paren_select.js ***!
54364
+ \*************************************************************/
54365
+ (__unused_webpack_module, exports, __webpack_require__) {
54366
+
54367
+ "use strict";
54368
+
54369
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
54370
+ exports.CDSParenSelect = void 0;
54371
+ const _1 = __webpack_require__(/*! . */ "../core/build/src/cds/expressions/index.js");
54372
+ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54373
+ class CDSParenSelect extends combi_1.Expression {
54374
+ getRunnable() {
54375
+ const unionBranch = (0, combi_1.altPrio)(CDSParenSelect, _1.CDSSelect);
54376
+ const unionOps = (0, combi_1.star)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.opt)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch)));
54377
+ return (0, combi_1.seq)("(", (0, combi_1.altPrio)((0, combi_1.seq)(CDSParenSelect, unionOps), (0, combi_1.seq)(_1.CDSSelect, unionOps)), ")");
54378
+ }
54379
+ }
54380
+ exports.CDSParenSelect = CDSParenSelect;
54381
+ //# sourceMappingURL=cds_paren_select.js.map
54382
+
54383
+ /***/ },
54384
+
54301
54385
  /***/ "../core/build/src/cds/expressions/cds_prefixed_name.js"
54302
54386
  /*!**************************************************************!*\
54303
54387
  !*** ../core/build/src/cds/expressions/cds_prefixed_name.js ***!
@@ -54310,10 +54394,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
54310
54394
  exports.CDSPrefixedName = void 0;
54311
54395
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54312
54396
  const cds_name_1 = __webpack_require__(/*! ./cds_name */ "../core/build/src/cds/expressions/cds_name.js");
54397
+ const cds_integer_1 = __webpack_require__(/*! ./cds_integer */ "../core/build/src/cds/expressions/cds_integer.js");
54313
54398
  const cds_parameters_1 = __webpack_require__(/*! ./cds_parameters */ "../core/build/src/cds/expressions/cds_parameters.js");
54314
54399
  const cds_parameters_select_1 = __webpack_require__(/*! ./cds_parameters_select */ "../core/build/src/cds/expressions/cds_parameters_select.js");
54315
54400
  const cds_condition_1 = __webpack_require__(/*! ./cds_condition */ "../core/build/src/cds/expressions/cds_condition.js");
54316
- const cds_integer_1 = __webpack_require__(/*! ./cds_integer */ "../core/build/src/cds/expressions/cds_integer.js");
54317
54401
  const cds_string_1 = __webpack_require__(/*! ./cds_string */ "../core/build/src/cds/expressions/cds_string.js");
54318
54402
  class CDSPrefixedName extends combi_1.Expression {
54319
54403
  getRunnable() {
@@ -54323,13 +54407,17 @@ class CDSPrefixedName extends combi_1.Expression {
54323
54407
  const cardinalityJoin = (0, combi_1.seq)("[", cardSpec, ":", joinType, "]");
54324
54408
  const cardinalityJoinWhere = (0, combi_1.seq)("[", cardSpec, ":", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
54325
54409
  const joinWhere = (0, combi_1.seq)("[", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
54326
- const textCard = (0, combi_1.altPrio)("MANY TO EXACT ONE", "MANY TO ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY");
54410
+ const textCard = (0, combi_1.altPrio)("EXACT ONE TO EXACT ONE", "EXACT ONE TO MANY", "EXACT ONE TO ONE", "MANY TO EXACT ONE", "MANY TO MANY", "MANY TO ONE", "ONE TO EXACT ONE", "ONE TO MANY", "ONE TO ONE", "TO EXACT ONE", "TO ONE", "TO MANY");
54327
54411
  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))), "]");
54328
54412
  const cardNum = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
54329
54413
  const rangeCard = (0, combi_1.seq)(cds_integer_1.CDSInteger, ".", ".", cardNum);
54330
54414
  const rangeCardFilter = (0, combi_1.seq)("[", rangeCard, ":", cds_condition_1.CDSCondition, "]");
54331
- 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, "]"));
54332
- 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));
54415
+ const rangeOnly = (0, combi_1.seq)("[", rangeCard, "]");
54416
+ const numToText = (0, combi_1.seq)(cds_integer_1.CDSInteger, (0, combi_1.altPrio)("TO EXACT ONE", "TO ONE", "TO MANY"));
54417
+ const numTextCardFilter = (0, combi_1.seq)("[", numToText, (0, combi_1.optPrio)((0, combi_1.seq)(":", cds_condition_1.CDSCondition)), "]");
54418
+ const numToNum = (0, combi_1.seq)("[", cds_integer_1.CDSInteger, "TO", cds_integer_1.CDSInteger, (0, combi_1.optPrio)((0, combi_1.seq)(":", cds_condition_1.CDSCondition)), "]");
54419
+ const pathFilter = (0, combi_1.altPrio)(cardinalityJoinWhere, joinWhere, cardinalityJoin, joinRedirect, numToNum, numTextCardFilter, textCardFilter, rangeCardFilter, rangeOnly, (0, combi_1.seq)("[", cardSpec, ":", cds_condition_1.CDSCondition, "]"), (0, combi_1.seq)("[", cardSpec, "]"), (0, combi_1.seq)("[", cds_condition_1.CDSCondition, "]"));
54420
+ const segment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(cds_string_1.CDSString, cds_integer_1.CDSInteger, cds_name_1.CDSName, "*"), (0, combi_1.optPrio)((0, combi_1.altPrio)(cds_parameters_select_1.CDSParametersSelect, cds_parameters_1.CDSParameters)), (0, combi_1.optPrio)(pathFilter));
54333
54421
  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));
54334
54422
  }
54335
54423
  }
@@ -54371,10 +54459,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
54371
54459
  exports.CDSRelation = void 0;
54372
54460
  const _1 = __webpack_require__(/*! . */ "../core/build/src/cds/expressions/index.js");
54373
54461
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54462
+ const KEYWORDS = ["AS", "ON", "WHERE", "WITH", "UNION", "GROUP", "HAVING",
54463
+ "AND", "OR", "BETWEEN", "LIKE", "IN", "EXISTS",
54464
+ "WHEN", "THEN", "ELSE", "END", "CASE", "CAST"];
54374
54465
  class CDSRelation extends combi_1.Expression {
54375
54466
  getRunnable() {
54376
- const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
54377
- return (0, combi_1.seq)((0, combi_1.opt)(pre), (0, combi_1.regex)(/^[\w_]+$/), (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs));
54467
+ const word = (0, combi_1.regex)(/^[\w_]+$/);
54468
+ const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w]+$/), "/", (0, combi_1.stopBefore1)(...KEYWORDS), (0, combi_1.regex)(/^[\w_]+$/));
54469
+ const name = (0, combi_1.altPrio)(slashName, word);
54470
+ return (0, combi_1.seq)(name, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs));
54378
54471
  }
54379
54472
  }
54380
54473
  exports.CDSRelation = CDSRelation;
@@ -54398,11 +54491,12 @@ const cds_association_1 = __webpack_require__(/*! ./cds_association */ "../core/
54398
54491
  const cds_join_1 = __webpack_require__(/*! ./cds_join */ "../core/build/src/cds/expressions/cds_join.js");
54399
54492
  class CDSSelect extends combi_1.Expression {
54400
54493
  getRunnable() {
54401
- const fields = (0, combi_1.seq)((0, combi_1.star)((0, combi_1.seq)(_1.CDSElement, ",")), _1.CDSElement);
54494
+ const fields = (0, combi_1.seq)((0, combi_1.stopBefore1)("FROM"), (0, combi_1.star)((0, combi_1.seq)(_1.CDSElement, ",")), _1.CDSElement);
54402
54495
  const distinct = (0, combi_1.str)("DISTINCT");
54403
54496
  const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
54404
54497
  const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
54405
- const aspectValue = (0, combi_1.altPrio)(_1.CDSString, _1.CDSPrefixedName);
54498
+ const typedLiteralVal = (0, combi_1.seq)(_1.CDSType, _1.CDSString);
54499
+ const aspectValue = (0, combi_1.altPrio)(typedLiteralVal, _1.CDSString, _1.CDSPrefixedName);
54406
54500
  const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", aspectValue);
54407
54501
  const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")", (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
54408
54502
  const parenSelect = (0, combi_1.seq)("(", CDSSelect, ")");
@@ -54477,16 +54571,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
54477
54571
  exports.CDSTableField = void 0;
54478
54572
  const _1 = __webpack_require__(/*! . */ "../core/build/src/cds/expressions/index.js");
54479
54573
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54480
- // A single field or association/composition inside a `define table entity { ... }`
54481
- // inline body. Wraps annotations + name + type together so tooling can iterate
54482
- // per-field with associated field-level annotations (matches the CDSElement
54483
- // shape used for select-list elements).
54484
54574
  class CDSTableField extends combi_1.Expression {
54485
54575
  getRunnable() {
54486
54576
  const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
54577
+ const excludingNames = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSName)));
54578
+ const excluding = (0, combi_1.seq)("EXCLUDING", "{", excludingNames, "}");
54579
+ const includeField = (0, combi_1.seq)("INCLUDE", _1.CDSPrefixedName, (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.str)("SIGNATURE ONLY"), (0, combi_1.optPrio)(excluding)), (0, combi_1.seq)(excluding, (0, combi_1.optPrio)((0, combi_1.str)("SIGNATURE ONLY"))))));
54487
54580
  const field = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, nullability);
54488
54581
  const assocOrComp = (0, combi_1.seq)(_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation));
54489
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, assocOrComp), ";");
54582
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.altPrio)(includeField, assocOrComp, field), ";");
54490
54583
  }
54491
54584
  }
54492
54585
  exports.CDSTableField = CDSTableField;
@@ -54553,7 +54646,9 @@ const _1 = __webpack_require__(/*! . */ "../core/build/src/cds/expressions/index
54553
54646
  const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
54554
54647
  class CDSWithParameters extends combi_1.Expression {
54555
54648
  getRunnable() {
54556
- const param = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", _1.CDSType, (0, combi_1.star)(_1.CDSAnnotation));
54649
+ const extNameValue = (0, combi_1.altPrio)(_1.CDSName, (0, combi_1.regex)(/^"(?:[^"]|"")*"$/));
54650
+ const externalName = (0, combi_1.seq)("EXTERNAL", "NAME", extNameValue);
54651
+ const param = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", _1.CDSType, (0, combi_1.opt)(externalName), (0, combi_1.star)(_1.CDSAnnotation));
54557
54652
  return (0, combi_1.seq)("WITH PARAMETERS", param, (0, combi_1.star)((0, combi_1.seq)(",", param)));
54558
54653
  }
54559
54654
  }
@@ -54607,6 +54702,7 @@ __exportStar(__webpack_require__(/*! ./cds_define_hierarchy */ "../core/build/sr
54607
54702
  __exportStar(__webpack_require__(/*! ./cds_define_projection */ "../core/build/src/cds/expressions/cds_define_projection.js"), exports);
54608
54703
  __exportStar(__webpack_require__(/*! ./cds_define_table_entity */ "../core/build/src/cds/expressions/cds_define_table_entity.js"), exports);
54609
54704
  __exportStar(__webpack_require__(/*! ./cds_define_table_function */ "../core/build/src/cds/expressions/cds_define_table_function.js"), exports);
54705
+ __exportStar(__webpack_require__(/*! ./cds_paren_select */ "../core/build/src/cds/expressions/cds_paren_select.js"), exports);
54610
54706
  __exportStar(__webpack_require__(/*! ./cds_define_view */ "../core/build/src/cds/expressions/cds_define_view.js"), exports);
54611
54707
  __exportStar(__webpack_require__(/*! ./cds_element */ "../core/build/src/cds/expressions/cds_element.js"), exports);
54612
54708
  __exportStar(__webpack_require__(/*! ./cds_extend_view */ "../core/build/src/cds/expressions/cds_extend_view.js"), exports);
@@ -68970,7 +69066,7 @@ class Registry {
68970
69066
  }
68971
69067
  static abaplintVersion() {
68972
69068
  // magic, see build script "version.js"
68973
- return "2.120.3";
69069
+ return "2.120.5";
68974
69070
  }
68975
69071
  getDDICReferences() {
68976
69072
  return this.ddicReferences;
@@ -96933,35 +97029,38 @@ class UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {
96933
97029
  exports.UnusedVariablesConf = UnusedVariablesConf;
96934
97030
  class WorkArea {
96935
97031
  constructor() {
96936
- this.workarea = [];
97032
+ // keyed by filename + start position, this equals Identifier.equals()
97033
+ this.workarea = new Map();
96937
97034
  }
96938
97035
  push(id, count = 1) {
96939
- for (const w of this.workarea) {
96940
- if (id.equals(w.id)) {
96941
- return;
96942
- }
97036
+ const key = this.buildKey(id);
97037
+ if (this.workarea.has(key)) {
97038
+ return;
96943
97039
  }
96944
- this.workarea.push({ id, count });
97040
+ this.workarea.set(key, { id, count });
96945
97041
  }
96946
97042
  removeIfExists(id) {
96947
97043
  if (id === undefined) {
96948
97044
  return;
96949
97045
  }
96950
- for (let i = 0; i < this.workarea.length; i++) {
96951
- if (id.equals(this.workarea[i].id)) {
96952
- this.workarea[i].count--;
96953
- if (this.workarea[i].count === 0) {
96954
- this.workarea.splice(i, 1);
96955
- }
96956
- return;
97046
+ const key = this.buildKey(id);
97047
+ const found = this.workarea.get(key);
97048
+ if (found !== undefined) {
97049
+ found.count--;
97050
+ if (found.count === 0) {
97051
+ this.workarea.delete(key);
96957
97052
  }
96958
97053
  }
96959
97054
  }
96960
97055
  get() {
96961
- return this.workarea;
97056
+ return [...this.workarea.values()];
96962
97057
  }
96963
97058
  count() {
96964
- return this.workarea.length;
97059
+ return this.workarea.size;
97060
+ }
97061
+ buildKey(id) {
97062
+ const start = id.getStart();
97063
+ return id.getFilename() + "," + start.getRow() + "," + start.getCol();
96965
97064
  }
96966
97065
  }
96967
97066
  class UnusedVariables {
@@ -97095,6 +97194,9 @@ Errors found in INCLUDES are reported for the main program.`,
97095
97194
  }
97096
97195
  buildIssues(obj) {
97097
97196
  const ret = [];
97197
+ const metadata = this.getMetadata();
97198
+ const pragma = metadata.pragma + "";
97199
+ const files = new Map();
97098
97200
  for (const w of this.workarea.get()) {
97099
97201
  const filename = w.id.getFilename();
97100
97202
  if (this.reg.isFileDependency(filename) === true) {
@@ -97103,41 +97205,52 @@ Errors found in INCLUDES are reported for the main program.`,
97103
97205
  else if (obj instanceof objects_1.Program === false && obj.containsFile(filename) === false) {
97104
97206
  continue;
97105
97207
  }
97106
- const statement = this.findStatement(w.id);
97107
- if (statement === null || statement === void 0 ? void 0 : statement.getPragmas().map(t => t.getStr()).includes(this.getMetadata().pragma + "")) {
97108
- continue;
97208
+ if (files.has(filename) === false) {
97209
+ files.set(filename, this.findFile(filename));
97210
+ }
97211
+ const file = files.get(filename);
97212
+ let statement = undefined;
97213
+ let statementIndex = -1;
97214
+ if (file !== undefined) {
97215
+ const statements = file.getStatements();
97216
+ const token = w.id.getToken();
97217
+ for (let i = 0; i < statements.length; i++) {
97218
+ if (statements[i].includesToken(token)) {
97219
+ statement = statements[i];
97220
+ statementIndex = i;
97221
+ break;
97222
+ }
97223
+ }
97109
97224
  }
97110
- else if (this.suppressedbyPseudo(statement, w.id, obj)) {
97111
- continue;
97225
+ if (statement !== undefined && file !== undefined) {
97226
+ if (statement.getPragmas().some(t => t.getStr() === pragma)) {
97227
+ continue;
97228
+ }
97229
+ else if (this.suppressedbyPseudo(file, statementIndex, w.id, obj)) {
97230
+ continue;
97231
+ }
97112
97232
  }
97113
97233
  const name = w.id.getName();
97114
97234
  const message = "Variable \"" + name.toLowerCase() + "\" not used";
97115
- const fix = this.buildFix(w.id, obj);
97116
- ret.push(issue_1.Issue.atIdentifier(w.id, message, this.getMetadata().key, this.conf.severity, fix));
97235
+ const fix = this.buildFix(w.id, obj, statement);
97236
+ ret.push(issue_1.Issue.atIdentifier(w.id, message, metadata.key, this.conf.severity, fix));
97117
97237
  }
97118
97238
  return ret;
97119
97239
  }
97120
- suppressedbyPseudo(statement, v, obj) {
97121
- if (statement === undefined) {
97240
+ suppressedbyPseudo(file, statementIndex, v, obj) {
97241
+ // pseudo comments are only found in files belonging to the object itself, not in eg. includes
97242
+ if (obj.getABAPFileByName(v.getFilename()) === undefined) {
97122
97243
  return false;
97123
97244
  }
97124
- const file = obj.getABAPFileByName(v.getFilename());
97125
- if (file === undefined) {
97126
- return false;
97127
- }
97128
- let next = false;
97129
- for (const s of file.getStatements()) {
97130
- if (next === true && s.get() instanceof _statement_1.Comment) {
97131
- return s.concatTokens().includes(this.getMetadata().pseudoComment + "");
97132
- }
97133
- if (s === statement) {
97134
- next = true;
97135
- }
97136
- }
97137
- return false;
97245
+ const statements = file.getStatements();
97246
+ const next = statements[statementIndex + 1];
97247
+ return (next === null || next === void 0 ? void 0 : next.get()) instanceof _statement_1.Comment
97248
+ && next.concatTokens().includes(this.getMetadata().pseudoComment + "");
97249
+ // removed by dead control flow
97250
+
97138
97251
  }
97139
- findStatement(v) {
97140
- const file = this.reg.getFileByName(v.getFilename());
97252
+ findFile(filename) {
97253
+ const file = this.reg.getFileByName(filename);
97141
97254
  if (file === undefined) {
97142
97255
  return undefined;
97143
97256
  }
@@ -97145,26 +97258,17 @@ Errors found in INCLUDES are reported for the main program.`,
97145
97258
  if (!(object instanceof _abap_object_1.ABAPObject)) {
97146
97259
  return undefined;
97147
97260
  }
97148
- const abapfile = object.getABAPFileByName(v.getFilename());
97149
- if (abapfile === undefined) {
97261
+ return object.getABAPFileByName(filename);
97262
+ }
97263
+ buildFix(v, obj, statement) {
97264
+ if (statement === undefined || !(statement.get() instanceof Statements.Data)) {
97150
97265
  return undefined;
97151
97266
  }
97152
- const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), abapfile);
97153
- return statement;
97154
- }
97155
- buildFix(v, obj) {
97156
97267
  const file = obj.getABAPFileByName(v.getFilename());
97157
97268
  if (file === undefined) {
97158
97269
  return undefined;
97159
97270
  }
97160
- const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), file);
97161
- if (statement === undefined) {
97162
- return undefined;
97163
- }
97164
- else if (statement.get() instanceof Statements.Data) {
97165
- return edit_helper_1.EditHelper.deleteStatement(file, statement);
97166
- }
97167
- return undefined;
97271
+ return edit_helper_1.EditHelper.deleteStatement(file, statement);
97168
97272
  }
97169
97273
  }
97170
97274
  exports.UnusedVariables = UnusedVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.3",
3
+ "version": "2.120.5",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.3",
42
+ "@abaplint/core": "^2.120.5",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",