@likec4/language-server 1.21.1 → 1.22.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 (113) hide show
  1. package/README.md +4 -1
  2. package/bin/likec4-language-server.mjs +5 -2
  3. package/dist/LikeC4FileSystem.js +2 -2
  4. package/dist/browser.d.ts +3 -3
  5. package/dist/browser.js +17 -2
  6. package/dist/bundled.d.ts +8 -0
  7. package/dist/bundled.js +25 -0
  8. package/dist/bundled.mjs +2555 -4022
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +23 -2
  11. package/dist/logger.d.ts +9 -3
  12. package/dist/logger.js +35 -55
  13. package/dist/model/fqn-computation.js +2 -2
  14. package/dist/model/model-builder.js +13 -14
  15. package/dist/model-change/ModelChanges.js +2 -2
  16. package/dist/module.js +1 -4
  17. package/dist/references/scope-provider.js +3 -3
  18. package/dist/view-utils/manual-layout.js +2 -2
  19. package/dist/views/configurable-layouter.js +4 -4
  20. package/dist/views/likec4-views.d.ts +2 -1
  21. package/dist/views/likec4-views.js +2 -2
  22. package/package.json +14 -12
  23. package/dist/test/setup.d.ts +0 -1
  24. package/dist/test/setup.js +0 -7
  25. package/src/LikeC4FileSystem.ts +0 -38
  26. package/src/Rpc.ts +0 -134
  27. package/src/ast.ts +0 -556
  28. package/src/browser.ts +0 -35
  29. package/src/documentation/documentation-provider.ts +0 -52
  30. package/src/documentation/index.ts +0 -1
  31. package/src/formatting/LikeC4Formatter.ts +0 -639
  32. package/src/formatting/utils.ts +0 -26
  33. package/src/generated/ast.ts +0 -3735
  34. package/src/generated/grammar.ts +0 -10
  35. package/src/generated/module.ts +0 -33
  36. package/src/generated-lib/icons.ts +0 -1538
  37. package/src/index.ts +0 -30
  38. package/src/like-c4.langium +0 -901
  39. package/src/likec4lib.ts +0 -6
  40. package/src/logger.ts +0 -80
  41. package/src/lsp/CodeLensProvider.ts +0 -50
  42. package/src/lsp/CompletionProvider.ts +0 -147
  43. package/src/lsp/DocumentHighlightProvider.ts +0 -12
  44. package/src/lsp/DocumentLinkProvider.ts +0 -65
  45. package/src/lsp/DocumentSymbolProvider.ts +0 -313
  46. package/src/lsp/HoverProvider.ts +0 -92
  47. package/src/lsp/RenameProvider.ts +0 -8
  48. package/src/lsp/SemanticTokenProvider.ts +0 -383
  49. package/src/lsp/index.ts +0 -8
  50. package/src/model/deployments-index.ts +0 -209
  51. package/src/model/fqn-computation.ts +0 -83
  52. package/src/model/fqn-index.ts +0 -138
  53. package/src/model/index.ts +0 -6
  54. package/src/model/model-builder.ts +0 -724
  55. package/src/model/model-locator.ts +0 -146
  56. package/src/model/model-parser-where.ts +0 -84
  57. package/src/model/model-parser.ts +0 -86
  58. package/src/model/parser/Base.ts +0 -113
  59. package/src/model/parser/DeploymentModelParser.ts +0 -192
  60. package/src/model/parser/DeploymentViewParser.ts +0 -122
  61. package/src/model/parser/FqnRefParser.ts +0 -143
  62. package/src/model/parser/GlobalsParser.ts +0 -96
  63. package/src/model/parser/ModelParser.ts +0 -170
  64. package/src/model/parser/PredicatesParser.ts +0 -315
  65. package/src/model/parser/SpecificationParser.ts +0 -133
  66. package/src/model/parser/ViewsParser.ts +0 -428
  67. package/src/model-change/ModelChanges.ts +0 -101
  68. package/src/model-change/changeElementStyle.ts +0 -172
  69. package/src/model-change/changeViewLayout.ts +0 -47
  70. package/src/model-change/saveManualLayout.ts +0 -41
  71. package/src/module.ts +0 -255
  72. package/src/protocol.ts +0 -93
  73. package/src/references/index.ts +0 -3
  74. package/src/references/name-provider.ts +0 -37
  75. package/src/references/scope-computation.ts +0 -364
  76. package/src/references/scope-provider.ts +0 -201
  77. package/src/shared/NodeKindProvider.ts +0 -121
  78. package/src/shared/WorkspaceManager.ts +0 -48
  79. package/src/shared/WorkspaceSymbolProvider.ts +0 -3
  80. package/src/shared/index.ts +0 -3
  81. package/src/test/index.ts +0 -1
  82. package/src/test/setup.ts +0 -8
  83. package/src/test/testServices.ts +0 -152
  84. package/src/utils/disposable.ts +0 -30
  85. package/src/utils/elementRef.ts +0 -26
  86. package/src/utils/fqnRef.ts +0 -56
  87. package/src/utils/index.ts +0 -2
  88. package/src/utils/printDocs.ts +0 -3
  89. package/src/utils/stringHash.ts +0 -6
  90. package/src/validation/_shared.ts +0 -29
  91. package/src/validation/deployment-checks.ts +0 -131
  92. package/src/validation/dynamic-view-rule.ts +0 -23
  93. package/src/validation/dynamic-view-step.ts +0 -36
  94. package/src/validation/element.ts +0 -56
  95. package/src/validation/index.ts +0 -171
  96. package/src/validation/property-checks.ts +0 -52
  97. package/src/validation/relation.ts +0 -63
  98. package/src/validation/specification.ts +0 -205
  99. package/src/validation/view-predicates/element-with.ts +0 -36
  100. package/src/validation/view-predicates/expanded-element.ts +0 -16
  101. package/src/validation/view-predicates/expression-v2.ts +0 -101
  102. package/src/validation/view-predicates/incoming.ts +0 -20
  103. package/src/validation/view-predicates/index.ts +0 -6
  104. package/src/validation/view-predicates/outgoing.ts +0 -20
  105. package/src/validation/view-predicates/relation-with.ts +0 -17
  106. package/src/validation/view.ts +0 -37
  107. package/src/view-utils/assignNavigateTo.ts +0 -31
  108. package/src/view-utils/index.ts +0 -2
  109. package/src/view-utils/manual-layout.ts +0 -116
  110. package/src/view-utils/resolve-relative-paths.ts +0 -90
  111. package/src/views/configurable-layouter.ts +0 -65
  112. package/src/views/index.ts +0 -1
  113. package/src/views/likec4-views.ts +0 -139
