@abaplint/core 2.120.83 → 2.120.84

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 (47) hide show
  1. package/build/abaplint.d.ts +19 -5
  2. package/build/src/abap/1_lexer/tokens/abstract_token.js +36 -12
  3. package/build/src/abap/5_syntax/_current_scope.js +14 -11
  4. package/build/src/abap/5_syntax/_eml.js +68 -0
  5. package/build/src/abap/5_syntax/_object_oriented.js +10 -0
  6. package/build/src/abap/5_syntax/spaghetti_scope.js +67 -9
  7. package/build/src/abap/5_syntax/statements/message.js +8 -0
  8. package/build/src/abap/5_syntax/statements/modify_entities.js +2 -0
  9. package/build/src/abap/5_syntax/statements/raise.js +6 -0
  10. package/build/src/abap/5_syntax/statements/read_entities.js +2 -0
  11. package/build/src/bdef/bdef_parser.js +75 -0
  12. package/build/src/bdef/expressions/bdef_action.js +15 -0
  13. package/build/src/bdef/expressions/bdef_alias.js +12 -0
  14. package/build/src/bdef/expressions/bdef_association.js +15 -0
  15. package/build/src/bdef/expressions/bdef_association_body.js +18 -0
  16. package/build/src/bdef/expressions/bdef_authorization_context.js +16 -0
  17. package/build/src/bdef/expressions/bdef_cardinality.js +13 -0
  18. package/build/src/bdef/expressions/bdef_default_function.js +14 -0
  19. package/build/src/bdef/expressions/bdef_define_behavior.js +21 -0
  20. package/build/src/bdef/expressions/bdef_definition.js +12 -0
  21. package/build/src/bdef/expressions/bdef_determination.js +15 -0
  22. package/build/src/bdef/expressions/bdef_determine_action.js +15 -0
  23. package/build/src/bdef/expressions/bdef_event.js +14 -0
  24. package/build/src/bdef/expressions/bdef_field.js +13 -0
  25. package/build/src/bdef/expressions/bdef_field_path.js +13 -0
  26. package/build/src/bdef/expressions/bdef_header.js +15 -0
  27. package/build/src/bdef/expressions/bdef_hierarchy.js +16 -0
  28. package/build/src/bdef/expressions/bdef_implementation_in.js +12 -0
  29. package/build/src/bdef/expressions/bdef_implementation_type.js +19 -0
  30. package/build/src/bdef/expressions/bdef_key.js +14 -0
  31. package/build/src/bdef/expressions/bdef_mapping.js +19 -0
  32. package/build/src/bdef/expressions/bdef_name.js +13 -0
  33. package/build/src/bdef/expressions/bdef_operation.js +13 -0
  34. package/build/src/bdef/expressions/bdef_options.js +15 -0
  35. package/build/src/bdef/expressions/bdef_parameter.js +13 -0
  36. package/build/src/bdef/expressions/bdef_reference.js +15 -0
  37. package/build/src/bdef/expressions/bdef_result.js +13 -0
  38. package/build/src/bdef/expressions/bdef_side_effects.js +25 -0
  39. package/build/src/bdef/expressions/bdef_string.js +11 -0
  40. package/build/src/bdef/expressions/bdef_use.js +18 -0
  41. package/build/src/bdef/expressions/index.js +46 -0
  42. package/build/src/objects/behavior_definition.js +46 -8
  43. package/build/src/registry.js +1 -1
  44. package/build/src/rules/bdef_check_syntax.js +88 -0
  45. package/build/src/rules/bdef_parser_error.js +47 -0
  46. package/build/src/rules/index.js +2 -0
  47. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFDefineBehavior = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** behavior of one entity, "define behavior for ZI_Travel alias Travel ... { ... }" */
