@likec4/language-server 0.40.0 → 0.42.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.
- package/contrib/likec4.monarch.ts +48 -0
- package/contrib/likec4.tmLanguage.json +73 -0
- package/dist/Rpc.d.ts +1 -0
- package/dist/ast.d.ts +117 -0
- package/dist/ast.js +46 -2
- package/dist/elementRef.d.ts +2 -1
- package/dist/generated/ast.d.ts +45 -3
- package/dist/generated/ast.js +36 -2
- package/dist/generated/grammar.d.ts +2 -0
- package/dist/generated/grammar.js +1 -1
- package/dist/generated/module.d.ts +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/logger.d.ts +1 -0
- package/dist/lsp/CodeLensProvider.d.ts +1 -0
- package/dist/lsp/DocumentLinkProvider.d.ts +1 -0
- package/dist/lsp/DocumentSymbolProvider.d.ts +1 -0
- package/dist/lsp/HoverProvider.d.ts +1 -0
- package/dist/lsp/SemanticTokenProvider.d.ts +1 -0
- package/dist/lsp/SemanticTokenProvider.js +21 -14
- package/dist/lsp/index.d.ts +1 -0
- package/dist/model/fqn-computation.d.ts +1 -0
- package/dist/model/fqn-index.d.ts +1 -0
- package/dist/model/fqn-index.js +25 -19
- package/dist/model/index.d.ts +1 -0
- package/dist/model/model-builder.d.ts +2 -1
- package/dist/model/model-builder.js +21 -15
- package/dist/model/model-locator.d.ts +1 -0
- package/dist/model/model-parser.d.ts +1 -0
- package/dist/model/model-parser.js +21 -32
- package/dist/module.d.ts +1 -0
- package/dist/protocol.d.ts +1 -0
- package/dist/references/index.d.ts +1 -0
- package/dist/references/scope-computation.d.ts +3 -2
- package/dist/references/scope-computation.js +5 -0
- package/dist/references/scope-provider.d.ts +2 -1
- package/dist/shared/WorkspaceManager.d.ts +2 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/test/index.d.ts +1 -0
- package/dist/test/testServices.d.ts +7 -6
- package/dist/test/testServices.js +12 -3
- package/dist/utils.d.ts +1 -0
- package/dist/validation/element.d.ts +3 -0
- package/dist/validation/element.js +17 -13
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +3 -2
- package/dist/validation/relation.d.ts +2 -0
- package/dist/validation/relation.js +8 -4
- package/dist/validation/specification.d.ts +3 -0
- package/dist/validation/specification.js +12 -0
- package/dist/validation/view.d.ts +2 -0
- package/dist/view-utils/assignNavigateTo.d.ts +3 -0
- package/dist/view-utils/assignNavigateTo.js +20 -0
- package/dist/view-utils/index.d.ts +4 -0
- package/dist/view-utils/index.js +3 -0
- package/dist/view-utils/resolve-extended-views.d.ts +7 -0
- package/dist/view-utils/resolve-extended-views.js +41 -0
- package/dist/view-utils/resolve-relative-paths.d.ts +3 -0
- package/dist/view-utils/resolve-relative-paths.js +76 -0
- package/package.json +22 -14
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Monarch syntax highlighting for the likec4 language.
|
|
2
|
+
export default {
|
|
3
|
+
keywords: [
|
|
4
|
+
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','crow','cylinder','dashed','description','diamond','dotted','element','exclude','extend','extends','gray','green','head','icon','include','indigo','it','kind','line','link','mobile','model','muted','none','normal','odiamond','of','onormal','open','person','primary','queue','rectangle','red','relationship','secondary','shape','sky','slate','solid','specification','storage','style','tag','tail','technology','this','title','vee','view','views'
|
|
5
|
+
],
|
|
6
|
+
operators: [
|
|
7
|
+
'*','.*'
|
|
8
|
+
],
|
|
9
|
+
symbols: /\*|-\[|\.\*|\]->/,
|
|
10
|
+
|
|
11
|
+
tokenizer: {
|
|
12
|
+
initial: [
|
|
13
|
+
{ regex: /#/, action: {"token":"HASH"} },
|
|
14
|
+
{ regex: /_/, action: {"token":"UNDERSCORE"} },
|
|
15
|
+
{ regex: /-/, action: {"token":"DASH"} },
|
|
16
|
+
{ regex: /[^\W\d_]/, action: { cases: { '@keywords': {"token":"keyword"}, '@default': {"token":"LETTER"} }} },
|
|
17
|
+
{ regex: /[0-9]/, action: {"token":"DIGIT"} },
|
|
18
|
+
{ regex: /[\t\r\n\v\f]/, action: {"token":"NEWLINE"} },
|
|
19
|
+
{ regex: /\w+:\/\/\S+/, action: {"token":"URI_WITH_SCHEMA"} },
|
|
20
|
+
{ regex: /\.{0,2}\/[^\/]\S+/, action: {"token":"URI_RELATIVE"} },
|
|
21
|
+
{ regex: /->/, action: {"token":"RARROW"} },
|
|
22
|
+
{ regex: /\b\.\b/, action: {"token":"Dot"} },
|
|
23
|
+
{ regex: /!=/, action: {"token":"NotEqual"} },
|
|
24
|
+
{ regex: /=/, action: {"token":"Eq"} },
|
|
25
|
+
{ regex: /\{/, action: {"token":"OpenBlock"} },
|
|
26
|
+
{ regex: /\}/, action: {"token":"CloseBlock"} },
|
|
27
|
+
{ regex: /:/, action: {"token":"Colon"} },
|
|
28
|
+
{ regex: /;/, action: {"token":"SemiColon"} },
|
|
29
|
+
{ regex: /,/, action: {"token":"Comma"} },
|
|
30
|
+
{ regex: /"[^"]*"|'[^']*'/, action: {"token":"string"} },
|
|
31
|
+
{ regex: /((#)([^\W\d_])(((([^\W\d_])|([0-9]))|(_))|(-))*)/, action: {"token":"TagID"} },
|
|
32
|
+
{ regex: /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/, action: { cases: { '@keywords': {"token":"keyword"}, '@default': {"token":"ID"} }} },
|
|
33
|
+
{ include: '@whitespace' },
|
|
34
|
+
{ regex: /@symbols/, action: { cases: { '@operators': {"token":"operator"}, '@default': {"token":""} }} },
|
|
35
|
+
],
|
|
36
|
+
whitespace: [
|
|
37
|
+
{ regex: /\/\*/, action: {"token":"comment","next":"@comment"} },
|
|
38
|
+
{ regex: /\/\/[^\n\r]*/, action: {"token":"comment"} },
|
|
39
|
+
{ regex: /(([\t\r\n\v\f])|([^\S\r\n]))+/, action: {"token":"white"} },
|
|
40
|
+
{ regex: /[^\S\r\n]/, action: {"token":"white"} },
|
|
41
|
+
],
|
|
42
|
+
comment: [
|
|
43
|
+
{ regex: /[^/\*]+/, action: {"token":"comment"} },
|
|
44
|
+
{ regex: /\*\//, action: {"token":"comment","next":"@pop"} },
|
|
45
|
+
{ regex: /[/\*]/, action: {"token":"comment"} },
|
|
46
|
+
],
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "likec4",
|
|
3
|
+
"scopeName": "source.likec4",
|
|
4
|
+
"fileTypes": [
|
|
5
|
+
".c4",
|
|
6
|
+
".likec4",
|
|
7
|
+
".like-c4"
|
|
8
|
+
],
|
|
9
|
+
"patterns": [
|
|
10
|
+
{
|
|
11
|
+
"include": "#comments"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "keyword.control.likec4",
|
|
15
|
+
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|browser|color|crow|cylinder|dashed|description|diamond|dotted|element|exclude|extend|extends|gray|green|head|icon|include|indigo|it|kind|line|link|mobile|model|muted|none|normal|odiamond|of|onormal|open|person|primary|queue|rectangle|red|relationship|secondary|shape|sky|slate|solid|specification|storage|style|tag|tail|technology|this|title|vee|view|views)\\b"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "string.quoted.double.likec4",
|
|
19
|
+
"begin": "\"",
|
|
20
|
+
"end": "\"",
|
|
21
|
+
"patterns": [
|
|
22
|
+
{
|
|
23
|
+
"include": "#string-character-escape"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "string.quoted.single.likec4",
|
|
29
|
+
"begin": "'",
|
|
30
|
+
"end": "'",
|
|
31
|
+
"patterns": [
|
|
32
|
+
{
|
|
33
|
+
"include": "#string-character-escape"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"repository": {
|
|
39
|
+
"comments": {
|
|
40
|
+
"patterns": [
|
|
41
|
+
{
|
|
42
|
+
"name": "comment.block.likec4",
|
|
43
|
+
"begin": "/\\*",
|
|
44
|
+
"beginCaptures": {
|
|
45
|
+
"0": {
|
|
46
|
+
"name": "punctuation.definition.comment.likec4"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"end": "\\*/",
|
|
50
|
+
"endCaptures": {
|
|
51
|
+
"0": {
|
|
52
|
+
"name": "punctuation.definition.comment.likec4"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"begin": "//",
|
|
58
|
+
"beginCaptures": {
|
|
59
|
+
"1": {
|
|
60
|
+
"name": "punctuation.whitespace.comment.leading.likec4"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"end": "(?=$)",
|
|
64
|
+
"name": "comment.line.likec4"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"string-character-escape": {
|
|
69
|
+
"name": "constant.character.escape.likec4",
|
|
70
|
+
"match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\\{[0-9A-Fa-f]+\\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
package/dist/Rpc.d.ts
CHANGED
package/dist/ast.d.ts
CHANGED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type c4 } from '@likec4/core';
|
|
3
|
+
import type { LangiumDocument, MultiMap } from 'langium';
|
|
4
|
+
import type { LikeC4Document } from './generated/ast';
|
|
5
|
+
import * as ast from './generated/ast';
|
|
6
|
+
export { ast };
|
|
7
|
+
declare module './generated/ast' {
|
|
8
|
+
interface Element {
|
|
9
|
+
fqn?: c4.Fqn;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export interface ParsedAstSpecification {
|
|
13
|
+
kinds: Record<c4.ElementKind, {
|
|
14
|
+
shape?: c4.ElementShape;
|
|
15
|
+
color?: c4.ThemeColor;
|
|
16
|
+
icon?: c4.IconUrl;
|
|
17
|
+
}>;
|
|
18
|
+
relationships: Record<c4.RelationshipKind, {
|
|
19
|
+
color?: c4.ThemeColor;
|
|
20
|
+
line?: c4.RelationshipLineType;
|
|
21
|
+
head?: c4.RelationshipArrowType;
|
|
22
|
+
tail?: c4.RelationshipArrowType;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export interface ParsedAstElement {
|
|
26
|
+
id: c4.Fqn;
|
|
27
|
+
astPath: string;
|
|
28
|
+
kind: c4.ElementKind;
|
|
29
|
+
title: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
technology?: string;
|
|
32
|
+
icon?: c4.IconUrl;
|
|
33
|
+
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
34
|
+
links?: c4.NonEmptyArray<string>;
|
|
35
|
+
shape?: c4.ElementShape;
|
|
36
|
+
color?: c4.ThemeColor;
|
|
37
|
+
}
|
|
38
|
+
export interface ParsedAstRelation {
|
|
39
|
+
id: c4.RelationID;
|
|
40
|
+
astPath: string;
|
|
41
|
+
source: c4.Fqn;
|
|
42
|
+
target: c4.Fqn;
|
|
43
|
+
kind?: c4.RelationshipKind;
|
|
44
|
+
title: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ParsedAstElementView {
|
|
47
|
+
id: c4.ViewID;
|
|
48
|
+
viewOf?: c4.Fqn;
|
|
49
|
+
extends?: c4.ViewID;
|
|
50
|
+
astPath: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
54
|
+
links?: c4.NonEmptyArray<string>;
|
|
55
|
+
rules: c4.ViewRule[];
|
|
56
|
+
}
|
|
57
|
+
export declare const ElementViewOps: {
|
|
58
|
+
writeId(node: ast.ElementView, id: c4.ViewID): ast.ElementView;
|
|
59
|
+
readId(node: ast.ElementView): c4.ViewID | undefined;
|
|
60
|
+
};
|
|
61
|
+
export declare const ElementOps: {
|
|
62
|
+
writeId(node: ast.Element, id: c4.Fqn | null): ast.Element;
|
|
63
|
+
readId(node: ast.Element): c4.Fqn | undefined;
|
|
64
|
+
};
|
|
65
|
+
export interface DocFqnIndexEntry {
|
|
66
|
+
name: string;
|
|
67
|
+
el: WeakRef<ast.Element>;
|
|
68
|
+
path: string;
|
|
69
|
+
}
|
|
70
|
+
export interface LikeC4DocumentProps {
|
|
71
|
+
c4Specification?: ParsedAstSpecification;
|
|
72
|
+
c4Elements?: ParsedAstElement[];
|
|
73
|
+
c4Relations?: ParsedAstRelation[];
|
|
74
|
+
c4Views?: ParsedAstElementView[];
|
|
75
|
+
c4fqns?: MultiMap<c4.Fqn, DocFqnIndexEntry>;
|
|
76
|
+
}
|
|
77
|
+
export interface LikeC4LangiumDocument extends LangiumDocument<LikeC4Document>, LikeC4DocumentProps {
|
|
78
|
+
}
|
|
79
|
+
export type ParsedLikeC4LangiumDocument = Omit<LikeC4LangiumDocument, keyof LikeC4DocumentProps> & Required<LikeC4DocumentProps>;
|
|
80
|
+
export declare function cleanParsedModel(doc: LikeC4LangiumDocument): {
|
|
81
|
+
elements: ParsedAstElement[];
|
|
82
|
+
relations: ParsedAstRelation[];
|
|
83
|
+
views: ParsedAstElementView[];
|
|
84
|
+
specification: ParsedAstSpecification;
|
|
85
|
+
};
|
|
86
|
+
export declare function isLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
|
|
87
|
+
export declare function isParsedLikeC4LangiumDocument(doc: LangiumDocument): doc is ParsedLikeC4LangiumDocument;
|
|
88
|
+
export declare const isValidLikeC4LangiumDocument: (doc: LangiumDocument) => doc is ParsedLikeC4LangiumDocument;
|
|
89
|
+
export declare function streamModel(doc: LikeC4LangiumDocument): Generator<ast.Element | ast.Relation, void, unknown>;
|
|
90
|
+
export declare function resolveRelationPoints(node: ast.Relation): {
|
|
91
|
+
source: ast.Element;
|
|
92
|
+
target: ast.Element;
|
|
93
|
+
};
|
|
94
|
+
export declare function toElementStyle(props?: ast.StyleProperties['props']): {
|
|
95
|
+
color?: c4.ThemeColor;
|
|
96
|
+
shape?: c4.ElementShape;
|
|
97
|
+
icon?: c4.IconUrl;
|
|
98
|
+
};
|
|
99
|
+
export declare function toElementStyleExcludeDefaults(props?: ast.StyleProperties['props']): {
|
|
100
|
+
shape?: "browser" | "cylinder" | "mobile" | "person" | "queue" | "storage";
|
|
101
|
+
color?: "amber" | "blue" | "gray" | "green" | "indigo" | "muted" | "red" | "secondary" | "sky" | "slate";
|
|
102
|
+
icon?: c4.IconUrl;
|
|
103
|
+
};
|
|
104
|
+
export declare function toRelationshipStyle(props?: ast.SpecificationRelationshipKind['props']): {
|
|
105
|
+
color?: c4.ThemeColor;
|
|
106
|
+
line?: c4.RelationshipLineType;
|
|
107
|
+
head?: c4.RelationshipArrowType;
|
|
108
|
+
tail?: c4.RelationshipArrowType;
|
|
109
|
+
};
|
|
110
|
+
export declare function toRelationshipStyleExcludeDefaults(props?: ast.SpecificationRelationshipKind['props']): {
|
|
111
|
+
tail?: "crow" | "diamond" | "none" | "odiamond" | "onormal" | "open" | "vee";
|
|
112
|
+
head?: "crow" | "diamond" | "none" | "odiamond" | "onormal" | "open" | "vee";
|
|
113
|
+
line?: "dotted" | "solid";
|
|
114
|
+
color?: "amber" | "blue" | "green" | "indigo" | "muted" | "primary" | "red" | "secondary" | "sky" | "slate";
|
|
115
|
+
};
|
|
116
|
+
export declare function toAutoLayout(direction: ast.ViewRuleLayoutDirection): c4.ViewRuleAutoLayout['autoLayout'];
|
|
117
|
+
//# sourceMappingURL=ast.d.ts.map
|
package/dist/ast.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultElementShape, DefaultThemeColor, RelationRefError, nonexhaustive } from "@likec4/core";
|
|
1
|
+
import { DefaultElementShape, DefaultThemeColor, RelationRefError, nonexhaustive, DefaultLineStyle, DefaultArrowType, DefaultRelationshipColor } from "@likec4/core";
|
|
2
2
|
import { DocumentState } from "langium";
|
|
3
3
|
import { elementRef } from "./elementRef.js";
|
|
4
4
|
import * as ast from "./generated/ast.js";
|
|
@@ -33,7 +33,8 @@ export const ElementOps = {
|
|
|
33
33
|
};
|
|
34
34
|
export function cleanParsedModel(doc) {
|
|
35
35
|
const specification = doc.c4Specification = {
|
|
36
|
-
kinds: {}
|
|
36
|
+
kinds: {},
|
|
37
|
+
relationships: {}
|
|
37
38
|
};
|
|
38
39
|
const elements = doc.c4Elements = [];
|
|
39
40
|
const relations = doc.c4Relations = [];
|
|
@@ -141,6 +142,49 @@ export function toElementStyleExcludeDefaults(props) {
|
|
|
141
142
|
...shape && shape !== DefaultElementShape ? { shape } : {}
|
|
142
143
|
};
|
|
143
144
|
}
|
|
145
|
+
export function toRelationshipStyle(props) {
|
|
146
|
+
const result = {};
|
|
147
|
+
if (!props || props.length === 0) {
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
for (const prop of props) {
|
|
151
|
+
if (ast.isColorProperty(prop)) {
|
|
152
|
+
result.color = prop.value;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (ast.isLineProperty(prop)) {
|
|
156
|
+
result.line = prop.value;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (ast.isArrowProperty(prop)) {
|
|
160
|
+
switch (prop.key) {
|
|
161
|
+
case "head": {
|
|
162
|
+
result.head = prop.value;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case "tail": {
|
|
166
|
+
result.tail = prop.value;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
default: {
|
|
170
|
+
nonexhaustive(prop);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
nonexhaustive(prop);
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
export function toRelationshipStyleExcludeDefaults(props) {
|
|
180
|
+
const { color, line, head, tail } = toRelationshipStyle(props);
|
|
181
|
+
return {
|
|
182
|
+
...color && color !== DefaultRelationshipColor ? { color } : {},
|
|
183
|
+
...line && line !== DefaultLineStyle ? { line } : {},
|
|
184
|
+
...head && head !== DefaultArrowType ? { head } : {},
|
|
185
|
+
...tail && tail !== DefaultArrowType ? { tail } : {}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
144
188
|
export function toAutoLayout(direction) {
|
|
145
189
|
switch (direction) {
|
|
146
190
|
case "TopBottom": {
|
package/dist/elementRef.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function isElementRefHead(node: ast.ElementRef | ast.StrictElemen
|
|
|
5
5
|
* Returns referenced AST Element
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
export declare function elementRef(node: ast.ElementRef | ast.StrictElementRef):
|
|
8
|
+
export declare function elementRef(node: ast.ElementRef | ast.StrictElementRef): ast.Element | undefined;
|
|
9
9
|
/**
|
|
10
10
|
* Returns FQN of strictElementRef
|
|
11
11
|
* a.b.c.d - for c node returns a.b
|
|
@@ -16,3 +16,4 @@ export declare function fqnElementRef(node: ast.StrictElementRef): c4.Fqn;
|
|
|
16
16
|
* a.b.c.d - for c node returns a.b
|
|
17
17
|
*/
|
|
18
18
|
export declare function parentFqnElementRef(node: ast.StrictElementRef): c4.Fqn;
|
|
19
|
+
//# sourceMappingURL=elementRef.d.ts.map
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export declare const LikeC4Terminals: {
|
|
|
23
23
|
TagID: RegExp;
|
|
24
24
|
ID: RegExp;
|
|
25
25
|
};
|
|
26
|
+
export type ArrowType = 'crow' | 'diamond' | 'none' | 'normal' | 'odiamond' | 'onormal' | 'open' | 'vee';
|
|
27
|
+
export declare function isArrowType(item: unknown): item is ArrowType;
|
|
26
28
|
export type ElementExpression = ElementKindExpression | ElementRefExpression | ElementTagExpression | WildcardExpression;
|
|
27
29
|
export declare const ElementExpression = "ElementExpression";
|
|
28
30
|
export declare function isElementExpression(item: unknown): item is ElementExpression;
|
|
@@ -34,7 +36,9 @@ export declare function isElementShape(item: unknown): item is ElementShape;
|
|
|
34
36
|
export type Expression = ElementExpression | InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression;
|
|
35
37
|
export declare const Expression = "Expression";
|
|
36
38
|
export declare function isExpression(item: unknown): item is Expression;
|
|
37
|
-
export type
|
|
39
|
+
export type LineOptions = 'dashed' | 'dotted' | 'solid';
|
|
40
|
+
export declare function isLineOptions(item: unknown): item is LineOptions;
|
|
41
|
+
export type Name = 'element' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
|
|
38
42
|
export declare function isName(item: unknown): item is Name;
|
|
39
43
|
export type RArrow = string;
|
|
40
44
|
export declare function isRArrow(item: unknown): item is RArrow;
|
|
@@ -50,8 +54,16 @@ export declare const ViewRule = "ViewRule";
|
|
|
50
54
|
export declare function isViewRule(item: unknown): item is ViewRule;
|
|
51
55
|
export type ViewRuleLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
|
|
52
56
|
export declare function isViewRuleLayoutDirection(item: unknown): item is ViewRuleLayoutDirection;
|
|
57
|
+
export interface ArrowProperty extends AstNode {
|
|
58
|
+
readonly $container: SpecificationRelationshipKind;
|
|
59
|
+
readonly $type: 'ArrowProperty';
|
|
60
|
+
key: 'head' | 'tail';
|
|
61
|
+
value: ArrowType;
|
|
62
|
+
}
|
|
63
|
+
export declare const ArrowProperty = "ArrowProperty";
|
|
64
|
+
export declare function isArrowProperty(item: unknown): item is ArrowProperty;
|
|
53
65
|
export interface ColorProperty extends AstNode {
|
|
54
|
-
readonly $container: StyleProperties | ViewRuleStyle;
|
|
66
|
+
readonly $container: SpecificationRelationshipKind | StyleProperties | ViewRuleStyle;
|
|
55
67
|
readonly $type: 'ColorProperty';
|
|
56
68
|
key: 'color';
|
|
57
69
|
value: ThemeColor;
|
|
@@ -197,6 +209,14 @@ export interface LikeC4Document extends AstNode {
|
|
|
197
209
|
}
|
|
198
210
|
export declare const LikeC4Document = "LikeC4Document";
|
|
199
211
|
export declare function isLikeC4Document(item: unknown): item is LikeC4Document;
|
|
212
|
+
export interface LineProperty extends AstNode {
|
|
213
|
+
readonly $container: SpecificationRelationshipKind;
|
|
214
|
+
readonly $type: 'LineProperty';
|
|
215
|
+
key: 'line';
|
|
216
|
+
value: LineOptions;
|
|
217
|
+
}
|
|
218
|
+
export declare const LineProperty = "LineProperty";
|
|
219
|
+
export declare function isLineProperty(item: unknown): item is LineProperty;
|
|
200
220
|
export interface LinkProperty extends AstNode {
|
|
201
221
|
readonly $container: ElementBody | ElementViewBody;
|
|
202
222
|
readonly $type: 'LinkProperty';
|
|
@@ -232,8 +252,9 @@ export declare function isOutgoingExpression(item: unknown): item is OutgoingExp
|
|
|
232
252
|
export interface Relation extends AstNode {
|
|
233
253
|
readonly $container: ElementBody | ExtendElementBody | Model;
|
|
234
254
|
readonly $type: 'Relation';
|
|
235
|
-
arr
|
|
255
|
+
arr?: RArrow;
|
|
236
256
|
body?: RelationBody;
|
|
257
|
+
kind?: Reference<RelationshipKind>;
|
|
237
258
|
source?: ElementRef;
|
|
238
259
|
target: ElementRef;
|
|
239
260
|
title?: string;
|
|
@@ -257,6 +278,13 @@ export interface RelationExpression extends AstNode {
|
|
|
257
278
|
}
|
|
258
279
|
export declare const RelationExpression = "RelationExpression";
|
|
259
280
|
export declare function isRelationExpression(item: unknown): item is RelationExpression;
|
|
281
|
+
export interface RelationshipKind extends AstNode {
|
|
282
|
+
readonly $container: SpecificationRelationshipKind;
|
|
283
|
+
readonly $type: 'RelationshipKind';
|
|
284
|
+
name: Name;
|
|
285
|
+
}
|
|
286
|
+
export declare const RelationshipKind = "RelationshipKind";
|
|
287
|
+
export declare function isRelationshipKind(item: unknown): item is RelationshipKind;
|
|
260
288
|
export interface RelationStringProperty extends AstNode {
|
|
261
289
|
readonly $container: RelationBody;
|
|
262
290
|
readonly $type: 'RelationStringProperty';
|
|
@@ -281,11 +309,20 @@ export interface SpecificationElementKind extends AstNode {
|
|
|
281
309
|
}
|
|
282
310
|
export declare const SpecificationElementKind = "SpecificationElementKind";
|
|
283
311
|
export declare function isSpecificationElementKind(item: unknown): item is SpecificationElementKind;
|
|
312
|
+
export interface SpecificationRelationshipKind extends AstNode {
|
|
313
|
+
readonly $container: SpecificationRule;
|
|
314
|
+
readonly $type: 'SpecificationRelationshipKind';
|
|
315
|
+
kind: RelationshipKind;
|
|
316
|
+
props: Array<ArrowProperty | ColorProperty | LineProperty>;
|
|
317
|
+
}
|
|
318
|
+
export declare const SpecificationRelationshipKind = "SpecificationRelationshipKind";
|
|
319
|
+
export declare function isSpecificationRelationshipKind(item: unknown): item is SpecificationRelationshipKind;
|
|
284
320
|
export interface SpecificationRule extends AstNode {
|
|
285
321
|
readonly $container: LikeC4Document;
|
|
286
322
|
readonly $type: 'SpecificationRule';
|
|
287
323
|
elements: Array<SpecificationElementKind>;
|
|
288
324
|
name: 'specification';
|
|
325
|
+
relationships: Array<SpecificationRelationshipKind>;
|
|
289
326
|
tags: Array<SpecificationTag>;
|
|
290
327
|
}
|
|
291
328
|
export declare const SpecificationRule = "SpecificationRule";
|
|
@@ -367,6 +404,7 @@ export interface WildcardExpression extends AstNode {
|
|
|
367
404
|
export declare const WildcardExpression = "WildcardExpression";
|
|
368
405
|
export declare function isWildcardExpression(item: unknown): item is WildcardExpression;
|
|
369
406
|
export type LikeC4AstType = {
|
|
407
|
+
ArrowProperty: ArrowProperty;
|
|
370
408
|
ColorProperty: ColorProperty;
|
|
371
409
|
Element: Element;
|
|
372
410
|
ElementBody: ElementBody;
|
|
@@ -388,6 +426,7 @@ export type LikeC4AstType = {
|
|
|
388
426
|
InOutExpression: InOutExpression;
|
|
389
427
|
IncomingExpression: IncomingExpression;
|
|
390
428
|
LikeC4Document: LikeC4Document;
|
|
429
|
+
LineProperty: LineProperty;
|
|
391
430
|
LinkProperty: LinkProperty;
|
|
392
431
|
Model: Model;
|
|
393
432
|
ModelViews: ModelViews;
|
|
@@ -396,8 +435,10 @@ export type LikeC4AstType = {
|
|
|
396
435
|
RelationBody: RelationBody;
|
|
397
436
|
RelationExpression: RelationExpression;
|
|
398
437
|
RelationStringProperty: RelationStringProperty;
|
|
438
|
+
RelationshipKind: RelationshipKind;
|
|
399
439
|
ShapeProperty: ShapeProperty;
|
|
400
440
|
SpecificationElementKind: SpecificationElementKind;
|
|
441
|
+
SpecificationRelationshipKind: SpecificationRelationshipKind;
|
|
401
442
|
SpecificationRule: SpecificationRule;
|
|
402
443
|
SpecificationTag: SpecificationTag;
|
|
403
444
|
StrictElementRef: StrictElementRef;
|
|
@@ -419,3 +460,4 @@ export declare class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
419
460
|
getTypeMetaData(type: string): TypeMetaData;
|
|
420
461
|
}
|
|
421
462
|
export declare const reflection: LikeC4AstReflection;
|
|
463
|
+
//# sourceMappingURL=ast.d.ts.map
|
package/dist/generated/ast.js
CHANGED
|
@@ -18,6 +18,9 @@ export const LikeC4Terminals = {
|
|
|
18
18
|
TagID: /((#)([^\W\d_])(((([^\W\d_])|([0-9]))|(_))|(-))*)/,
|
|
19
19
|
ID: /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/
|
|
20
20
|
};
|
|
21
|
+
export function isArrowType(item) {
|
|
22
|
+
return item === "none" || item === "normal" || item === "onormal" || item === "diamond" || item === "odiamond" || item === "crow" || item === "open" || item === "vee";
|
|
23
|
+
}
|
|
21
24
|
export const ElementExpression = "ElementExpression";
|
|
22
25
|
export function isElementExpression(item) {
|
|
23
26
|
return reflection.isInstance(item, ElementExpression);
|
|
@@ -33,8 +36,11 @@ export const Expression = "Expression";
|
|
|
33
36
|
export function isExpression(item) {
|
|
34
37
|
return reflection.isInstance(item, Expression);
|
|
35
38
|
}
|
|
39
|
+
export function isLineOptions(item) {
|
|
40
|
+
return item === "solid" || item === "dashed" || item === "dotted";
|
|
41
|
+
}
|
|
36
42
|
export function isName(item) {
|
|
37
|
-
return isElementShape(item) || isThemeColor(item) || item === "element" || item === "model" || typeof item === "string" && /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/.test(item);
|
|
43
|
+
return isElementShape(item) || isThemeColor(item) || isLineOptions(item) || isArrowType(item) || item === "element" || item === "model" || typeof item === "string" && /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/.test(item);
|
|
38
44
|
}
|
|
39
45
|
export function isRArrow(item) {
|
|
40
46
|
return typeof item === "string" && /->/.test(item);
|
|
@@ -56,6 +62,10 @@ export function isViewRule(item) {
|
|
|
56
62
|
export function isViewRuleLayoutDirection(item) {
|
|
57
63
|
return item === "TopBottom" || item === "LeftRight" || item === "BottomTop" || item === "RightLeft";
|
|
58
64
|
}
|
|
65
|
+
export const ArrowProperty = "ArrowProperty";
|
|
66
|
+
export function isArrowProperty(item) {
|
|
67
|
+
return reflection.isInstance(item, ArrowProperty);
|
|
68
|
+
}
|
|
59
69
|
export const ColorProperty = "ColorProperty";
|
|
60
70
|
export function isColorProperty(item) {
|
|
61
71
|
return reflection.isInstance(item, ColorProperty);
|
|
@@ -128,6 +138,10 @@ export const LikeC4Document = "LikeC4Document";
|
|
|
128
138
|
export function isLikeC4Document(item) {
|
|
129
139
|
return reflection.isInstance(item, LikeC4Document);
|
|
130
140
|
}
|
|
141
|
+
export const LineProperty = "LineProperty";
|
|
142
|
+
export function isLineProperty(item) {
|
|
143
|
+
return reflection.isInstance(item, LineProperty);
|
|
144
|
+
}
|
|
131
145
|
export const LinkProperty = "LinkProperty";
|
|
132
146
|
export function isLinkProperty(item) {
|
|
133
147
|
return reflection.isInstance(item, LinkProperty);
|
|
@@ -156,6 +170,10 @@ export const RelationExpression = "RelationExpression";
|
|
|
156
170
|
export function isRelationExpression(item) {
|
|
157
171
|
return reflection.isInstance(item, RelationExpression);
|
|
158
172
|
}
|
|
173
|
+
export const RelationshipKind = "RelationshipKind";
|
|
174
|
+
export function isRelationshipKind(item) {
|
|
175
|
+
return reflection.isInstance(item, RelationshipKind);
|
|
176
|
+
}
|
|
159
177
|
export const RelationStringProperty = "RelationStringProperty";
|
|
160
178
|
export function isRelationStringProperty(item) {
|
|
161
179
|
return reflection.isInstance(item, RelationStringProperty);
|
|
@@ -168,6 +186,10 @@ export const SpecificationElementKind = "SpecificationElementKind";
|
|
|
168
186
|
export function isSpecificationElementKind(item) {
|
|
169
187
|
return reflection.isInstance(item, SpecificationElementKind);
|
|
170
188
|
}
|
|
189
|
+
export const SpecificationRelationshipKind = "SpecificationRelationshipKind";
|
|
190
|
+
export function isSpecificationRelationshipKind(item) {
|
|
191
|
+
return reflection.isInstance(item, SpecificationRelationshipKind);
|
|
192
|
+
}
|
|
171
193
|
export const SpecificationRule = "SpecificationRule";
|
|
172
194
|
export function isSpecificationRule(item) {
|
|
173
195
|
return reflection.isInstance(item, SpecificationRule);
|
|
@@ -214,7 +236,7 @@ export function isWildcardExpression(item) {
|
|
|
214
236
|
}
|
|
215
237
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
216
238
|
getAllTypes() {
|
|
217
|
-
return ["ColorProperty", "Element", "ElementBody", "ElementExpression", "ElementKind", "ElementKindExpression", "ElementProperty", "ElementRef", "ElementRefExpression", "ElementStringProperty", "ElementTagExpression", "ElementView", "ElementViewBody", "ElementViewRef", "Expression", "ExtendElement", "ExtendElementBody", "IconProperty", "InOutExpression", "IncomingExpression", "LikeC4Document", "LinkProperty", "Model", "ModelViews", "OutgoingExpression", "Relation", "RelationBody", "RelationExpression", "RelationStringProperty", "ShapeProperty", "SpecificationElementKind", "SpecificationRule", "SpecificationTag", "StrictElementRef", "StyleProperties", "Tag", "Tags", "View", "ViewProperty", "ViewRule", "ViewRuleAutoLayout", "ViewRuleExpression", "ViewRuleStyle", "WildcardExpression"];
|
|
239
|
+
return ["ArrowProperty", "ColorProperty", "Element", "ElementBody", "ElementExpression", "ElementKind", "ElementKindExpression", "ElementProperty", "ElementRef", "ElementRefExpression", "ElementStringProperty", "ElementTagExpression", "ElementView", "ElementViewBody", "ElementViewRef", "Expression", "ExtendElement", "ExtendElementBody", "IconProperty", "InOutExpression", "IncomingExpression", "LikeC4Document", "LineProperty", "LinkProperty", "Model", "ModelViews", "OutgoingExpression", "Relation", "RelationBody", "RelationExpression", "RelationStringProperty", "RelationshipKind", "ShapeProperty", "SpecificationElementKind", "SpecificationRelationshipKind", "SpecificationRule", "SpecificationTag", "StrictElementRef", "StyleProperties", "Tag", "Tags", "View", "ViewProperty", "ViewRule", "ViewRuleAutoLayout", "ViewRuleExpression", "ViewRuleStyle", "WildcardExpression"];
|
|
218
240
|
}
|
|
219
241
|
computeIsSubtype(subtype, supertype) {
|
|
220
242
|
switch (subtype) {
|
|
@@ -266,6 +288,9 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
266
288
|
case "ElementViewRef:view": {
|
|
267
289
|
return ElementView;
|
|
268
290
|
}
|
|
291
|
+
case "Relation:kind": {
|
|
292
|
+
return RelationshipKind;
|
|
293
|
+
}
|
|
269
294
|
default: {
|
|
270
295
|
throw new Error(`${referenceId} is not a valid reference id.`);
|
|
271
296
|
}
|
|
@@ -355,11 +380,20 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
355
380
|
]
|
|
356
381
|
};
|
|
357
382
|
}
|
|
383
|
+
case "SpecificationRelationshipKind": {
|
|
384
|
+
return {
|
|
385
|
+
name: "SpecificationRelationshipKind",
|
|
386
|
+
mandatory: [
|
|
387
|
+
{ name: "props", type: "array" }
|
|
388
|
+
]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
358
391
|
case "SpecificationRule": {
|
|
359
392
|
return {
|
|
360
393
|
name: "SpecificationRule",
|
|
361
394
|
mandatory: [
|
|
362
395
|
{ name: "elements", type: "array" },
|
|
396
|
+
{ name: "relationships", type: "array" },
|
|
363
397
|
{ name: "tags", type: "array" }
|
|
364
398
|
]
|
|
365
399
|
};
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
* This file was generated by langium-cli 2.0.1.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
|
+
import type { Grammar } from 'langium';
|
|
5
6
|
export declare const LikeC4Grammar: () => Grammar;
|
|
7
|
+
//# sourceMappingURL=grammar.d.ts.map
|