github-linguist 7.6.0 → 7.10.0

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