github-linguist 7.7.0 → 7.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/grammars/hidden.manref.json +1 -1
  3. data/grammars/source.4dm.json +1029 -0
  4. data/grammars/source.agda.json +32 -202
  5. data/grammars/source.clarion.json +6 -6
  6. data/grammars/source.dircolors.json +101 -3
  7. data/grammars/source.editorconfig.json +23 -5
  8. data/grammars/source.elm.json +1 -1
  9. data/grammars/source.emacs.lisp.json +10 -0
  10. data/grammars/source.faust.json +119 -0
  11. data/grammars/source.gcode.json +170 -8
  12. data/grammars/source.hlsl.json +9 -5
  13. data/grammars/source.hx.json +4 -0
  14. data/grammars/source.igor.json +44 -0
  15. data/grammars/source.julia.json +8 -4
  16. data/grammars/source.mcfunction-snapshot.json +1 -1
  17. data/grammars/source.meson.json +1 -1
  18. data/grammars/source.odin-ehr.json +806 -0
  19. data/grammars/source.odin.json +402 -0
  20. data/grammars/source.p4.json +5 -21
  21. data/grammars/source.scala.json +27 -3
  22. data/grammars/source.sy.json +2088 -183
  23. data/grammars/source.terraform.json +576 -132
  24. data/grammars/source.ts.json +89 -30
  25. data/grammars/source.tsx.json +89 -30
  26. data/grammars/source.v.json +541 -788
  27. data/grammars/source.viml.json +2 -2
  28. data/grammars/source.webassembly.json +10 -0
  29. data/grammars/version +1 -1
  30. data/lib/linguist/VERSION +1 -1
  31. data/lib/linguist/generated.rb +10 -1
  32. data/lib/linguist/heuristics.yml +41 -3
  33. data/lib/linguist/languages.json +1 -1
  34. data/lib/linguist/languages.yml +117 -34
  35. data/lib/linguist/lazy_blob.rb +10 -10
  36. data/lib/linguist/linguist.bundle +0 -0
  37. data/lib/linguist/samples.json +6577 -1979
  38. data/lib/linguist/vendor.yml +3 -0
  39. metadata +6 -6
  40. data/grammars/source.LS.json +0 -85
  41. data/grammars/source.MCPOST.json +0 -54
  42. data/grammars/source.MOD.json +0 -55
  43. data/grammars/source.apt.json +0 -18
