|
7 | 7 | { "include": "#comment" }
|
8 | 8 | ],
|
9 | 9 | "repository": {
|
| 10 | + "simple_name": { |
| 11 | + "name": "entity.name.gpr", |
| 12 | + "match": "\\w+" |
| 13 | + }, |
| 14 | + "name": { |
| 15 | + "name": "meta.name.gpr", |
| 16 | + "patterns": [ |
| 17 | + { "include": "#simple_name" }, |
| 18 | + { "name": "punctuation.gpr", "match": "\\.+" } |
| 19 | + ] |
| 20 | + }, |
| 21 | + "simple_name_ref": { |
| 22 | + "comment": "The same as 'simple_name' but formatted as a variable, often used in places where we reference a name instead of defining it", |
| 23 | + "name": "variable.name.gpr", |
| 24 | + "match": "\\w+" |
| 25 | + }, |
| 26 | + "name_ref": { |
| 27 | + "comment": "The same as 'name' but formatted as a variable, often used in places where we reference a name instead of defining it", |
| 28 | + "name": "meta.name_ref.gpr", |
| 29 | + "patterns": [ |
| 30 | + { "include": "#simple_name_ref" }, |
| 31 | + { "name": "punctuation.gpr", "match": "\\.+" } |
| 32 | + ] |
| 33 | + }, |
10 | 34 | "empty_declaration": {
|
11 | 35 | "begin": "(null)",
|
12 | 36 | "end": ";",
|
|
15 | 39 | }
|
16 | 40 | },
|
17 | 41 | "assignment": {
|
| 42 | + "name": "meta.assignment.gpr", |
18 | 43 | "begin": ":=",
|
19 | 44 | "end": "(?=;)",
|
20 | 45 | "beginCaptures": {
|
21 | 46 | "0": { "name": "punctuation.gpr" }
|
22 | 47 | },
|
23 |
| - "patterns": [ |
24 |
| - { |
25 |
| - "name": "keyword.control.directive.gpr", |
26 |
| - "match": "(?i)\\bexternal\\b" |
27 |
| - }, |
28 |
| - { |
29 |
| - "name": "punctuation.gpr", |
30 |
| - "match": "[(),]" |
31 |
| - }, |
32 |
| - { "include": "#string" } |
33 |
| - ] |
| 48 | + "patterns": [{ "include": "#expression" }] |
34 | 49 | },
|
35 | 50 | "attribute": {
|
36 | 51 | "name": "meta.attribute.gpr",
|
37 |
| - "begin": "(?i)\\b(for)\\s+((?:\\w|_)+)(?:\\s*\\((.*)\\))?\\s+(use)\\b", |
| 52 | + "begin": "(?i)\\b(for)\\s*((?:\\w|_)+)?(?:\\s*\\((.*)\\))?\\s+", |
38 | 53 | "end": ";",
|
39 | 54 | "beginCaptures": {
|
40 | 55 | "1": { "name": "keyword.gpr" },
|
41 | 56 | "2": { "name": "entity.other.attribute-name.gpr" },
|
42 |
| - "3": { "patterns": [{ "include": "#string" }] }, |
43 |
| - "4": { "name": "keyword.gpr" } |
| 57 | + "3": { |
| 58 | + "patterns": [ |
| 59 | + { "include": "#string_literal" }, |
| 60 | + { "name": "punctuation.gpr", "match": "[()]" } |
| 61 | + ] |
| 62 | + } |
44 | 63 | },
|
45 | 64 | "endCaptures": {
|
46 | 65 | "0": { "name": "punctuation.gpr" }
|
47 | 66 | },
|
48 |
| - "patterns": [{ "include": "#string" }] |
| 67 | + "patterns": [ |
| 68 | + { "name": "keyword.gpr", "match": "(?i)\\buse\\b" }, |
| 69 | + { "include": "#expression" } |
| 70 | + ] |
| 71 | + }, |
| 72 | + "string_expression": { |
| 73 | + "patterns": [ |
| 74 | + { "include": "#attribute_reference" }, |
| 75 | + { "include": "#external_value" }, |
| 76 | + { "include": "#string_literal" }, |
| 77 | + { "include": "#name_ref" }, |
| 78 | + { |
| 79 | + "name": "punctuation.gpr", |
| 80 | + "match": "&" |
| 81 | + } |
| 82 | + ] |
| 83 | + }, |
| 84 | + "external_value": { |
| 85 | + "name": "meta.external.gpr", |
| 86 | + "begin": "(?i)\\b(external)\\b", |
| 87 | + "end": "(?<=\\))", |
| 88 | + "beginCaptures": { |
| 89 | + "1": { "name": "variable.language.gpr" } |
| 90 | + }, |
| 91 | + "patterns": [{ "include": "#string_list" }] |
| 92 | + }, |
| 93 | + "attribute_reference": { |
| 94 | + "name": "meta.attribute_reference.gpr", |
| 95 | + "match": "\\b(\\w+(?:\\.\\w+)?)\\s*(')\\s*(\\w+)\\s*(\\(.*\\))?", |
| 96 | + "captures": { |
| 97 | + "1": { |
| 98 | + "name": "variable.name.gpr", |
| 99 | + "patterns": [ |
| 100 | + { "name": "variable.language.gpr", "match": "(?i)\\bproject\\b" }, |
| 101 | + { "include": "#name_ref" } |
| 102 | + ] |
| 103 | + }, |
| 104 | + "2": { "name": "punctuation.gpr" }, |
| 105 | + "3": { |
| 106 | + "name": "meta.attribute_reference.attribute_name", |
| 107 | + "patterns": [{ "include": "#simple_name_ref" }] |
| 108 | + }, |
| 109 | + "4": { |
| 110 | + "name": "meta.attribute_reference.attribute_index", |
| 111 | + "patterns": [ |
| 112 | + { "name": "punctuation.gpr", "match": "[()]" }, |
| 113 | + { "include": "#string_literal" } |
| 114 | + ] |
| 115 | + } |
| 116 | + } |
| 117 | + }, |
| 118 | + "string_list": { |
| 119 | + "patterns": [ |
| 120 | + { |
| 121 | + "name": "meta.string_list.gpr", |
| 122 | + "begin": "\\(", |
| 123 | + "end": "\\)", |
| 124 | + "beginCaptures": { |
| 125 | + "0": { "name": "punctuation.gpr" } |
| 126 | + }, |
| 127 | + "endCaptures": { |
| 128 | + "0": { "name": "punctuation.gpr" } |
| 129 | + }, |
| 130 | + "patterns": [ |
| 131 | + { "include": "#string_expression" }, |
| 132 | + { "name": "punctuation.gpr", "match": "," } |
| 133 | + ] |
| 134 | + }, |
| 135 | + { "include": "#name_ref" }, |
| 136 | + { "include": "#attribute_reference" } |
| 137 | + ] |
| 138 | + }, |
| 139 | + "expression": { |
| 140 | + "patterns": [ |
| 141 | + { "include": "#string_expression" }, |
| 142 | + { "include": "#string_list" }, |
| 143 | + { "name": "punctuation.gpr", "match": "&" } |
| 144 | + ] |
49 | 145 | },
|
50 | 146 | "case_construction": {
|
51 | 147 | "name": "meta.case.gpr",
|
52 | 148 | "begin": "(?i)\\b(case)\\s+(.+)\\s+(is)\\b",
|
53 | 149 | "end": "(?i)\\b(end)\\s+(case)\\s*(;)",
|
54 | 150 | "beginCaptures": {
|
55 | 151 | "1": { "name": "keyword.control.gpr" },
|
56 |
| - "2": { "name": "variable.name.gpr" }, |
| 152 | + "2": { "name": "variable.name.gpr", "patterns": [{ "include": "#name_ref" }] }, |
57 | 153 | "3": { "name": "keyword.control.gpr" }
|
58 | 154 | },
|
59 | 155 | "endCaptures": {
|
60 | 156 | "1": { "name": "keyword.control.gpr" },
|
61 | 157 | "2": { "name": "keyword.control.gpr" },
|
62 | 158 | "3": { "name": "punctuation.gpr" }
|
63 | 159 | },
|
| 160 | + "patterns": [{ "include": "#comment" }, { "include": "#when" }] |
| 161 | + }, |
| 162 | + "when": { |
| 163 | + "name": "meta.case.when.gpr", |
| 164 | + "begin": "(?i)\\b(when)\\b\\s+((?!=>).*)(=>)", |
| 165 | + "end": "(?i)(?=\\b(?=when|end\\s+case)\\b)", |
| 166 | + "beginCaptures": { |
| 167 | + "1": { "name": "keyword.control.gpr" }, |
| 168 | + "2": { "patterns": [{ "include": "#discrete_choice_list" }] }, |
| 169 | + "3": { "name": "keyword.control.gpr" } |
| 170 | + }, |
64 | 171 | "patterns": [
|
65 |
| - { "include": "#case_construction" }, |
66 |
| - { "include": "#case_when" }, |
67 | 172 | { "include": "#comment" },
|
| 173 | + { "include": "#case_construction" }, |
68 | 174 | { "include": "#attribute" },
|
| 175 | + { "include": "#variable" }, |
69 | 176 | { "include": "#empty_declaration" }
|
70 | 177 | ]
|
71 | 178 | },
|
72 |
| - "case_when": { |
73 |
| - "name": "meta.case.when.gpr", |
74 |
| - "begin": "(?i)\\bwhen\\b", |
75 |
| - "end": "=>", |
76 |
| - "beginCaptures": { |
77 |
| - "0": { "name": "keyword.control.gpr" } |
78 |
| - }, |
79 |
| - "endCaptures": { |
80 |
| - "0": { "name": "keyword.gpr" } |
81 |
| - }, |
82 |
| - "patterns": [{ "include": "#string" }] |
| 179 | + "discrete_choice_list": { |
| 180 | + "patterns": [ |
| 181 | + { "include": "#string_literal" }, |
| 182 | + { "name": "keyword.control.gpr", "match": "others" }, |
| 183 | + { "name": "punctuation.gpr", "match": "\\|" } |
| 184 | + ] |
83 | 185 | },
|
84 | 186 | "comment": {
|
85 | 187 | "patterns": [
|
|
179 | 281 | "beginCaptures": {
|
180 | 282 | "1": { "name": "keyword.gpr" },
|
181 | 283 | "2": { "name": "keyword.gpr" },
|
182 |
| - "3": { "name": "entity.name.project.gpr" } |
| 284 | + "3": { |
| 285 | + "name": "entity.name.project.gpr", |
| 286 | + "patterns": [{ "include": "#simple_name" }] |
| 287 | + } |
183 | 288 | },
|
184 | 289 | "endCaptures": {
|
185 | 290 | "1": { "name": "keyword.gpr" },
|
|
199 | 304 | { "include": "#comment" },
|
200 | 305 | { "include": "#attribute" },
|
201 | 306 | { "include": "#type" },
|
202 |
| - { "include": "#typed_variable" } |
| 307 | + { "include": "#variable" } |
203 | 308 | ]
|
204 | 309 | },
|
205 | 310 | {
|
|
209 | 314 | "2": { "name": "keyword.gpr" }
|
210 | 315 | },
|
211 | 316 | "end": "(?i)\\b(?=is)\\b",
|
212 |
| - "patterns": [{ "include": "#string" }] |
| 317 | + "patterns": [{ "include": "#string_literal" }] |
213 | 318 | }
|
214 | 319 | ]
|
215 | 320 | },
|
216 |
| - "string": { |
| 321 | + "string_literal": { |
217 | 322 | "name": "string.quoted.double.gpr",
|
218 | 323 | "match": "(\").*?(\")",
|
219 | 324 | "captures": {
|
|
227 | 332 | },
|
228 | 333 | "type": {
|
229 | 334 | "name": "meta.declaration.type.gpr",
|
230 |
| - "begin": "(?i)\\b(type)\\s+((?:\\w|\\d|_)+)\\b", |
| 335 | + "begin": "(?i)\\b(type)\\b\\s*(\\S+)\\b\\s*(is)", |
231 | 336 | "end": ";",
|
232 | 337 | "beginCaptures": {
|
233 | 338 | "1": { "name": "keyword.gpr" },
|
234 |
| - "2": { "name": "entity.name.type.gpr" } |
| 339 | + "2": { |
| 340 | + "name": "entity.name.type.gpr", |
| 341 | + "patterns": [{ "include": "#simple_name" }] |
| 342 | + }, |
| 343 | + "3": { "name": "keyword.gpr" } |
235 | 344 | },
|
236 | 345 | "endCaptures": {
|
237 | 346 | "0": { "name": "punctuation.gpr" }
|
238 | 347 | },
|
239 | 348 | "patterns": [
|
240 |
| - { "include": "#string" }, |
| 349 | + { "include": "#string_literal" }, |
241 | 350 | {
|
242 | 351 | "name": "punctuation.gpr",
|
243 | 352 | "match": "[(),]"
|
244 |
| - }, |
245 |
| - { |
246 |
| - "name": "keyword.gpr", |
247 |
| - "match": "(?i)\\bis\\b" |
248 | 353 | }
|
249 | 354 | ]
|
250 | 355 | },
|
251 | 356 | "type_annotation": {
|
252 |
| - "name": "entity.name.type.gpr", |
253 |
| - "match": "\\b(\\w|\\d|_)+\\b" |
| 357 | + "name": "meta.declaration.variable.type.gpr", |
| 358 | + "begin": "(:)(?!=)\\s*(\\S+)", |
| 359 | + "end": "(?=;|:=)", |
| 360 | + "beginCaptures": { |
| 361 | + "1": { "name": "punctuation.gpr" }, |
| 362 | + "2": { |
| 363 | + "name": "entity.name.type.gpr", |
| 364 | + "patterns": [{ "include": "#name" }] |
| 365 | + } |
| 366 | + } |
254 | 367 | },
|
255 |
| - "typed_variable": { |
| 368 | + "variable": { |
256 | 369 | "name": "meta.declaration.variable.gpr",
|
257 |
| - "begin": "\\b((?:\\w|\\d|_)+)\\s*(:)", |
| 370 | + "begin": "\\b((?:\\w|\\d|_)+)\\s*(?=:)", |
258 | 371 | "end": ";",
|
259 | 372 | "beginCaptures": {
|
260 |
| - "1": { "name": "variable.name.gpr" }, |
261 |
| - "2": { "name": "punctuation.gpr" } |
| 373 | + "1": { "name": "variable.name.gpr", "patterns": [{ "include": "#simple_name" }] } |
262 | 374 | },
|
263 | 375 | "endCaptures": {
|
264 | 376 | "0": { "name": "punctuation.gpr" }
|
265 | 377 | },
|
266 |
| - "patterns": [{ "include": "#assignment" }, { "include": "#type_annotation" }] |
| 378 | + "patterns": [{ "include": "#type_annotation" }, { "include": "#assignment" }] |
267 | 379 | },
|
268 | 380 | "with_clause": {
|
269 | 381 | "name": "meta.clause.with.gpr",
|
|
277 | 389 | "0": { "name": "punctuation.gpr" }
|
278 | 390 | },
|
279 | 391 | "patterns": [
|
280 |
| - { "include": "#string" }, |
| 392 | + { "include": "#string_literal" }, |
281 | 393 | {
|
282 | 394 | "match": ",",
|
283 | 395 | "name": "punctuation.gpr"
|
|
0 commit comments