@lionweb/io-lionweb-mps-specific 0.8.0-beta.4 → 0.8.0-beta.6
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.
- package/CHANGELOG.md +10 -0
- package/README.md +6 -0
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +8 -5
- package/dist/definition.js.map +1 -1
- package/dist/deserializer.js +4 -4
- package/dist/deserializer.js.map +1 -1
- package/dist/facade.d.ts +2 -2
- package/dist/facade.d.ts.map +1 -1
- package/dist/facade.js +4 -3
- package/dist/facade.js.map +1 -1
- package/package.json +5 -5
- package/src/definition.ts +11 -12
- package/src/deserializer.ts +5 -5
- package/src/facade.ts +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 — not yet released
|
|
4
|
+
|
|
5
|
+
* Tie the language explicitly to LionWeb version 2023.1 — see the [README.md](./README.md#lionweb-version) for more details.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 0.7.2
|
|
9
|
+
|
|
10
|
+
(No changes)
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
## 0.7.1
|
|
4
14
|
|
|
5
15
|
(The 0.7.0 release was deprecated because its `validation` package was faulty.)
|
package/README.md
CHANGED
|
@@ -32,3 +32,9 @@ The API consists of the following things exported from this package:
|
|
|
32
32
|
**Note**: only language elements having annotations (at any nesting depth) are rendered.
|
|
33
33
|
This is useful to get a quick overview of the annotations.
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
## LionWeb version
|
|
37
|
+
|
|
38
|
+
The implementation is explicitly tied to LionWeb version 2023.1, meaning that its definition refers to the LionCore and LionCore builtins languages in that version.
|
|
39
|
+
No parametrization in the LionWeb version is provided at the moment.
|
|
40
|
+
|
package/dist/definition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAiBA,OAAO,
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAgD,MAAM,eAAe,CAAA;AAyCxF,eAAO,MAAM,4BAA4B,kCAAmB,CAAA;AAG5D,eAAO,MAAM,+BAA+B;;;;;;CAM3C,CAAA"}
|
package/dist/definition.js
CHANGED
|
@@ -14,26 +14,29 @@
|
|
|
14
14
|
//
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
import {
|
|
17
|
+
import { LanguageFactory, LionWebVersions } from "@lionweb/core";
|
|
18
|
+
const { v2023_1 } = LionWebVersions;
|
|
18
19
|
const languageName = "io.lionweb.mps.specific";
|
|
19
20
|
const dashedLanguageName = languageName.replaceAll(".", "-");
|
|
20
21
|
const idKeyGen = (...names) => names.length === 1
|
|
21
22
|
? names[0]
|
|
22
23
|
: names.slice(1).join("-");
|
|
23
24
|
const factory = new LanguageFactory(dashedLanguageName, "2024-01", idKeyGen, idKeyGen);
|
|
25
|
+
const { inamed, node } = v2023_1.builtinsFacade.classifiers;
|
|
24
26
|
const defineAnnotation = (nameOfAnnotation, annotates, ...namesOfOptionalStringProperties) => {
|
|
25
27
|
const annotation = factory.annotation(nameOfAnnotation).annotating(annotates);
|
|
26
28
|
namesOfOptionalStringProperties.forEach((name) => {
|
|
27
|
-
factory.property(annotation, name).ofType(
|
|
29
|
+
factory.property(annotation, name).ofType(v2023_1.builtinsFacade.primitiveTypes.stringDataType).isOptional();
|
|
28
30
|
});
|
|
29
31
|
return annotation;
|
|
30
32
|
};
|
|
33
|
+
const { metaConcepts } = v2023_1.lioncoreFacade;
|
|
31
34
|
const ConceptDescription = defineAnnotation("ConceptDescription", metaConcepts.classifier, "conceptAlias", "conceptShortDescription", "helpUrl");
|
|
32
35
|
const Deprecated = defineAnnotation("Deprecated", metaConcepts.ikeyed, "comment", "build");
|
|
33
36
|
const KeyedDescription = defineAnnotation("KeyedDescription", metaConcepts.ikeyed, "documentation");
|
|
34
|
-
factory.reference(KeyedDescription, "seeAlso").ofType(
|
|
35
|
-
const ShortDescription = defineAnnotation("ShortDescription",
|
|
36
|
-
const VirtualPackage = defineAnnotation("VirtualPackage",
|
|
37
|
+
factory.reference(KeyedDescription, "seeAlso").ofType(node).isMultiple().isOptional();
|
|
38
|
+
const ShortDescription = defineAnnotation("ShortDescription", node, "description");
|
|
39
|
+
const VirtualPackage = defineAnnotation("VirtualPackage", node).implementing(inamed);
|
|
37
40
|
export const ioLionWebMpsSpecificLanguage = factory.language;
|
|
38
41
|
ioLionWebMpsSpecificLanguage.name = languageName;
|
|
39
42
|
export const ioLionWebMpsSpecificClassifiers = {
|
package/dist/definition.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EAA0B,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAGx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UAAU,GAAG,gBAAgB,CAAC,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAE1F,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,YAAY,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;AACnG,OAAO,CAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,UAAU,EAAE,CAAA;AAErF,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,EAAE,aAAa,CAAC,CAAA;AAElF,MAAM,cAAc,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;AAGpF,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,QAAQ,CAAA;AAC5D,4BAA4B,CAAC,IAAI,GAAG,YAAY,CAAA;AAEhD,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC3C,kBAAkB;IAClB,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;CACjB,CAAA"}
|
package/dist/deserializer.js
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
//
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
import { consoleProblemReporter, deserializerWith, Language,
|
|
18
|
-
import { lioncoreExtractionFacade } from "@lionweb/core/dist/m3/facade.js";
|
|
17
|
+
import { consoleProblemReporter, deserializerWith, Language, lioncoreReaderFor, LionWebVersions, nodesExtractorUsing } from "@lionweb/core";
|
|
19
18
|
import { ioLionWebMpsSpecificLanguage } from "./definition.js";
|
|
20
19
|
import { combinedWriter } from "./facade.js";
|
|
20
|
+
const { v2023_1 } = LionWebVersions;
|
|
21
21
|
/**
|
|
22
22
|
* @return the deserialization of the given {@link LionWebJsonChunk serialization chunk} as an array of {@link Language languages}.
|
|
23
23
|
* Any LionCore/M3 node can be annotated using annotations from the `io.lionweb.mps.specific` language.
|
|
@@ -25,7 +25,7 @@ import { combinedWriter } from "./facade.js";
|
|
|
25
25
|
*/
|
|
26
26
|
export const deserializeLanguagesWithIoLionWebMpsSpecific = (serializationChunk, problemHandler = consoleProblemReporter) => deserializerWith({
|
|
27
27
|
writer: combinedWriter,
|
|
28
|
-
languages: [
|
|
28
|
+
languages: [v2023_1.lioncoreFacade.language, ioLionWebMpsSpecificLanguage],
|
|
29
29
|
problemReporter: problemHandler
|
|
30
|
-
})(serializationChunk, [
|
|
30
|
+
})(serializationChunk, [v2023_1.lioncoreFacade.language, v2023_1.builtinsFacade.language].flatMap(nodesExtractorUsing(lioncoreReaderFor(v2023_1)))).filter((node) => node instanceof Language);
|
|
31
31
|
//# sourceMappingURL=deserializer.js.map
|
package/dist/deserializer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../src/deserializer.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAGtC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../src/deserializer.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAGtC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EAEtB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAA;AACnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC,kBAAoC,EAAE,iBAAkC,sBAAsB,EAAE,EAAE,CAC3J,gBAAgB,CAAC;IACb,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,4BAA4B,CAAC;IAC1E,eAAe,EAAE,cAAc;CAClC,CAAC,CACE,kBAAkB,EAClB,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAC9H,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,QAAQ,CAAe,CAAA"}
|
package/dist/facade.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M3Node, Node, Writer } from "@lionweb/core";
|
|
2
2
|
import { IoLionWebMpsSpecificAnnotation } from "./implementation.js";
|
|
3
|
-
export declare const combinedWriter:
|
|
3
|
+
export declare const combinedWriter: Writer<M3Node | IoLionWebMpsSpecificAnnotation, Node>;
|
|
4
4
|
//# sourceMappingURL=facade.d.ts.map
|
package/dist/facade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAiBA,OAAO,
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAiBA,OAAO,EAOH,MAAM,EACN,IAAI,EAEJ,MAAM,EACT,MAAM,eAAe,CAAA;AAItB,OAAO,EAGH,8BAA8B,EAIjC,MAAM,qBAAqB,CAAA;AA+C5B,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,GAAG,8BAA8B,EAAE,IAAI,CAchF,CAAA"}
|
package/dist/facade.js
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
//
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
import { areSameClassifiers, areSameLanguages,
|
|
17
|
+
import { areSameClassifiers, areSameLanguages, lioncoreWriterFor, LionWebVersions, updateSettingsNameBased } from "@lionweb/core";
|
|
18
18
|
import { ioLionWebMpsSpecificClassifiers, ioLionWebMpsSpecificLanguage } from "./definition.js";
|
|
19
19
|
import { ConceptDescription, Deprecated, KeyedDescription, ShortDescription, VirtualPackage } from "./implementation.js";
|
|
20
|
+
const { v2023_1 } = LionWebVersions;
|
|
20
21
|
const ioLionWebMpsSpecificFactory = (parent, classifier, id, propertySettings) => {
|
|
21
22
|
const setProperties = (node, ...namesOfOptionalStringProperties) => {
|
|
22
23
|
namesOfOptionalStringProperties.forEach((propertyName) => {
|
|
@@ -61,8 +62,8 @@ export const combinedWriter = {
|
|
|
61
62
|
if (areSameLanguages(classifier.language, ioLionWebMpsSpecificLanguage)) {
|
|
62
63
|
return ioLionWebMpsSpecificFactory(parent, classifier, id, propertySettings);
|
|
63
64
|
}
|
|
64
|
-
if (areSameLanguages(classifier.language,
|
|
65
|
-
return
|
|
65
|
+
if (areSameLanguages(classifier.language, v2023_1.lioncoreFacade.language)) {
|
|
66
|
+
return lioncoreWriterFor(v2023_1).nodeFor(parent, classifier, id, propertySettings);
|
|
66
67
|
}
|
|
67
68
|
throw new Error(`don't know how to instantiate a ${classifier.name} from language ${classifier.language.name} (${classifier.language.key}, ${classifier.language.version})`);
|
|
68
69
|
},
|
package/dist/facade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EACH,kBAAkB,EAClB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAEhB,iBAAiB,EACjB,eAAe,EAIf,uBAAuB,EAE1B,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,+BAA+B,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC/F,OAAO,EACH,kBAAkB,EAClB,UAAU,EAEV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACjB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAA;AAEnC,MAAM,2BAA2B,GAAG,CAAC,MAAwB,EAAE,UAAsB,EAAE,EAAa,EAAE,gBAAwD,EAAE,EAAE;IAE9J,MAAM,aAAa,GAAG,CAA2C,IAAO,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CAAC,OAAO,GAAG,CAAC,CAAA;IAChL,CAAC;IACD,eAAe,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACtC,uBAAuB,CAAC,IAA0C,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IACvF,CAAC;CACJ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/io-lionweb-mps-specific",
|
|
3
|
-
"version": "0.8.0-beta.
|
|
3
|
+
"version": "0.8.0-beta.6",
|
|
4
4
|
"description": "TypeScript implementation of the io.lionweb.mps.specific language",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lionweb/core": "0.8.0-beta.
|
|
19
|
-
"@lionweb/json": "0.8.0-beta.
|
|
20
|
-
"@lionweb/textgen-utils": "0.8.0-beta.
|
|
21
|
-
"@lionweb/ts-utils": "0.8.0-beta.
|
|
18
|
+
"@lionweb/core": "0.8.0-beta.6",
|
|
19
|
+
"@lionweb/json": "0.8.0-beta.6",
|
|
20
|
+
"@lionweb/textgen-utils": "0.8.0-beta.6",
|
|
21
|
+
"@lionweb/ts-utils": "0.8.0-beta.6",
|
|
22
22
|
"littoral-templates": "0.5.1"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
package/src/definition.ts
CHANGED
|
@@ -15,16 +15,11 @@
|
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
Annotation,
|
|
20
|
-
builtinClassifiers,
|
|
21
|
-
builtinPrimitives,
|
|
22
|
-
Classifier,
|
|
23
|
-
LanguageFactory,
|
|
24
|
-
metaConcepts
|
|
25
|
-
} from "@lionweb/core"
|
|
18
|
+
import { Annotation, Classifier, LanguageFactory, LionWebVersions } from "@lionweb/core"
|
|
26
19
|
import { StringsMapper } from "@lionweb/ts-utils"
|
|
27
20
|
|
|
21
|
+
const { v2023_1 } = LionWebVersions
|
|
22
|
+
|
|
28
23
|
const languageName = "io.lionweb.mps.specific"
|
|
29
24
|
const dashedLanguageName = languageName.replaceAll(".", "-")
|
|
30
25
|
|
|
@@ -36,25 +31,29 @@ const idKeyGen: StringsMapper = (...names) =>
|
|
|
36
31
|
const factory = new LanguageFactory(dashedLanguageName, "2024-01", idKeyGen, idKeyGen)
|
|
37
32
|
|
|
38
33
|
|
|
34
|
+
const { inamed, node } = v2023_1.builtinsFacade.classifiers
|
|
35
|
+
|
|
39
36
|
const defineAnnotation = (nameOfAnnotation: string, annotates: Classifier, ...namesOfOptionalStringProperties: string[]): Annotation => {
|
|
40
37
|
const annotation = factory.annotation(nameOfAnnotation).annotating(annotates)
|
|
41
38
|
namesOfOptionalStringProperties.forEach((name) => {
|
|
42
|
-
factory.property(annotation, name).ofType(
|
|
39
|
+
factory.property(annotation, name).ofType(v2023_1.builtinsFacade.primitiveTypes.stringDataType).isOptional()
|
|
43
40
|
})
|
|
44
41
|
return annotation
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
|
|
45
|
+
const { metaConcepts } = v2023_1.lioncoreFacade
|
|
46
|
+
|
|
48
47
|
const ConceptDescription = defineAnnotation("ConceptDescription", metaConcepts.classifier, "conceptAlias", "conceptShortDescription", "helpUrl")
|
|
49
48
|
|
|
50
49
|
const Deprecated = defineAnnotation("Deprecated", metaConcepts.ikeyed, "comment", "build")
|
|
51
50
|
|
|
52
51
|
const KeyedDescription = defineAnnotation("KeyedDescription", metaConcepts.ikeyed, "documentation")
|
|
53
|
-
factory.reference(KeyedDescription, "seeAlso").ofType(
|
|
52
|
+
factory.reference(KeyedDescription, "seeAlso").ofType(node).isMultiple().isOptional()
|
|
54
53
|
|
|
55
|
-
const ShortDescription = defineAnnotation("ShortDescription",
|
|
54
|
+
const ShortDescription = defineAnnotation("ShortDescription", node, "description")
|
|
56
55
|
|
|
57
|
-
const VirtualPackage = defineAnnotation("VirtualPackage",
|
|
56
|
+
const VirtualPackage = defineAnnotation("VirtualPackage", node).implementing(inamed)
|
|
58
57
|
|
|
59
58
|
|
|
60
59
|
export const ioLionWebMpsSpecificLanguage = factory.language
|
package/src/deserializer.ts
CHANGED
|
@@ -20,15 +20,15 @@ import {
|
|
|
20
20
|
consoleProblemReporter,
|
|
21
21
|
deserializerWith,
|
|
22
22
|
Language,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
lioncoreReaderFor,
|
|
24
|
+
LionWebVersions,
|
|
25
25
|
nodesExtractorUsing,
|
|
26
26
|
ProblemReporter
|
|
27
27
|
} from "@lionweb/core"
|
|
28
|
-
import { lioncoreExtractionFacade } from "@lionweb/core/dist/m3/facade.js"
|
|
29
28
|
import { ioLionWebMpsSpecificLanguage } from "./definition.js"
|
|
30
29
|
import { combinedWriter } from "./facade.js"
|
|
31
30
|
|
|
31
|
+
const { v2023_1 } = LionWebVersions
|
|
32
32
|
/**
|
|
33
33
|
* @return the deserialization of the given {@link LionWebJsonChunk serialization chunk} as an array of {@link Language languages}.
|
|
34
34
|
* Any LionCore/M3 node can be annotated using annotations from the `io.lionweb.mps.specific` language.
|
|
@@ -37,10 +37,10 @@ import { combinedWriter } from "./facade.js"
|
|
|
37
37
|
export const deserializeLanguagesWithIoLionWebMpsSpecific = (serializationChunk: LionWebJsonChunk, problemHandler: ProblemReporter = consoleProblemReporter) =>
|
|
38
38
|
deserializerWith({
|
|
39
39
|
writer: combinedWriter,
|
|
40
|
-
languages: [
|
|
40
|
+
languages: [v2023_1.lioncoreFacade.language, ioLionWebMpsSpecificLanguage],
|
|
41
41
|
problemReporter: problemHandler
|
|
42
42
|
})(
|
|
43
43
|
serializationChunk,
|
|
44
|
-
[
|
|
44
|
+
[v2023_1.lioncoreFacade.language, v2023_1.builtinsFacade.language].flatMap(nodesExtractorUsing(lioncoreReaderFor(v2023_1)))
|
|
45
45
|
).filter((node) => node instanceof Language) as Language[]
|
|
46
46
|
|
package/src/facade.ts
CHANGED
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
areSameClassifiers,
|
|
20
20
|
areSameLanguages,
|
|
21
21
|
Classifier,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
lioncoreWriter,
|
|
22
|
+
lioncoreWriterFor,
|
|
23
|
+
LionWebVersions,
|
|
25
24
|
M3Concept,
|
|
26
25
|
M3Node,
|
|
27
26
|
Node,
|
|
28
|
-
updateSettingsNameBased
|
|
27
|
+
updateSettingsNameBased,
|
|
28
|
+
Writer
|
|
29
29
|
} from "@lionweb/core"
|
|
30
30
|
import { LionWebId, LionWebKey } from "@lionweb/json"
|
|
31
31
|
|
|
@@ -39,6 +39,8 @@ import {
|
|
|
39
39
|
VirtualPackage
|
|
40
40
|
} from "./implementation.js"
|
|
41
41
|
|
|
42
|
+
const { v2023_1 } = LionWebVersions
|
|
43
|
+
|
|
42
44
|
const ioLionWebMpsSpecificFactory = (parent: Node | undefined, classifier: Classifier, id: LionWebId, propertySettings: { [propertyKey: LionWebKey]: unknown }) => {
|
|
43
45
|
|
|
44
46
|
const setProperties = <T extends IoLionWebMpsSpecificAnnotation>(node: T, ...namesOfOptionalStringProperties: (keyof T)[]) => {
|
|
@@ -82,14 +84,14 @@ const ioLionWebMpsSpecificFactory = (parent: Node | undefined, classifier: Class
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
|
|
85
|
-
export const combinedWriter:
|
|
87
|
+
export const combinedWriter: Writer<M3Node | IoLionWebMpsSpecificAnnotation, Node> = {
|
|
86
88
|
encodingOf: (_literal) => undefined, // (there are no literals in either LionCore/M3 or io.lionweb.mps.specific)
|
|
87
89
|
nodeFor: (parent, classifier, id, propertySettings) => {
|
|
88
90
|
if (areSameLanguages(classifier.language, ioLionWebMpsSpecificLanguage)) {
|
|
89
91
|
return ioLionWebMpsSpecificFactory(parent, classifier, id, propertySettings)
|
|
90
92
|
}
|
|
91
|
-
if (areSameLanguages(classifier.language,
|
|
92
|
-
return
|
|
93
|
+
if (areSameLanguages(classifier.language, v2023_1.lioncoreFacade.language)) {
|
|
94
|
+
return lioncoreWriterFor(v2023_1).nodeFor(parent as M3Concept, classifier, id, propertySettings)
|
|
93
95
|
}
|
|
94
96
|
throw new Error(`don't know how to instantiate a ${classifier.name} from language ${classifier.language.name} (${classifier.language.key}, ${classifier.language.version})`)
|
|
95
97
|
},
|