Skip to content

Commit ec3fce0

Browse files
committed
fix(vscode): Enhance tmLanguage to support thing like variables, assignments,... better
1 parent 375b772 commit ec3fce0

File tree

1 file changed

+212
-19
lines changed

1 file changed

+212
-19
lines changed

syntaxes/robotframework.tmLanguage.json

Lines changed: 212 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,233 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
33

4+
"repository": {
5+
"header": {
6+
"name": "keyword.other.header.robotframework",
7+
"match": "(^\\*\\*\\*.*?\\*\\*\\*)|((?<=^\\|)\\s+\\*\\*\\*.*?\\*\\*\\*)"
8+
},
9+
"variable_setting": {
10+
"name": "meta.variable.assign.robotframework",
11+
"contentName": "string.unquoted.argument.robotframework",
12+
"begin": "^(?:([$@&%]\\{)(.+?}*)(\\})( ?=)?)",
13+
"beginCaptures": {
14+
"1": {
15+
"name": "keyword.operator.robotframework"
16+
},
17+
"2": {
18+
"name": "variable.other.readwrite.robotframework"
19+
},
20+
"3": {
21+
"name": "keyword.operator.robotframework"
22+
},
23+
"4": {
24+
"name": "keyword.operator.robotframework"
25+
}
26+
},
27+
"end": "^(?!\\s*\\.\\.\\.)",
28+
"patterns": [
29+
{
30+
"include": "#escape"
31+
},
32+
{
33+
"include": "#comment"
34+
},
35+
{
36+
"include": "#line_continuation"
37+
},
38+
{
39+
"include": "#variables"
40+
}
41+
]
42+
},
43+
"variables": {
44+
"name": "meta.variables.robotframework",
45+
"match": "(?i)(?:(?:(?<!^)(?<!\\\\)|(?<=\\\\\\\\))([$@&%]\\{)(?:((?:\\d+\\.?\\d*)|(?:0x[/da-f]+)|(?:0o[0-7]+)|(?:0b[01]+))|(true|false|none|null|empty|space|/|:|\\\\n)|((.+?}*)))(\\})(?:(\\[)(?:(\\d+)|(.*?))?(\\]))?)",
46+
"captures": {
47+
"1": {
48+
"name": "keyword.operator.robotframework"
49+
},
50+
"2": {
51+
"name": "constant.numeric.robotframework"
52+
},
53+
"3": {
54+
"name": "constant.language.robotframework"
55+
},
56+
"4": {
57+
"name": "constant.other.robotframework"
58+
},
59+
"5": {
60+
"name": "variable.other.robotframework"
61+
},
62+
"6": {
63+
"name": "keyword.operator.robotframework"
64+
},
65+
"7": {
66+
"name": "keyword.operator.robotframework"
67+
},
68+
"8": {
69+
"name": "constant.numeric.robotframework"
70+
},
71+
"9": {
72+
"name": "meta.variable.as.key.robotframework",
73+
"patterns": [
74+
{
75+
"include": "#variables"
76+
}
77+
]
78+
},
79+
"10": {
80+
"name": "keyword.operator.robotframework"
81+
}
82+
}
83+
},
84+
"comment": {
85+
"name": "comment.robotframework",
86+
"match": "(?:^ *|\\t+| {2,})(#.*)$",
87+
"captures": {
88+
"1": {
89+
"name": "comment.line.robotframework"
90+
}
91+
}
92+
},
93+
"setting": {
94+
"contentName": "string.unquoted.argument.robotframework",
95+
"begin": "(?i)^(\\S+( \\S+)*)(?= {2}| ?\\t| ?$)",
96+
"beginCaptures": {
97+
"1": {
98+
"name": "keyword.control.settings.robotframework"
99+
}
100+
},
101+
"end": "^(?!\\s*\\.\\.\\.)",
102+
"patterns": [
103+
{
104+
"include": "#escape"
105+
},
106+
{
107+
"include": "#comment"
108+
},
109+
{
110+
"include": "#variables"
111+
},
112+
{
113+
"include": "#line_continuation"
114+
}
115+
]
116+
},
117+
"testcase_settings": {
118+
"match": "\\[.*?\\]",
119+
"name": "keyword.control.settings.robotframework"
120+
},
121+
"keyword_call": {
122+
"contentName": "string.unquoted.argument.robotframework",
123+
"begin": "^(?!(?: {2,}| ?\\t ?)+(?:(?=[$\\[@&%]|\\.)))(?: {2,}| ?\\t ?)+(.*?)(?= {2,}| ?\\t ?| ?$)",
124+
"end": "^(?!\\s*\\.\\.\\.)",
125+
"beginCaptures": {
126+
"1": {
127+
"name": "variable.function.keyword-call.robotframework"
128+
}
129+
},
130+
"patterns": [
131+
{
132+
"include": "#comment"
133+
},
134+
{
135+
"include": "#variables"
136+
},
137+
{
138+
"include": "#line_continuation"
139+
}
140+
]
141+
},
142+
"returning_keyword_call": {
143+
"contentName": "meta.returning.keyword.content.robotframework",
144+
"begin": "^(?=(?: {2,}| ?\\t ?)+(?:(?=[$@&])))(?:\\s)",
145+
"end": "^(?!\\s*\\.\\.\\.)",
146+
"patterns": [
147+
{
148+
"include": "#returning_keyword"
149+
}
150+
],
151+
"name": "meta.returning.keyword.call.robotframework"
152+
},
153+
"returning_keyword": {
154+
"contentName": "string.unquoted.argument.robotframework",
155+
"name": "meta.returning.keyword.robotframework",
156+
"begin": "(?<=\\s)(?=\\s*(?:(?=[$@&])))((?:\\s)*(?:[$&@]{(?:.*?)}(?:\\[.*?\\])?(?: ?=?\\s*))*)(.*?)(?: {2,}| ?\\t ?|$)",
157+
"beginCaptures": {
158+
"1": {
159+
"name": "variable.other.readwrite.robotframework",
160+
"patterns": [
161+
{
162+
"include": "#variable_assignment_from_kw"
163+
}
164+
]
165+
},
166+
"2": {
167+
"name": "variable.function.keyword-call.robotframework"
168+
}
169+
},
170+
"end": "^(?!\\s*\\.\\.\\.)",
171+
"patterns": [
172+
{
173+
"include": "#variables"
174+
},
175+
{
176+
"include": "#line_continuation"
177+
},
178+
{
179+
"include": "#comment"
180+
}
181+
]
182+
},
183+
"variable_assignment_from_kw": {
184+
"contentName": "meta.variable.assignment.keyword.content.robotframework",
185+
"begin": "(?<=^\\s)(?:\\s*)(?=[$@&])",
186+
"end": "(?:( ?=)|(?: {2,}| ?\\t+ ?| ?$)(?![#$@& \\n\\r]|\\.\\.\\.)|^(?=\\.\\.\\.)( {2,}| ?\\t+ ?| ?$)(?![#$@&]))",
187+
"endCaptures": {
188+
"1": {
189+
"name": "keyword.operator.robotframework"
190+
}
191+
},
192+
"patterns": [
193+
{
194+
"include": "#line_continuation"
195+
},
196+
{
197+
"include": "#comment"
198+
}
199+
]
200+
},
201+
"line_continuation": {
202+
"match": "^(\\s*\\.\\.\\.)(?: {2,}| ?\\t+| ?$)(?!ELSE)",
203+
"name": "keyword.operator.robotframework"
204+
}
205+
},
4206
"patterns": [
5207
{
6-
"match": "(^\\*\\*\\*.*?\\*\\*\\*)|((?<=^\\|)\\s+\\*\\*\\*.*?\\*\\*\\*)",
7-
"name": "keyword.other.header.robotframework"
208+
"include": "#header"
8209
},
9210
{
10-
"match": "\\[.*?\\]",
11-
"name": "keyword.control.settings.robotframework"
211+
"include": "#variable_setting"
12212
},
13213
{
14-
"match": "(\\$\\{.*?\\})|(@\\{.*?\\})|(%\\{.*?\\})|(&\\{.*?\\})",
15-
"name": "variable.other.readwrite.robotframework"
214+
"include": "#setting"
16215
},
17216
{
18-
"begin": "((^\\s*)|(\\s\\s)|\\t)(?<!\\\\)#",
19-
"end": "$",
20-
"name": "comment.line.robotframework"
217+
"include": "#testcase_settings"
21218
},
22219
{
23-
"begin": "(^[^ \\t\\*\\n\\|]+)|((?<=^\\|)\\s+[^ \\t\\*\\n\\|]+)",
24-
"end": "\\s{2}|\\t|$|\\s+(?=\\|)",
25-
"name": "entity.name.function.testcase.name.robotframework"
220+
"include": "#keyword_call"
26221
},
27222
{
28-
"begin": "^(?!(?: {2,}| ?\\t ?)+(?:(?=[$\\[@&%]|\\.)))(?: {2,}| ?\\t ?)+(.*?)(?= {2,}| ?\\t ?| ?$)",
29-
"end": "^(?!\\s*\\.\\.\\.)",
30-
"beginCaptures": {
31-
"1": {
32-
"name": "variable.function.keyword-call.robotframework"
33-
}
34-
}
223+
"include": "#returning_keyword_call"
224+
},
225+
{
226+
"include": "#comment"
35227
}
36228
],
37229

230+
"uuid": "a7fae509-bc8d-451e-b5fc-a47feb9d2a9e",
38231
"fileTypes": ["robotframework"],
39232
"name": "Robot Framework",
40233
"scopeName": "source.robotframework"

0 commit comments

Comments
 (0)