7
+ class BDEFDefineBehavior extends combi_1.Expression {
8
+ getRunnable() {
9
+ const fieldMapping = (0, combi_1.seq)(_1.BDEFName, "=", _1.BDEFName);
10
+ const lockMapping = (0, combi_1.seq)("(", fieldMapping, (0, combi_1.starPrio)((0, combi_1.seq)(",", fieldMapping)), ")");
11
+ const dependentBy = (0, combi_1.seq)("DEPENDENT", (0, combi_1.optPrio)((0, combi_1.seq)("BY", _1.BDEFName)));
12
+ const save = (0, combi_1.seq)((0, combi_1.altPrio)("WITH ADDITIONAL SAVE", "WITH UNMANAGED SAVE"), (0, combi_1.optPrio)("AND CLEANUP"), (0, combi_1.optPrio)("WITH FULL DATA"));
13
+ const option = (0, combi_1.altPrio)(_1.BDEFAlias, _1.BDEFImplementationIn, (0, combi_1.seq)("EXTERNAL", _1.BDEFString), (0, combi_1.seq)("PERSISTENT TABLE", _1.BDEFName), (0, combi_1.seq)("DRAFT TABLE", _1.BDEFName), (0, combi_1.seq)("QUERY", _1.BDEFName), (0, combi_1.seq)("LOCK", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", (0, combi_1.optPrio)("UNMANAGED")), (0, combi_1.seq)(dependentBy, (0, combi_1.optPrio)(lockMapping)))), (0, combi_1.seq)("AUTHORIZATION", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", _1.BDEFOptions), dependentBy)), (0, combi_1.seq)((0, combi_1.optPrio)("TOTAL"), "ETAG", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", _1.BDEFName), dependentBy, _1.BDEFName)),
14
+ // eg. "( lock, authorization, etag ) dependent by _Travel"
15
+ (0, combi_1.seq)(_1.BDEFOptions, dependentBy), (0, combi_1.seq)((0, combi_1.altPrio)("LATE", "EARLY"), "NUMBERING", (0, combi_1.optPrio)("IN PLACE")), save, "WITH CONTROL", "USE ETAG", (0, combi_1.seq)("USING", _1.BDEFName), (0, combi_1.seq)("CHANGEDOCUMENTS", (0, combi_1.altPrio)((0, combi_1.seq)("MASTER", (0, combi_1.optPrio)("UTC"), (0, combi_1.optPrio)(_1.BDEFOptions)), dependentBy)), "EXTENSIBLE");
16
+ const item = (0, combi_1.altPrio)(_1.BDEFUse, _1.BDEFDetermineAction, _1.BDEFOperation, _1.BDEFAction, _1.BDEFDetermination, _1.BDEFField, _1.BDEFAssociation, _1.BDEFMapping, _1.BDEFSideEffects, _1.BDEFEvent, _1.BDEFHierarchy, _1.BDEFKey, (0, combi_1.seq)("CHANGEDOCUMENTS", _1.BDEFOptions, ";"), ";");
17
+ return (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("ROOT"), "BEHAVIOR FOR"), "EXTEND BEHAVIOR FOR"), _1.BDEFName, (0, combi_1.starPrio)(option), "{", (0, combi_1.starPrio)(item), "}", (0, combi_1.optPrio)(";"));
18
+ }
19
+ }
20
+ exports.BDEFDefineBehavior = BDEFDefineBehavior;
21
+ //# sourceMappingURL=bdef_define_behavior.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFDefinition = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class BDEFDefinition extends combi_1.Expression {
7
+ getRunnable() {
8
+ return (0, combi_1.seq)(_1.BDEFImplementationType, (0, combi_1.starPrio)((0, combi_1.altPrio)(_1.BDEFHeader, _1.BDEFDefineBehavior, _1.BDEFAuthorizationContext)));
9
+ }
10
+ }
11
+ exports.BDEFDefinition = BDEFDefinition;
12
+ //# sourceMappingURL=bdef_definition.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFDetermination = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** determinations and validations, eg. "validation validateDates on save { create; field BeginDate, EndDate; }" */
7
+ class BDEFDetermination extends combi_1.Expression {
8
+ getRunnable() {
9
+ const fields = (0, combi_1.seq)(_1.BDEFFieldPath, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFFieldPath)));
10
+ const trigger = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), ";"), (0, combi_1.seq)("FIELD", fields, ";"), (0, combi_1.seq)("ENTITY", fields, ";"), ";");
11
+ return (0, combi_1.seq)((0, combi_1.altPrio)("DETERMINATION", "VALIDATION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, "ON", (0, combi_1.altPrio)("MODIFY", "SAVE"), "{", (0, combi_1.starPrio)(trigger), "}");
12
+ }
13
+ }
14
+ exports.BDEFDetermination = BDEFDetermination;
15
+ //# sourceMappingURL=bdef_determination.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFDetermineAction = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "draft determine action Prepare { validation validateDate; determination ( always ) Child ~ setStatus; }" */
7
+ class BDEFDetermineAction extends combi_1.Expression {
8
+ getRunnable() {
9
+ const item = (0, combi_1.seq)((0, combi_1.altPrio)("VALIDATION", "DETERMINATION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFReference, ";");
10
+ const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)(item), "}");
11
+ return (0, combi_1.seq)((0, combi_1.optPrio)("EXTEND"), (0, combi_1.optPrio)("DRAFT"), "DETERMINE ACTION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)("EXTENSIBLE"), (0, combi_1.altPrio)(";", body));
12
+ }
13
+ }
14
+ exports.BDEFDetermineAction = BDEFDetermineAction;
15
+ //# sourceMappingURL=bdef_determine_action.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFEvent = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "event TravelCreated parameter ZD_TRAVEL_EVENT;" or "event StatusUpdated for side effects;" */
7
+ class BDEFEvent extends combi_1.Expression {
8
+ getRunnable() {
9
+ const tail = (0, combi_1.altPrio)((0, combi_1.seq)("ON", _1.BDEFName), _1.BDEFParameter, "FOR SIDE EFFECTS", (0, combi_1.seq)("DESCRIPTION", _1.BDEFString), (0, combi_1.seq)("CATEGORY", _1.BDEFName));
10
+ return (0, combi_1.seq)((0, combi_1.optPrio)("MANAGED"), "EVENT", _1.BDEFName, (0, combi_1.starPrio)(tail), ";");
11
+ }
12
+ }
13
+ exports.BDEFEvent = BDEFEvent;
14
+ //# sourceMappingURL=bdef_event.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFField = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** field characteristics, eg. "field ( readonly, numbering : managed ) ID, CreatedBy;" */
7
+ class BDEFField extends combi_1.Expression {
8
+ getRunnable() {
9
+ return (0, combi_1.seq)("FIELD", _1.BDEFOptions, _1.BDEFFieldPath, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFFieldPath)), (0, combi_1.optPrio)(","), ";");
10
+ }
11
+ }
12
+ exports.BDEFField = BDEFField;
13
+ //# sourceMappingURL=bdef_field.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFFieldPath = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** field or association, possibly via associations, eg. "_Root.TotalPieces" */
7
+ class BDEFFieldPath extends combi_1.Expression {
8
+ getRunnable() {
9
+ return (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.BDEFName)));
10
+ }
11
+ }
12
+ exports.BDEFFieldPath = BDEFFieldPath;
13
+ //# sourceMappingURL=bdef_field_path.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFHeader = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** header statements following the implementation type, eg. "strict ( 2 );" or "with draft;" */
7
+ class BDEFHeader extends combi_1.Expression {
8
+ getRunnable() {
9
+ const extensibleItem = (0, combi_1.seq)("WITH", (0, combi_1.plusPrio)((0, combi_1.regex)(/^\w+$/)), ";");
10
+ const extensible = (0, combi_1.seq)("EXTENSIBLE", (0, combi_1.optPrio)((0, combi_1.seq)("{", (0, combi_1.starPrio)(extensibleItem), "}")), (0, combi_1.optPrio)(";"));
11
+ return (0, combi_1.altPrio)((0, combi_1.seq)("STRICT", (0, combi_1.optPrio)((0, combi_1.seq)("(", (0, combi_1.regex)(/^\d+$/), ")")), ";"), (0, combi_1.seq)("WITH DRAFT", ";"), (0, combi_1.seq)("USE DRAFT", (0, combi_1.optPrio)("AS DEPENDENT"), ";"), (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "USE"), "COLLABORATIVE DRAFT", ";"), (0, combi_1.seq)("WITH PRIVILEGED MODE", (0, combi_1.optPrio)((0, combi_1.seq)("DISABLING", _1.BDEFName)), ";"), (0, combi_1.seq)("WITH MANAGED INSTANCE FILTER", ";"), (0, combi_1.seq)("WITH HIERARCHY", ";"), (0, combi_1.seq)("WITH CROSS ASSOCIATIONS", ";"), (0, combi_1.seq)("USE SIDE EFFECTS", ";"), (0, combi_1.seq)("USE RECOMMENDATIONS", ";"), (0, combi_1.seq)("FOREIGN ENTITY", _1.BDEFName, (0, combi_1.optPrio)(_1.BDEFAlias), ";"), (0, combi_1.seq)("SCALAR ENTITY", _1.BDEFName, "FIELD", _1.BDEFName, ";"), (0, combi_1.seq)("AUXILIARY CLASS", _1.BDEFName, ";"), extensible);
12
+ }
13
+ }
14
+ exports.BDEFHeader = BDEFHeader;
15
+ //# sourceMappingURL=bdef_header.js.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFHierarchy = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "instance hierarchy /DMO/I_EmployeeHN { managed reorder action changeNextSibling; ascending association _Manager; }" */
7
+ class BDEFHierarchy extends combi_1.Expression {
8
+ getRunnable() {
9
+ const action = (0, combi_1.seq)((0, combi_1.optPrio)("MANAGED"), (0, combi_1.altPrio)("REORDER", "COPY"), "ACTION", _1.BDEFName, ";");
10
+ const association = (0, combi_1.seq)((0, combi_1.altPrio)("ASCENDING", "DESCENDING"), "ASSOCIATION", _1.BDEFName, (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
11
+ const item = (0, combi_1.altPrio)(action, association, _1.BDEFField, ";");
12
+ return (0, combi_1.seq)("INSTANCE HIERARCHY", _1.BDEFName, "{", (0, combi_1.starPrio)(item), "}");
13
+ }
14
+ }
15
+ exports.BDEFHierarchy = BDEFHierarchy;
16
+ //# sourceMappingURL=bdef_hierarchy.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFImplementationIn = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class BDEFImplementationIn extends combi_1.Expression {
7
+ getRunnable() {
8
+ return (0, combi_1.seq)("IMPLEMENTATION IN CLASS", _1.BDEFName, (0, combi_1.optPrio)("UNIQUE"));
9
+ }
10
+ }
11
+ exports.BDEFImplementationIn = BDEFImplementationIn;
12
+ //# sourceMappingURL=bdef_implementation_in.js.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFImplementationType = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** first statement, eg. "managed with additional save implementation in class zbp_travel unique;" */
7
+ class BDEFImplementationType extends combi_1.Expression {
8
+ getRunnable() {
9
+ const extension = (0, combi_1.seq)("EXTENSION", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("USING INTERFACE", _1.BDEFName), (0, combi_1.seq)("FOR", (0, combi_1.altPrio)("PROJECTION", "INTERFACE")))));
10
+ const type = (0, combi_1.altPrio)("MANAGED", "UNMANAGED", "ABSTRACT", "PROJECTION", "INTERFACE", extension,
11
+ // old syntax, eg. "implementation unmanaged;"
12
+ (0, combi_1.seq)("IMPLEMENTATION", (0, combi_1.altPrio)("MANAGED", "UNMANAGED", "ABSTRACT", "PROJECTION")));
13
+ const save = (0, combi_1.seq)((0, combi_1.altPrio)("WITH ADDITIONAL SAVE", "WITH UNMANAGED SAVE"), (0, combi_1.optPrio)("AND CLEANUP"), (0, combi_1.optPrio)("WITH FULL DATA"));
14
+ const option = (0, combi_1.altPrio)(_1.BDEFImplementationIn, save);
15
+ return (0, combi_1.seq)(type, (0, combi_1.starPrio)(option), ";");
16
+ }
17
+ }
18
+ exports.BDEFImplementationType = BDEFImplementationType;
19
+ //# sourceMappingURL=bdef_implementation_type.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFKey = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** alternative key, eg. "define pure key AlternativeKey { id; }" */
7
+ class BDEFKey extends combi_1.Expression {
8
+ getRunnable() {
9
+ const fields = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)), ";");
10
+ return (0, combi_1.seq)("DEFINE", (0, combi_1.optPrio)("PURE"), "KEY", _1.BDEFName, "{", (0, combi_1.starPrio)(fields), "}");
11
+ }
12
+ }
13
+ exports.BDEFKey = BDEFKey;
14
+ //# sourceMappingURL=bdef_key.js.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFMapping = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "mapping for ztravel corresponding { TravelID = travel_id; }" */
7
+ class BDEFMapping extends combi_1.Expression {
8
+ getRunnable() {
9
+ const names = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)));
10
+ const line = (0, combi_1.seq)(_1.BDEFName, "=", _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("CONTROL", _1.BDEFName)), ";");
11
+ // deep mapping of a sub node, eg. "sub _Items = items;"
12
+ const sub = (0, combi_1.seq)("SUB", _1.BDEFName, "=", _1.BDEFName, ";");
13
+ const body = (0, combi_1.seq)("{", (0, combi_1.starPrio)((0, combi_1.altPrio)(sub, line, ";")), "}");
14
+ const option = (0, combi_1.altPrio)("CORRESPONDING", "EXTENSIBLE", (0, combi_1.seq)("EXCEPT", names), (0, combi_1.seq)("CONTROL", _1.BDEFName));
15
+ return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "MAPPING FOR", _1.BDEFName, (0, combi_1.starPrio)(option), (0, combi_1.altPrio)(";", body));
16
+ }
17
+ }
18
+ exports.BDEFMapping = BDEFMapping;
19
+ //# sourceMappingURL=bdef_mapping.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFName = void 0;
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
+ class BDEFName extends combi_1.Expression {
6
+ getRunnable() {
7
+ const word = (0, combi_1.regex)(/^\$?\w+$/);
8
+ const slashName = (0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/), "/", (0, combi_1.regex)(/^\w+$/));
9
+ return (0, combi_1.altPrio)(slashName, word);
10
+ }
11
+ }
12
+ exports.BDEFName = BDEFName;
13
+ //# sourceMappingURL=bdef_name.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFOperation = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** standard operations, eg. "internal create ( features : global );" */
7
+ class BDEFOperation extends combi_1.Expression {
8
+ getRunnable() {
9
+ return (0, combi_1.seq)((0, combi_1.starPrio)((0, combi_1.altPrio)("INTERNAL", "STATIC")), (0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFOptions), (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction));
10
+ }
11
+ }
12
+ exports.BDEFOperation = BDEFOperation;
13
+ //# sourceMappingURL=bdef_operation.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFOptions = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "( features : instance, precheck )", "( read only )" or "( hierarchy-index )" */
7
+ class BDEFOptions extends combi_1.Expression {
8
+ getRunnable() {
9
+ const name = (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.altPrio)((0, combi_1.seq)("-", _1.BDEFName), _1.BDEFName)));
10
+ const option = (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)(":", _1.BDEFName)));
11
+ return (0, combi_1.seq)("(", option, (0, combi_1.starPrio)((0, combi_1.seq)(",", option)), ")");
12
+ }
13
+ }
14
+ exports.BDEFOptions = BDEFOptions;
15
+ //# sourceMappingURL=bdef_options.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFParameter = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "deep parameter ZD_PARAMETER" */
7
+ class BDEFParameter extends combi_1.Expression {
8
+ getRunnable() {
9
+ return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "PARAMETER", _1.BDEFName);
10
+ }
11
+ }
12
+ exports.BDEFParameter = BDEFParameter;
13
+ //# sourceMappingURL=bdef_parameter.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFReference = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** reference to a determination, validation or action, optionally prefixed with an entity, eg. "Child ~ validatePercentage" */
7
+ class BDEFReference extends combi_1.Expression {
8
+ getRunnable() {
9
+ const namespace = (0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/), "/");
10
+ const tildeEnd = (0, combi_1.regex)(/^\w+~$/);
11
+ return (0, combi_1.altPrio)((0, combi_1.seq)(_1.BDEFName, "~", _1.BDEFName), (0, combi_1.seq)(_1.BDEFName, (0, combi_1.regex)(/^~\w+$/)), (0, combi_1.seq)((0, combi_1.optPrio)(namespace), tildeEnd, _1.BDEFName), (0, combi_1.seq)((0, combi_1.optPrio)(namespace), (0, combi_1.regex)(/^\w+~\w+$/)), _1.BDEFName);
12
+ }
13
+ }
14
+ exports.BDEFReference = BDEFReference;
15
+ //# sourceMappingURL=bdef_reference.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFResult = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "result [1] $self", "deep result ZD_RESULT" or "result selective [0..*] entity ZI_Travel" */
7
+ class BDEFResult extends combi_1.Expression {
8
+ getRunnable() {
9
+ return (0, combi_1.seq)((0, combi_1.optPrio)("DEEP"), "RESULT", (0, combi_1.optPrio)("SELECTIVE"), (0, combi_1.optPrio)(_1.BDEFCardinality), (0, combi_1.optPrio)("ENTITY"), _1.BDEFName);
10
+ }
11
+ }
12
+ exports.BDEFResult = BDEFResult;
13
+ //# sourceMappingURL=bdef_result.js.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFSideEffects = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** eg. "side effects { field Price affects field TotalPrice, messages; }" */
7
+ class BDEFSideEffects extends combi_1.Expression {
8
+ getRunnable() {
9
+ const fieldList = (0, combi_1.seq)("(", _1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.BDEFName)), ")");
10
+ // eg. "field *", "field ( A, B )", "field _Item.*" or "field _Root.( A, B )"
11
+ const field = (0, combi_1.seq)("FIELD", (0, combi_1.altPrio)("*", fieldList, (0, combi_1.seq)(_1.BDEFName, (0, combi_1.starPrio)((0, combi_1.seq)(".", (0, combi_1.altPrio)("*", fieldList, _1.BDEFName))))));
12
+ const permission = (0, combi_1.altPrio)((0, combi_1.seq)("ACTION", _1.BDEFReference), field, (0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFName)));
13
+ const permissions = (0, combi_1.seq)("PERMISSIONS", "(", permission, (0, combi_1.starPrio)((0, combi_1.seq)(",", permission)), ")");
14
+ const target = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), "MESSAGES", permissions, "$SELF");
15
+ const targets = (0, combi_1.seq)(target, (0, combi_1.starPrio)((0, combi_1.seq)(",", target)));
16
+ const trigger = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), "$SELF");
17
+ const triggers = (0, combi_1.seq)(trigger, (0, combi_1.starPrio)((0, combi_1.seq)(",", trigger)));
18
+ const source = (0, combi_1.altPrio)(field, (0, combi_1.seq)("ACTION", _1.BDEFReference), (0, combi_1.seq)("DETERMINE ACTION", _1.BDEFReference, "EXECUTED ON", triggers), (0, combi_1.seq)("ENTITY", _1.BDEFFieldPath), (0, combi_1.seq)("EVENT", _1.BDEFName), "$SELF");
19
+ const recommendation = (0, combi_1.seq)("RECOMMENDATION FUNCTION", _1.BDEFName, "EXECUTED ON", triggers, ";");
20
+ const item = (0, combi_1.altPrio)((0, combi_1.seq)(source, "AFFECTS", targets, ";"), recommendation, ";");
21
+ return (0, combi_1.seq)("SIDE EFFECTS", "{", (0, combi_1.starPrio)(item), "}");
22
+ }
23
+ }
24
+ exports.BDEFSideEffects = BDEFSideEffects;
25
+ //# sourceMappingURL=bdef_side_effects.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFString = void 0;
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
+ class BDEFString extends combi_1.Expression {
6
+ getRunnable() {
7
+ return (0, combi_1.regex)(/^'(?:[^']|'')*'$/);
8
+ }
9
+ }
10
+ exports.BDEFString = BDEFString;
11
+ //# sourceMappingURL=bdef_string.js.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFUse = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ /** reuse in projections and interfaces, eg. "use action acceptTravel as accept;" */
7
+ class BDEFUse extends combi_1.Expression {
8
+ getRunnable() {
9
+ const end = (0, combi_1.altPrio)(";", _1.BDEFDefaultFunction);
10
+ const operation = (0, combi_1.seq)((0, combi_1.altPrio)("CREATE", "UPDATE", "DELETE"), (0, combi_1.optPrio)(_1.BDEFOptions), end);
11
+ const actionTail = (0, combi_1.altPrio)((0, combi_1.seq)("AS", _1.BDEFName), (0, combi_1.seq)("EXTERNAL", _1.BDEFString), _1.BDEFParameter, _1.BDEFResult);
12
+ const action = (0, combi_1.seq)((0, combi_1.altPrio)("ACTION", "FUNCTION"), (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.starPrio)(actionTail), end);
13
+ const association = (0, combi_1.seq)("ASSOCIATION", (0, combi_1.optPrio)(_1.BDEFOptions), _1.BDEFName, (0, combi_1.optPrio)((0, combi_1.seq)("ABBREVIATION", _1.BDEFName)), (0, combi_1.altPrio)(";", _1.BDEFAssociationBody));
14
+ return (0, combi_1.seq)("USE", (0, combi_1.altPrio)(operation, action, association, (0, combi_1.seq)("ETAG", ";"), (0, combi_1.seq)("SIDE EFFECTS", ";"), (0, combi_1.seq)("KEY", _1.BDEFName, ";"), (0, combi_1.seq)("EVENT", _1.BDEFName, (0, combi_1.optPrio)(_1.BDEFParameter), ";")));
15
+ }
16
+ }
17
+ exports.BDEFUse = BDEFUse;
18
+ //# sourceMappingURL=bdef_use.js.map
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bdef_action"), exports);
18
+ __exportStar(require("./bdef_alias"), exports);
19
+ __exportStar(require("./bdef_association_body"), exports);
20
+ __exportStar(require("./bdef_association"), exports);
21
+ __exportStar(require("./bdef_authorization_context"), exports);
22
+ __exportStar(require("./bdef_cardinality"), exports);
23
+ __exportStar(require("./bdef_default_function"), exports);
24
+ __exportStar(require("./bdef_define_behavior"), exports);
25
+ __exportStar(require("./bdef_definition"), exports);
26
+ __exportStar(require("./bdef_determination"), exports);
27
+ __exportStar(require("./bdef_determine_action"), exports);
28
+ __exportStar(require("./bdef_event"), exports);
29
+ __exportStar(require("./bdef_field_path"), exports);
30
+ __exportStar(require("./bdef_field"), exports);
31
+ __exportStar(require("./bdef_header"), exports);
32
+ __exportStar(require("./bdef_hierarchy"), exports);
33
+ __exportStar(require("./bdef_implementation_in"), exports);
34
+ __exportStar(require("./bdef_implementation_type"), exports);
35
+ __exportStar(require("./bdef_key"), exports);
36
+ __exportStar(require("./bdef_mapping"), exports);
37
+ __exportStar(require("./bdef_name"), exports);
38
+ __exportStar(require("./bdef_operation"), exports);
39
+ __exportStar(require("./bdef_options"), exports);
40
+ __exportStar(require("./bdef_parameter"), exports);
41
+ __exportStar(require("./bdef_reference"), exports);
42
+ __exportStar(require("./bdef_result"), exports);
43
+ __exportStar(require("./bdef_side_effects"), exports);
44
+ __exportStar(require("./bdef_string"), exports);
45
+ __exportStar(require("./bdef_use"), exports);
46
+ //# sourceMappingURL=index.js.map
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BehaviorDefinition = void 0;
4
+ const bdef_parser_1 = require("../bdef/bdef_parser");
5
+ const expressions_1 = require("../bdef/expressions");
4
6
  const _abstract_object_1 = require("./_abstract_object");