@@ -1,96 +1,30 @@
1
1
  {
2
- "name": "v",
2
+ "name": "V",
3
3
  "scopeName": "source.v",
4
4
  "patterns": [
5
5
  {
6
- "name": "meta.definition.module.v",
7
- "begin": "^\\s*(module)\\s+",
8
- "end": "([0-9a-zA-Z_]*)",
9
- "beginCaptures": {
10
- "1": {
11
- "name": "keyword.module.v"
12
- }
13
- },
14
- "endCaptures": {
15
- "1": {
16
- "name": "entity.name.module.v"
17
- }
18
- }
6
+ "include": "#comments"
19
7
  },
20
8
  {
21
- "name": "meta.definition.import.v",
22
- "begin": "^\\s*(import)\\s+",
23
- "end": "([0-9a-zA-Z_.]*)",
24
- "beginCaptures": {
25
- "1": {
26
- "name": "keyword.import.v"
27
- }
28
- },
29
- "endCaptures": {
30
- "1": {
31
- "name": "entity.name.import.v"
32
- }
33
- }
9
+ "include": "#as"
34
10
  },
35
11
  {
36
- "name": "meta.definition.include.v",
37
- "begin": "^\\s*(#include)",
38
- "end": "\\s+([\\\u003c\"])\\s*(.*)([\\\u003e\"])",
39
- "beginCaptures": {
40
- "1": {
41
- "name": "keyword.include.v"
42
- }
43
- },
44
- "endCaptures": {
45
- "1": {
46
- "name": "string.quoted.double.v"
47
- },
48
- "2": {
49
- "name": "string.quoted.double.v"
50
- },
51
- "3": {
52
- "name": "string.quoted.double.v"
53
- }
54
- }
12
+ "include": "#attributes"
55
13
  },
56
14
  {
57
- "name": "meta.definition.flag.v",
58
- "begin": "^\\s*(#flag)",
59
- "end": "\\s+(.*?)$",
60
- "beginCaptures": {
61
- "1": {
62
- "name": "keyword.flag.v"
63
- }
64
- },
65
- "endCaptures": {
66
- "1": {
67
- "name": "string.quoted.single.v"
68
- }
69
- }
15
+ "include": "#assignment"
70
16
  },
71
17
  {
72
- "name": "meta.definition.reference.v",
73
- "match": "(\u0026)\\s*(?=[0-9a-zA-Z_])",
74
- "captures": {
75
- "1": {
76
- "name": "keyword.operator.address.v"
77
- }
78
- }
18
+ "include": "#module-decl"
79
19
  },
80
20
  {
81
- "name": "meta.definition.escaped.keyword.v",
82
- "match": "((?:@)(?:mut|pub|fn|module|import|const|map|assert|sizeof|type|struct|interface|enum|in|or|match|if|else|for|go|goto|defer|return|i?(?:8|16|nt|64|128)|u?(?:16|32|64|128)|f?(?:32|64)|bool|byte|byteptr|voidptr|string|ustring|rune|none))",
83
- "captures": {
84
- "0": {
85
- "name": "keyword.other.escaped.v"
86
- }
87
- }
21
+ "include": "#import-decl"
88
22
  },
89
23
  {
90
- "include": "#comments"
24
+ "include": "#include-decl"
91
25
  },
92
26
  {
93
- "include": "#attributes"
27
+ "include": "#flag-decl"
94
28
  },
95
29
  {
96
30
  "include": "#brackets"
@@ -99,46 +33,40 @@
99
33
  "include": "#builtin-fix"
100
34
  },
101
35
  {
102
- "include": "#generics"
36
+ "include": "#escaped-fix"
103
37
  },
104
38
  {
105
39
  "include": "#operators"
106
40
  },
107
41
  {
108
- "include": "#function-new-limited-overload"
42
+ "include": "#function-limited-overload-decl"
109
43
  },
110
44
  {
111
- "include": "#function-new-extend"
45
+ "include": "#function-extend-decl"
112
46
  },
113
47
  {
114
- "include": "#function-new"
48
+ "include": "#function-decl"
115
49
  },
116
50
  {
117
51
  "include": "#function-exist"
118
52
  },
119
53
  {
120
- "include": "#type"
121
- },
122
- {
123
- "include": "#enum"
54
+ "include": "#generic"
124
55
  },
125
56
  {
126
- "include": "#struct"
127
- },
128
- {
129
- "include": "#interface"
57
+ "include": "#constants"
130
58
  },
131
59
  {
132
- "include": "#constants"
60
+ "include": "#type"
133
61
  },
134
62
  {
135
- "include": "#variable-assignment"
63
+ "include": "#enum"
136
64
  },
137
65
  {
138
- "include": "#variable-increment-decrement"
66
+ "include": "#interface"
139
67
  },
140
68
  {
141
- "include": "#goto"
69
+ "include": "#struct"
142
70
  },
143
71
  {
144
72
  "include": "#keywords"
@@ -146,57 +74,72 @@
146
74
  {
147
75
  "include": "#storage"
148
76
  },
149
- {
150
- "include": "#std-types"
151
- },
152
- {
153
- "include": "#std-cbased-types"
154
- },
155
77
  {
156
78
  "include": "#numbers"
157
79
  },
158
80
  {
159
81
  "include": "#strings"
82
+ },
83
+ {
84
+ "include": "#types"
160
85
  }
161
86
  ],
162
87
  "repository": {
163
- "attributes": {
164
- "patterns": [
165
- {
166
- "match": "^\\s*((\\[)(unsafe_fn|deprecated|live|inline)(\\]))",
167
- "captures": {
168
- "1": {
169
- "name": "meta.function.attribute.v"
170
- },
171
- "2": {
172
- "name": "punctuation.definition.begin.bracket.square.v"
173
- },
174
- "3": {
175
- "name": "storage.modifier.attribute.v"
88
+ "as": {
89
+ "begin": "\\s+(as)\\s+",
90
+ "end": "([\\w.]*)",
91
+ "beginCaptures": {
92
+ "1": {
93
+ "name": "keyword.as.v"
94
+ }
95
+ },
96
+ "endCaptures": {
97
+ "1": {
98
+ "name": "entity.name.alias.v"
99
+ }
100
+ }
101
+ },
102
+ "assignment": {
103
+ "name": "meta.definition.variable.v",
104
+ "match": "([\\w.]+)\\s*((?:\\:|\\+|\\-|\\*|\\/|\\%|\\\u0026|\\||\\^)?=)\\s*(?=.+)",
105
+ "captures": {
106
+ "1": {
107
+ "patterns": [
108
+ {
109
+ "include": "#illegal-name"
176
110
  },
177
- "4": {
178
- "name": "punctuation.definition.end.bracket.square.v"
111
+ {
112
+ "name": "variable.assignment.other.v",
113
+ "match": "\\w+"
179
114
  }
180
- }
115
+ ]
181
116
  },
182
- {
183
- "match": "(?\u003c=[0-9a-zA-Z_\\s])((\\[)(skip)(\\]))",
184
- "captures": {
185
- "0": {
186
- "name": "meta.struct.attribute.v"
187
- },
188
- "1": {
189
- "name": "punctuation.definition.begin.bracket.square.v"
190
- },
191
- "2": {
192
- "name": "entity.struct.attribute.v"
193
- },
194
- "3": {
195
- "name": "punctuation.definition.end.bracket.square.v"
117
+ "2": {
118
+ "patterns": [
119
+ {
120
+ "include": "#operators"
196
121
  }
197
- }
122
+ ]
198
123
  }
199
- ]
124
+ }
125
+ },
126
+ "attributes": {
127
+ "name": "meta.definition.attribute.v",
128
+ "match": "^\\s*((\\[)(deprecated|unsafe_fn|typedef|live|inline)(\\]))",
129
+ "captures": {
130
+ "1": {
131
+ "name": "meta.function.attribute.v"
132
+ },
133
+ "2": {
134
+ "name": "punctuation.definition.begin.bracket.square.v"
135
+ },
136
+ "3": {
137
+ "name": "storage.modifier.attribute.v"
138
+ },
139
+ "4": {
140
+ "name": "punctuation.definition.end.bracket.square.v"
141
+ }
142
+ }
200
143
  },
201
144
  "brackets": {
202
145
  "patterns": [
@@ -239,8 +182,23 @@
239
182
  }
240
183
  },
241
184
  {
242
- "name": "punctuation.definition.bracket.square.v",
243
- "match": "\\[|\\]"
185
+ "begin": "\\[",
186
+ "end": "\\]",
187
+ "patterns": [
188
+ {
189
+ "include": "$self"
190
+ }
191
+ ],
192
+ "beginCaptures": {
193
+ "0": {
194
+ "name": "punctuation.definition.bracket.square.begin.v"
195
+ }
196
+ },
197
+ "endCaptures": {
198
+ "0": {
199
+ "name": "punctuation.definition.bracket.square.end.v"
200
+ }
201
+ }
244
202
  }
245
203
  ]
246
204
  },
@@ -249,40 +207,24 @@
249
207
  {
250
208
  "patterns": [
251
209
  {
252
- "match": "^\\s*(const)(?=\\s*\\()",
253
- "captures": {
254
- "1": {
255
- "name": "storage.modifier.v"
256
- }
257
- }
258
- },
259
- {
260
- "match": "(assert)(?=\\s*\\()",
261
- "captures": {
262
- "1": {
263
- "name": "keyword.assert.v"
264
- }
265
- }
210
+ "name": "storage.modifier.v",
211
+ "match": "(const)(?=\\s*\\()"
266
212
  },
267
213
  {
268
- "match": "(sizeof)(?=\\s*\\()",
269
- "captures": {
270
- "1": {
271
- "name": "keyword.sizeof.v"
272
- }
273
- }
214
+ "name": "keyword.$1.v",
215
+ "match": "\\b(fn|type|enum|struct|interface|map|assert|sizeof)\\b(?=\\s*\\()"
274
216
  }
275
217
  ]
276
218
  },
277
219
  {
278
220
  "patterns": [
279
221
  {
280
- "match": "(in|or|match|if|else|for|go|goto|defer|return)(?=\\s*\\()",
281
- "captures": {
282
- "1": {
283
- "name": "keyword.control.v"
284
- }
285
- }
222
+ "name": "keyword.control.v",
223
+ "match": "(\\$if|\\$else)(?=\\s*\\()"
224
+ },
225
+ {
226
+ "name": "keyword.control.v",
227
+ "match": "\\b(in|or|break|continue|default|unsafe|match|if|else|for|go|goto|defer|return)\\b(?=\\s*\\()"
286
228
  }
287
229
  ]
288
230
  },
@@ -299,73 +241,10 @@
299
241
  },
300
242
  {
301
243
  "name": "meta.expr.bool.cast.v",
302
- "match": "(bool)(?=\\s*\\()",
303
- "captures": {
304
- "1": {
305
- "name": "storage.type.boolean.v"
306
- }
307
- }
308
- },
309
- {
310
- "name": "meta.expr.byte.cast.v",
311
- "match": "(byte)(?=\\s*\\()",
312
- "captures": {
313
- "1": {
314
- "name": "storage.type.byte.v"
315
- }
316
- }
317
- },
318
- {
319
- "name": "meta.expr.byteptr.cast.v",
320
- "match": "(byteptr)(?=\\s*\\()",
321
- "captures": {
322
- "1": {
323
- "name": "storage.type.byteptr.v"
324
- }
325
- }
326
- },
327
- {
328
- "name": "meta.expr.voidptr.cast.v",
329
- "match": "(voidptr)(?=\\s*\\()",
330
- "captures": {
331
- "1": {
332
- "name": "storage.type.voidptr.v"
333
- }
334
- }
335
- },
336
- {
337
- "name": "meta.expr.string.cast.v",
338
- "match": "(string)(?=\\s*\\()",
339
- "captures": {
340
- "1": {
341
- "name": "storage.type.string.v"
342
- }
343
- }
344
- },
345
- {
346
- "name": "meta.expr.ustring.cast.v",
347
- "match": "(ustring)(?=\\s*\\()",
348
- "captures": {
349
- "1": {
350
- "name": "storage.type.ustring.v"
351
- }
352
- }
353
- },
354
- {
355
- "name": "meta.expr.rune.cast.v",
356
- "match": "(rune)(?=\\s*\\()",
357
- "captures": {
358
- "1": {
359
- "name": "storage.type.rune.v"
360
- }
361
- }
362
- },
363
- {
364
- "name": "meta.expr.none.cast.v",
365
- "match": "(none)(?=\\s*\\()",
244
+ "match": "(bool|byte|byteptr|charptr|voidptr|string|ustring|rune|none)(?=\\s*\\()",
366
245
  "captures": {
367
246
  "1": {
368
- "name": "storage.type.none.v"
247
+ "name": "storage.type.$1.v"
369
248
  }
370
249
  }
371
250
  }
@@ -408,339 +287,248 @@
408
287
  ]
409
288
  },
410
289
  "constants": {
411
- "patterns": [
412
- {
413
- "name": "constant.language.v",
414
- "match": "\\b(true|false)\\b"
415
- },
416
- {
417
- "name": "constant.other.v",
418
- "match": "([0-9A-Z]+)(?=\\s*\\=)"
419
- }
420
- ]
290
+ "name": "constant.language.v",
291
+ "match": "\\b(true|false)\\b"
421
292
  },
422
293
  "enum": {
423
- "patterns": [
424
- {
425
- "name": "meta.definition.enum.v",
426
- "match": "^\\s*(\\benum\\b)\\s+(?:[0-9a-zA-Z_]+\\.)?([0-9a-zA-Z_]*)",
427
- "captures": {
428
- "1": {
429
- "name": "keyword.enum.v"
430
- },
431
- "2": {
432
- "patterns": [
433
- {
434
- "name": "invalid.illegal.v",
435
- "match": "\\d\\w+"
436
- },
437
- {
438
- "name": "entity.name.enum.v",
439
- "match": "\\w+"
440
- }
441
- ]
442
- }
443
- }
444
- }
445
- ]
446
- },
447
- "flags": {
448
- "patterns": [
449
- {
450
- "name": "meta.flag.include.v",
451
- "match": "(-L|I)\\s*(?=.+?)",
452
- "captures": {
453
- "1": {
454
- "name": "keyword.flag.include.v"
455
- }
456
- }
294
+ "name": "meta.definition.enum.v",
295
+ "match": "^\\s*(?:(pub)?\\s+)?(enum)\\s+(?:\\w+\\.)?(\\w*)",
296
+ "captures": {
297
+ "1": {
298
+ "name": "storage.modifier.$1.v"
457
299
  },
458
- {
459
- "name": "meta.flag.linking.v",
460
- "match": "(-l[0-9a-zA-Z._\\-]+)",
461
- "captures": {
462
- "1": {
463
- "name": "entity.name.library.v"
464
- }
465
- }
300
+ "2": {
301
+ "name": "storage.type.enum.v"
466
302
  },
467
- {
468
- "name": "meta.flag.os-specific.linking.v",
469
- "match": "(windows|darwin|linux|bsd)\\s+(?=-(?=l|L))",
470
- "captures": {
471
- "1": {
472
- "name": "keyword.flag.os.v"
473
- }
474
- }
303
+ "3": {
304
+ "name": "entity.name.enum.v"
475
305
  }
476
- ]
306
+ }
477
307
  },
478
- "function-exist": {
479
- "patterns": [
480
- {
481
- "name": "meta.function.v",
482
- "match": "([0-9a-zA-Z_]+)(\\\u003c[0-9a-zA-Z_]*\\\u003e)?(?=\\s*\\()",
483
- "captures": {
484
- "0": {
485
- "name": "meta.function.call.v"
486
- },
487
- "1": {
488
- "patterns": [
489
- {
490
- "name": "invalid.illegal.v",
491
- "match": "\\d\\w+"
492
- },
493
- {
494
- "name": "support.function.v",
495
- "match": "\\w+"
496
- }
497
- ]
498
- },
499
- "2": {
500
- "patterns": [
501
- {
502
- "include": "#function-generic"
503
- }
504
- ]
505
- }
506
- }
308
+ "escaped-fix": {
309
+ "name": "meta.escaped.keyword.v",
310
+ "match": "((?:@)(?:mut|pub|fn|unsafe|module|import|as|const|map|assert|sizeof|type|struct|interface|enum|in|or|match|if|else|for|go|goto|defer|return|i?(?:8|16|nt|64|128)|u?(?:16|32|64|128)|f?(?:32|64)|bool|byte|byteptr|charptr|voidptr|string|ustring|rune|none))",
311
+ "captures": {
312
+ "0": {
313
+ "name": "keyword.other.escaped.v"
507
314
  }
508
- ]
315
+ }
509
316
  },
510
- "function-generic": {
511
- "patterns": [
512
- {
513
- "name": "meta.definition.generic.v",
514
- "match": "(\\\u003c)([0-9a-zA-Z_]+)(\\\u003e)",
515
- "captures": {
516
- "1": {
517
- "name": "punctuation.definition.bracket.angle.begin.v"
518
- },
519
- "2": {
520
- "patterns": [
521
- {
522
- "name": "invalid.illegal.v",
523
- "match": "\\d\\w+"
524
- },
525
- {
526
- "name": "entity.name.generic.v",
527
- "match": "\\w+"
528
- }
529
- ]
317
+ "flag-decl": {
318
+ "name": "meta.flag.v",
319
+ "begin": "^\\s*(#flag)",
320
+ "end": "\\s+(.*?)$",
321
+ "beginCaptures": {
322
+ "1": {
323
+ "name": "keyword.flag.v"
324
+ }
325
+ },
326
+ "endCaptures": {
327
+ "1": {
328
+ "name": "string.quoted.single.v"
329
+ }
330
+ }
331
+ },
332
+ "function-decl": {
333
+ "name": "meta.definition.function.v",
334
+ "begin": "^\\s*(pub)?\\s*(fn)\\s+",
335
+ "end": "(?:(?:C\\.)?)(\\w+)\\s*((?\u003c=[\\w\\s+])(\\\u003c)(\\w+)(\\\u003e))?",
336
+ "beginCaptures": {
337
+ "1": {
338
+ "name": "storage.modifier.v"
339
+ },
340
+ "2": {
341
+ "name": "keyword.function.v"
342
+ }
343
+ },
344
+ "endCaptures": {
345
+ "1": {
346
+ "patterns": [
347
+ {
348
+ "include": "#illegal-name"
530
349
  },
531
- "3": {
532
- "name": "punctuation.definition.bracket.angle.end.v"
350
+ {
351
+ "name": "entity.name.function.v",
352
+ "match": "\\w+"
533
353
  }
534
- }
354
+ ]
355
+ },
356
+ "2": {
357
+ "patterns": [
358
+ {
359
+ "include": "#generic"
360
+ }
361
+ ]
535
362
  }
536
- ]
363
+ }
537
364
  },
538
- "function-new": {
539
- "patterns": [
540
- {
541
- "name": "meta.function.v",
542
- "begin": "^\\s*(pub)?\\s*(fn)\\s+",
543
- "end": "(?:(?:C\\.)?)([0-9a-zA-Z_]+)(\\\u003c[0-9a-zA-Z_]*\\\u003e)?",
544
- "beginCaptures": {
545
- "1": {
546
- "name": "storage.modifier.v"
365
+ "function-exist": {
366
+ "name": "meta.support.function.v",
367
+ "match": "(\\w+)((?\u003c=[\\w\\s+])(\\\u003c)(\\w+)(\\\u003e))?(?=\\s*\\()",
368
+ "captures": {
369
+ "0": {
370
+ "name": "meta.function.call.v"
371
+ },
372
+ "1": {
373
+ "patterns": [
374
+ {
375
+ "include": "#illegal-name"
547
376
  },
548
- "2": {
549
- "name": "keyword.function.v"
377
+ {
378
+ "name": "entity.name.function.v",
379
+ "match": "\\w+"
550
380
  }
551
- },
552
- "endCaptures": {
553
- "0": {
554
- "name": "meta.definition.function.v"
555
- },
556
- "1": {
557
- "patterns": [
558
- {
559
- "name": "invalid.illegal.v",
560
- "match": "\\d\\w+"
561
- },
562
- {
563
- "name": "entity.name.function.v",
564
- "match": "\\w+"
565
- }
566
- ]
567
- },
568
- "2": {
569
- "patterns": [
570
- {
571
- "include": "#function-generic"
572
- }
573
- ]
381
+ ]
382
+ },
383
+ "2": {
384
+ "patterns": [
385
+ {
386
+ "include": "#generic"
574
387
  }
575
- }
388
+ ]
576
389
  }
577
- ]
390
+ }
578
391
  },
579
- "function-new-extend": {
580
- "patterns": [
581
- {
582
- "name": "meta.function.v",
583
- "match": "^\\s*(pub)?\\s*(fn)\\s+(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)([0-9a-zA-Z_]+)(\\\u003c[0-9a-zA-Z_]*\\\u003e)?",
584
- "captures": {
585
- "0": {
586
- "name": "meta.definition.function.v"
587
- },
588
- "1": {
589
- "name": "storage.modifier.v"
590
- },
591
- "2": {
592
- "name": "keyword.function.v"
392
+ "function-extend-decl": {
393
+ "name": "meta.definition.function.v",
394
+ "match": "^\\s*(pub)?\\s*(fn)\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)(\\w+)\\s*((?\u003c=[\\w\\s+])(\\\u003c)(\\w+)(\\\u003e))?",
395
+ "captures": {
396
+ "1": {
397
+ "name": "storage.modifier.v"
398
+ },
399
+ "2": {
400
+ "name": "keyword.function.v"
401
+ },
402
+ "3": {
403
+ "name": "punctuation.definition.bracket.round.begin.v"
404
+ },
405
+ "4": {
406
+ "patterns": [
407
+ {
408
+ "include": "#brackets"
593
409
  },
594
- "3": {
595
- "name": "punctuation.definition.bracket.round.begin.v"
410
+ {
411
+ "include": "#storage"
596
412
  },
597
- "4": {
598
- "patterns": [
599
- {
600
- "include": "#brackets"
601
- },
602
- {
603
- "include": "#storage"
604
- },
605
- {
606
- "include": "#generics"
607
- },
608
- {
609
- "include": "#std-types"
610
- },
611
- {
612
- "include": "#std-cbased-types"
613
- },
614
- {
615
- "include": "#punctuation"
616
- }
617
- ]
413
+ {
414
+ "include": "#generic"
618
415
  },
619
- "5": {
620
- "name": "punctuation.definition.bracket.round.end.v"
416
+ {
417
+ "include": "#types"
621
418
  },
622
- "6": {
623
- "patterns": [
624
- {
625
- "name": "invalid.illegal.v",
626
- "match": "\\d\\w+"
627
- },
628
- {
629
- "name": "entity.name.function.v",
630
- "match": "\\w+"
631
- }
632
- ]
419
+ {
420
+ "include": "#punctuation"
421
+ }
422
+ ]
423
+ },
424
+ "5": {
425
+ "name": "punctuation.definition.bracket.round.end.v"
426
+ },
427
+ "6": {
428
+ "patterns": [
429
+ {
430
+ "include": "#illegal-name"
633
431
  },
634
- "7": {
635
- "patterns": [
636
- {
637
- "include": "#function-generic"
638
- }
639
- ]
432
+ {
433
+ "name": "entity.name.function.v",
434
+ "match": "\\w+"
640
435
  }
641
- }
436
+ ]
437
+ },
438
+ "7": {
439
+ "patterns": [
440
+ {
441
+ "include": "#generic"
442
+ }
443
+ ]
642
444
  }
643
- ]
445
+ }
644
446
  },
645
- "function-new-limited-overload": {
646
- "patterns": [
647
- {
648
- "name": "meta.function.v",
649
- "match": "^\\s*(pub)?\\s*(fn)\\s+(\\()([^\\)]*)(\\))\\s*([\\+\\-\\*\\/])?\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)([0-9a-zA-Z_]+)",
650
- "captures": {
651
- "0": {
652
- "name": "meta.definition.function.v"
653
- },
654
- "1": {
655
- "name": "storage.modifier.v"
447
+ "function-limited-overload-decl": {
448
+ "name": "meta.definition.function.v",
449
+ "match": "^\\s*(pub)?\\s*(fn)\\s*(\\()([^\\)]*)(\\))\\s*([\\+\\-\\*\\/])?\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)(\\w+)",
450
+ "captures": {
451
+ "1": {
452
+ "name": "storage.modifier.v"
453
+ },
454
+ "10": {
455
+ "patterns": [
456
+ {
457
+ "include": "#illegal-name"
656
458
  },
657
- "10": {
658
- "patterns": [
659
- {
660
- "name": "invalid.illegal.v",
661
- "match": "\\d\\w+"
662
- },
663
- {
664
- "name": "entity.name.function.v",
665
- "match": "\\w+"
666
- }
667
- ]
459
+ {
460
+ "name": "entity.name.function.v",
461
+ "match": "\\w+"
462
+ }
463
+ ]
464
+ },
465
+ "2": {
466
+ "name": "keyword.function.v"
467
+ },
468
+ "3": {
469
+ "name": "punctuation.definition.bracket.round.begin.v"
470
+ },
471
+ "4": {
472
+ "patterns": [
473
+ {
474
+ "include": "#brackets"
668
475
  },
669
- "2": {
670
- "name": "keyword.function.v"
476
+ {
477
+ "include": "#storage"
671
478
  },
672
- "3": {
673
- "name": "punctuation.definition.bracket.round.begin.v"
479
+ {
480
+ "include": "#generic"
674
481
  },
675
- "4": {
676
- "patterns": [
677
- {
678
- "include": "#brackets"
679
- },
680
- {
681
- "include": "#storage"
682
- },
683
- {
684
- "include": "#generics"
685
- },
686
- {
687
- "include": "#std-types"
688
- },
689
- {
690
- "include": "#std-cbased-types"
691
- },
692
- {
693
- "include": "#punctuation"
694
- }
695
- ]
482
+ {
483
+ "include": "#types"
696
484
  },
697
- "5": {
698
- "name": "punctuation.definition.bracket.round.end.v"
485
+ {
486
+ "include": "#punctuation"
487
+ }
488
+ ]
489
+ },
490
+ "5": {
491
+ "name": "punctuation.definition.bracket.round.end.v"
492
+ },
493
+ "6": {
494
+ "patterns": [
495
+ {
496
+ "include": "#operators"
497
+ }
498
+ ]
499
+ },
500
+ "7": {
501
+ "name": "punctuation.definition.bracket.round.begin.v"
502
+ },
503
+ "8": {
504
+ "patterns": [
505
+ {
506
+ "include": "#brackets"
699
507
  },
700
- "6": {
701
- "patterns": [
702
- {
703
- "include": "#operators"
704
- }
705
- ]
508
+ {
509
+ "include": "#storage"
706
510
  },
707
- "7": {
708
- "name": "punctuation.definition.bracket.round.begin.v"
511
+ {
512
+ "include": "#generic"
709
513
  },
710
- "8": {
711
- "patterns": [
712
- {
713
- "include": "#brackets"
714
- },
715
- {
716
- "include": "#storage"
717
- },
718
- {
719
- "include": "#generics"
720
- },
721
- {
722
- "include": "#std-types"
723
- },
724
- {
725
- "include": "#std-cbased-types"
726
- },
727
- {
728
- "include": "#punctuation"
729
- }
730
- ]
514
+ {
515
+ "include": "#types"
731
516
  },
732
- "9": {
733
- "name": "punctuation.definition.bracket.round.end.v"
517
+ {
518
+ "include": "#punctuation"
734
519
  }
735
- }
520
+ ]
521
+ },
522
+ "9": {
523
+ "name": "punctuation.definition.bracket.round.end.v"
736
524
  }
737
- ]
525
+ }
738
526
  },
739
- "generics": {
527
+ "generic": {
740
528
  "patterns": [
741
529
  {
742
530
  "name": "meta.definition.generic.v",
743
- "match": "(?\u003c=[\\w\\s])(\\\u003c)([0-9a-zA-Z_]+)(\\\u003e)",
531
+ "match": "(?\u003c=[\\w\\s+])(\\\u003c)(\\w+)(\\\u003e)",
744
532
  "captures": {
745
533
  "1": {
746
534
  "name": "punctuation.definition.bracket.angle.begin.v"
@@ -748,8 +536,7 @@
748
536
  "2": {
749
537
  "patterns": [
750
538
  {
751
- "name": "invalid.illegal.v",
752
- "match": "\\d\\w+"
539
+ "include": "#illegal-name"
753
540
  },
754
541
  {
755
542
  "name": "entity.name.generic.v",
@@ -764,115 +551,107 @@
764
551
  }
765
552
  ]
766
553
  },
554
+ "illegal-name": {
555
+ "name": "invalid.illegal.v",
556
+ "match": "\\d\\w+"
557
+ },
558
+ "import-decl": {
559
+ "name": "meta.import.v",
560
+ "begin": "^\\s*(import)\\s+",
561
+ "end": "([\\w.]+)",
562
+ "beginCaptures": {
563
+ "1": {
564
+ "name": "keyword.import.v"
565
+ }
566
+ },
567
+ "endCaptures": {
568
+ "1": {
569
+ "name": "entity.name.import.v"
570
+ }
571
+ }
572
+ },
573
+ "include-decl": {
574
+ "name": "meta.include.v",
575
+ "begin": "^\\s*(#include)",
576
+ "end": "\\s+(([\\\u003c\"])\\s*(.*)([\\\u003e\"]))",
577
+ "beginCaptures": {
578
+ "1": {
579
+ "name": "keyword.include.v"
580
+ }
581
+ },
582
+ "endCaptures": {
583
+ "1": {
584
+ "name": "string.quoted.double.v"
585
+ }
586
+ }
587
+ },
767
588
  "interface": {
768
- "patterns": [
769
- {
770
- "name": "meta.definition.interface.v",
771
- "match": "^\\s*(\\binterface\\b)\\s+([0-9a-zA-Z_]*)",
772
- "captures": {
773
- "1": {
774
- "name": "keyword.interface.v"
589
+ "name": "meta.definition.interface.v",
590
+ "match": "^\\s*(?:(pub)?\\s+)?(interface)\\s+(\\w*)",
591
+ "captures": {
592
+ "1": {
593
+ "name": "storage.modifier.$1.v"
594
+ },
595
+ "2": {
596
+ "name": "keyword.interface.v"
597
+ },
598
+ "3": {
599
+ "patterns": [
600
+ {
601
+ "include": "#illegal-name"
775
602
  },
776
- "2": {
777
- "patterns": [
778
- {
779
- "name": "invalid.illegal.v",
780
- "match": "\\d\\w+"
781
- },
782
- {
783
- "name": "entity.name.interface.v",
784
- "match": "\\w+"
785
- }
786
- ]
603
+ {
604
+ "name": "entity.name.interface.v",
605
+ "match": "\\w+"
787
606
  }
788
- }
607
+ ]
789
608
  }
790
- ]
609
+ }
791
610
  },
792
611
  "keywords": {
793
612
  "patterns": [
794
613
  {
795
614
  "name": "keyword.control.v",
796
- "match": "\\b(in|or|break|continue|default|match|if|else|for|go|goto|defer|return)\\b"
615
+ "match": "(\\$if|\\$else)"
797
616
  },
798
617
  {
799
618
  "name": "keyword.control.v",
800
- "match": "(\\$if)"
619
+ "match": "\\b(in|or|break|continue|default|unsafe|match|if|else|for|go|goto|defer|return)\\b"
801
620
  },
802
621
  {
803
- "name": "keyword.control.v",
804
- "match": "(\\$else)"
805
- },
806
- {
807
- "name": "keyword.type.v",
808
- "match": "\\btype\\b"
809
- },
810
- {
811
- "name": "keyword.enum.v",
812
- "match": "\\benum\\b"
813
- },
814
- {
815
- "name": "keyword.struct.v",
816
- "match": "\\bstruct\\b"
817
- },
818
- {
819
- "name": "keyword.interface.v",
820
- "match": "\\binterface\\b"
821
- },
822
- {
823
- "name": "keyword.map.v",
824
- "match": "\\bmap\\b"
825
- },
826
- {
827
- "name": "keyword.assert.v",
828
- "match": "\\bassert\\b"
829
- },
830
- {
831
- "name": "keyword.sizeof.v",
832
- "match": "\\bsizeof\\b"
622
+ "name": "keyword.$1.v",
623
+ "match": "\\b(fn|type|enum|struct|interface|map|assert|sizeof)\\b"
833
624
  }
834
625
  ]
835
626
  },
627
+ "module-decl": {
628
+ "name": "meta.module.v",
629
+ "begin": "^\\s*(module)\\s+",
630
+ "end": "([\\w.]+)",
631
+ "beginCaptures": {
632
+ "1": {
633
+ "name": "keyword.module.v"
634
+ }
635
+ },
636
+ "endCaptures": {
637
+ "1": {
638
+ "name": "entity.name.module.v"
639
+ }
640
+ }
641
+ },
836
642
  "numbers": {
837
643
  "patterns": [
838
644
  {
839
- "match": "([-]?)([0-9e]*)([.]){1}([0-9]+)",
840
- "captures": {
841
- "1": {
842
- "name": "constant.numeric.float.v"
843
- },
844
- "2": {
845
- "name": "constant.numeric.float.v"
846
- },
847
- "3": {
848
- "name": "constant.numeric.float.v"
849
- },
850
- "4": {
851
- "name": "constant.numeric.float.v"
852
- }
853
- }
645
+ "name": "constant.numeric.float.v",
646
+ "match": "(?:(?:[-]?)(?:[0-9e]*)(?:[.]){1}(?:[0-9]+))"
854
647
  },
855
648
  {
856
- "match": "(0[xX])([0-9a-fA-F]+)",
857
- "captures": {
858
- "1": {
859
- "name": "constant.numeric.hex.v"
860
- },
861
- "2": {
862
- "name": "constant.numeric.hex.v"
863
- }
864
- }
649
+ "name": "constant.numeric.hex.v",
650
+ "match": "\\b(?:0[xX])(?:[0-9a-fA-F]+)"
865
651
  },
866
652
  {
867
- "match": "\\b([-]?)([0-9]+)",
868
- "captures": {
869
- "1": {
870
- "name": "constant.numeric.integer.v"
871
- },
872
- "2": {
873
- "name": "constant.numeric.integer.v"
874
- }
875
- }
653
+ "name": "constant.numeric.integer.v",
654
+ "match": "\\b(?:[-]?)(?:[0-9]+)"
876
655
  }
877
656
  ]
878
657
  },
@@ -883,106 +662,50 @@
883
662
  "match": "(\\+|\\-|\\*|\\/|\\%|\\+\\+|\\-\\-)"
884
663
  },
885
664
  {
886
- "name": "keyword.operator.relation.v",
887
- "match": "(\\=\\=|\\!\\=|\\\u003e|\\\u003c|\\\u003e\\=|\\\u003c\\=)"
888
- },
889
- {
890
- "name": "keyword.operator.logical.v",
891
- "match": "(\\\u0026\\\u0026|\\|\\||\\!)"
665
+ "name": "keyword.operator.assignment.v",
666
+ "match": "(\\:\\=|\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=|\\\u0026\\=|\\|\\=|\\^\\=|\\\u0026\\\u0026\\=|\\|\\|\\=|\\\u003e\\\u003e\\=|\\\u003c\\\u003c\\=)"
892
667
  },
893
668
  {
894
669
  "name": "keyword.operator.bitwise.v",
895
670
  "match": "(\\\u0026|\\||\\^|\u003c(?!\u003c)|\u003e(?!\u003e))"
896
671
  },
897
672
  {
898
- "name": "keyword.operator.assignment.v",
899
- "match": "(\\:\\=|\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=|\\\u0026\\=|\\|\\=|\\^\\=|\\\u0026\\\u0026\\=|\\|\\|\\=|\\\u003e\\\u003e\\=|\\\u003c\\\u003c\\=)"
673
+ "name": "keyword.operator.logical.v",
674
+ "match": "(\\\u0026\\\u0026|\\|\\||\\!)"
675
+ },
676
+ {
677
+ "name": "keyword.operator.relation.v",
678
+ "match": "(\\=\\=|\\!\\=|\\\u003e|\\\u003c|\\\u003e\\=|\\\u003c\\=)"
900
679
  }
901
680
  ]
902
681
  },
903
682
  "punctuation": {
904
683
  "patterns": [
905
684
  {
906
- "name": "punctuation.other.dot.v",
685
+ "name": "punctuation.delimiter.period.dot.v",
907
686
  "match": "\\."
908
687
  },
909
688
  {
910
- "name": "punctuation.other.comma.v",
911
- "match": "\\,"
689
+ "name": "punctuation.delimiter.comma.v",
690
+ "match": ","
912
691
  },
913
692
  {
914
- "name": "punctuation.other.colon.v",
915
- "match": "\\:"
693
+ "name": "punctuation.separator.key-value.colon.v",
694
+ "match": ":"
916
695
  },
917
696
  {
918
- "name": "punctuation.other.semicolon.v",
919
- "match": "\\;"
697
+ "name": "punctuation.definition.other.semicolon.v",
698
+ "match": ";"
920
699
  },
921
700
  {
922
- "name": "punctuation.other.questionmark.v",
701
+ "name": "punctuation.definition.other.questionmark.v",
923
702
  "match": "\\?"
924
703
  }
925
704
  ]
926
705
  },
927
- "std-cbased-types": {
928
- "patterns": [
929
- {
930
- "name": "storage.type.numeric.cbased.v",
931
- "match": "\\b(size_t|ptrdiff_t)\\b"
932
- }
933
- ]
934
- },
935
- "std-types": {
936
- "patterns": [
937
- {
938
- "name": "storage.type.boolean.v",
939
- "match": "\\bbool\\b"
940
- },
941
- {
942
- "name": "storage.type.byte.v",
943
- "match": "\\bbyte\\b"
944
- },
945
- {
946
- "name": "storage.type.byteptr.v",
947
- "match": "\\bbyteptr\\b"
948
- },
949
- {
950
- "name": "storage.type.voidptr.v",
951
- "match": "\\bvoidptr\\b"
952
- },
953
- {
954
- "name": "storage.type.string.v",
955
- "match": "\\bstring\\b"
956
- },
957
- {
958
- "name": "storage.type.ustring.v",
959
- "match": "\\bustring\\b"
960
- },
961
- {
962
- "name": "storage.type.rune.v",
963
- "match": "\\brune\\b"
964
- },
965
- {
966
- "name": "storage.type.option.v",
967
- "match": "\\boption\\b"
968
- },
969
- {
970
- "name": "storage.type.numeric.v",
971
- "match": "\\b(i(8|16|nt|64|128)|u(16|32|64|u128)|f(32|64))\\b"
972
- },
973
- {
974
- "name": "storage.type.none.v",
975
- "match": "\\bnone\\b"
976
- }
977
- ]
978
- },
979
706
  "storage": {
980
- "patterns": [
981
- {
982
- "name": "storage.modifier.v",
983
- "match": "\\b(const|mut|pub)\\b"
984
- }
985
- ]
707
+ "name": "storage.modifier.v",
708
+ "match": "\\b(const|mut|pub)\\b"
986
709
  },
987
710
  "string-escaped-char": {
988
711
  "patterns": [
@@ -997,47 +720,39 @@
997
720
  ]
998
721
  },
999
722
  "string-interpolation": {
1000
- "patterns": [
1001
- {
1002
- "name": "meta.string.interpolation.v",
1003
- "match": "(\\$([0-9a-zA-Z_.]+|\\{.*?\\}))",
1004
- "captures": {
1005
- "1": {
1006
- "patterns": [
1007
- {
1008
- "name": "invalid.illegal.v",
1009
- "match": "\\$\\d[\\.\\w]+"
1010
- },
1011
- {
1012
- "name": "variable.other.interpolated.v",
1013
- "match": "\\$([\\.\\w]+|\\{.*?\\})"
1014
- }
1015
- ]
723
+ "name": "meta.string.interpolation.v",
724
+ "match": "(\\$([\\w.]+|\\{.*?\\}))",
725
+ "captures": {
726
+ "1": {
727
+ "patterns": [
728
+ {
729
+ "name": "invalid.illegal.v",
730
+ "match": "\\$\\d[\\.\\w]+"
731
+ },
732
+ {
733
+ "name": "variable.other.interpolated.v",
734
+ "match": "\\$([\\.\\w]+|\\{.*?\\})"
1016
735
  }
1017
- }
736
+ ]
1018
737
  }
1019
- ]
738
+ }
1020
739
  },
1021
740
  "string-placeholder": {
1022
- "patterns": [
1023
- {
1024
- "name": "constant.other.placeholder.v",
1025
- "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]"
1026
- }
1027
- ]
741
+ "name": "constant.other.placeholder.v",
742
+ "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]"
1028
743
  },
1029
744
  "strings": {
1030
745
  "patterns": [
1031
746
  {
1032
747
  "name": "string.quoted.raw.v",
1033
- "begin": "\\`",
1034
- "end": "\\`",
748
+ "begin": "`",
749
+ "end": "`",
1035
750
  "patterns": [
1036
751
  {
1037
- "include": "#string-interpolation"
752
+ "include": "#string-escaped-char"
1038
753
  },
1039
754
  {
1040
- "include": "#string-escaped-char"
755
+ "include": "#string-interpolation"
1041
756
  },
1042
757
  {
1043
758
  "include": "#string-placeholder"
@@ -1056,14 +771,14 @@
1056
771
  },
1057
772
  {
1058
773
  "name": "string.quoted.single.v",
1059
- "begin": "\\'",
1060
- "end": "\\'",
774
+ "begin": "'",
775
+ "end": "'",
1061
776
  "patterns": [
1062
777
  {
1063
- "include": "#string-interpolation"
778
+ "include": "#string-escaped-char"
1064
779
  },
1065
780
  {
1066
- "include": "#string-escaped-char"
781
+ "include": "#string-interpolation"
1067
782
  },
1068
783
  {
1069
784
  "include": "#string-placeholder"
@@ -1086,10 +801,10 @@
1086
801
  "end": "\"",
1087
802
  "patterns": [
1088
803
  {
1089
- "include": "#string-interpolation"
804
+ "include": "#string-escaped-char"
1090
805
  },
1091
806
  {
1092
- "include": "#string-escaped-char"
807
+ "include": "#string-interpolation"
1093
808
  },
1094
809
  {
1095
810
  "include": "#string-placeholder"
@@ -1112,113 +827,151 @@
1112
827
  "patterns": [
1113
828
  {
1114
829
  "name": "meta.definition.struct.v",
1115
- "match": "^\\s*(\\bstruct\\b)\\s+(?:[0-9a-zA-Z_]+\\.)?([0-9a-zA-Z_]*)",
1116
- "captures": {
1117
- "1": {
1118
- "name": "keyword.struct.v"
830
+ "begin": "^\\s*(?:(mut|pub(?:\\s+mut)?|__global)\\s+)?(struct)\\s+([\\w.]+)\\s*({)",
831
+ "end": "\\s*(})",
832
+ "patterns": [
833
+ {
834
+ "include": "#struct-access-modifier"
1119
835
  },
1120
- "2": {
1121
- "patterns": [
1122
- {
1123
- "name": "invalid.illegal.v",
1124
- "match": "\\d\\w+"
836
+ {
837
+ "match": "\\b(\\w+)\\s+([\\w\\[\\]\\*\u0026.]+)(?:\\s*(=)\\s*((?:.(?=$|//|/\\*))*+))?",
838
+ "captures": {
839
+ "1": {
840
+ "name": "variable.other.property.v"
1125
841
  },
1126
- {
1127
- "name": "entity.name.struct.v",
1128
- "match": "\\w+"
842
+ "2": {
843
+ "patterns": [
844
+ {
845
+ "include": "#numbers"
846
+ },
847
+ {
848
+ "include": "#brackets"
849
+ },
850
+ {
851
+ "include": "#types"
852
+ },
853
+ {
854
+ "name": "storage.type.other.v",
855
+ "match": "\\w+"
856
+ }
857
+ ]
858
+ },
859
+ "3": {
860
+ "name": "keyword.operator.assignment.v"
861
+ },
862
+ "4": {
863
+ "patterns": [
864
+ {
865
+ "include": "$self"
866
+ }
867
+ ]
1129
868
  }
1130
- ]
869
+ }
870
+ },
871
+ {
872
+ "include": "#types"
873
+ },
874
+ {
875
+ "include": "$self"
1131
876
  }
1132
- }
1133
- }
1134
- ]
1135
- },
1136
- "type": {
1137
- "patterns": [
1138
- {
1139
- "name": "meta.definition.type.v",
1140
- "match": "^\\s*(\\btype\\b)\\s+([0-9a-zA-Z_]*)\\s+(?:[0-9a-zA-Z]+\\.+)?([0-9a-zA-Z_]*)",
1141
- "captures": {
877
+ ],
878
+ "beginCaptures": {
1142
879
  "1": {
1143
- "name": "keyword.type.v"
880
+ "name": "storage.modifier.$1.v"
1144
881
  },
1145
882
  "2": {
1146
- "patterns": [
1147
- {
1148
- "name": "invalid.illegal.v",
1149
- "match": "\\d\\w+"
1150
- },
1151
- {
1152
- "name": "entity.name.type.v",
1153
- "match": "\\w+"
1154
- }
1155
- ]
883
+ "name": "storage.type.struct.v"
1156
884
  },
1157
885
  "3": {
1158
- "patterns": [
1159
- {
1160
- "name": "invalid.illegal.v",
1161
- "match": "\\d\\w+"
1162
- },
1163
- {
1164
- "name": "entity.name.type.v",
1165
- "match": "\\w+"
1166
- }
1167
- ]
886
+ "name": "entity.name.struct.v"
887
+ },
888
+ "4": {
889
+ "name": "punctuation.definition.bracket.curly.begin.v"
1168
890
  }
1169
- }
1170
- }
1171
- ]
1172
- },
1173
- "variable-assignment": {
1174
- "patterns": [
1175
- {
1176
- "match": "(match|if|else)(?=\\s*\\=\\\u003e)",
1177
- "captures": {
891
+ },
892
+ "endCaptures": {
1178
893
  "1": {
1179
- "name": "keyword.control.v"
894
+ "name": "punctuation.definition.bracket.curly.end.v"
1180
895
  }
1181
896
  }
1182
897
  },
1183
898
  {
1184
- "name": "meta.definition.var.v",
1185
- "match": "([0-9a-zA-Z_.]+)\\s*((?:\\:|\\+|\\-|\\*|\\/|\\%|\\\u0026|\\||\\^)?=)\\s*(?=.+)",
899
+ "name": "meta.definition.struct.v",
900
+ "match": "^\\s*(?:(mut|pub(?:\\s+mut)?|__global)\\s+)?(struct)(?:\\s+([\\w.]+))?",
1186
901
  "captures": {
1187
902
  "1": {
1188
- "name": "variable.other.v"
903
+ "name": "storage.modifier.$1.v"
1189
904
  },
1190
905
  "2": {
1191
- "name": "keyword.operator.assignment.v"
906
+ "name": "storage.type.struct.v"
907
+ },
908
+ "3": {
909
+ "name": "entity.name.struct.v"
1192
910
  }
1193
911
  }
1194
912
  }
1195
913
  ]
1196
914
  },
1197
- "variable-increment-decrement": {
1198
- "patterns": [
1199
- {
1200
- "name": "meta.var.increment.expr.v",
1201
- "match": "([0-9a-zA-Z_.]+)(\\+\\+)",
1202
- "captures": {
1203
- "1": {
1204
- "name": "variable.other.increment.v"
915
+ "struct-access-modifier": {
916
+ "match": "(?\u003c=\\s|^)(mut|pub(?:\\s+mut)?|__global)(:|\\b)",
917
+ "captures": {
918
+ "1": {
919
+ "name": "storage.modifier.$1.v"
920
+ },
921
+ "2": {
922
+ "name": "punctuation.separator.struct.key-value.v"
923
+ }
924
+ }
925
+ },
926
+ "type": {
927
+ "name": "meta.definition.type.v",
928
+ "match": "^\\s*(?:(pub)?\\s+)?(type)\\s+(\\w*)\\s+(?:\\w+\\.+)?(\\w*)",
929
+ "captures": {
930
+ "1": {
931
+ "name": "storage.modifier.$1.v"
932
+ },
933
+ "2": {
934
+ "name": "storage.type.type.v"
935
+ },
936
+ "3": {
937
+ "patterns": [
938
+ {
939
+ "include": "#illegal-name"
1205
940
  },
1206
- "2": {
1207
- "name": "keyword.operator.increment.v"
941
+ {
942
+ "include": "#types"
943
+ },
944
+ {
945
+ "name": "entity.name.type.v",
946
+ "match": "\\w+"
1208
947
  }
1209
- }
948
+ ]
1210
949
  },
1211
- {
1212
- "name": "meta.var.decrement.expr.v",
1213
- "match": "([0-9a-zA-Z_.]+)(\\-\\-)",
1214
- "captures": {
1215
- "1": {
1216
- "name": "variable.other.decrement.v"
950
+ "4": {
951
+ "patterns": [
952
+ {
953
+ "include": "#illegal-name"
1217
954
  },
1218
- "2": {
1219
- "name": "keyword.operator.decrement.v"
955
+ {
956
+ "include": "#types"
957
+ },
958
+ {
959
+ "name": "entity.name.type.v",
960
+ "match": "\\w+"
1220
961
  }
1221
- }
962
+ ]
963
+ }
964
+ }
965
+ },
966
+ "types": {
967
+ "patterns": [
968
+ {
969
+ "name": "storage.type.numeric.v",
970
+ "match": "\\b(i(8|16|nt|64|128)|u(8|16|32|64|128)|f(32|64))\\b"
971
+ },
972
+ {
973
+ "name": "storage.type.$1.v",
974
+ "match": "\\b(bool|byte|byteptr|charptr|voidptr|string|ustring|rune|none)\\b"
1222
975
  }
1223
976
  ]
1224
977
  }