aurora-langium 0.0.6 → 0.0.8

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/out/cli/main.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const getAuroraServices: () => Promise<{
2
- shared: import("langium/lsp").LangiumSharedServices;
2
+ shared: import("langium-sprotty").LangiumSprottySharedServices;
3
3
  Aurora: import("../language/aurora-module.js").AuroraServices;
4
4
  }>;
5
5
  export declare const generateAction: (fileName: string, opts: GenerateOptions) => Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { GeneratorContext, LangiumDiagramGenerator } from 'langium-sprotty';
2
+ import { SEdge, SModelRoot, SNode } from 'sprotty-protocol';
3
+ import { IssueCoordinate, NL_STATEMENT, OrderCoordinate, PCM } from './generated/ast.js';
4
+ export declare function clearNGOFilter(): void;
5
+ export declare function addToNGOFilter(s: string[]): void;
6
+ export declare function getNgoFilter(): string[];
7
+ export declare class AuroraDiagramGenerator extends LangiumDiagramGenerator {
8
+ ngoFilter: string[];
9
+ updateNGOFilter(s: string[]): void;
10
+ protected generateRoot(args: GeneratorContext<PCM>): SModelRoot;
11
+ protected generateNar(nl: NL_STATEMENT, { idCache }: GeneratorContext<PCM>): SNode;
12
+ protected generateIC(state: IssueCoordinate, { idCache }: GeneratorContext<PCM>): SNode;
13
+ protected generateOC(oc: OrderCoordinate, { idCache }: GeneratorContext<PCM>): SNode;
14
+ protected generateEdge(ic: IssueCoordinate | OrderCoordinate, { idCache }: GeneratorContext<PCM>): SEdge;
15
+ protected generateNLEdge(nl: NL_STATEMENT, { idCache }: GeneratorContext<PCM>): SEdge;
16
+ }
@@ -0,0 +1,133 @@
1
+ import { LangiumDiagramGenerator } from 'langium-sprotty';
2
+ import { AstUtils } from 'langium';
3
+ var ngoFilter = [];
4
+ export function clearNGOFilter() { ngoFilter = []; }
5
+ export function addToNGOFilter(s) { ngoFilter = [...ngoFilter, ...s]; }
6
+ export function getNgoFilter() { return ngoFilter; }
7
+ function listOfNarratives(a) {
8
+ return AstUtils.streamAllContents(a)
9
+ .toArray()
10
+ .filter((i) => i.$type == "NL_STATEMENT");
11
+ }
12
+ export class AuroraDiagramGenerator extends LangiumDiagramGenerator {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.ngoFilter = [];
16
+ }
17
+ updateNGOFilter(s) { {
18
+ ngoFilter = [...ngoFilter, ...s];
19
+ } }
20
+ generateRoot(args) {
21
+ const { document } = args;
22
+ const sm = document.parseResult.value;
23
+ let ic = sm.elements.filter(x => x.$type == "Issues").map(i => i).flatMap(x => x.coord);
24
+ let ngo = sm.elements.filter(x => x.$type == "Orders").map(i => i).flatMap(x => x.namedGroups);
25
+ let oc = ngo.filter(x => this.ngoFilter.indexOf(x.name.replace(":", "").trim()) === -1).flatMap(n => n.orders).filter(x => x.$type == "OrderCoordinate").map(x => x);
26
+ let nar = listOfNarratives(sm).filter(x => x.$container.$type != "ClinicalCoordinate" && x.$container.$type != "NamedGroupOrder" && x.$container.$type != "NamedGroupClinical");
27
+ return {
28
+ type: 'graph',
29
+ id: 'pcm',
30
+ children: [
31
+ ...ic.map(x => this.generateIC(x, args)),
32
+ ...oc.map(x => this.generateOC(x, args)),
33
+ ...nar.map(x => this.generateNar(x, args)),
34
+ ...nar.map(x => this.generateNLEdge(x, args)),
35
+ ...oc.map(x => this.generateEdge(x, args)),
36
+ ...ic.filter(i => i.refs.length != 0).map(x => this.generateEdge(x, args))
37
+ ]
38
+ };
39
+ }
40
+ generateNar(nl, { idCache }) {
41
+ const nodeId = idCache.uniqueId(nl.name, nl);
42
+ var t = "node:nl"; // Neutral Nar
43
+ switch (nl.name.trim()[1].toString()) {
44
+ case '?':
45
+ t = "node:nldraft";
46
+ break;
47
+ case '!':
48
+ t = "node:nlexclamation";
49
+ break;
50
+ case 'x':
51
+ t = "node:nltaskcompleted";
52
+ break;
53
+ case '.':
54
+ t = "node:nltask";
55
+ break;
56
+ default:
57
+ }
58
+ return {
59
+ type: t,
60
+ id: nodeId,
61
+ children: [{ type: 'label:darktext', id: idCache.uniqueId(nodeId + '.label'), text: nl.name }],
62
+ layout: 'stack',
63
+ layoutOptions: { paddingTop: 10.0, paddingBottom: 10.0, paddingLeft: 10.0, paddingRight: 10.0 }
64
+ };
65
+ }
66
+ generateIC(state, { idCache }) {
67
+ const nodeId = idCache.uniqueId(state.name, state);
68
+ return {
69
+ type: 'node:ic',
70
+ id: nodeId,
71
+ children: [
72
+ { type: 'label', id: idCache.uniqueId(nodeId + '.label'), text: state.name }
73
+ ],
74
+ layout: 'stack',
75
+ layoutOptions: { paddingTop: 10.0, paddingBottom: 10.0, paddingLeft: 10.0, paddingRight: 10.0
76
+ }
77
+ };
78
+ }
79
+ generateOC(oc, { idCache }) {
80
+ var i = "node:oc";
81
+ if (oc.refs.length == 0) {
82
+ i = "node:ocorphan";
83
+ }
84
+ const nodeId = idCache.uniqueId(oc.name, oc);
85
+ return {
86
+ type: i,
87
+ id: nodeId,
88
+ children: [{ type: 'label:darktext', id: idCache.uniqueId(nodeId + '.label'), text: oc.name }],
89
+ layout: 'stack',
90
+ layoutOptions: { paddingTop: 10.0, paddingBottom: 10.0, paddingLeft: 10.0, paddingRight: 10.0 }
91
+ };
92
+ }
93
+ // TODO, change this from ic -> (to, from )
94
+ // And capture the ~ for the negative relationship
95
+ generateEdge(ic, { idCache }) {
96
+ const sourceId = idCache.getId(ic);
97
+ const targetId = idCache.getId(ic.refs[0].ref);
98
+ const edgeId = idCache.uniqueId(`${sourceId}:${ic.refs[0].$refNode.text}:${targetId}`, ic);
99
+ return {
100
+ type: 'edge',
101
+ id: edgeId,
102
+ sourceId: sourceId,
103
+ targetId: targetId,
104
+ children: [
105
+ {
106
+ type: 'label:xref',
107
+ id: idCache.uniqueId(edgeId + '.label'),
108
+ // text: transition.event?.ref?.name
109
+ }
110
+ ]
111
+ };
112
+ }
113
+ generateNLEdge(nl, { idCache }) {
114
+ var _a;
115
+ const sourceId = idCache.getId(nl);
116
+ const targetId = idCache.getId(nl.$container);
117
+ const edgeId = idCache.uniqueId(`${sourceId}:${(_a = nl.$container.$cstNode) === null || _a === void 0 ? void 0 : _a.text}:${targetId}`, nl);
118
+ return {
119
+ type: 'edge',
120
+ id: edgeId,
121
+ sourceId: sourceId,
122
+ targetId: targetId,
123
+ children: [
124
+ {
125
+ type: 'label:xref',
126
+ id: idCache.uniqueId(edgeId + '.label'),
127
+ // text: transition.event?.ref?.name
128
+ }
129
+ ]
130
+ };
131
+ }
132
+ }
133
+ //# sourceMappingURL=aurora-diagram-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aurora-diagram-generator.js","sourceRoot":"","sources":["../../src/language/aurora-diagram-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,IAAI,SAAS,GAAa,EAAE,CAAA;AAC5B,MAAM,UAAU,cAAc,KAAW,SAAS,GAAG,EAAE,CAAA,CAAA,CAAC;AACxD,MAAM,UAAU,cAAc,CAAC,CAAW,IAAU,SAAS,GAAG,CAAE,GAAG,SAAS,EAAE,GAAG,CAAC,CAAC,CAAA,CAAC,CAAC;AACvF,MAAM,UAAU,YAAY,KAAc,OAAO,SAAS,CAAA,CAAA,CAAC;AAE3D,SAAS,gBAAgB,CAAC,CAAU;IAChC,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;SACjC,OAAO,EAAE;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,cAAc,CAAmB,CAAC;AAClE,CAAC;AAED,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;QACI,cAAS,GAAc,EAAE,CAAA;IA2G7B,CAAC;IA1GG,eAAe,CAAC,CAAW,IAAK;QAAC,SAAS,GAAG,CAAE,GAAG,SAAS,EAAE,GAAG,CAAC,CAAC,CAAA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E;gBACE;oBACJ,IAAI,EAAE,YAAY;oBAClB,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC;oBACvC,oCAAoC;iBACvC;aACJ;SACJ,CAAC;IACN,CAAC;IACS,cAAc,CAAC,EAAgB,EAAE,EAAE,OAAO,EAAyB;;QACzE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,IAAI,MAAA,EAAE,CAAC,UAAU,CAAC,QAAQ,0CAAE,IAAI,IAAI,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/F,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,EAAE,EAAE,MAAM;YACV,QAAQ,EAAE,QAAS;YACnB,QAAQ,EAAE,QAAS;YACnB,QAAQ,EAAE;gBACE;oBACJ,IAAI,EAAE,YAAY;oBAClB,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC;oBACvC,oCAAoC;iBACvC;aACJ;SACJ,CAAC;IACN,CAAC;CACJ"}
@@ -1,6 +1,7 @@
1
1
  import { type Module } from 'langium';