5
7
  class BehaviorDefinition extends _abstract_object_1.AbstractObject {
6
8
  constructor() {
@@ -23,8 +25,30 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
23
25
  findSourceFile() {
24
26
  return this.getFiles().find(f => f.getFilename().endsWith(".asbdef"));
25
27
  }
28
+ parse() {
29
+ if (this.isDirty() === false && this.parsedData !== undefined) {
30
+ return { updated: false, runtime: 0 };
31
+ }
32
+ const start = Date.now();
33
+ const tree = new bdef_parser_1.BDEFParser().parse(this.findSourceFile());
34
+ this.parsedData = {
35
+ entities: tree ? this.findEntities(tree) : this.findEntitiesFallback(),
36
+ tree,
37
+ };
38
+ this.dirty = false;
39
+ return { updated: true, runtime: Date.now() - start };
40
+ }
41
+ getTree() {
42
+ var _a;
43
+ this.parse();
44
+ return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tree;
45
+ }
46
+ hasParserError() {
47
+ return this.findSourceFile() !== undefined && this.getTree() === undefined;
48
+ }
26
49
  listEntities() {
27
- return this.parseSource().entities;
50
+ this.parse();
51
+ return this.parsedData.entities;
28
52
  }
29
53
  /** finds the entity name for a given alias, undefined if the alias is not defined */
30
54
  findEntityNameByAlias(alias) {
@@ -38,15 +62,29 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
38
62
  return undefined;
39
63
  }
40
64
  /////////////////////////
41
- parseSource() {
65
+ findEntities(tree) {
42
66
  var _a;
43
- if (this.parsedData !== undefined) {
44
- return this.parsedData;
67
+ const ret = [];
68
+ for (const define of tree.findDirectExpressions(expressions_1.BDEFDefineBehavior)) {
69
+ const name = define.findDirectExpression(expressions_1.BDEFName);
70
+ if (name === undefined) {
71
+ continue;
72
+ }
73
+ const alias = (_a = define.findDirectExpression(expressions_1.BDEFAlias)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.BDEFName);
74
+ ret.push({
75
+ name: name.concatTokens().replace(/ /g, ""),
76
+ alias: alias === null || alias === void 0 ? void 0 : alias.concatTokens().replace(/ /g, ""),
77
+ });
45
78
  }
46
- this.parsedData = { entities: [] };
79
+ return ret;
80
+ }
81
+ /** used if the source cannot be parsed */
82
+ findEntitiesFallback() {
83
+ var _a;
84
+ const ret = [];
47
85
  const raw = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw();
48
86
  if (raw === undefined) {
49
- return this.parsedData;
87
+ return ret;
50
88
  }
51
89
  // BDEF uses "//" for line comments
52
90
  const stripped = raw.replace(/\/\/.*$/gm, "");
@@ -54,10 +92,10 @@ class BehaviorDefinition extends _abstract_object_1.AbstractObject {
54
92
  const regex = /\bdefine\s+(?:\w+\s+)*?behavior\s+for\s+([\w/]+)(?:\s+alias\s+(\w+))?/gi;
55
93
  let match = regex.exec(stripped);
56
94
  while (match !== null) {
57
- this.parsedData.entities.push({ name: match[1], alias: match[2] });
95
+ ret.push({ name: match[1], alias: match[2] });
58
96
  match = regex.exec(stripped);
59
97
  }
60
- return this.parsedData;
98
+ return ret;
61
99
  }
62
100
  }
63
101
  exports.BehaviorDefinition = BehaviorDefinition;
@@ -75,7 +75,7 @@ class Registry {
75
75
  }
76
76
  static abaplintVersion() {
77
77
  // magic, see build script "version.js"
78
- return "2.120.83";
78
+ return "2.120.84";
79
79
  }
80
80
  getDDICReferences() {
81
81
  return this.ddicReferences;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BDEFCheckSyntax = exports.BDEFCheckSyntaxConf = void 0;
4
+ const expressions_1 = require("../bdef/expressions");
5
+ const ddic_1 = require("../ddic");
6
+ const issue_1 = require("../issue");
7
+ const objects_1 = require("../objects");
8
+ const _basic_rule_config_1 = require("./_basic_rule_config");
9
+ const _irule_1 = require("./_irule");
10
+ class BDEFCheckSyntaxConf extends _basic_rule_config_1.BasicRuleConfig {
11
+ }
12
+ exports.BDEFCheckSyntaxConf = BDEFCheckSyntaxConf;
13
+ class BDEFCheckSyntax {
14
+ constructor() {
15
+ this.conf = new BDEFCheckSyntaxConf();
16
+ }
17
+ getMetadata() {
18
+ return {
19
+ key: "bdef_check_syntax",
20
+ title: "BDEF Check Syntax",
21
+ shortDescription: "Checks behavior definition references to entities and implementation classes",
22
+ extendedInformation: `Performs semantic checks which require other objects to be available.
23
+
24
+ Missing objects are only reported when their names match the configured errorNamespace.`,
25
+ tags: [_irule_1.RuleTag.Syntax],
26
+ };
27
+ }
28
+ getConfig() {
29
+ return this.conf;
30
+ }
31
+ setConfig(conf) {
32
+ this.conf = conf;
33
+ }
34
+ initialize(reg) {
35
+ this.reg = reg;
36
+ return this;
37
+ }
38
+ run(object) {
39
+ if (!(object instanceof objects_1.BehaviorDefinition)) {
40
+ return [];
41
+ }
42
+ const tree = object.getTree();
43
+ const file = object.findSourceFile();
44
+ if (tree === undefined || file === undefined) {
45
+ return [];
46
+ }
47
+ const issues = [];
48
+ this.checkImplementationClasses(tree, issues, file);
49
+ this.checkEntities(tree, issues, file);
50
+ return issues;
51
+ }
52
+ checkImplementationClasses(tree, issues, file) {
53
+ for (const implementation of tree.findAllExpressions(expressions_1.BDEFImplementationIn)) {
54
+ const nameNode = implementation.findDirectExpression(expressions_1.BDEFName);
55
+ if (nameNode === undefined) {
56
+ continue;
57
+ }
58
+ const name = this.name(nameNode);
59
+ if (this.reg.getObject("CLAS", name) === undefined && this.reg.inErrorNamespace(name)) {
60
+ issues.push(issue_1.Issue.atToken(file, nameNode.getFirstToken(), `Implementation class "${name}" not found`, this.getMetadata().key, this.conf.severity));
61
+ }
62
+ }
63
+ }
64
+ checkEntities(tree, issues, file) {
65
+ const ddic = new ddic_1.DDIC(this.reg);
66
+ for (const define of tree.findDirectExpressions(expressions_1.BDEFDefineBehavior)) {
67
+ if (define.getFirstToken().getStr().toUpperCase() !== "DEFINE") {
68
+ // "extend behavior for" refers to entities of the extended BDEF
69
+ continue;
70
+ }
71
+ const nameNode = define.findDirectExpression(expressions_1.BDEFName);
72
+ if (nameNode === undefined) {
73
+ continue;
74
+ }
75
+ const name = this.name(nameNode);
76
+ if (this.reg.inErrorNamespace(name)
77
+ && this.reg.getObject("DDLS", name) === undefined
78
+ && ddic.lookupDDLS(name) === undefined) {
79
+ issues.push(issue_1.Issue.atToken(file, nameNode.getFirstToken(), `Entity "${name}" not found`, this.getMetadata().key, this.conf.severity));
80
+ }
81
+ }
82
+ }
83
+ name(node) {
84
+ return node.concatTokens().replace(/ /g, "");
85
+ }
86
+ }
87
+ exports.BDEFCheckSyntax = BDEFCheckSyntax;
88
+ //# sourceMappingURL=bdef_check_syntax.js.map