aurora-langium 0.0.5 → 0.0.7

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.
@@ -2,6 +2,7 @@ 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';
5
6
  /**
6
7
  * Dependency injection module that overrides Langium default services and contributes the
7
8
  * declared custom services. The Langium defaults can be partially specified to override only
@@ -10,6 +11,9 @@ import { AuroraValidator, registerValidationChecks } from './aurora-validator.js
10
11
  export const AuroraModule = {
11
12
  validation: {
12
13
  AuroraValidator: () => new AuroraValidator()
14
+ },
15
+ references: {
16
+ ScopeComputation: (services) => new AuroraScopeComputation(services),
13
17
  }
14
18
  };
15
19
  /**
@@ -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,CAA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M,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,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,QA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AgB,CACtB,SAAc,EACd,MAAyB,EACzB,QAAyB;QAEzB,MAAM,iBAAiB,GAAyB,EAAE,CAAA;QAClD,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE;YAC3D,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;gBAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CACrD,OAAO,EACP,OAAO,CAAC,IAAI,EACZ,QAAQ,CACT,CAAA;gBACD,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;aACpC;YACD,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;gBAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CACrD,OAAO,EACP,OAAO,CAAC,IAAI,EACZ,QAAQ,CACT,CAAA;gBACD,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;aACpC;YACD,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE;gBACrB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CACrD,OAAO,EACP,OAAO,CAAC,IAAI,EACZ,QAAQ,CACT,CAAA;gBACD,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;aACpC;SACF;QACD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;QAC3C,OAAO,iBAAiB,CAAA;IAC1B,CAAC;CACF"}
@@ -30511,13 +30511,22 @@ var ClinicalCoordinate = "ClinicalCoordinate";
30511
30511
  var ClinicalValue = "ClinicalValue";
30512
30512
  var Import = "Import";
30513
30513
  var IssueCoordinate = "IssueCoordinate";
30514
+ function isIssueCoordinate(item) {
30515
+ return reflection2.isInstance(item, IssueCoordinate);
30516
+ }
30514
30517
  var Issues = "Issues";
30515
30518
  var MODULE = "MODULE";
30519
+ function isMODULE(item) {
30520
+ return reflection2.isInstance(item, MODULE);
30521
+ }
30516
30522
  var MutuallyExclusive = "MutuallyExclusive";
30517
30523
  var NamedGroupClinical = "NamedGroupClinical";
30518
30524
  var NamedGroupOrder = "NamedGroupOrder";
30519
30525
  var NL_STATEMENT = "NL_STATEMENT";
30520
30526
  var OrderCoordinate = "OrderCoordinate";
30527
+ function isOrderCoordinate(item) {
30528
+ return reflection2.isInstance(item, OrderCoordinate);
30529
+ }
30521
30530
  var Orders = "Orders";
30522
30531
  var PACKAGE = "PACKAGE";
30523
30532
  var PCM = "PCM";
@@ -33248,10 +33257,94 @@ var AuroraValidator = class {
33248
33257
  }
33249
33258
  };
33250
33259
 
33260
+ // src/language/aurora-scope.ts
33261
+ var AuroraScopeComputation = class extends DefaultScopeComputation {
33262
+ constructor(services) {
33263
+ super(services);
33264
+ }
33265
+ async computeExports(document) {
33266
+ const exportedDescriptions = [];
33267
+ for (const childNode of ast_utils_exports.streamAllContents(document.parseResult.value)) {
33268
+ if (isIssueCoordinate(childNode)) {
33269
+ const fullyQualifiedName = childNode.name;
33270
+ exportedDescriptions.push(
33271
+ this.descriptions.createDescription(
33272
+ childNode,
33273
+ fullyQualifiedName,
33274
+ document
33275
+ )
33276
+ );
33277
+ }
33278
+ if (isOrderCoordinate(childNode)) {
33279
+ const fullyQualifiedName = childNode.name;
33280
+ exportedDescriptions.push(
33281
+ this.descriptions.createDescription(
33282
+ childNode,
33283
+ fullyQualifiedName,
33284
+ document
33285
+ )
33286
+ );
33287
+ }
33288
+ if (isMODULE(childNode)) {
33289
+ const fullyQualifiedName = childNode.name;
33290
+ const description = this.descriptions.createDescription(
33291
+ childNode,
33292
+ fullyQualifiedName,
33293
+ document
33294
+ );
33295
+ exportedDescriptions.push(
33296
+ description
33297
+ );
33298
+ }
33299
+ }
33300
+ return exportedDescriptions;
33301
+ }
33302
+ async computeLocalScopes(document) {
33303
+ const model = document.parseResult.value;
33304
+ const scopes = new MultiMap();
33305
+ this.processContainer(model, scopes, document);
33306
+ return scopes;
33307
+ }
33308
+ processContainer(container, scopes, document) {
33309
+ const localDescriptions = [];
33310
+ for (const element of ast_utils_exports.streamAllContents(container)) {
33311
+ if (isIssueCoordinate(element)) {
33312
+ const description = this.descriptions.createDescription(
33313
+ element,
33314
+ element.name,
33315
+ document
33316
+ );
33317
+ localDescriptions.push(description);
33318
+ }
33319
+ if (isOrderCoordinate(element)) {
33320
+ const description = this.descriptions.createDescription(
33321
+ element,
33322
+ element.name,
33323
+ document
33324
+ );
33325
+ localDescriptions.push(description);
33326
+ }
33327
+ if (isMODULE(element)) {
33328
+ const description = this.descriptions.createDescription(
33329
+ element,
33330
+ element.name,
33331
+ document
33332
+ );
33333
+ localDescriptions.push(description);
33334
+ }
33335
+ }
33336
+ scopes.addAll(container, localDescriptions);
33337
+ return localDescriptions;
33338
+ }
33339
+ };
33340
+
33251
33341
  // src/language/aurora-module.ts
33252
33342
  var AuroraModule = {
33253
33343
  validation: {
33254
33344
  AuroraValidator: () => new AuroraValidator()
33345
+ },
33346
+ references: {
33347
+ ScopeComputation: (services) => new AuroraScopeComputation(services)
33255
33348
  }
33256
33349
  };
33257
33350
  function createAuroraServices(context) {