2
- import { type DefaultSharedModuleContext, type LangiumServices, type LangiumSharedServices, type PartialLangiumServices } from 'langium/lsp';
2
+ import { type DefaultSharedModuleContext, type LangiumServices, type PartialLangiumServices } from 'langium/lsp';
3
3
  import { AuroraValidator } from './aurora-validator.js';
4
+ import { LangiumSprottyServices, LangiumSprottySharedServices, SprottyDiagramServices } from 'langium-sprotty';
4
5
  /**
5
6
  * Declaration of custom services - add your own service classes here.
6
7
  */
@@ -13,13 +14,13 @@ export type AuroraAddedServices = {
13
14
  * Union of Langium default services and your custom services - use this as constructor parameter
14
15
  * of custom service classes.
15
16
  */
16
- export type AuroraServices = LangiumServices & AuroraAddedServices;
17
+ export type AuroraServices = LangiumSprottyServices & LangiumServices & AuroraAddedServices;
17
18
  /**
18
19
  * Dependency injection module that overrides Langium default services and contributes the
19
20
  * declared custom services. The Langium defaults can be partially specified to override only
20
21
  * selected services, while the custom services must be fully specified.
21
22
  */
22
- export declare const AuroraModule: Module<AuroraServices, PartialLangiumServices & AuroraAddedServices>;
23
+ export declare const AuroraModule: Module<AuroraServices, PartialLangiumServices & SprottyDiagramServices & AuroraAddedServices>;
23
24
  /**
24
25
  * Create the full set of services required by Langium.
25
26
  *
@@ -36,6 +37,6 @@ export declare const AuroraModule: Module<AuroraServices, PartialLangiumServices
36
37
  * @returns An object wrapping the shared services and the language-specific services
37
38
  */
38
39
  export declare function createAuroraServices(context: DefaultSharedModuleContext): {
39
- shared: LangiumSharedServices;
40
+ shared: LangiumSprottySharedServices;
40
41
  Aurora: AuroraServices;
41
42
  };
@@ -2,14 +2,23 @@ import { inject } from 'langium';
2
2
  import { createDefaultModule, createDefaultSharedModule } from 'langium/lsp';
3
3
  import { AuroraGeneratedModule, AuroraGeneratedSharedModule } from './generated/module.js';
4
4
  import { AuroraValidator, registerValidationChecks } from './aurora-validator.js';
5
+ import { AuroraScopeComputation } from './aurora-scope.js';
6
+ import { AuroraDiagramGenerator } from './aurora-diagram-generator.js';
7
+ import { SprottySharedModule } from 'langium-sprotty';
5
8
  /**
6
9
  * Dependency injection module that overrides Langium default services and contributes the
7
10
  * declared custom services. The Langium defaults can be partially specified to override only
8
11
  * selected services, while the custom services must be fully specified.
9
12
  */
10
13
  export const AuroraModule = {
14
+ diagram: {
15
+ DiagramGenerator: services => new AuroraDiagramGenerator(services),
16
+ },
11
17
  validation: {
12
18
  AuroraValidator: () => new AuroraValidator()
19
+ },
20
+ references: {
21
+ ScopeComputation: (services) => new AuroraScopeComputation(services),
13
22
  }
14
23
  };
15
24
  /**
@@ -28,7 +37,7 @@ export const AuroraModule = {
28
37
  * @returns An object wrapping the shared services and the language-specific services
29
38
  */
30
39
  export function createAuroraServices(context) {
31
- const shared = inject(createDefaultSharedModule(context), AuroraGeneratedSharedModule);
40
+ const shared = inject(createDefaultSharedModule(context), AuroraGeneratedSharedModule, SprottySharedModule);
32
41
  const Aurora = inject(createDefaultModule({ shared }), AuroraGeneratedModule, AuroraModule);
33
42
  shared.ServiceRegistry.register(Aurora);
34
43
  registerValidationChecks(Aurora);
@@ -1 +1 @@
1
- {"version":3,"file":"aurora-module.js","sourceRoot":"","sources":["../../src/language/aurora-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAkH,MAAM,aAAa,CAAC;AAC7L,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAiBlF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyE;IAC9F,UAAU,EAAE;QACR,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,eAAe,EAAE;KAC/C;CACJ,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAmC;IAIpE,MAAM,MAAM,GAAG,MAAM,CACjB,yBAAyB,CAAC,OAAO,CAAC,EAClC,2BAA2B,CAC9B,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CACjB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,EAC/B,qBAAqB,EACrB,YAAY,CACf,CAAC;IACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACrB,wCAAwC;QACxC,6DAA6D;QAC7D,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,EA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AC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACrB,wCAAwC;QACxC,6DAA6D;QAC7D,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KAC1D;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /******************************************************************************
2
+ * Copyright 2021 TypeFox GmbH
3
+ * This program and the accompanying materials are made available under the
4
+ * terms of the MIT License, which is available in the project root.
5
+ ******************************************************************************/
6
+ import { DefaultScopeComputation } from 'langium';
7
+ import type { AstNodeDescription, LangiumDocument, PrecomputedScopes } from 'langium';
8
+ import { AuroraServices } from './aurora-module.js';
9
+ export declare class AuroraScopeComputation extends DefaultScopeComputation {
10
+ constructor(services: AuroraServices);
11
+ computeExports(document: LangiumDocument): Promise<AstNodeDescription[]>;
12
+ computeLocalScopes(document: LangiumDocument): Promise<PrecomputedScopes>;
13
+ private processContainer;
14
+ }
@@ -0,0 +1,57 @@
1
+ /******************************************************************************
2
+ * Copyright 2021 TypeFox GmbH
3
+ * This program and the accompanying materials are made available under the
4
+ * terms of the MIT License, which is available in the project root.
5
+ ******************************************************************************/
6
+ import { DefaultScopeComputation, MultiMap, AstUtils } from 'langium';
7
+ import { isIssueCoordinate, isMODULE, isOrderCoordinate } from './generated/ast.js';
8
+ export class AuroraScopeComputation extends DefaultScopeComputation {
9
+ constructor(services) {
10
+ super(services);
11
+ }
12
+ async computeExports(document) {
13
+ const exportedDescriptions = [];
14
+ for (const childNode of AstUtils.streamAllContents(document.parseResult.value)) {
15
+ if (isIssueCoordinate(childNode)) {
16
+ const fullyQualifiedName = childNode.name;
17
+ exportedDescriptions.push(this.descriptions.createDescription(childNode, fullyQualifiedName, document));
18
+ }
19
+ if (isOrderCoordinate(childNode)) {
20
+ const fullyQualifiedName = childNode.name;
21
+ exportedDescriptions.push(this.descriptions.createDescription(childNode, fullyQualifiedName, document));
22
+ }
23
+ if (isMODULE(childNode)) {
24
+ const fullyQualifiedName = childNode.name;
25
+ const description = this.descriptions.createDescription(childNode, fullyQualifiedName, document);
26
+ exportedDescriptions.push(description);
27
+ }
28
+ }
29
+ return exportedDescriptions;
30
+ }
31
+ async computeLocalScopes(document) {
32
+ const model = document.parseResult.value;
33
+ const scopes = new MultiMap();
34
+ this.processContainer(model, scopes, document);
35
+ return scopes;
36
+ }
37
+ processContainer(container, scopes, document) {
38
+ const localDescriptions = [];
39
+ for (const element of AstUtils.streamAllContents(container)) {
40
+ if (isIssueCoordinate(element)) {
41
+ const description = this.descriptions.createDescription(element, element.name, document);
42
+ localDescriptions.push(description);
43
+ }
44
+ if (isOrderCoordinate(element)) {
45
+ const description = this.descriptions.createDescription(element, element.name, document);
46
+ localDescriptions.push(description);
47
+ }
48
+ if (isMODULE(element)) {
49
+ const description = this.descriptions.createDescription(element, element.name, document);
50
+ localDescriptions.push(description);
51
+ }
52
+ }
53
+ scopes.addAll(container, localDescriptions);
54
+ return localDescriptions;
55
+ }
56
+ }
57
+ //# sourceMappingURL=aurora-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aurora-scope.js","sourceRoot":"","sources":["../../src/language/aurora-scope.ts"],"names":[],"mappings":"AAAA;;;;gFAIgF;AAEhF,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGrE,OAAO,EAAE,iBAAiB,EAAC,QAAQ,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAA;AAIhF,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAEjE,YAAY,QAAuB;QACjC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjB,CAAC;IAEQ,KAAK,CAAC,cAAc,CAC3B,QAAyB;QAEzB,MAAM,oBAAoB,GAAyB,EAAE,CAAA;QAErD,KAAK,M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