@@ -1,901 +0,0 @@
1
- grammar LikeC4
2
-
3
- entry LikeC4Grammar:
4
- (
5
- specifications+=SpecificationRule |
6
- models+=Model |
7
- views+=ModelViews |
8
- globals+=Globals |
9
- deployments+=ModelDeployments |
10
- likec4lib+=LikeC4Lib
11
- )*
12
- ;
13
-
14
- // Lib -------------------------------------
15
- LikeC4Lib:
16
- 'likec4lib' '{'
17
- 'icons' '{'
18
- (icons+=LibIcon)+
19
- '}'
20
- '}';
21
-
22
- LibIcon: name=IconId;
23
-
24
- // Specification -------------------------------------
25
-
26
- ElementKind: name=Id;
27
- Tag: name=Id;
28
- RelationshipKind: name=Id;
29
- CustomColor: name=CustomColorId;
30
- DeploymentNodeKind: name=Id;
31
-
32
- SpecificationRule:
33
- name='specification' '{'
34
- (
35
- elements+=SpecificationElementKind |
36
- tags+=SpecificationTag |
37
- relationships+=SpecificationRelationshipKind |
38
- colors+=SpecificationColor |
39
- deploymentNodes+=SpecificationDeploymentNodeKind
40
- )*
41
- '}';
42
-
43
- SpecificationElementKind:
44
- 'element' kind=ElementKind ('{'
45
- props+=(
46
- SpecificationElementStringProperty |
47
- ElementStyleProperty
48
- )*
49
- '}')?;
50
-
51
- SpecificationElementStringProperty:
52
- key=('technology' | 'notation') ':'? value=String ';'?;
53
-
54
- SpecificationDeploymentNodeKind:
55
- 'deploymentNode' kind=DeploymentNodeKind ('{'
56
- props+=(
57
- SpecificationElementStringProperty |
58
- ElementStyleProperty
59
- )*
60
- '}')?;
61
-
62
- SpecificationTag:
63
- 'tag' tag=Tag;
64
-
65
- SpecificationColor:
66
- 'color' name=CustomColor color=CustomColorValue;
67
-
68
- SpecificationRelationshipKind:
69
- 'relationship' kind=RelationshipKind ('{'
70
- props+=(
71
- RelationshipStyleProperty |
72
- SpecificationRelationshipStringProperty
73
- )*
74
- '}')?
75
- ;
76
-
77
- SpecificationRelationshipStringProperty:
78
- key=('technology' | 'notation') ':'? value=String ';'?;
79
-
80
- // Model -------------------------------------
81
-
82
- Model:
83
- name='model' '{'
84
- elements+=(
85
- ExtendElement |
86
- Relation<true> |
87
- Element
88
- )*
89
- '}'
90
- ;
91
-
92
- Element:
93
- (
94
- kind=[ElementKind] name=Id |
95
- name=Id Eq kind=[ElementKind]
96
- )
97
- (props+=String // title
98
- (props+=String // description
99
- (props+=String // technology
100
- (props+=String)? // tags
101
- )?
102
- )?
103
- )?
104
- body=ElementBody?
105
- ;
106
-
107
- ElementBody: '{'
108
- tags=Tags?
109
- props+=ElementProperty*
110
- elements+=(
111
- Relation<false> |
112
- Element
113
- )*
114
- '}'
115
- ;
116
-
117
- ElementProperty:
118
- ElementStringProperty |
119
- ElementStyleProperty |
120
- LinkProperty |
121
- IconProperty |
122
- MetadataProperty;
123
-
124
- ElementStringProperty:
125
- key=('title' | 'technology' | 'description') ':'? value=String ';'?;
126
-
127
- ExtendElement:
128
- 'extend' element=StrictFqnElementRef body=ExtendElementBody
129
- ;
130
-
131
- ExtendElementBody: '{'
132
- tags=Tags?
133
- props+=ExtendElementProperty*
134
-
135
- elements+=(
136
- Relation<true> |
137
- Element
138
- )*
139
- '}'
140
- ;
141
-
142
- ExtendElementProperty:
143
- LinkProperty |
144
- MetadataProperty;
145
-
146
- //
147
- StrictFqnElementRef:
148
- el=[Element:Id] ({infer StrictFqnElementRef.parent=current} StickyDot el=[Element:Id])*;
149
-
150
- ElementRef:
151
- el=[Element:Id] ({infer ElementRef.parent=current} StickyDot el=[Element:Id])*;
152
-
153
- Tags:
154
- (values+=[Tag:TagId])+ ({infer Tags.prev=current} ',' (values+=[Tag:TagId])*)* ';'?
155
- ;
156
-
157
- Relation<isExplicit>:
158
- (<isExplicit> source=ElementRef | <!isExplicit> source=ElementRef?)
159
- (
160
- kind=[RelationshipKind:DotId] |
161
- '-[' kind=[RelationshipKind] ']->' |
162
- '->'
163
- )
164
- target=ElementRef
165
- (
166
- title=String
167
- technology=String?
168
- )?
169
- tags=Tags?
170
- body=RelationBody?
171
- ;
172
-
173
- RelationBody: '{'
174
- tags=Tags?
175
- props+=RelationProperty*
176
- '}'
177
- ;
178
-
179
- RelationProperty:
180
- RelationStringProperty |
181
- RelationNavigateToProperty |
182
- RelationStyleProperty |
183
- LinkProperty |
184
- MetadataProperty
185
- ;
186
-
187
- RelationStringProperty:
188
- key=('title' | 'technology' | 'description') ':'? value=String ';'?;
189
-
190
- RelationStyleProperty:
191
- key='style' '{'
192
- props+=RelationshipStyleProperty*
193
- '}'
194
- ;
195
-
196
- MetadataProperty:
197
- 'metadata' MetadataBody
198
- ;
199
-
200
- MetadataBody: '{'
201
- props+=(MetadataAttribute)*
202
- '}'
203
- ;
204
-
205
- MetadataAttribute:
206
- key=IdTerminal ':'? value=String ';'?
207
- ;
208
-
209
- // Views -------------------------------------
210
-
211
- ModelViews:
212
- name='views' '{' (
213
- views+=LikeC4ViewRule |
214
- styles+=ViewRuleStyleOrGlobalRef
215
- )*
216
- '}';
217
-
218
- type LikeC4View = ElementView | DynamicView | DeploymentView;
219
- LikeC4ViewRule returns LikeC4View:
220
- ElementView | DynamicView | DeploymentView;
221
-
222
- ElementView:
223
- 'view' name=Id? (
224
- 'extends' extends=ElementViewRef |
225
- 'of' viewOf=ElementRef
226
- )?
227
- body=ElementViewBody?
228
- ;
229
-
230
- DynamicView:
231
- 'dynamic' 'view' name=Id body=DynamicViewBody?
232
- ;
233
-
234
- ViewRef:
235
- view=[LikeC4View];
236
-
237
- ElementViewRef:
238
- view=[ElementView];
239
-
240
- DynamicViewRef:
241
- view=[DynamicView];
242
-
243
- ElementViewBody: '{'
244
- tags=Tags?
245
- props+=ViewProperty*
246
- rules+=ViewRule*
247
- '}'
248
- ;
249
-
250
- DynamicViewBody: '{'
251
- tags=Tags?
252
- props+=ViewProperty*
253
- (
254
- steps+=(DynamicViewParallelSteps | DynamicViewStep) |
255
- rules+=DynamicViewRule
256
- )*
257
- '}'
258
- ;
259
-
260
-
261
- type StringProperty =
262
- ElementStringProperty |
263
- ViewStringProperty |
264
- RelationStringProperty |
265
- MetadataAttribute |
266
- SpecificationElementStringProperty |
267
- SpecificationRelationshipStringProperty |
268
- NotationProperty |
269
- NotesProperty
270
- ;
271
-
272
- ViewProperty:
273
- ViewStringProperty | LinkProperty
274
- ;
275
-
276
- ViewStringProperty:
277
- key=('title' | 'description') ':'? value=String ';'?;
278
-
279
- ViewLayoutDirection returns string:
280
- 'TopBottom' | 'LeftRight' | 'BottomTop' | 'RightLeft';
281
-
282
- ViewRule:
283
- ViewRulePredicate |
284
- ViewRuleGlobalPredicateRef |
285
- ViewRuleGroup |
286
- ViewRuleStyleOrGlobalRef |
287
- ViewRuleAutoLayout
288
- ;
289
-
290
- ViewRuleGroup:
291
- 'group' title=String? '{'
292
- props+=(
293
- ColorProperty |
294
- BorderProperty |
295
- OpacityProperty
296
- )*
297
- groupRules+=(
298
- ViewRulePredicate |
299
- ViewRuleGroup
300
- )*
301
- '}';
302
-
303
- DynamicViewRule:
304
- DynamicViewIncludePredicate |
305
- DynamicViewGlobalPredicateRef |
306
- ViewRuleStyleOrGlobalRef |
307
- ViewRuleAutoLayout
308
- ;
309
-
310
- DynamicViewParallelSteps:
311
- ('parallel'|'par') '{'
312
- (steps+=DynamicViewStep)*
313
- '}'
314
- ;
315
-
316
- DynamicViewStep:
317
- source=ElementRef
318
- (isBackward?='<-' | '->' | '-[' kind=[RelationshipKind] ']->' | kind=[RelationshipKind:DotId] )
319
- target=ElementRef
320
- title=String?
321
- custom=CustomRelationProperties?
322
- ;
323
-
324
- ViewRulePredicate:
325
- {infer IncludePredicate} 'include' predicates=Predicates |
326
- {infer ExcludePredicate} 'exclude' predicates=Predicates
327
- ;
328
- Predicates:
329
- value=Predicate ({infer Predicates.prev=current} ',' value=Predicate?)*
330
- ;
331
-
332
- Predicate:
333
- RelationPredicate |
334
- ElementPredicate
335
- ;
336
-
337
- ViewRuleGlobalPredicateRef:
338
- 'global' 'predicate' predicate=[GlobalPredicateGroup];
339
-
340
- ElementPredicate:
341
- ElementPredicates;
342
-
343
- ElementPredicates infers ElementPredicate:
344
- ElementPredicateOrWhere ({infer ElementPredicateWith.subject=current} 'with' custom=CustomElementProperties?)?
345
- ;
346
-
347
- ElementPredicateOrWhere:
348
- ElementExpression ({infer ElementPredicateWhere.subject=current} 'where' where=WhereElementExpression?)?
349
- ;
350
-
351
- WhereElementExpression:
352
- WhereElementOr
353
- ;
354
- WhereElementOr infers WhereElementExpression:
355
- WhereElementAnd ({infer WhereBinaryExpression.left=current} operator='or' right=WhereElementAnd)*
356
- ;
357
- WhereElementAnd infers WhereElementExpression:
358
- WhereElementPrimary ({infer WhereBinaryExpression.left=current} operator='and' right=WhereElementPrimary)*
359
- ;
360
-
361
- WhereElementPrimary infers WhereElementExpression:
362
- '(' WhereElementExpression ')' |
363
- WhereElementNegation |
364
- WhereElement
365
- ;
366
-
367
- WhereElementNegation:
368
- 'not' value=WhereElementExpression;
369
-
370
- WhereElement:
371
- {infer WhereElementTag} 'tag' EqOperator value=[Tag:TagId]? |
372
- {infer WhereElementKind} 'kind' EqOperator value=[DeploymentNodeOrElementKind]?
373
- ;
374
-
375
- ElementExpression:
376
- ElementSelectorExpression |
377
- ElementDescedantsExpression
378
- ;
379
-
380
- ElementSelectorExpression infers ElementExpression:
381
- {infer WildcardExpression} isWildcard?='*' |
382
- {infer ElementTagExpression} 'element.tag' IsEqual tag=[Tag:TagId]? |
383
- {infer ElementKindExpression} 'element.kind' IsEqual kind=[ElementKind]?
384
- ;
385
-
386
- ElementDescedantsExpression infers ElementExpression:
387
- ElementRef (
388
- {infer ExpandElementExpression.expand=current} DotUnderscore |
389
- {infer ElementDescedantsExpression.parent=current} suffix=DotWildcard
390
- )?
391
- ;
392
-
393
- RelationPredicate:
394
- RelationPredicates
395
- ;
396
-
397
- RelationPredicates infers RelationPredicate:
398
- RelationPredicateOrWhere ({infer RelationPredicateWith.subject=current} 'with' custom=CustomRelationProperties?)?
399
- ;
400
-
401
- RelationPredicateOrWhere:
402
- RelationExpression ({infer RelationPredicateWhere.subject=current} 'where' where=WhereRelationExpression?)?
403
- ;
404
-
405
- WhereRelationExpression:
406
- WhereRelationOr
407
- ;
408
-
409
- WhereRelationOr infers WhereRelationExpression:
410
- WhereRelationAnd ({infer WhereBinaryExpression.left=current} operator='or' right=WhereRelationAnd)*
411
- ;
412
- WhereRelationAnd infers WhereRelationExpression:
413
- WhereRelationPrimary ({infer WhereBinaryExpression.left=current} operator='and' right=WhereRelationPrimary)*
414
- ;
415
-
416
- WhereRelationPrimary infers WhereRelationExpression:
417
- '(' WhereRelationExpression ')' |
418
- WhereRelationNegation |
419
- WhereRelation
420
- ;
421
-
422
- WhereRelationNegation:
423
- 'not' value=WhereRelationExpression;
424
-
425
- WhereRelation:
426
- {infer WhereRelationTag} 'tag' EqOperator value=[Tag:TagId]? |
427
- {infer WhereRelationKind} 'kind' EqOperator value=[RelationshipKind:Id]? |
428
- {infer WhereRelationParticipantTag} participant=Participant StickyDot 'tag' EqOperator value=[Tag:TagId]? |
429
- {infer WhereRelationParticipantKind} participant=Participant StickyDot 'kind' EqOperator value=[DeploymentNodeOrElementKind:Id]?
430
- ;
431
- type DeploymentNodeOrElementKind = ElementKind | DeploymentNodeKind
432
- type WhereTagEqual = WhereElementTag | WhereRelationTag | WhereRelationParticipantTag;
433
- type WhereKindEqual = WhereElementKind | WhereRelationKind | WhereRelationParticipantKind;
434
-
435
- type WhereExpression = WhereElementExpression | WhereRelationExpression;
436
-
437
- RelationExpression:
438
- InOutRelationExpressions |
439
- DirectedRelationExpressions
440
- ;
441
-
442
- InOutRelationExpressions infers RelationExpression:
443
- IncomingRelationExpression ({infer InOutRelationExpression.inout=current} '->')?
444
- ;
445
-
446
- IncomingRelationExpression:
447
- '->' to=ElementExpression;
448
-
449
- DirectedRelationExpressions infers RelationExpression:
450
- OutgoingRelationExpression ({infer DirectedRelationExpression.source=current} target=ElementExpression)?
451
- ;
452
-
453
- OutgoingRelationExpression:
454
- from=ElementExpression
455
- (isBidirectional?='<->' | '->' | '-[' kind=[RelationshipKind:Id] ']->' | kind=[RelationshipKind:DotId])
456
- ;
457
-
458
- // Comma-separated list of ElementExpressions
459
- ElementExpressionsIterator:
460
- value=ElementExpression ({infer ElementExpressionsIterator.prev=current} ',' (value=ElementExpression)?)*
461
- ;
462
-
463
- DynamicViewIncludePredicate:
464
- 'include' predicates=DynamicViewPredicateIterator
465
- ;
466
-
467
- DynamicViewGlobalPredicateRef:
468
- 'global' 'predicate' predicate=[GlobalDynamicPredicateGroup];
469
-
470
- DynamicViewPredicateIterator:
471
- value=ElementPredicate ({infer DynamicViewPredicateIterator.prev=current} ',' (value=ElementPredicate)?)*
472
- ;
473
-
474
- ViewRuleStyle:
475
- 'style' target=ElementExpressionsIterator '{'
476
- props+=(
477
- StyleProperty |
478
- NotationProperty
479
- )*
480
- '}';
481
-
482
- ViewRuleGlobalStyle:
483
- 'global' 'style' style=[GlobalStyleId];
484
-
485
- ViewRuleStyleOrGlobalRef:
486
- ViewRuleStyle | ViewRuleGlobalStyle;
487
-
488
- ViewRuleAutoLayout:
489
- 'autoLayout' direction=ViewLayoutDirection (
490
- rankSep=Number (
491
- nodeSep=Number)?
492
- )?;
493
-
494
- NotationProperty:
495
- key='notation' ':'? value=String ';'?
496
- ;
497
- NotesProperty:
498
- key='notes' ':'? value=String ';'?
499
- ;
500
-
501
- CustomElementProperties: '{'
502
- props+=(
503
- NavigateToProperty |
504
- ElementStringProperty |
505
- NotationProperty |
506
- StyleProperty
507
- )*
508
- '}'
509
- ;
510
-
511
- CustomRelationProperties: '{'
512
- props+=(
513
- RelationNavigateToProperty |
514
- RelationStringProperty |
515
- NotationProperty |
516
- NotesProperty |
517
- RelationshipStyleProperty
518
- )*
519
- '}'
520
- ;
521
-
522
- NavigateToProperty:
523
- key='navigateTo' value=ViewRef;
524
-
525
- RelationNavigateToProperty:
526
- key='navigateTo' value=DynamicViewRef;
527
-
528
- // Deployment -------------------------------------
529
-
530
- ModelDeployments:
531
- name='deployment' '{'
532
- elements+=(
533
- DeploymentNode |
534
- DeploymentRelation
535
- )*
536
- '}';
537
-
538
- type DeploymentElement = DeploymentNode | DeployedInstance;
539
-
540
- DeploymentNode:
541
- (
542
- kind=[DeploymentNodeKind:Id] name=Id |
543
- name=Id Eq kind=[DeploymentNodeKind:Id]
544
- )
545
- title=String?
546
- body=DeploymentNodeBody?
547
- ;
548
-
549
- DeploymentNodeBody: '{'
550
- tags=Tags?
551
- props+=ElementProperty*
552
- elements+=(
553
- DeployedInstance |
554
- DeploymentRelation |
555
- DeploymentNode
556
- )*
557
- '}';
558
-
559
- DeployedInstance:
560
- (name=Id Eq)?
561
- 'instanceOf'
562
- element=ElementRef
563
- title=String?
564
- body=DeployedInstanceBody?
565
- ';'?
566
- ;
567
-
568
- DeployedInstanceBody: '{'
569
- tags=Tags?
570
- props+=ElementProperty*
571
- '}';
572
-
573
- type Referenceable = DeploymentNode | DeployedInstance | Element;
574
- // Reference to Elements in logical or deployment model
575
- // Scope computation is based on the parent element:
576
- // - If parent is DeploymentNode, then it can reference nested DeploymentNodes and DeployedInstances
577
- // - If parent is DeployedInstance, then it can reference nested Element
578
- // - If parent is Element, then it can reference nested Element
579
- // Mix of DeploymentRef and ElementRef
580
- FqnRef:
581
- value=[Referenceable:Id] ({infer FqnRef.parent=current} StickyDot value=[Referenceable:Id])*;
582
-
583
- DeploymentRelation:
584
- source=FqnRef
585
- ('->' | '-[' kind=[RelationshipKind:Id] ']->' | kind=[RelationshipKind:DotId])
586
- target=FqnRef
587
- (
588
- title=String
589
- technology=String?
590
- )?
591
- tags=Tags?
592
- body=DeploymentRelationBody?
593
- ;
594
-
595
- DeploymentRelationBody: '{'
596
- tags=Tags?
597
- props+=RelationProperty*
598
- '}'
599
- ;
600
-
601
- DeploymentView:
602
- 'deployment' 'view' name=Id body=DeploymentViewBody?
603
- ;
604
-
605
- DeploymentViewBody: '{'
606
- tags=Tags?
607
- props+=ViewProperty*
608
- rules+=DeploymentViewRule*
609
- '}';
610
-
611
- DeploymentViewRule:
612
- DeploymentViewRulePredicate |
613
- DeploymentViewRuleStyle |
614
- ViewRuleAutoLayout
615
- ;
616
-
617
- DeploymentViewRuleStyle:
618
- 'style' targets=FqnExpressions '{'
619
- props+=(
620
- StyleProperty |
621
- NotationProperty
622
- )*
623
- '}';
624
-
625
-
626
- DeploymentViewRulePredicate:
627
- (isInclude?='include' | 'exclude')
628
- expr=DeploymentViewRulePredicateExpression
629
- ;
630
-
631
- DeploymentViewRulePredicateExpression:
632
- value=ExpressionV2 ({infer DeploymentViewRulePredicateExpression.prev=current} ',' (value=ExpressionV2)?)*
633
- ;
634
-
635
- ExpressionV2:
636
- RelationPredicateOrWhereV2 |
637
- ElementPredicateOrWhereV2
638
- ;
639
-
640
- ElementPredicateOrWhereV2:
641
- FqnExpr ({infer ElementPredicateWhereV2.subject=current} 'where' where=WhereElementExpression?)?
642
- ;
643
-
644
- RelationPredicateOrWhereV2:
645
- RelationExpr ({infer RelationPredicateWhereV2.subject=current} 'where' where=WhereRelationExpression?)?
646
- ;
647
-
648
- FqnExpr:
649
- {infer WildcardExpression} isWildcard?='*' |
650
- FqnRefExpr
651
- ;
652
-
653
- FqnRefExpr:
654
- ref=FqnRef selector=(DotUnderscore | DotWildcard)?
655
- ;
656
-
657
- RelationExpr:
658
- InOutRelationExpr |
659
- DirectedRelationExpr
660
- ;
661
-
662
- InOutRelationExpr infers RelationExpr:
663
- IncomingRelationExpr ({infer InOutRelationExpr.inout=current} '->')?
664
- ;
665
-
666
- IncomingRelationExpr:
667
- '->' to=FqnExpr;
668
-
669
- DirectedRelationExpr infers RelationExpr:
670
- OutgoingRelationExpr ({infer DirectedRelationExpr.source=current} target=FqnExpr)?
671
- ;
672
-
673
- OutgoingRelationExpr:
674
- from=FqnExpr
675
- (isBidirectional?='<->' | '->' | '-[' kind=[RelationshipKind:Id] ']->' | kind=[RelationshipKind:DotId])
676
- ;
677
-
678
- FqnExpressions:
679
- value=FqnExpr ({infer FqnExpressions.prev=current} ',' (value=FqnExpr)?)*
680
- ;
681
- // Global -------------------------------------
682
-
683
- Globals:
684
- name='global' '{'
685
- (
686
- predicates+=(GlobalPredicateGroup | GlobalDynamicPredicateGroup)*
687
- styles+=(GlobalStyle | GlobalStyleGroup)*
688
- )*
689
- '}';
690
-
691
- GlobalPredicateGroup:
692
- 'predicateGroup' name=IdTerminal '{'
693
- predicates+=ViewRulePredicate*
694
- '}';
695
-
696
- GlobalDynamicPredicateGroup:
697
- 'dynamicPredicateGroup' name=IdTerminal '{'
698
- predicates+=DynamicViewIncludePredicate*
699
- '}';
700
-
701
- GlobalStyleId:
702
- name=IdTerminal;
703
-
704
- GlobalStyle:
705
- 'style' id=GlobalStyleId target=ElementExpressionsIterator '{'
706
- props+=(
707
- StyleProperty |
708
- NotationProperty
709
- )*
710
- '}';
711
-
712
- GlobalStyleGroup:
713
- 'styleGroup' id=GlobalStyleId '{'
714
- styles+=ViewRuleStyle*
715
- '}';
716
-
717
- type FqnReferenceable = Referenceable | Element | ExtendElement;
718
-
719
- // Common properties -------------------------------------
720
-
721
- LinkProperty:
722
- key='link' ':'? value=Uri title=String? ';'?;
723
- ColorProperty:
724
- key='color' ':'? (themeColor=ThemeColor | customColor=[CustomColor:CustomColorId]) ';'?;
725
-
726
- OpacityProperty:
727
- key='opacity' ':'? value=Percent ';'?;
728
-
729
- MultipleProperty:
730
- key='multiple' ':'? value=Boolean ';'?;
731
-
732
- // Element properties -------------------------------------
733
- IconProperty:
734
- key='icon' ':'? (libicon=[LibIcon:IconId] | value=('none'|Uri)) ';'?;
735
-
736
- ShapeProperty:
737
- key='shape' ':'? value=ElementShape ';'?;
738
-
739
- BorderStyleValue returns string:
740
- LineOptions | 'none';
741
-
742
- BorderProperty:
743
- key='border' ':'? value=BorderStyleValue ';'?;
744
-
745
- SizeValue returns string:
746
- 'xs' |
747
- 'sm' |
748
- 'md' |
749
- 'lg' |
750
- 'xl' |
751
- 'xsmall' |
752
- 'small' |
753
- 'medium' |
754
- 'large' |
755
- 'xlarge';
756
-
757
- ShapeSizeProperty:
758
- key='size' ':'? value=SizeValue ';'?;
759
-
760
- PaddingSizeProperty:
761
- key='padding' ':'? value=SizeValue ';'?;
762
-
763
- TextSizeProperty:
764
- key='textSize' ':'? value=SizeValue ';'?;
765
-
766
- type SizeProperty = ShapeSizeProperty | PaddingSizeProperty | TextSizeProperty;
767
-
768
- StyleProperty:
769
- ColorProperty |
770
- ShapeProperty |
771
- BorderProperty |
772
- OpacityProperty |
773
- IconProperty |
774
- MultipleProperty |
775
- ShapeSizeProperty |
776
- PaddingSizeProperty |
777
- TextSizeProperty
778
- ;
779
-
780
- ElementStyleProperty:
781
- key='style' '{'
782
- props+=StyleProperty*
783
- '}';
784
-
785
-
786
- // -------------------------
787
- // Relationship Style Properties
788
- LineProperty:
789
- key='line' ':'? value=LineOptions ';'?;
790
- ArrowProperty:
791
- key=('head' | 'tail') ':'? value=ArrowType ';'?;
792
-
793
- RelationshipStyleProperty:
794
- ColorProperty | LineProperty | ArrowProperty;
795
-
796
- Boolean returns boolean: 'true' | 'false';
797
-
798
- LineOptions returns string:
799
- 'solid' |
800
- 'dashed' |
801
- 'dotted'
802
- ;
803
-
804
- ArrowType returns string:
805
- 'none' |
806
- 'normal' |
807
- 'onormal' |
808
- 'dot' |
809
- 'odot' |
810
- 'diamond' |
811
- 'odiamond' |
812
- 'crow' |
813
- 'open' |
814
- 'vee'
815
- ;
816
-
817
- ThemeColor returns string:
818
- 'primary' | 'secondary' | 'muted' | 'slate' | 'blue' | 'indigo' | 'sky' | 'red' | 'gray' | 'green' | 'amber';
819
- ElementShape returns string:
820
- 'rectangle' | 'person' | 'browser' | 'mobile' | 'cylinder' | 'storage' | 'queue';
821
- Participant returns string:
822
- 'source' | 'target';
823
-
824
- CustomColorValue returns string:
825
- Hash (Id | Hex | Number);
826
-
827
- IconId returns string:
828
- LIB_ICON;
829
-
830
- Uri returns string:
831
- URI_WITH_SCHEMA | URI_RELATIVE;
832
-
833
- TagId returns string:
834
- Hash Id;
835
-
836
- DotId returns string:
837
- Dot Id;
838
-
839
- CustomColorId returns string:
840
- IdTerminal | ElementShape | ArrowType | LineOptions | 'element' | 'model';
841
-
842
- Id returns string:
843
- IdTerminal | ElementShape | ThemeColor | ArrowType | LineOptions | Participant | SizeValue | 'element' | 'model' | 'group' | 'node' | 'deployment' | 'instance';
844
-
845
- fragment EqOperator:
846
- (
847
- operator=(Eq | NotEqual) |
848
- operator="is" not?='not'?
849
- )
850
- ;
851
-
852
- fragment IsEqual:
853
- isEqual?=Eq | NotEqual;
854
-
855
- // -----------------------------------
856
- // Symbols
857
- // terminal fragment HASH: '#';
858
- // terminal fragment UNDERSCORE: '_';
859
- // terminal fragment DASH: '-';
860
- // terminal fragment LETTER: /[^\W\d_]/;
861
- // terminal fragment DIGIT: /[0-9]/;
862
- // terminal fragment NEWLINE: /[\r?\n]/;
863
- // terminal fragment SPACE: /[^\S\r\n]/;
864
-
865
- // -------------------------
866
- // Comments
867
- hidden terminal BLOCK_COMMENT: /\/\*[\s\S]*?\*\//;
868
- hidden terminal LINE_COMMENT: /\/\/[^\n\r]*/;
869
- hidden terminal WS: /[\t ]+/;
870
- hidden terminal NL: /[\r\n]+/;
871
-
872
- // -----------------------------------
873
- // Terminals
874
- //terminal LineStartWithDash: /(?<=([\r?\n][^\S\r\n]*))-/;
875
- // terminal Boolean returns boolean: 'true' | 'false';
876
-
877
-
878
- // LibIcons
879
- terminal LIB_ICON: /(aws|azure|gcp|tech):[-\w]*/;
880
-
881
- terminal URI_WITH_SCHEMA: /\w+:\/\/\S+/;
882
- terminal URI_RELATIVE: /\.{0,2}\/[^\/]\S+/;
883
-
884
- terminal DotUnderscore: /\b\._(?![_a-zA-Z])/;
885
- terminal DotWildcard: /\b\.\*{1,2}/;
886
- terminal Hash: '#';
887
-
888
- // No space allowed before dot
889
- terminal StickyDot: /\b\./;
890
- terminal Dot: '.';
891
- terminal NotEqual: /\!\={1,2}/;
892
- terminal Eq: /\={1,2}/;
893
- terminal Percent: /\b\d+%/;
894
-
895
- terminal String: /"[^"]*"|'[^']*'/;
896
-
897
- // terminal TagId: HASH LETTER (LETTER | DIGIT | UNDERSCORE | DASH)*;
898
- // terminal IdTerminal: (LETTER | UNDERSCORE+ (LETTER | DIGIT)) (LETTER | DIGIT | UNDERSCORE | DASH)*;
899
- terminal IdTerminal: /[_]*[a-zA-Z][-\w]*/;
900
- terminal Number returns number: /\b\d+\b/;
901
- terminal Hex: /\b[a-zA-Z0-9]+\b/;