@lionweb/core 0.5.0-beta.0

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 (119) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +201 -0
  3. package/dist/api.d.ts +72 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +47 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/deserializer.d.ts +14 -0
  8. package/dist/deserializer.d.ts.map +1 -0
  9. package/dist/deserializer.js +134 -0
  10. package/dist/deserializer.js.map +1 -0
  11. package/dist/dynamic-api.d.ts +19 -0
  12. package/dist/dynamic-api.d.ts.map +1 -0
  13. package/dist/dynamic-api.js +28 -0
  14. package/dist/dynamic-api.js.map +1 -0
  15. package/dist/functions.d.ts +10 -0
  16. package/dist/functions.d.ts.map +1 -0
  17. package/dist/functions.js +13 -0
  18. package/dist/functions.js.map +1 -0
  19. package/dist/id-generation.d.ts +54 -0
  20. package/dist/id-generation.d.ts.map +1 -0
  21. package/dist/id-generation.js +76 -0
  22. package/dist/id-generation.js.map +1 -0
  23. package/dist/index.d.ts +12 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +12 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/m3/api.d.ts +16 -0
  28. package/dist/m3/api.d.ts.map +1 -0
  29. package/dist/m3/api.js +55 -0
  30. package/dist/m3/api.js.map +1 -0
  31. package/dist/m3/builtins.d.ts +24 -0
  32. package/dist/m3/builtins.d.ts.map +1 -0
  33. package/dist/m3/builtins.js +67 -0
  34. package/dist/m3/builtins.js.map +1 -0
  35. package/dist/m3/constraints.d.ts +16 -0
  36. package/dist/m3/constraints.d.ts.map +1 -0
  37. package/dist/m3/constraints.js +40 -0
  38. package/dist/m3/constraints.js.map +1 -0
  39. package/dist/m3/deserializer.d.ts +8 -0
  40. package/dist/m3/deserializer.d.ts.map +1 -0
  41. package/dist/m3/deserializer.js +16 -0
  42. package/dist/m3/deserializer.js.map +1 -0
  43. package/dist/m3/factory.d.ts +26 -0
  44. package/dist/m3/factory.d.ts.map +1 -0
  45. package/dist/m3/factory.js +48 -0
  46. package/dist/m3/factory.js.map +1 -0
  47. package/dist/m3/functions.d.ts +110 -0
  48. package/dist/m3/functions.d.ts.map +1 -0
  49. package/dist/m3/functions.js +145 -0
  50. package/dist/m3/functions.js.map +1 -0
  51. package/dist/m3/index.d.ts +12 -0
  52. package/dist/m3/index.d.ts.map +1 -0
  53. package/dist/m3/index.js +12 -0
  54. package/dist/m3/index.js.map +1 -0
  55. package/dist/m3/key-generation.d.ts +15 -0
  56. package/dist/m3/key-generation.d.ts.map +1 -0
  57. package/dist/m3/key-generation.js +11 -0
  58. package/dist/m3/key-generation.js.map +1 -0
  59. package/dist/m3/lioncore.d.ts +39 -0
  60. package/dist/m3/lioncore.d.ts.map +1 -0
  61. package/dist/m3/lioncore.js +150 -0
  62. package/dist/m3/lioncore.js.map +1 -0
  63. package/dist/m3/reference-checker.d.ts +6 -0
  64. package/dist/m3/reference-checker.d.ts.map +1 -0
  65. package/dist/m3/reference-checker.js +29 -0
  66. package/dist/m3/reference-checker.js.map +1 -0
  67. package/dist/m3/serializer.d.ts +9 -0
  68. package/dist/m3/serializer.d.ts.map +1 -0
  69. package/dist/m3/serializer.js +9 -0
  70. package/dist/m3/serializer.js.map +1 -0
  71. package/dist/m3/textual-syntax.d.ts +4 -0
  72. package/dist/m3/textual-syntax.d.ts.map +1 -0
  73. package/dist/m3/textual-syntax.js +57 -0
  74. package/dist/m3/textual-syntax.js.map +1 -0
  75. package/dist/m3/types.d.ts +117 -0
  76. package/dist/m3/types.d.ts.map +1 -0
  77. package/dist/m3/types.js +196 -0
  78. package/dist/m3/types.js.map +1 -0
  79. package/dist/references.d.ts +18 -0
  80. package/dist/references.d.ts.map +1 -0
  81. package/dist/references.js +10 -0
  82. package/dist/references.js.map +1 -0
  83. package/dist/serialization.d.ts +51 -0
  84. package/dist/serialization.d.ts.map +1 -0
  85. package/dist/serialization.js +5 -0
  86. package/dist/serialization.js.map +1 -0
  87. package/dist/serializer.d.ts +8 -0
  88. package/dist/serializer.d.ts.map +1 -0
  89. package/dist/serializer.js +101 -0
  90. package/dist/serializer.js.map +1 -0
  91. package/dist/types.d.ts +12 -0
  92. package/dist/types.d.ts.map +1 -0
  93. package/dist/types.js +2 -0
  94. package/dist/types.js.map +1 -0
  95. package/dist/utils/array-helpers.d.ts +14 -0
  96. package/dist/utils/array-helpers.d.ts.map +1 -0
  97. package/dist/utils/array-helpers.js +15 -0
  98. package/dist/utils/array-helpers.js.map +1 -0
  99. package/dist/utils/cycles.d.ts +8 -0
  100. package/dist/utils/cycles.d.ts.map +1 -0
  101. package/dist/utils/cycles.js +26 -0
  102. package/dist/utils/cycles.js.map +1 -0
  103. package/dist/utils/grouping.d.ts +13 -0
  104. package/dist/utils/grouping.d.ts.map +1 -0
  105. package/dist/utils/grouping.js +26 -0
  106. package/dist/utils/grouping.js.map +1 -0
  107. package/dist/utils/index.d.ts +5 -0
  108. package/dist/utils/index.d.ts.map +1 -0
  109. package/dist/utils/index.js +5 -0
  110. package/dist/utils/index.js.map +1 -0
  111. package/dist/utils/recursion.d.ts +13 -0
  112. package/dist/utils/recursion.d.ts.map +1 -0
  113. package/dist/utils/recursion.js +21 -0
  114. package/dist/utils/recursion.js.map +1 -0
  115. package/dist/utils/sorting.d.ts +7 -0
  116. package/dist/utils/sorting.d.ts.map +1 -0
  117. package/dist/utils/sorting.js +7 -0
  118. package/dist/utils/sorting.js.map +1 -0
  119. package/package.json +23 -0
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Various functions on M3 models.
3
+ */
4
+ import { Classifier, Concept, ConceptInterface, Containment, Datatype, Enumeration, Feature, IKeyed, INamed, Language, LanguageEntity, Link, M3Concept, Property, Reference } from "./types.js";
5
+ import { unresolved } from "../references.js";
6
+ import { Id, Node } from "../types.js";
7
+ import { ConceptDeducer } from "../api.js";
8
+ import { containmentChain } from "../functions.js";
9
+ /**
10
+ * @return The type of the given {@link Feature}
11
+ */
12
+ declare const type: (feature: Feature) => Classifier | Datatype | typeof unresolved;
13
+ declare const isProperty: (feature: Feature) => feature is Property;
14
+ declare const isContainment: (feature: Feature) => feature is Containment;
15
+ declare const isReference: (feature: Feature) => feature is Reference;
16
+ /**
17
+ * @return the relations among the given {@link Feature features}.
18
+ */
19
+ declare const relations: (features: Feature[]) => Link[];
20
+ /**
21
+ * @return the non-relations among the given {@link Feature features}.
22
+ */
23
+ declare const nonRelationalFeatures: (features: Feature[]) => Feature[];
24
+ /**
25
+ * @return the relations of the given {@link LanguageEntity language element}.
26
+ */
27
+ declare const relationsOf: (element: LanguageEntity) => Link[];
28
+ /**
29
+ * @return The "things", i.e. {@link M3Concept}s, contained by the given "thing".
30
+ * These can be: {@link LanguageEntity}s, {@link Feature}s, {@link EnumerationLiteral}
31
+ * (and all their sub types).
32
+ */
33
+ declare const containeds: (thing: M3Concept) => M3Concept[];
34
+ /**
35
+ * Performs a depth-first tree traversal of a language, "flatMapping" the `map` function on every node.
36
+ * It avoids visiting nodes twice (to avoid potential infinite loops), but doesn't report cycles.
37
+ */
38
+ declare const flatMap: <T>(language: Language, map: (t: M3Concept) => T[]) => T[];
39
+ /**
40
+ * @return the name of the given {@link INamed named thing}.
41
+ */
42
+ declare const nameOf: <T extends INamed>({ name }: T) => string;
43
+ /**
44
+ * @return the concatenation of the names of the given nodes using the given separator.
45
+ */
46
+ declare const concatenateNamesOf: (separator: string, nodes: M3Concept[]) => string;
47
+ /**
48
+ * @return the qualified name of the given {@link INamed named thing}.
49
+ */
50
+ declare const qualifiedNameOf: <T extends INamed>(node: T, separator?: string) => string;
51
+ /**
52
+ * @return the {@link INamed named things} in this {@link Language language}
53
+ * (excluding the language itself)
54
+ */
55
+ declare const namedsOf: (language: Language) => M3Concept[];
56
+ /**
57
+ * @return the key of the given {@link INamed named thing}.
58
+ */
59
+ declare const keyOf: <T extends IKeyed>({ key }: T) => string;
60
+ /**
61
+ * @return the id of the given {@link M3Concept}.
62
+ */
63
+ declare const idOf: <T extends M3Concept>({ id }: T) => string;
64
+ /**
65
+ * Sorts the given {@link LanguageEntity language entities} by name.
66
+ */
67
+ declare const entitiesSortedByName: (entities: LanguageEntity[]) => LanguageEntity[];
68
+ /**
69
+ * A sum type of {@link Concept} and {@link ConceptInterface}.
70
+ */
71
+ type ConceptType = Concept | ConceptInterface;
72
+ /**
73
+ * Determines whether the given {@link LanguageEntity metamodel element} is
74
+ * *concrete*, i.e. is instantiable.
75
+ */
76
+ declare const isConcrete: (thing: LanguageEntity) => thing is Concept;
77
+ /**
78
+ * @return an array that's either an inheritance cycle, or empty (meaning: no inheritance cycle).
79
+ */
80
+ declare const inheritedCycleWith: (conceptType: ConceptType) => ConceptType[];
81
+ /**
82
+ * @return *all* super types (through `extends` or `implements`) of the given
83
+ * {@link Concept concept} or {@link ConceptInterface concept interface}.
84
+ */
85
+ declare const allSuperTypesOf: (conceptType: ConceptType) => ConceptType[];
86
+ /**
87
+ * @return *all* {@link Feature features} of the given {@link Concept concept} or {@link ConceptInterface concept interface},
88
+ * including the inherited ones.
89
+ */
90
+ declare const allFeaturesOf: (conceptType: ConceptType) => Feature[];
91
+ /**
92
+ * Determines whether the given {@link LanguageEntity language element} is an {@link Enumeration enumeration}.
93
+ */
94
+ declare const isEnumeration: (element: LanguageEntity) => element is Enumeration;
95
+ /**
96
+ * @return a function that looks up a concept from the given {@link Language language} by its ID.
97
+ */
98
+ declare const idBasedConceptDeducerFor: (language: Language) => (id: Id) => Concept;
99
+ /**
100
+ * @return a function that looks up a concept from the given {@link Language language} by its name.
101
+ */
102
+ declare const nameBasedConceptDeducerFor: (language: Language) => (name: string) => Concept;
103
+ /**
104
+ * @return a {@link ConceptDeducer concept deducer} that deduces the concept of nodes by looking up
105
+ * the concept in the given {@link Language language} by matching the node object's class name to the concept's name.
106
+ */
107
+ declare const classBasedConceptDeducerFor: <NT extends Node>(language: Language) => ConceptDeducer<NT>;
108
+ export { allFeaturesOf, allSuperTypesOf, classBasedConceptDeducerFor, concatenateNamesOf, containeds, containmentChain, entitiesSortedByName, flatMap, idBasedConceptDeducerFor, idOf, inheritedCycleWith, isConcrete, isContainment, isEnumeration, isProperty, isReference, keyOf, nameBasedConceptDeducerFor, nameOf, namedsOf, nonRelationalFeatures, relations, relationsOf, type, qualifiedNameOf };
109
+ export type { ConceptType };
110
+ //# sourceMappingURL=functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/m3/functions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,OAAO,EACP,MAAM,EACN,MAAM,EAEN,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,SAAS,EACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAQ,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAIlD,OAAO,EAAC,EAAE,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAA;AAGhD;;GAEG;AACH,QAAA,MAAM,IAAI,YAAa,OAAO,KAAG,UAAU,GAAG,QAAQ,GAAG,iBAClB,CAAA;AAGvC,QAAA,MAAM,UAAU,YAAa,OAAO,wBACL,CAAA;AAE/B,QAAA,MAAM,aAAa,YAAa,OAAO,2BACL,CAAA;AAElC,QAAA,MAAM,WAAW,YAAa,OAAO,yBACL,CAAA;AAUhC;;GAEG;AACH,QAAA,MAAM,SAAS,aAAc,OAAO,EAAE,KAAG,IAAI,EACZ,CAAA;AAEjC;;GAEG;AACH,QAAA,MAAM,qBAAqB,aAAc,OAAO,EAAE,KAAG,OAAO,EACJ,CAAA;AAGxD;;GAEG;AACH,QAAA,MAAM,WAAW,Y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AGG;AACH,QAAA,MAAM,2BAA2B,8BAA+B,QAAQ,uBAGvE,CAAA;AAGD,OAAO,EACH,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EACP,wBAAwB,EACxB,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,KAAK,EACL,0BAA0B,EAC1B,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,IAAI,EACJ,eAAe,EAClB,CAAA;AAED,YAAY,EACR,WAAW,EACd,CAAA"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Various functions on M3 models.
3
+ */
4
+ import { Classifier, Concept, ConceptInterface, Containment, Enumeration, isINamed, Language, Link, Property, Reference } from "./types.js";
5
+ import { isRef } from "../references.js";
6
+ import { sortByStringKey } from "../utils/sorting.js";
7
+ import { cycleWith } from "../utils/cycles.js";
8
+ import { flatMapNonCyclingFollowing } from "../utils/recursion.js";
9
+ import { containmentChain } from "../functions.js";
10
+ /**
11
+ * @return The type of the given {@link Feature}
12
+ */
13
+ const type = (feature) => feature.type;
14
+ const isProperty = (feature) => feature instanceof Property;
15
+ const isContainment = (feature) => feature instanceof Containment;
16
+ const isReference = (feature) => feature instanceof Reference;
17
+ /**
18
+ * Determines whether a {@link Feature feature} is "relational",
19
+ * i.e. it's a {@link Link containment or reference}.
20
+ */
21
+ const isRelational = (feature) => feature instanceof Link;
22
+ /**
23
+ * @return the relations among the given {@link Feature features}.
24
+ */
25
+ const relations = (features) => features.filter(isRelational);
26
+ /**
27
+ * @return the non-relations among the given {@link Feature features}.
28
+ */
29
+ const nonRelationalFeatures = (features) => features.filter((feature) => !isRelational(feature));
30
+ /**
31
+ * @return the relations of the given {@link LanguageEntity language element}.
32
+ */
33
+ const relationsOf = (element) => element instanceof Classifier
34
+ ? relations(element.features)
35
+ : [];
36
+ /**
37
+ * @return The "things", i.e. {@link M3Concept}s, contained by the given "thing".
38
+ * These can be: {@link LanguageEntity}s, {@link Feature}s, {@link EnumerationLiteral}
39
+ * (and all their sub types).
40
+ */
41
+ const containeds = (thing) => {
42
+ if (thing instanceof Language) {
43
+ return thing.entities;
44
+ }
45
+ if (thing instanceof Classifier) {
46
+ return thing.features; // (cast is necessary because of presence of Feature#classifier getter...?)
47
+ }
48
+ if (thing instanceof Enumeration) {
49
+ return thing.literals;
50
+ }
51
+ return [];
52
+ };
53
+ /**
54
+ * Performs a depth-first tree traversal of a language, "flatMapping" the `map` function on every node.
55
+ * It avoids visiting nodes twice (to avoid potential infinite loops), but doesn't report cycles.
56
+ */
57
+ const flatMap = (language, map) => flatMapNonCyclingFollowing(map, containeds)(language);
58
+ /**
59
+ * @return the name of the given {@link INamed named thing}.
60
+ */
61
+ const nameOf = ({ name }) => name;
62
+ /**
63
+ * @return the concatenation of the names of the given nodes using the given separator.
64
+ */
65
+ const concatenateNamesOf = (separator, nodes) => nodes
66
+ .filter(isINamed)
67
+ .map(nameOf)
68
+ .join(separator);
69
+ // !! slight overkill: every node in an M2 is an M3Concept, so IKeyed and INamed
70
+ /**
71
+ * @return the qualified name of the given {@link INamed named thing}.
72
+ */
73
+ const qualifiedNameOf = (node, separator = ".") => concatenateNamesOf(separator, containmentChain(node).reverse());
74
+ /**
75
+ * @return the {@link INamed named things} in this {@link Language language}
76
+ * (excluding the language itself)
77
+ */
78
+ const namedsOf = (language) => flatMap(language, (t) => isINamed(t) ? [t] : []);
79
+ /**
80
+ * @return the key of the given {@link INamed named thing}.
81
+ */
82
+ const keyOf = ({ key }) => key;
83
+ /**
84
+ * @return the id of the given {@link M3Concept}.
85
+ */
86
+ const idOf = ({ id }) => id;
87
+ /**
88
+ * Sorts the given {@link LanguageEntity language entities} by name.
89
+ */
90
+ const entitiesSortedByName = (entities) => sortByStringKey(entities, nameOf);
91
+ /**
92
+ * Determines whether the given {@link LanguageEntity metamodel element} is
93
+ * *concrete*, i.e. is instantiable.
94
+ */
95
+ const isConcrete = (thing) => thing instanceof Concept && !thing.abstract;
96
+ const inheritsFrom = (conceptType) => {
97
+ if (conceptType instanceof Concept) {
98
+ return [
99
+ ...(isRef(conceptType.extends)
100
+ ? [conceptType.extends]
101
+ : []),
102
+ ...conceptType.implements
103
+ ];
104
+ }
105
+ if (conceptType instanceof ConceptInterface) {
106
+ return conceptType.extends;
107
+ }
108
+ throw new Error(`concept type ${typeof conceptType} not handled`);
109
+ };
110
+ /**
111
+ * @return an array that's either an inheritance cycle, or empty (meaning: no inheritance cycle).
112
+ */
113
+ const inheritedCycleWith = (conceptType) => cycleWith(conceptType, inheritsFrom);
114
+ /**
115
+ * @return *all* super types (through `extends` or `implements`) of the given
116
+ * {@link Concept concept} or {@link ConceptInterface concept interface}.
117
+ */
118
+ const allSuperTypesOf = (conceptType) => flatMapNonCyclingFollowing(inheritsFrom, inheritsFrom)(conceptType);
119
+ /**
120
+ * @return *all* {@link Feature features} of the given {@link Concept concept} or {@link ConceptInterface concept interface},
121
+ * including the inherited ones.
122
+ */
123
+ const allFeaturesOf = (conceptType) => flatMapNonCyclingFollowing((ci) => ci.features, inheritsFrom)(conceptType);
124
+ /**
125
+ * Determines whether the given {@link LanguageEntity language element} is an {@link Enumeration enumeration}.
126
+ */
127
+ const isEnumeration = (element) => element instanceof Enumeration;
128
+ /**
129
+ * @return a function that looks up a concept from the given {@link Language language} by its ID.
130
+ */
131
+ const idBasedConceptDeducerFor = (language) => (id) => language.entities.find((element) => element instanceof Concept && element.id === id);
132
+ /**
133
+ * @return a function that looks up a concept from the given {@link Language language} by its name.
134
+ */
135
+ const nameBasedConceptDeducerFor = (language) => (name) => language.entities.find((element) => element instanceof Concept && element.name === name);
136
+ /**
137
+ * @return a {@link ConceptDeducer concept deducer} that deduces the concept of nodes by looking up
138
+ * the concept in the given {@link Language language} by matching the node object's class name to the concept's name.
139
+ */
140
+ const classBasedConceptDeducerFor = (language) => {
141
+ const deducer = nameBasedConceptDeducerFor(language);
142
+ return (node) => deducer(node.constructor.name);
143
+ };
144
+ export { allFeaturesOf, allSuperTypesOf, classBasedConceptDeducerFor, concatenateNamesOf, containeds, containmentChain, entitiesSortedByName, flatMap, idBasedConceptDeducerFor, idOf, inheritedCycleWith, isConcrete, isContainment, isEnumeration, isProperty, isReference, keyOf, nameBasedConceptDeducerFor, nameOf, namedsOf, nonRelationalFeatures, relations, relationsOf, type, qualifiedNameOf };
145
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/m3/functions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,WAAW,EAEX,WAAW,EAIX,QAAQ,EACR,QAAQ,EAER,IAAI,EAEJ,QAAQ,EACR,SAAS,EACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAC,KAAK,EAAa,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAC,0BAA0B,EAAC,MAAM,uBAAuB,CAAA;AAGhE,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAA;AAGhD;;GAEG;AACH,MAAM,IAAI,GAAG,CAAC,OAAgB,EAA6C,EAAE,CACxE,OAA6B,CAAC,IAAI,CAAA;AAGvC,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAuB,EAAE,CACzD,OAAO,YAAY,QAAQ,CAAA;AAE/B,MAAM,aAAa,GAAG,CAAC,OAAgB,EAA0B,EAAE,CAC/D,OAAO,YAAY,WAAW,CAAA;AAElC,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAwB,EAAE,CAC3D,OAAO,YAAY,SAAS,CAAA;AAGhC;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAmB,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,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC,CAAA;AAGD,OAAO,EACH,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EACP,wBAAwB,EACxB,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,KAAK,EACL,0BAA0B,EAC1B,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,IAAI,EACJ,eAAe,EAClB,CAAA"}
@@ -0,0 +1,12 @@
1
+ export * from "./builtins.js";
2
+ export * from "./types.js";
3
+ export * from "./constraints.js";
4
+ export * from "./deserializer.js";
5
+ export * from "./factory.js";
6
+ export * from "./functions.js";
7
+ export * from "./key-generation.js";
8
+ export * from "./lioncore.js";
9
+ export * from "./reference-checker.js";
10
+ export * from "./serializer.js";
11
+ export * from "./textual-syntax.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/m3/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,12 @@
1
+ export * from "./builtins.js";
2
+ export * from "./types.js";
3
+ export * from "./constraints.js";
4
+ export * from "./deserializer.js";
5
+ export * from "./factory.js";
6
+ export * from "./functions.js";
7
+ export * from "./key-generation.js";
8
+ export * from "./lioncore.js";
9
+ export * from "./reference-checker.js";
10
+ export * from "./serializer.js";
11
+ export * from "./textual-syntax.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/m3/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { INamed } from "./types.js";
2
+ /**
3
+ * Type definition for functions that generate a key given an {@link M3Concept}.
4
+ * Note that, in theory, key generation doesn't need to be idempotent: f(node) != f(node.havingKey(f(node)), with f of type KeyGenerator.
5
+ */
6
+ export type KeyGenerator = (node: INamed) => string;
7
+ /**
8
+ * A {@link KeyGenerator key generator} for which: key = name
9
+ */
10
+ export declare const nameIsKeyGenerator: KeyGenerator;
11
+ /**
12
+ * @return A {@link KeyGenerator key generator} that generates a key with the qualified name using the given separator.
13
+ */
14
+ export declare const qualifiedNameBasedKeyGenerator: (separator: string) => KeyGenerator;
15
+ //# sourceMappingURL=key-generation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-generation.d.ts","sourceRoot":"","sources":["../../src/m3/key-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAA;AAIjC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;AAGnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,YACpB,CAAA;AAGb;;GAEG;AACH,eAAO,MAAM,8BAA8B,cAAe,MAAM,KAAG,YACrB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { qualifiedNameOf } from "./functions.js";
2
+ /**
3
+ * A {@link KeyGenerator key generator} for which: key = name
4
+ */
5
+ export const nameIsKeyGenerator = (node) => node.name;
6
+ /**
7
+ * @return A {@link KeyGenerator key generator} that generates a key with the qualified name using the given separator.
8
+ */
9
+ export const qualifiedNameBasedKeyGenerator = (separator) => (node) => qualifiedNameOf(node, separator);
10
+ // TODO implement checkers
11
+ //# sourceMappingURL=key-generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-generation.js","sourceRoot":"","sources":["../../src/m3/key-generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAA;AAU9C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiB,CAAC,IAAY,EAAE,EAAE,CAC7D,IAAI,CAAC,IAAI,CAAA;AAGb;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,SAAiB,EAAgB,EAAE,CAC9E,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;AAG9C,2BAA2B"}
@@ -0,0 +1,39 @@
1
+ declare const lioncoreQName = "LionCore-M3";
2
+ /**
3
+ * Definition of LionCore in terms of itself.
4
+ */
5
+ export declare const lioncore: import("./types.js").Language;
6
+ export declare const metaConcepts: {
7
+ annotation: import("./types.js").Concept;
8
+ concept: import("./types.js").Concept;
9
+ conceptInterface: import("./types.js").Concept;
10
+ containment: import("./types.js").Concept;
11
+ enumeration: import("./types.js").Concept;
12
+ enumerationLiteral: import("./types.js").Concept;
13
+ language: import("./types.js").Concept;
14
+ primitiveType: import("./types.js").Concept;
15
+ property: import("./types.js").Concept;
16
+ reference: import("./types.js").Concept;
17
+ };
18
+ export declare const metaFeatures: {
19
+ annotation_annotates: import("./types.js").Reference;
20
+ annotation_extends: import("./types.js").Reference;
21
+ annotation_implements: import("./types.js").Reference;
22
+ classifier_features: import("./types.js").Containment;
23
+ concept_abstract: import("./types.js").Property;
24
+ concept_partition: import("./types.js").Property;
25
+ concept_extends: import("./types.js").Reference;
26
+ concept_implements: import("./types.js").Reference;
27
+ conceptInterface_extends: import("./types.js").Reference;
28
+ enumeration_literals: import("./types.js").Containment;
29
+ feature_optional: import("./types.js").Property;
30
+ ikeyed_key: import("./types.js").Property;
31
+ language_dependsOn: import("./types.js").Reference;
32
+ language_entities: import("./types.js").Containment;
33
+ language_version: import("./types.js").Property;
34
+ link_multiple: import("./types.js").Property;
35
+ link_type: import("./types.js").Reference;
36
+ property_type: import("./types.js").Reference;
37
+ };
38
+ export { lioncoreQName };
39
+ //# sourceMappingURL=lioncore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lioncore.d.ts","sourceRoot":"","sources":["../../src/m3/lioncore.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,aAAa,gBAAgB,CAAA;AA8BnC;;GAEG;AACH,eAAO,MAAM,QAAQ,+BAA4C,CAAA;AAsMjE,eAAO,MAAM,YAAY;;;;;;;;;;;CAWxB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;CAmBxB,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA"}
@@ -0,0 +1,150 @@
1
+ import { LanguageFactory } from "./factory.js";
2
+ import { builtinClassifiers, builtinPrimitives } from "./builtins.js";
3
+ import { Classifier, EnumerationLiteral, Feature, lioncoreQNameSeparator } from "./types.js";
4
+ import { checkAll } from "../id-generation.js";
5
+ const lioncoreQName = "LionCore-M3";
6
+ const factory = new LanguageFactory("LionCore.M3", "1", checkAll((qualifiedName) => "-id-" +
7
+ (qualifiedName === "LionCore.M3"
8
+ ? lioncoreQName
9
+ : qualifiedName
10
+ .substring(lioncoreQName.length + 1)
11
+ .replaceAll(".", lioncoreQNameSeparator))), (node) => {
12
+ if (node instanceof Classifier) {
13
+ return node.name;
14
+ }
15
+ if (node instanceof EnumerationLiteral) {
16
+ return `${node.enumeration.name}-${node.name}`;
17
+ }
18
+ if (node instanceof Feature) {
19
+ return `${node.classifier.name}-${node.name}`;
20
+ }
21
+ throw Error(`cannot compute key for node "${node.name}" of runtime-type "${node.constructor.name}"`);
22
+ });
23
+ /**
24
+ * Definition of LionCore in terms of itself.
25
+ */
26
+ export const lioncore = factory.language.havingKey("LionCore-M3");
27
+ const { inamed } = builtinClassifiers;
28
+ const { booleanDatatype, stringDatatype } = builtinPrimitives;
29
+ const ikeyed = factory.conceptInterface("IKeyed")
30
+ .extending(inamed);
31
+ const ikeyed_key = factory.property(ikeyed, "key")
32
+ .ofType(stringDatatype);
33
+ ikeyed.havingFeatures(ikeyed_key);
34
+ const feature = factory.concept("Feature", true).implementing(ikeyed);
35
+ const feature_optional = factory.property(feature, "optional")
36
+ .ofType(booleanDatatype);
37
+ feature.havingFeatures(feature_optional);
38
+ const property = factory.concept("Property", false, feature);
39
+ const property_type = factory.reference(property, "type");
40
+ property.havingFeatures(property_type);
41
+ const link = factory.concept("Link", true, feature);
42
+ const link_multiple = factory.property(link, "multiple")
43
+ .ofType(booleanDatatype);
44
+ const link_type = factory.reference(link, "type");
45
+ link.havingFeatures(link_multiple, link_type);
46
+ const containment = factory.concept("Containment", false, link);
47
+ const reference = factory.concept("Reference", false, link);
48
+ const languageEntity = factory.concept("LanguageEntity", true)
49
+ .implementing(ikeyed);
50
+ const classifier = factory.concept("Classifier", true, languageEntity);
51
+ const classifier_features = factory.containment(classifier, "features")
52
+ .isOptional()
53
+ .isMultiple()
54
+ .ofType(feature);
55
+ classifier.havingFeatures(classifier_features);
56
+ link_type.ofType(classifier);
57
+ const annotation = factory.concept("Annotation", false, classifier);
58
+ const annotation_multiple = factory.property(annotation, "multiple")
59
+ .isOptional()
60
+ .ofType(booleanDatatype);
61
+ const annotation_annotates = factory.reference(annotation, "annotates")
62
+ .isOptional()
63
+ .ofType(classifier);
64
+ const annotation_extends = factory.reference(annotation, "extends")
65
+ .isOptional()
66
+ .ofType(annotation);
67
+ const annotation_implements = factory.reference(annotation, "implements")
68
+ .isMultiple()
69
+ .isOptional();
70
+ annotation.havingFeatures(annotation_multiple, annotation_annotates, annotation_extends, annotation_implements);
71
+ const concept = factory.concept("Concept", false, classifier);
72
+ const concept_abstract = factory.property(concept, "abstract")
73
+ .ofType(booleanDatatype);
74
+ const concept_partition = factory.property(concept, "partition")
75
+ .ofType(booleanDatatype);
76
+ const concept_extends = factory.reference(concept, "extends")
77
+ .isOptional()
78
+ .ofType(concept);
79
+ const concept_implements = factory.reference(concept, "implements")
80
+ .isOptional()
81
+ .isMultiple();
82
+ concept.havingFeatures(concept_abstract, concept_partition, concept_extends, concept_implements);
83
+ const conceptInterface = factory.concept("ConceptInterface", false, classifier);
84
+ const conceptInterface_extends = factory.reference(conceptInterface, "extends")
85
+ .isOptional()
86
+ .isMultiple()
87
+ .ofType(conceptInterface);
88
+ conceptInterface.havingFeatures(conceptInterface_extends);
89
+ annotation_implements.ofType(conceptInterface);
90
+ concept_implements.ofType(conceptInterface);
91
+ const dataType = factory.concept("DataType", true, languageEntity);
92
+ property_type.ofType(dataType);
93
+ const primitiveType = factory.concept("PrimitiveType", false, dataType);
94
+ const enumeration = factory.concept("Enumeration", false, dataType);
95
+ const enumeration_literals = factory.containment(enumeration, "literals")
96
+ .isMultiple()
97
+ .isOptional();
98
+ enumeration.havingFeatures(enumeration_literals);
99
+ const enumerationLiteral = factory.concept("EnumerationLiteral", false)
100
+ .implementing(ikeyed);
101
+ enumeration_literals.ofType(enumerationLiteral);
102
+ const language = factory.concept("Language", false)
103
+ .implementing(ikeyed)
104
+ .isPartition();
105
+ const language_version = factory.property(language, "version")
106
+ .ofType(stringDatatype);
107
+ const language_entities = factory.containment(language, "entities")
108
+ .isOptional()
109
+ .isMultiple()
110
+ .ofType(languageEntity);
111
+ const language_dependsOn = factory.reference(language, "dependsOn")
112
+ .isOptional()
113
+ .isMultiple()
114
+ .ofType(language);
115
+ language.havingFeatures(language_version, language_entities, language_dependsOn);
116
+ lioncore.havingEntities(ikeyed, feature, property, link, containment, reference, languageEntity, classifier, annotation, concept, conceptInterface, dataType, primitiveType, enumeration, enumerationLiteral, language);
117
+ export const metaConcepts = {
118
+ annotation,
119
+ concept,
120
+ conceptInterface,
121
+ containment,
122
+ enumeration,
123
+ enumerationLiteral,
124
+ language,
125
+ primitiveType,
126
+ property,
127
+ reference
128
+ };
129
+ export const metaFeatures = {
130
+ annotation_annotates,
131
+ annotation_extends,
132
+ annotation_implements,
133
+ classifier_features,
134
+ concept_abstract,
135
+ concept_partition,
136
+ concept_extends,
137
+ concept_implements,
138
+ conceptInterface_extends,
139
+ enumeration_literals,
140
+ feature_optional,
141
+ ikeyed_key,
142
+ language_dependsOn,
143
+ language_entities,
144
+ language_version,
145
+ link_multiple,
146
+ link_type,
147
+ property_type
148
+ };
149
+ export { lioncoreQName };
150
+ //# sourceMappingURL=lioncore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lioncore.js","sourceRoot":"","sources":["../../src/m3/lioncore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAA;AACnE,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAA;AAC1F,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AAG5C,MAAM,aAAa,GAAG,aAAa,CAAA;AAGnC,MAAM,OAAO,GAAG,IAAI,eAAe,CAC/B,aAAa,EACb,GAAG,EACH,QAAQ,CAAC,CAAC,aAAa,EAAE,EAAE,CACvB,MAAM;IACF,CAAC,aAAa,KAAK,aAAa;QAC5B,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,aAAc;aACX,SAAS,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;aACnC,UAAU,CAAC,GAAG,EAAE,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B,aAAa;IACb,SAAS;IACT,aAAa;CAChB,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Language } from "./types.js";
2
+ /**
3
+ * Checks whether the metamodel of the given language contains unresolved references.
4
+ */
5
+ export declare const checkReferences: (language: Language) => string[];
6
+ //# sourceMappingURL=reference-checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-checker.d.ts","sourceRoot":"","sources":["../../src/m3/reference-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAsB,MAAM,YAAY,CAAA;AAK9E;;GAEG;AACH,eAAO,MAAM,eAAe,aAAc,QAAQ,KAAG,MAAM,EA2BtD,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { Concept, Containment, Property, Reference } from "./types.js";
2
+ import { flatMap, qualifiedNameOf } from "./functions.js";
3
+ import { unresolved } from "../references.js";
4
+ /**
5
+ * Checks whether the metamodel of the given language contains unresolved references.
6
+ */
7
+ export const checkReferences = (language) => flatMap(language, (thing) => {
8
+ const locations = [];
9
+ const check = (ref, location) => {
10
+ if (ref === unresolved) {
11
+ locations.push(location);
12
+ }
13
+ };
14
+ if (thing instanceof Concept) {
15
+ check(thing.extends, `<Concept>${qualifiedNameOf(thing)}#extends`);
16
+ }
17
+ if (thing instanceof Containment) {
18
+ check(thing.type, `<Containment>${qualifiedNameOf(thing)}#type`);
19
+ }
20
+ if (thing instanceof Property) {
21
+ check(thing.type, `<Property>${qualifiedNameOf(thing)}#type`);
22
+ }
23
+ if (thing instanceof Reference) {
24
+ check(thing.type, `<Reference>${qualifiedNameOf(thing)}#type`);
25
+ }
26
+ return locations;
27
+ });
28
+ // TODO (#8) make this generic, parametrized by a {@link Metamodel}
29
+ //# sourceMappingURL=reference-checker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-checker.js","sourceRoot":"","sources":["../../src/m3/reference-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,WAAW,EAAY,QAAQ,EAAE,SAAS,EAAC,MAAM,YAAY,CAAA;AAC9E,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAY,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAGtD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAkB,EAAY,EAAE,CAC5D,OAAO,CACH,QAAQ,EACR,CAAC,KAAK,EAAE,EAAE;IAEN,MAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,MAAM,KAAK,GAAG,CAAC,GAAuB,EAAE,QAAgB,EAAE,EAAE;QACxD,IAAI,GAAG,KAAK,UAAU,EAAE;YACpB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAC3B;IACL,CAAC,CAAA;IAED,IAAI,KAAK,YAAY,OAAO,EAAE;QAC1B,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,eAAe,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;KACrE;IACD,IAAI,KAAK,YAAY,WAAW,EAAE;QAC9B,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;KACnE;IACD,IAAI,KAAK,YAAY,QAAQ,EAAE;QAC3B,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;KAChE;IACD,IAAI,KAAK,YAAY,SAAS,EAAE;QAC5B,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;KACjE;IAED,OAAO,SAAS,CAAA;AACpB,CAAC,CACJ,CAAA;AACL,oEAAoE"}
@@ -0,0 +1,9 @@
1
+ import { Language } from "./types.js";
2
+ import { SerializationChunk } from "../serialization.js";
3
+ /**
4
+ * Serializes a language (i.e., an instance of the LionCore metametamodel,
5
+ * using {@link M3Concept these type definitions})
6
+ * into the LionWeb serialization JSON format.
7
+ */
8
+ export declare const serializeLanguage: (language: Language) => SerializationChunk;
9
+ //# sourceMappingURL=serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/m3/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAA;AAKtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAAc,QAAQ,KAAG,kBACR,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { serializeNodes } from "../serializer.js";
2
+ import { lioncoreReadAPI } from "./api.js";
3
+ /**
4
+ * Serializes a language (i.e., an instance of the LionCore metametamodel,
5
+ * using {@link M3Concept these type definitions})
6
+ * into the LionWeb serialization JSON format.
7
+ */
8
+ export const serializeLanguage = (language) => serializeNodes([language], lioncoreReadAPI);
9
+ //# sourceMappingURL=serializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/m3/serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AAGxC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAkB,EAAsB,EAAE,CACxE,cAAc,CAAC,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { M3Node } from "./types.js";
2
+ declare const asText: (node: M3Node) => string;
3
+ export { asText };
4
+ //# sourceMappingURL=textual-syntax.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textual-syntax.d.ts","sourceRoot":"","sources":["../../src/m3/textual-syntax.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,MAAM,EAIT,MAAM,YAAY,CAAA;AAqBnB,QAAA,MAAM,MAAM,SAAU,MAAM,KAAG,MAwD9B,CAAA;AAGD,OAAO,EACH,MAAM,EACT,CAAA"}