@likec4/language-server 0.5.0 → 0.6.1
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 +31 -0
- package/contrib/likec4.tmLanguage.json +73 -0
- package/dist/__test__/parser-smoke/01-Specification.d.ts +3 -0
- package/dist/__test__/parser-smoke/01-Specification.js +42 -0
- package/dist/__test__/parser-smoke/02-Model.d.ts +9 -0
- package/dist/__test__/parser-smoke/02-Model.js +110 -0
- package/dist/__test__/parser-smoke/03-ModelRelation.d.ts +6 -0
- package/dist/__test__/parser-smoke/03-ModelRelation.js +81 -0
- package/dist/__test__/parser-smoke/04-Scope.d.ts +2 -0
- package/dist/__test__/parser-smoke/04-Scope.js +38 -0
- package/dist/__test__/parser-smoke/05-StrictElementRef.d.ts +3 -0
- package/dist/__test__/parser-smoke/05-StrictElementRef.js +46 -0
- package/dist/__test__/parser-smoke/06-ElementRef.d.ts +2 -0
- package/dist/__test__/parser-smoke/06-ElementRef.js +59 -0
- package/dist/__test__/parser-smoke/07-Views.d.ts +10 -0
- package/dist/__test__/parser-smoke/07-Views.js +146 -0
- package/dist/__test__/parser-smoke/08-Structurizr.d.ts +1 -0
- package/dist/__test__/parser-smoke/08-Structurizr.js +22 -0
- package/dist/__test__/parser-smoke/index.d.ts +8 -0
- package/dist/__test__/parser-smoke/index.js +8 -0
- package/dist/__test__/parser-smoke-extendsElement.spec.d.ts +1 -0
- package/dist/__test__/parser-smoke-extendsElement.spec.js +36 -0
- package/dist/__test__/parser-smoke.spec.d.ts +1 -0
- package/dist/__test__/parser-smoke.spec.js +28 -0
- package/dist/ast.d.ts +1 -0
- package/dist/ast.js +16 -15
- package/dist/generated/ast.d.ts +16 -12
- package/dist/generated/ast.js +15 -5
- package/dist/generated/grammar.js +1534 -1379
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -2
- package/dist/lsp/SemanticTokenProvider.js +32 -58
- package/dist/model/model-builder.js +13 -12
- package/dist/model/model-builder.spec.d.ts +1 -0
- package/dist/model/model-builder.spec.js +141 -0
- package/dist/protocol.d.ts +16 -12
- package/dist/protocol.js +2 -2
- package/dist/registerProtocolHandlers.js +24 -9
- package/dist/validation/element.spec.d.ts +1 -0
- package/dist/validation/element.spec.js +65 -0
- package/dist/validation/relation.spec.d.ts +1 -0
- package/dist/validation/relation.spec.js +93 -0
- package/dist/validation/specification.spec.d.ts +1 -0
- package/dist/validation/specification.spec.js +31 -0
- package/dist/validation/view.spec.d.ts +1 -0
- package/dist/validation/view.spec.js +20 -0
- package/package.json +22 -18
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Monarch syntax highlighting for the likec4 language.
|
|
2
|
+
export default {
|
|
3
|
+
keywords: [
|
|
4
|
+
'BottomTop','LeftRight','RightLeft','TopBottom','autoLayout','browser','color','cylinder','description','element','exclude','extend','include','it','model','muted','of','person','primary','queue','rectangle','secondary','shape','specification','storage','style','tag','technology','this','title','view','views'
|
|
5
|
+
],
|
|
6
|
+
operators: [
|
|
7
|
+
'*','->','.*'
|
|
8
|
+
],
|
|
9
|
+
symbols: /\*|->|\.\*/,
|
|
10
|
+
|
|
11
|
+
tokenizer: {
|
|
12
|
+
initial: [
|
|
13
|
+
{ regex: /[^\W\d_]/, action: { cases: { '@keywords': {"token":"keyword"}, '@default': {"token":"LETTER"} }} },
|
|
14
|
+
{ regex: /[0-9]/, action: {"token":"DIGIT"} },
|
|
15
|
+
{ regex: /[\t\r\n\v\f]/, action: {"token":"NEWLINE"} },
|
|
16
|
+
{ regex: /"[^"]*"|'[^']*'/, action: {"token":"string"} },
|
|
17
|
+
{ include: '@whitespace' },
|
|
18
|
+
{ regex: /@symbols/, action: { cases: { '@operators': {"token":"operator"}, '@default': {"token":""} }} },
|
|
19
|
+
],
|
|
20
|
+
whitespace: [
|
|
21
|
+
{ regex: /[^\S\r\n]/, action: {"token":"white"} },
|
|
22
|
+
{ regex: /\/\*/, action: {"token":"comment","next":"@comment"} },
|
|
23
|
+
{ regex: /\/\/[^\n\r]*/, action: {"token":"comment"} },
|
|
24
|
+
],
|
|
25
|
+
comment: [
|
|
26
|
+
{ regex: /[^\/\*]+/, action: {"token":"comment"} },
|
|
27
|
+
{ regex: /\*\//, action: {"token":"comment","next":"@pop"} },
|
|
28
|
+
{ regex: /[\/\*]/, action: {"token":"comment"} },
|
|
29
|
+
],
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -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|autoLayout|browser|color|cylinder|description|element|exclude|extend|include|it|model|muted|of|person|primary|queue|rectangle|secondary|shape|specification|storage|style|tag|technology|this|title|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
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const valid_01_Specification = "\nspecification {\n element container\n element component {\n style {\n shape: rectangle\n }\n }\n element person {\n style {\n shape: person\n }\n }\n\n tag gray\n tag lightgray\n}\n";
|
|
2
|
+
export declare const valid_01_Specification_ElementKindStyle = "\nspecification {\n element frontend {\n style {\n shape browser\n color secondary\n }\n }\n element person {\n style {\n shape: person\n }\n }\n}\n";
|
|
3
|
+
export declare const invalid_01_Specification_ElementKind = "\nspecification {\n element element {\n style {\n shape browser\n }\n }\n}\n";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const valid_01_Specification = `
|
|
2
|
+
specification {
|
|
3
|
+
element container
|
|
4
|
+
element component {
|
|
5
|
+
style {
|
|
6
|
+
shape: rectangle
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
element person {
|
|
10
|
+
style {
|
|
11
|
+
shape: person
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
tag gray
|
|
16
|
+
tag lightgray
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
export const valid_01_Specification_ElementKindStyle = `
|
|
20
|
+
specification {
|
|
21
|
+
element frontend {
|
|
22
|
+
style {
|
|
23
|
+
shape browser
|
|
24
|
+
color secondary
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
element person {
|
|
28
|
+
style {
|
|
29
|
+
shape: person
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
export const invalid_01_Specification_ElementKind = `
|
|
35
|
+
specification {
|
|
36
|
+
element element {
|
|
37
|
+
style {
|
|
38
|
+
shape browser
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const valid_02_Model_Element = "\nspecification {\n element person\n}\nmodel {\n person user1\n person user2\n}\n";
|
|
2
|
+
export declare const valid_02_Model_Element_2 = "\nspecification {\n element person\n}\nmodel {\n user1 = person\n user2 = person\n}\n";
|
|
3
|
+
export declare const valid_02_Model_Builtin = "\nmodel {\n el1 = element\n el2 = element\n}\n";
|
|
4
|
+
export declare const valid_02_Model_ElementWithTitle = "\nspecification {\n element person\n}\nmodel {\n person user1\n user2 = person 'Person2'\n user3 = person\n}\n";
|
|
5
|
+
export declare const valid_02_Model_Element_Style = "\nspecification {\n element person\n}\nmodel {\n user1 = person {\n style {\n shape person\n color secondary\n }\n }\n user2 = person\n}\n";
|
|
6
|
+
export declare const invalid_02_Model = "\nspecification {\n element person\n}\nmodel {\n user = person\n person 'Person2'\n}\n";
|
|
7
|
+
export declare const valid_02_Model_NestedElemenets = "\nspecification {\n element person\n element system\n element component\n}\nmodel {\n person user1\n user2 = person {\n }\n user3 = person 'Person3'\n component system {\n subsystem = component\n backend = component {\n api = component 'API'\n }\n }\n}\n";
|
|
8
|
+
export declare const invalid_02_Model_NestedElemenets = "\nspecification {\n element person\n element component\n}\nmodel {\n person user1\n component system {\n component 'Subsystem'\n component backend\n }\n}\n";
|
|
9
|
+
export declare const valid_02_ModelElementProps = "\nspecification {\n element component\n tag one\n}\nmodel {\n component system {\n #one\n\n component subsystem {\n title: 'SubSystem'\n }\n component storage {\n title 'Storage'\n style {\n shape: storage\n }\n }\n }\n}\n";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export const valid_02_Model_Element = `
|
|
2
|
+
specification {
|
|
3
|
+
element person
|
|
4
|
+
}
|
|
5
|
+
model {
|
|
6
|
+
person user1
|
|
7
|
+
person user2
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
export const valid_02_Model_Element_2 = `
|
|
11
|
+
specification {
|
|
12
|
+
element person
|
|
13
|
+
}
|
|
14
|
+
model {
|
|
15
|
+
user1 = person
|
|
16
|
+
user2 = person
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
export const valid_02_Model_Builtin = `
|
|
20
|
+
model {
|
|
21
|
+
el1 = element
|
|
22
|
+
el2 = element
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
export const valid_02_Model_ElementWithTitle = `
|
|
26
|
+
specification {
|
|
27
|
+
element person
|
|
28
|
+
}
|
|
29
|
+
model {
|
|
30
|
+
person user1
|
|
31
|
+
user2 = person 'Person2'
|
|
32
|
+
user3 = person
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
export const valid_02_Model_Element_Style = `
|
|
36
|
+
specification {
|
|
37
|
+
element person
|
|
38
|
+
}
|
|
39
|
+
model {
|
|
40
|
+
user1 = person {
|
|
41
|
+
style {
|
|
42
|
+
shape person
|
|
43
|
+
color secondary
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
user2 = person
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
export const invalid_02_Model = `
|
|
50
|
+
specification {
|
|
51
|
+
element person
|
|
52
|
+
}
|
|
53
|
+
model {
|
|
54
|
+
user = person
|
|
55
|
+
person 'Person2'
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
export const valid_02_Model_NestedElemenets = `
|
|
59
|
+
specification {
|
|
60
|
+
element person
|
|
61
|
+
element system
|
|
62
|
+
element component
|
|
63
|
+
}
|
|
64
|
+
model {
|
|
65
|
+
person user1
|
|
66
|
+
user2 = person {
|
|
67
|
+
}
|
|
68
|
+
user3 = person 'Person3'
|
|
69
|
+
component system {
|
|
70
|
+
subsystem = component
|
|
71
|
+
backend = component {
|
|
72
|
+
api = component 'API'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
export const invalid_02_Model_NestedElemenets = `
|
|
78
|
+
specification {
|
|
79
|
+
element person
|
|
80
|
+
element component
|
|
81
|
+
}
|
|
82
|
+
model {
|
|
83
|
+
person user1
|
|
84
|
+
component system {
|
|
85
|
+
component 'Subsystem'
|
|
86
|
+
component backend
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
export const valid_02_ModelElementProps = `
|
|
91
|
+
specification {
|
|
92
|
+
element component
|
|
93
|
+
tag one
|
|
94
|
+
}
|
|
95
|
+
model {
|
|
96
|
+
component system {
|
|
97
|
+
#one
|
|
98
|
+
|
|
99
|
+
component subsystem {
|
|
100
|
+
title: 'SubSystem'
|
|
101
|
+
}
|
|
102
|
+
component storage {
|
|
103
|
+
title 'Storage'
|
|
104
|
+
style {
|
|
105
|
+
shape: storage
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const valid_03_Relation = "\nspecification {\n element person\n}\nmodel {\n person user1\n person user2\n user1 -> user2\n}\n";
|
|
2
|
+
export declare const valid_03_Relation2 = "\nspecification {\n element person\n}\nmodel {\n person user1\n person user2 {\n -> user1\n }\n}\n";
|
|
3
|
+
export declare const valid_03_Relation3 = "\nspecification {\n element person\n}\nmodel {\n person user1 {\n -> user2\n }\n person user2\n}\n";
|
|
4
|
+
export declare const valid_03_Relation4 = "\nspecification {\n element person\n element component\n}\nmodel {\n person user\n component system {\n component subsystem {\n it -> api\n }\n backend = component {\n api = component 'API' {\n -> user\n }\n this -> subsystem\n }\n }\n user -> api\n}\n";
|
|
5
|
+
export declare const valid_03_Relation_with_title = "\nspecification {\n element person\n}\nmodel {\n person user1\n person user2 {\n -> user1 'calls'\n }\n user1 -> user2 'responds to'\n}\n";
|
|
6
|
+
export declare const valid_03_Relation_with_props = "\nspecification {\n element person\n}\nmodel {\n person user1\n person user2 {\n -> user1 {\n title 'calls'\n }\n }\n user1 -> user2 'responds to' {\n title 'some description'\n }\n}\n";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const valid_03_Relation = `
|
|
2
|
+
specification {
|
|
3
|
+
element person
|
|
4
|
+
}
|
|
5
|
+
model {
|
|
6
|
+
person user1
|
|
7
|
+
person user2
|
|
8
|
+
user1 -> user2
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export const valid_03_Relation2 = `
|
|
12
|
+
specification {
|
|
13
|
+
element person
|
|
14
|
+
}
|
|
15
|
+
model {
|
|
16
|
+
person user1
|
|
17
|
+
person user2 {
|
|
18
|
+
-> user1
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const valid_03_Relation3 = `
|
|
23
|
+
specification {
|
|
24
|
+
element person
|
|
25
|
+
}
|
|
26
|
+
model {
|
|
27
|
+
person user1 {
|
|
28
|
+
-> user2
|
|
29
|
+
}
|
|
30
|
+
person user2
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export const valid_03_Relation4 = `
|
|
34
|
+
specification {
|
|
35
|
+
element person
|
|
36
|
+
element component
|
|
37
|
+
}
|
|
38
|
+
model {
|
|
39
|
+
person user
|
|
40
|
+
component system {
|
|
41
|
+
component subsystem {
|
|
42
|
+
it -> api
|
|
43
|
+
}
|
|
44
|
+
backend = component {
|
|
45
|
+
api = component 'API' {
|
|
46
|
+
-> user
|
|
47
|
+
}
|
|
48
|
+
this -> subsystem
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
user -> api
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
export const valid_03_Relation_with_title = `
|
|
55
|
+
specification {
|
|
56
|
+
element person
|
|
57
|
+
}
|
|
58
|
+
model {
|
|
59
|
+
person user1
|
|
60
|
+
person user2 {
|
|
61
|
+
-> user1 'calls'
|
|
62
|
+
}
|
|
63
|
+
user1 -> user2 'responds to'
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
export const valid_03_Relation_with_props = `
|
|
67
|
+
specification {
|
|
68
|
+
element person
|
|
69
|
+
}
|
|
70
|
+
model {
|
|
71
|
+
person user1
|
|
72
|
+
person user2 {
|
|
73
|
+
-> user1 {
|
|
74
|
+
title 'calls'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
user1 -> user2 'responds to' {
|
|
78
|
+
title 'some description'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const valid_04_Scope = "\nspecification {\n element person\n element component\n}\nmodel {\n person user\n component system {\n component subsystem {\n -> backend\n }\n backend = component {\n api = component 'API'\n }\n user -> api\n }\n}\n";
|
|
2
|
+
export declare const invalid_04_DuplicateNameInScope = "\nspecification {\n element person\n element component\n}\nmodel {\n person user\n component system {\n component subsystem {\n }\n backend1 = component {\n api = component 'API 1'\n }\n backend2 = component {\n api = component 'API 2'\n }\n user -> api\n }\n}\n";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const valid_04_Scope = `
|
|
2
|
+
specification {
|
|
3
|
+
element person
|
|
4
|
+
element component
|
|
5
|
+
}
|
|
6
|
+
model {
|
|
7
|
+
person user
|
|
8
|
+
component system {
|
|
9
|
+
component subsystem {
|
|
10
|
+
-> backend
|
|
11
|
+
}
|
|
12
|
+
backend = component {
|
|
13
|
+
api = component 'API'
|
|
14
|
+
}
|
|
15
|
+
user -> api
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
export const invalid_04_DuplicateNameInScope = `
|
|
20
|
+
specification {
|
|
21
|
+
element person
|
|
22
|
+
element component
|
|
23
|
+
}
|
|
24
|
+
model {
|
|
25
|
+
person user
|
|
26
|
+
component system {
|
|
27
|
+
component subsystem {
|
|
28
|
+
}
|
|
29
|
+
backend1 = component {
|
|
30
|
+
api = component 'API 1'
|
|
31
|
+
}
|
|
32
|
+
backend2 = component {
|
|
33
|
+
api = component 'API 2'
|
|
34
|
+
}
|
|
35
|
+
user -> api
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const valid_05_StrictElementRef = "\nspecification {\n element component\n}\nmodel {\n component system {\n component sub1 {\n component sub2\n }\n }\n extend system {\n }\n extend system.sub1 {\n }\n extend system.sub1.sub2 {\n }\n}\n";
|
|
2
|
+
export declare const invalid_05_StrictElementRefScope = "\nspecification {\n element component\n}\nmodel {\n component system {\n component sub1 {\n component sub2\n }\n }\n extend sub1 {\n }\n}\n";
|
|
3
|
+
export declare const invalid_05_StrictElementChildRefScope = "\nspecification {\n element component\n}\nmodel {\n component system {\n component sub1 {\n component sub2\n }\n }\n extend system.sub2 {\n }\n}\n";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const valid_05_StrictElementRef = `
|
|
2
|
+
specification {
|
|
3
|
+
element component
|
|
4
|
+
}
|
|
5
|
+
model {
|
|
6
|
+
component system {
|
|
7
|
+
component sub1 {
|
|
8
|
+
component sub2
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
extend system {
|
|
12
|
+
}
|
|
13
|
+
extend system.sub1 {
|
|
14
|
+
}
|
|
15
|
+
extend system.sub1.sub2 {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
export const invalid_05_StrictElementRefScope = `
|
|
20
|
+
specification {
|
|
21
|
+
element component
|
|
22
|
+
}
|
|
23
|
+
model {
|
|
24
|
+
component system {
|
|
25
|
+
component sub1 {
|
|
26
|
+
component sub2
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
extend sub1 {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export const invalid_05_StrictElementChildRefScope = `
|
|
34
|
+
specification {
|
|
35
|
+
element component
|
|
36
|
+
}
|
|
37
|
+
model {
|
|
38
|
+
component system {
|
|
39
|
+
component sub1 {
|
|
40
|
+
component sub2
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
extend system.sub2 {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const valid_06_ElementRef = "\nspecification {\n element component\n}\nmodel {\n component user\n component system {\n component sub1 {\n component sub2\n }\n }\n user -> sub1.sub2\n component system2 {\n it -> system.sub2\n }\n}\n";
|
|
2
|
+
export declare const invalid_06_ElementRef = "\nspecification {\n element component\n}\nmodel {\n component user\n component system {\n component sub1 {\n component sub2\n }\n }\n user -> sub2.sub1\n}\n";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const valid_06_ElementRef = `
|
|
2
|
+
specification {
|
|
3
|
+
element component
|
|
4
|
+
}
|
|
5
|
+
model {
|
|
6
|
+
component user
|
|
7
|
+
component system {
|
|
8
|
+
component sub1 {
|
|
9
|
+
component sub2
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
user -> sub1.sub2
|
|
13
|
+
component system2 {
|
|
14
|
+
it -> system.sub2
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const invalid_06_ElementRef = `
|
|
19
|
+
specification {
|
|
20
|
+
element component
|
|
21
|
+
}
|
|
22
|
+
model {
|
|
23
|
+
component user
|
|
24
|
+
component system {
|
|
25
|
+
component sub1 {
|
|
26
|
+
component sub2
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
user -> sub2.sub1
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
// export const invalid_06_ElementRefScope = `
|
|
33
|
+
// specification {
|
|
34
|
+
// element component
|
|
35
|
+
// }
|
|
36
|
+
// model {
|
|
37
|
+
// component system {
|
|
38
|
+
// component sub1 {
|
|
39
|
+
// component sub2
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
|
+
// extends sub1 {
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
// `
|
|
46
|
+
// export const invalid_06_ElementChildRefScope = `
|
|
47
|
+
// specification {
|
|
48
|
+
// element component
|
|
49
|
+
// }
|
|
50
|
+
// model {
|
|
51
|
+
// component system {
|
|
52
|
+
// component sub1 {
|
|
53
|
+
// component sub2
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
// extends system.sub2 {
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
// `
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const valid_07_View: string;
|
|
2
|
+
export declare const valid_07_ViewOf: string;
|
|
3
|
+
export declare const valid_07_ViewRules: string;
|
|
4
|
+
export declare const invalid_07_ViewRules_Inambiqutes: string;
|
|
5
|
+
export declare const valid_07_ViewRules_IncludeScopeOf: string;
|
|
6
|
+
export declare const valid_07_ViewProperties: string;
|
|
7
|
+
export declare const valid_07_ViewRules_Relations: string;
|
|
8
|
+
export declare const valid_07_ViewStyleRules: string;
|
|
9
|
+
export declare const invalid_07_ViewStyleRules: string;
|
|
10
|
+
export declare const valid_07_ViewLayoutRules: string;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const model = `
|
|
2
|
+
specification {
|
|
3
|
+
element component
|
|
4
|
+
}
|
|
5
|
+
model {
|
|
6
|
+
component user
|
|
7
|
+
component system {
|
|
8
|
+
component backend {
|
|
9
|
+
component model
|
|
10
|
+
component api
|
|
11
|
+
}
|
|
12
|
+
component auth {
|
|
13
|
+
component api
|
|
14
|
+
}
|
|
15
|
+
component frontend
|
|
16
|
+
}
|
|
17
|
+
component infra {
|
|
18
|
+
component database
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
backend.model -> infra.database
|
|
22
|
+
backend.api -> backend.model
|
|
23
|
+
auth.api -> backend.api
|
|
24
|
+
frontend -> auth.api
|
|
25
|
+
frontend -> backend.api
|
|
26
|
+
user -> frontend
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
export const valid_07_View = model +
|
|
30
|
+
`
|
|
31
|
+
views {
|
|
32
|
+
view index {
|
|
33
|
+
include *
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const valid_07_ViewOf = model +
|
|
38
|
+
`
|
|
39
|
+
views {
|
|
40
|
+
view index of system.backend {
|
|
41
|
+
include *
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export const valid_07_ViewRules = model +
|
|
46
|
+
`
|
|
47
|
+
views {
|
|
48
|
+
view {
|
|
49
|
+
include *,
|
|
50
|
+
infra.*,
|
|
51
|
+
backend.*
|
|
52
|
+
exclude frontend
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
// Two api: in backend and auth
|
|
57
|
+
export const invalid_07_ViewRules_Inambiqutes = model +
|
|
58
|
+
`
|
|
59
|
+
views {
|
|
60
|
+
view of system {
|
|
61
|
+
include api
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
export const valid_07_ViewRules_IncludeScopeOf = model +
|
|
66
|
+
`
|
|
67
|
+
views {
|
|
68
|
+
view of system.backend {
|
|
69
|
+
include api, auth.api
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
export const valid_07_ViewProperties = model +
|
|
74
|
+
`
|
|
75
|
+
views {
|
|
76
|
+
view {
|
|
77
|
+
title 'User view'
|
|
78
|
+
description "
|
|
79
|
+
View description
|
|
80
|
+
"
|
|
81
|
+
include *
|
|
82
|
+
exclude -> user
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
export const valid_07_ViewRules_Relations = model +
|
|
87
|
+
`
|
|
88
|
+
views {
|
|
89
|
+
view {
|
|
90
|
+
include
|
|
91
|
+
-> backend,
|
|
92
|
+
-> backend.*,
|
|
93
|
+
-> backend ->,
|
|
94
|
+
-> backend.* ->,
|
|
95
|
+
backend ->,
|
|
96
|
+
backend.* ->
|
|
97
|
+
exclude
|
|
98
|
+
* -> infra,
|
|
99
|
+
* -> infra.*,
|
|
100
|
+
* -> *
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
export const valid_07_ViewStyleRules = model +
|
|
105
|
+
`
|
|
106
|
+
views {
|
|
107
|
+
view {
|
|
108
|
+
include *
|
|
109
|
+
style * {
|
|
110
|
+
color: secondary
|
|
111
|
+
}
|
|
112
|
+
style backend, infra {
|
|
113
|
+
color: muted
|
|
114
|
+
}
|
|
115
|
+
exclude -> frontend
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
export const invalid_07_ViewStyleRules = model +
|
|
120
|
+
`
|
|
121
|
+
views {
|
|
122
|
+
view {
|
|
123
|
+
include *
|
|
124
|
+
style backend, {
|
|
125
|
+
color muted
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
export const valid_07_ViewLayoutRules = model +
|
|
131
|
+
`
|
|
132
|
+
views {
|
|
133
|
+
view {
|
|
134
|
+
include *
|
|
135
|
+
style * {
|
|
136
|
+
color: secondary
|
|
137
|
+
}
|
|
138
|
+
autoLayout BottomTop
|
|
139
|
+
exclude -> frontend
|
|
140
|
+
}
|
|
141
|
+
view {
|
|
142
|
+
autoLayout LeftRight
|
|
143
|
+
include *
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const valid_08_Structurizr: string;
|