tm-grammars 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/NOTICE +6565 -0
- package/README.md +211 -0
- package/grammars/abap.json +380 -0
- package/grammars/actionscript-3.json +951 -0
- package/grammars/ada.json +3874 -0
- package/grammars/apache.json +562 -0
- package/grammars/apex.json +3203 -0
- package/grammars/apl.json +1479 -0
- package/grammars/applescript.json +1406 -0
- package/grammars/ara.json +428 -0
- package/grammars/asm.json +1741 -0
- package/grammars/astro.json +776 -0
- package/grammars/awk.json +388 -0
- package/grammars/ballerina.json +3768 -0
- package/grammars/bat.json +783 -0
- package/grammars/beancount.json +831 -0
- package/grammars/berry.json +172 -0
- package/grammars/bibtex.json +315 -0
- package/grammars/bicep.json +239 -0
- package/grammars/blade.json +3870 -0
- package/grammars/c.json +3552 -0
- package/grammars/cadence.json +738 -0
- package/grammars/clarity.json +877 -0
- package/grammars/clojure.json +426 -0
- package/grammars/cmake.json +143 -0
- package/grammars/cobol.json +1124 -0
- package/grammars/codeql.json +1540 -0
- package/grammars/coffee.json +1311 -0
- package/grammars/cpp-macro.json +9498 -0
- package/grammars/cpp.json +16635 -0
- package/grammars/crystal.json +1866 -0
- package/grammars/csharp.json +5722 -0
- package/grammars/css.json +1860 -0
- package/grammars/csv.json +46 -0
- package/grammars/cue.json +1128 -0
- package/grammars/cypher.json +353 -0
- package/grammars/d.json +3185 -0
- package/grammars/dart.json +522 -0
- package/grammars/dax.json +185 -0
- package/grammars/diff.json +155 -0
- package/grammars/docker.json +97 -0
- package/grammars/dream-maker.json +640 -0
- package/grammars/elixir.json +1014 -0
- package/grammars/elm.json +751 -0
- package/grammars/erb.json +156 -0
- package/grammars/erlang.json +1757 -0
- package/grammars/fish.json +189 -0
- package/grammars/fsharp.json +1831 -0
- package/grammars/gdresource.json +290 -0
- package/grammars/gdscript.json +969 -0
- package/grammars/gdshader.json +405 -0
- package/grammars/gherkin.json +133 -0
- package/grammars/git-commit.json +85 -0
- package/grammars/git-rebase.json +56 -0
- package/grammars/glimmer-js.json +98 -0
- package/grammars/glimmer-ts.json +98 -0
- package/grammars/glsl.json +57 -0
- package/grammars/gnuplot.json +892 -0
- package/grammars/go.json +1012 -0
- package/grammars/graphql.json +1295 -0
- package/grammars/groovy.json +1378 -0
- package/grammars/hack.json +2650 -0
- package/grammars/haml.json +598 -0
- package/grammars/handlebars.json +848 -0
- package/grammars/haskell.json +2431 -0
- package/grammars/hcl.json +787 -0
- package/grammars/hjson.json +821 -0
- package/grammars/hlsl.json +212 -0
- package/grammars/html.json +93 -0
- package/grammars/imba.json +2696 -0
- package/grammars/ini.json +108 -0
- package/grammars/java.json +1885 -0
- package/grammars/javascript.json +5984 -0
- package/grammars/jinja-html.json +16 -0
- package/grammars/jinja.json +345 -0
- package/grammars/jison.json +715 -0
- package/grammars/jsdoc.json +21 -0
- package/grammars/json.json +208 -0
- package/grammars/json5.json +244 -0
- package/grammars/jsonc.json +208 -0
- package/grammars/jsonl.json +208 -0
- package/grammars/jsonnet.json +211 -0
- package/grammars/jssm.json +159 -0
- package/grammars/jsx.json +5984 -0
- package/grammars/julia.json +1061 -0
- package/grammars/kotlin.json +580 -0
- package/grammars/kusto.json +687 -0
- package/grammars/latex.json +2395 -0
- package/grammars/less.json +5012 -0
- package/grammars/liquid.json +990 -0
- package/grammars/lisp.json +121 -0
- package/grammars/logo.json +55 -0
- package/grammars/lua.json +956 -0
- package/grammars/make.json +629 -0
- package/grammars/markdown.json +3066 -0
- package/grammars/marko.json +1344 -0
- package/grammars/matlab.json +1131 -0
- package/grammars/mdc.json +571 -0
- package/grammars/mdx.json +5629 -0
- package/grammars/mermaid.json +1382 -0
- package/grammars/mojo.json +4153 -0
- package/grammars/narrat.json +227 -0
- package/grammars/nextflow.json +298 -0
- package/grammars/nginx.json +2121 -0
- package/grammars/nim.json +1522 -0
- package/grammars/nix.json +1200 -0
- package/grammars/nushell.json +1047 -0
- package/grammars/objective-c.json +3750 -0
- package/grammars/objective-cpp.json +7242 -0
- package/grammars/ocaml.json +2967 -0
- package/grammars/pascal.json +154 -0
- package/grammars/perl.json +2971 -0
- package/grammars/php.json +4024 -0
- package/grammars/plsql.json +241 -0
- package/grammars/postcss.json +377 -0
- package/grammars/powerquery.json +349 -0
- package/grammars/powershell.json +1024 -0
- package/grammars/prisma.json +443 -0
- package/grammars/prolog.json +298 -0
- package/grammars/proto.json +507 -0
- package/grammars/pug.json +1033 -0
- package/grammars/puppet.json +777 -0
- package/grammars/purescript.json +871 -0
- package/grammars/python.json +4208 -0
- package/grammars/r.json +637 -0
- package/grammars/raku.json +310 -0
- package/grammars/razor.json +1813 -0
- package/grammars/reg.json +136 -0
- package/grammars/rel.json +200 -0
- package/grammars/riscv.json +298 -0
- package/grammars/rst.json +734 -0
- package/grammars/ruby.json +2769 -0
- package/grammars/rust.json +1171 -0
- package/grammars/sas.json +302 -0
- package/grammars/sass.json +618 -0
- package/grammars/scala.json +1313 -0
- package/grammars/scheme.json +384 -0
- package/grammars/scss.json +1874 -0
- package/grammars/shaderlab.json +199 -0
- package/grammars/shellscript.json +2025 -0
- package/grammars/shellsession.json +33 -0
- package/grammars/smalltalk.json +235 -0
- package/grammars/solidity.json +1210 -0
- package/grammars/sparql.json +45 -0
- package/grammars/splunk.json +91 -0
- package/grammars/sql.json +631 -0
- package/grammars/ssh-config.json +88 -0
- package/grammars/stata.json +3050 -0
- package/grammars/stylus.json +1208 -0
- package/grammars/svelte.json +1171 -0
- package/grammars/swift.json +4203 -0
- package/grammars/system-verilog.json +1063 -0
- package/grammars/tasl.json +292 -0
- package/grammars/tcl.json +291 -0
- package/grammars/tex.json +281 -0
- package/grammars/toml.json +431 -0
- package/grammars/tsx.json +5984 -0
- package/grammars/turtle.json +261 -0
- package/grammars/twig.json +1394 -0
- package/grammars/typescript.json +5735 -0
- package/grammars/v.json +1001 -0
- package/grammars/vb.json +232 -0
- package/grammars/verilog.json +305 -0
- package/grammars/vhdl.json +1484 -0
- package/grammars/viml.json +445 -0
- package/grammars/vue-html.json +559 -0
- package/grammars/vue.json +1237 -0
- package/grammars/vyper.json +5415 -0
- package/grammars/wasm.json +831 -0
- package/grammars/wenyan.json +129 -0
- package/grammars/wgsl.json +391 -0
- package/grammars/wolfram.json +2370 -0
- package/grammars/xml.json +382 -0
- package/grammars/xsl.json +89 -0
- package/grammars/yaml.json +616 -0
- package/grammars/zenscript.json +257 -0
- package/grammars/zig.json +312 -0
- package/index.d.ts +18 -0
- package/index.js +2165 -0
- package/package.json +46 -0
|
@@ -0,0 +1,1171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"displayName": "Rust",
|
|
3
|
+
"name": "rust",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{
|
|
6
|
+
"begin": "(<)(\\[)",
|
|
7
|
+
"beginCaptures": {
|
|
8
|
+
"1": {
|
|
9
|
+
"name": "punctuation.brackets.angle.rust"
|
|
10
|
+
},
|
|
11
|
+
"2": {
|
|
12
|
+
"name": "punctuation.brackets.square.rust"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"comment": "boxed slice literal",
|
|
16
|
+
"end": ">",
|
|
17
|
+
"endCaptures": {
|
|
18
|
+
"0": {
|
|
19
|
+
"name": "punctuation.brackets.angle.rust"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"patterns": [
|
|
23
|
+
{
|
|
24
|
+
"include": "#block-comments"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"include": "#comments"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"include": "#gtypes"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"include": "#lvariables"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"include": "#lifetimes"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"include": "#punctuation"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"include": "#types"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"captures": {
|
|
48
|
+
"1": {
|
|
49
|
+
"name": "keyword.operator.macro.dollar.rust"
|
|
50
|
+
},
|
|
51
|
+
"3": {
|
|
52
|
+
"name": "keyword.other.crate.rust"
|
|
53
|
+
},
|
|
54
|
+
"4": {
|
|
55
|
+
"name": "entity.name.type.metavariable.rust"
|
|
56
|
+
},
|
|
57
|
+
"6": {
|
|
58
|
+
"name": "keyword.operator.key-value.rust"
|
|
59
|
+
},
|
|
60
|
+
"7": {
|
|
61
|
+
"name": "variable.other.metavariable.specifier.rust"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"comment": "macro type metavariables",
|
|
65
|
+
"match": "(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?",
|
|
66
|
+
"name": "meta.macro.metavariable.type.rust",
|
|
67
|
+
"patterns": [
|
|
68
|
+
{
|
|
69
|
+
"include": "#keywords"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"captures": {
|
|
75
|
+
"1": {
|
|
76
|
+
"name": "keyword.operator.macro.dollar.rust"
|
|
77
|
+
},
|
|
78
|
+
"2": {
|
|
79
|
+
"name": "variable.other.metavariable.name.rust"
|
|
80
|
+
},
|
|
81
|
+
"4": {
|
|
82
|
+
"name": "keyword.operator.key-value.rust"
|
|
83
|
+
},
|
|
84
|
+
"5": {
|
|
85
|
+
"name": "variable.other.metavariable.specifier.rust"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"comment": "macro metavariables",
|
|
89
|
+
"match": "(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?",
|
|
90
|
+
"name": "meta.macro.metavariable.rust",
|
|
91
|
+
"patterns": [
|
|
92
|
+
{
|
|
93
|
+
"include": "#keywords"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"captures": {
|
|
99
|
+
"1": {
|
|
100
|
+
"name": "entity.name.function.macro.rules.rust"
|
|
101
|
+
},
|
|
102
|
+
"3": {
|
|
103
|
+
"name": "entity.name.function.macro.rust"
|
|
104
|
+
},
|
|
105
|
+
"4": {
|
|
106
|
+
"name": "entity.name.type.macro.rust"
|
|
107
|
+
},
|
|
108
|
+
"5": {
|
|
109
|
+
"name": "punctuation.brackets.curly.rust"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"comment": "macro rules",
|
|
113
|
+
"match": "\\b(macro_rules!)\\s+(([a-z0-9_]+)|([A-Z][a-z0-9_]*))\\s+(\\{)",
|
|
114
|
+
"name": "meta.macro.rules.rust"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"captures": {
|
|
118
|
+
"1": {
|
|
119
|
+
"name": "storage.type.rust"
|
|
120
|
+
},
|
|
121
|
+
"2": {
|
|
122
|
+
"name": "entity.name.module.rust"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"comment": "modules",
|
|
126
|
+
"match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"begin": "\\b(extern)\\s+(crate)",
|
|
130
|
+
"beginCaptures": {
|
|
131
|
+
"1": {
|
|
132
|
+
"name": "storage.type.rust"
|
|
133
|
+
},
|
|
134
|
+
"2": {
|
|
135
|
+
"name": "keyword.other.crate.rust"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"comment": "external crate imports",
|
|
139
|
+
"end": ";",
|
|
140
|
+
"endCaptures": {
|
|
141
|
+
"0": {
|
|
142
|
+
"name": "punctuation.semi.rust"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"name": "meta.import.rust",
|
|
146
|
+
"patterns": [
|
|
147
|
+
{
|
|
148
|
+
"include": "#block-comments"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"include": "#comments"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"include": "#keywords"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"include": "#punctuation"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"begin": "\\b(use)\\s",
|
|
163
|
+
"beginCaptures": {
|
|
164
|
+
"1": {
|
|
165
|
+
"name": "keyword.other.rust"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"comment": "use statements",
|
|
169
|
+
"end": ";",
|
|
170
|
+
"endCaptures": {
|
|
171
|
+
"0": {
|
|
172
|
+
"name": "punctuation.semi.rust"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"name": "meta.use.rust",
|
|
176
|
+
"patterns": [
|
|
177
|
+
{
|
|
178
|
+
"include": "#block-comments"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"include": "#comments"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"include": "#keywords"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"include": "#namespaces"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"include": "#punctuation"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"include": "#types"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"include": "#lvariables"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"include": "#block-comments"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"include": "#comments"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"include": "#attributes"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"include": "#lvariables"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"include": "#constants"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"include": "#gtypes"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"include": "#functions"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"include": "#types"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"include": "#keywords"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"include": "#lifetimes"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"include": "#macros"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"include": "#namespaces"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"include": "#punctuation"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"include": "#strings"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"include": "#variables"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"repository": {
|
|
247
|
+
"attributes": {
|
|
248
|
+
"begin": "(#)(\\!?)(\\[)",
|
|
249
|
+
"beginCaptures": {
|
|
250
|
+
"1": {
|
|
251
|
+
"name": "punctuation.definition.attribute.rust"
|
|
252
|
+
},
|
|
253
|
+
"3": {
|
|
254
|
+
"name": "punctuation.brackets.attribute.rust"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"comment": "attributes",
|
|
258
|
+
"end": "\\]",
|
|
259
|
+
"endCaptures": {
|
|
260
|
+
"0": {
|
|
261
|
+
"name": "punctuation.brackets.attribute.rust"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"name": "meta.attribute.rust",
|
|
265
|
+
"patterns": [
|
|
266
|
+
{
|
|
267
|
+
"include": "#block-comments"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"include": "#comments"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"include": "#keywords"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"include": "#lifetimes"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"include": "#punctuation"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"include": "#strings"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"include": "#gtypes"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"include": "#types"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
"block-comments": {
|
|
293
|
+
"patterns": [
|
|
294
|
+
{
|
|
295
|
+
"comment": "empty block comments",
|
|
296
|
+
"match": "/\\*\\*/",
|
|
297
|
+
"name": "comment.block.rust"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"begin": "/\\*\\*",
|
|
301
|
+
"comment": "block documentation comments",
|
|
302
|
+
"end": "\\*/",
|
|
303
|
+
"name": "comment.block.documentation.rust",
|
|
304
|
+
"patterns": [
|
|
305
|
+
{
|
|
306
|
+
"include": "#block-comments"
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"begin": "/\\*(?!\\*)",
|
|
312
|
+
"comment": "block comments",
|
|
313
|
+
"end": "\\*/",
|
|
314
|
+
"name": "comment.block.rust",
|
|
315
|
+
"patterns": [
|
|
316
|
+
{
|
|
317
|
+
"include": "#block-comments"
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
"comments": {
|
|
324
|
+
"patterns": [
|
|
325
|
+
{
|
|
326
|
+
"comment": "documentation comments",
|
|
327
|
+
"match": "^\\s*///.*",
|
|
328
|
+
"name": "comment.line.documentation.rust"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"comment": "line comments",
|
|
332
|
+
"match": "\\s*//.*",
|
|
333
|
+
"name": "comment.line.double-slash.rust"
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
"constants": {
|
|
338
|
+
"patterns": [
|
|
339
|
+
{
|
|
340
|
+
"comment": "ALL CAPS constants",
|
|
341
|
+
"match": "\\b[A-Z]{2}[A-Z0-9_]*\\b",
|
|
342
|
+
"name": "constant.other.caps.rust"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"captures": {
|
|
346
|
+
"1": {
|
|
347
|
+
"name": "storage.type.rust"
|
|
348
|
+
},
|
|
349
|
+
"2": {
|
|
350
|
+
"name": "constant.other.caps.rust"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"comment": "constant declarations",
|
|
354
|
+
"match": "\\b(const)\\s+([A-Z][A-Za-z0-9_]*)\\b"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"captures": {
|
|
358
|
+
"1": {
|
|
359
|
+
"name": "punctuation.separator.dot.decimal.rust"
|
|
360
|
+
},
|
|
361
|
+
"2": {
|
|
362
|
+
"name": "keyword.operator.exponent.rust"
|
|
363
|
+
},
|
|
364
|
+
"3": {
|
|
365
|
+
"name": "keyword.operator.exponent.sign.rust"
|
|
366
|
+
},
|
|
367
|
+
"4": {
|
|
368
|
+
"name": "constant.numeric.decimal.exponent.mantissa.rust"
|
|
369
|
+
},
|
|
370
|
+
"5": {
|
|
371
|
+
"name": "entity.name.type.numeric.rust"
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
"comment": "decimal integers and floats",
|
|
375
|
+
"match": "\\b\\d[\\d_]*(\\.?)[\\d_]*(?:(E|e)([+-]?)([\\d_]+))?(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
|
|
376
|
+
"name": "constant.numeric.decimal.rust"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"captures": {
|
|
380
|
+
"1": {
|
|
381
|
+
"name": "entity.name.type.numeric.rust"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
"comment": "hexadecimal integers",
|
|
385
|
+
"match": "\\b0x[\\da-fA-F_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
|
|
386
|
+
"name": "constant.numeric.hex.rust"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"captures": {
|
|
390
|
+
"1": {
|
|
391
|
+
"name": "entity.name.type.numeric.rust"
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"comment": "octal integers",
|
|
395
|
+
"match": "\\b0o[0-7_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
|
|
396
|
+
"name": "constant.numeric.oct.rust"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"captures": {
|
|
400
|
+
"1": {
|
|
401
|
+
"name": "entity.name.type.numeric.rust"
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
"comment": "binary integers",
|
|
405
|
+
"match": "\\b0b[01_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
|
|
406
|
+
"name": "constant.numeric.bin.rust"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"comment": "booleans",
|
|
410
|
+
"match": "\\b(true|false)\\b",
|
|
411
|
+
"name": "constant.language.bool.rust"
|
|
412
|
+
}
|
|
413
|
+
]
|
|
414
|
+
},
|
|
415
|
+
"escapes": {
|
|
416
|
+
"captures": {
|
|
417
|
+
"1": {
|
|
418
|
+
"name": "constant.character.escape.backslash.rust"
|
|
419
|
+
},
|
|
420
|
+
"2": {
|
|
421
|
+
"name": "constant.character.escape.bit.rust"
|
|
422
|
+
},
|
|
423
|
+
"3": {
|
|
424
|
+
"name": "constant.character.escape.unicode.rust"
|
|
425
|
+
},
|
|
426
|
+
"4": {
|
|
427
|
+
"name": "constant.character.escape.unicode.punctuation.rust"
|
|
428
|
+
},
|
|
429
|
+
"5": {
|
|
430
|
+
"name": "constant.character.escape.unicode.punctuation.rust"
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"comment": "escapes: ASCII, byte, Unicode, quote, regex",
|
|
434
|
+
"match": "(\\\\)(?:(?:(x[0-7][\\da-fA-F])|(u(\\{)[\\da-fA-F]{4,6}(\\}))|.))",
|
|
435
|
+
"name": "constant.character.escape.rust"
|
|
436
|
+
},
|
|
437
|
+
"functions": {
|
|
438
|
+
"patterns": [
|
|
439
|
+
{
|
|
440
|
+
"captures": {
|
|
441
|
+
"1": {
|
|
442
|
+
"name": "keyword.other.rust"
|
|
443
|
+
},
|
|
444
|
+
"2": {
|
|
445
|
+
"name": "punctuation.brackets.round.rust"
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
"comment": "pub as a function",
|
|
449
|
+
"match": "\\b(pub)(\\()"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"begin": "\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))",
|
|
453
|
+
"beginCaptures": {
|
|
454
|
+
"1": {
|
|
455
|
+
"name": "keyword.other.fn.rust"
|
|
456
|
+
},
|
|
457
|
+
"2": {
|
|
458
|
+
"name": "entity.name.function.rust"
|
|
459
|
+
},
|
|
460
|
+
"4": {
|
|
461
|
+
"name": "punctuation.brackets.round.rust"
|
|
462
|
+
},
|
|
463
|
+
"5": {
|
|
464
|
+
"name": "punctuation.brackets.angle.rust"
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
"comment": "function definition",
|
|
468
|
+
"end": "\\{|;",
|
|
469
|
+
"endCaptures": {
|
|
470
|
+
"0": {
|
|
471
|
+
"name": "punctuation.brackets.curly.rust"
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
"name": "meta.function.definition.rust",
|
|
475
|
+
"patterns": [
|
|
476
|
+
{
|
|
477
|
+
"include": "#block-comments"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"include": "#comments"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"include": "#keywords"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"include": "#lvariables"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"include": "#constants"
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"include": "#gtypes"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"include": "#functions"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"include": "#lifetimes"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"include": "#macros"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"include": "#namespaces"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"include": "#punctuation"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"include": "#strings"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"include": "#types"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"include": "#variables"
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()",
|
|
522
|
+
"beginCaptures": {
|
|
523
|
+
"1": {
|
|
524
|
+
"name": "entity.name.function.rust"
|
|
525
|
+
},
|
|
526
|
+
"2": {
|
|
527
|
+
"name": "punctuation.brackets.round.rust"
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
"comment": "function/method calls, chaining",
|
|
531
|
+
"end": "\\)",
|
|
532
|
+
"endCaptures": {
|
|
533
|
+
"0": {
|
|
534
|
+
"name": "punctuation.brackets.round.rust"
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
"name": "meta.function.call.rust",
|
|
538
|
+
"patterns": [
|
|
539
|
+
{
|
|
540
|
+
"include": "#block-comments"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"include": "#comments"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"include": "#attributes"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"include": "#keywords"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"include": "#lvariables"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"include": "#constants"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"include": "#gtypes"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"include": "#functions"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"include": "#lifetimes"
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"include": "#macros"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"include": "#namespaces"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"include": "#punctuation"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"include": "#strings"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"include": "#types"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"include": "#variables"
|
|
583
|
+
}
|
|
584
|
+
]
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(?=::<.*>\\()",
|
|
588
|
+
"beginCaptures": {
|
|
589
|
+
"1": {
|
|
590
|
+
"name": "entity.name.function.rust"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
"comment": "function/method calls with turbofish",
|
|
594
|
+
"end": "\\)",
|
|
595
|
+
"endCaptures": {
|
|
596
|
+
"0": {
|
|
597
|
+
"name": "punctuation.brackets.round.rust"
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
"name": "meta.function.call.rust",
|
|
601
|
+
"patterns": [
|
|
602
|
+
{
|
|
603
|
+
"include": "#block-comments"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"include": "#comments"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"include": "#attributes"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"include": "#keywords"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"include": "#lvariables"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"include": "#constants"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
"include": "#gtypes"
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"include": "#functions"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
"include": "#lifetimes"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"include": "#macros"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"include": "#namespaces"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"include": "#punctuation"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"include": "#strings"
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
"include": "#types"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"include": "#variables"
|
|
646
|
+
}
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
]
|
|
650
|
+
},
|
|
651
|
+
"gtypes": {
|
|
652
|
+
"patterns": [
|
|
653
|
+
{
|
|
654
|
+
"comment": "option types",
|
|
655
|
+
"match": "\\b(Some|None)\\b",
|
|
656
|
+
"name": "entity.name.type.option.rust"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"comment": "result types",
|
|
660
|
+
"match": "\\b(Ok|Err)\\b",
|
|
661
|
+
"name": "entity.name.type.result.rust"
|
|
662
|
+
}
|
|
663
|
+
]
|
|
664
|
+
},
|
|
665
|
+
"interpolations": {
|
|
666
|
+
"captures": {
|
|
667
|
+
"1": {
|
|
668
|
+
"name": "punctuation.definition.interpolation.rust"
|
|
669
|
+
},
|
|
670
|
+
"2": {
|
|
671
|
+
"name": "punctuation.definition.interpolation.rust"
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
"comment": "curly brace interpolations",
|
|
675
|
+
"match": "({)[^\"{}]*(})",
|
|
676
|
+
"name": "meta.interpolation.rust"
|
|
677
|
+
},
|
|
678
|
+
"keywords": {
|
|
679
|
+
"patterns": [
|
|
680
|
+
{
|
|
681
|
+
"comment": "control flow keywords",
|
|
682
|
+
"match": "\\b(await|break|continue|do|else|for|if|loop|match|return|try|while|yield)\\b",
|
|
683
|
+
"name": "keyword.control.rust"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"comment": "storage keywords",
|
|
687
|
+
"match": "\\b(extern|let|macro|mod)\\b",
|
|
688
|
+
"name": "keyword.other.rust storage.type.rust"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"comment": "const keyword",
|
|
692
|
+
"match": "\\b(const)\\b",
|
|
693
|
+
"name": "storage.modifier.rust"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"comment": "type keyword",
|
|
697
|
+
"match": "\\b(type)\\b",
|
|
698
|
+
"name": "keyword.declaration.type.rust storage.type.rust"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"comment": "enum keyword",
|
|
702
|
+
"match": "\\b(enum)\\b",
|
|
703
|
+
"name": "keyword.declaration.enum.rust storage.type.rust"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"comment": "trait keyword",
|
|
707
|
+
"match": "\\b(trait)\\b",
|
|
708
|
+
"name": "keyword.declaration.trait.rust storage.type.rust"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
"comment": "struct keyword",
|
|
712
|
+
"match": "\\b(struct)\\b",
|
|
713
|
+
"name": "keyword.declaration.struct.rust storage.type.rust"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"comment": "storage modifiers",
|
|
717
|
+
"match": "\\b(abstract|static)\\b",
|
|
718
|
+
"name": "storage.modifier.rust"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"comment": "other keywords",
|
|
722
|
+
"match": "\\b(as|async|become|box|dyn|move|final|impl|in|override|priv|pub|ref|typeof|union|unsafe|unsized|use|virtual|where)\\b",
|
|
723
|
+
"name": "keyword.other.rust"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"comment": "fn",
|
|
727
|
+
"match": "\\bfn\\b",
|
|
728
|
+
"name": "keyword.other.fn.rust"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"comment": "crate",
|
|
732
|
+
"match": "\\bcrate\\b",
|
|
733
|
+
"name": "keyword.other.crate.rust"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
"comment": "mut",
|
|
737
|
+
"match": "\\bmut\\b",
|
|
738
|
+
"name": "storage.modifier.mut.rust"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"comment": "logical operators",
|
|
742
|
+
"match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)",
|
|
743
|
+
"name": "keyword.operator.logical.rust"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"comment": "logical AND, borrow references",
|
|
747
|
+
"match": "&(?![&=])",
|
|
748
|
+
"name": "keyword.operator.borrow.and.rust"
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"comment": "assignment operators",
|
|
752
|
+
"match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)",
|
|
753
|
+
"name": "keyword.operator.assignment.rust"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"comment": "single equal",
|
|
757
|
+
"match": "(?<![<>])=(?!=|>)",
|
|
758
|
+
"name": "keyword.operator.assignment.equal.rust"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"comment": "comparison operators",
|
|
762
|
+
"match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)",
|
|
763
|
+
"name": "keyword.operator.comparison.rust"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"comment": "math operators",
|
|
767
|
+
"match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))",
|
|
768
|
+
"name": "keyword.operator.math.rust"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
"captures": {
|
|
772
|
+
"1": {
|
|
773
|
+
"name": "punctuation.brackets.round.rust"
|
|
774
|
+
},
|
|
775
|
+
"2": {
|
|
776
|
+
"name": "punctuation.brackets.square.rust"
|
|
777
|
+
},
|
|
778
|
+
"3": {
|
|
779
|
+
"name": "punctuation.brackets.curly.rust"
|
|
780
|
+
},
|
|
781
|
+
"4": {
|
|
782
|
+
"name": "keyword.operator.comparison.rust"
|
|
783
|
+
},
|
|
784
|
+
"5": {
|
|
785
|
+
"name": "punctuation.brackets.round.rust"
|
|
786
|
+
},
|
|
787
|
+
"6": {
|
|
788
|
+
"name": "punctuation.brackets.square.rust"
|
|
789
|
+
},
|
|
790
|
+
"7": {
|
|
791
|
+
"name": "punctuation.brackets.curly.rust"
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
"comment": "less than, greater than (special case)",
|
|
795
|
+
"match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"comment": "namespace operator",
|
|
799
|
+
"match": "::",
|
|
800
|
+
"name": "keyword.operator.namespace.rust"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"captures": {
|
|
804
|
+
"1": {
|
|
805
|
+
"name": "keyword.operator.dereference.rust"
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
"comment": "dereference asterisk",
|
|
809
|
+
"match": "(\\*)(?=\\w+)"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"comment": "subpattern binding",
|
|
813
|
+
"match": "@",
|
|
814
|
+
"name": "keyword.operator.subpattern.rust"
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"comment": "dot access",
|
|
818
|
+
"match": "\\.(?!\\.)",
|
|
819
|
+
"name": "keyword.operator.access.dot.rust"
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
"comment": "ranges, range patterns",
|
|
823
|
+
"match": "\\.{2}(=|\\.)?",
|
|
824
|
+
"name": "keyword.operator.range.rust"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
"comment": "colon",
|
|
828
|
+
"match": ":(?!:)",
|
|
829
|
+
"name": "keyword.operator.key-value.rust"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"comment": "dashrocket, skinny arrow",
|
|
833
|
+
"match": "->",
|
|
834
|
+
"name": "keyword.operator.arrow.skinny.rust"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
"comment": "hashrocket, fat arrow",
|
|
838
|
+
"match": "=>",
|
|
839
|
+
"name": "keyword.operator.arrow.fat.rust"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"comment": "dollar macros",
|
|
843
|
+
"match": "\\$",
|
|
844
|
+
"name": "keyword.operator.macro.dollar.rust"
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"comment": "question mark operator, questionably sized, macro kleene matcher",
|
|
848
|
+
"match": "\\?",
|
|
849
|
+
"name": "keyword.operator.question.rust"
|
|
850
|
+
}
|
|
851
|
+
]
|
|
852
|
+
},
|
|
853
|
+
"lifetimes": {
|
|
854
|
+
"patterns": [
|
|
855
|
+
{
|
|
856
|
+
"captures": {
|
|
857
|
+
"1": {
|
|
858
|
+
"name": "punctuation.definition.lifetime.rust"
|
|
859
|
+
},
|
|
860
|
+
"2": {
|
|
861
|
+
"name": "entity.name.type.lifetime.rust"
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
"comment": "named lifetime parameters",
|
|
865
|
+
"match": "(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b"
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"captures": {
|
|
869
|
+
"1": {
|
|
870
|
+
"name": "keyword.operator.borrow.rust"
|
|
871
|
+
},
|
|
872
|
+
"2": {
|
|
873
|
+
"name": "punctuation.definition.lifetime.rust"
|
|
874
|
+
},
|
|
875
|
+
"3": {
|
|
876
|
+
"name": "entity.name.type.lifetime.rust"
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
"comment": "borrowing references to named lifetimes",
|
|
880
|
+
"match": "(\\&)(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b"
|
|
881
|
+
}
|
|
882
|
+
]
|
|
883
|
+
},
|
|
884
|
+
"lvariables": {
|
|
885
|
+
"patterns": [
|
|
886
|
+
{
|
|
887
|
+
"comment": "self",
|
|
888
|
+
"match": "\\b[Ss]elf\\b",
|
|
889
|
+
"name": "variable.language.self.rust"
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
"comment": "super",
|
|
893
|
+
"match": "\\bsuper\\b",
|
|
894
|
+
"name": "variable.language.super.rust"
|
|
895
|
+
}
|
|
896
|
+
]
|
|
897
|
+
},
|
|
898
|
+
"macros": {
|
|
899
|
+
"patterns": [
|
|
900
|
+
{
|
|
901
|
+
"captures": {
|
|
902
|
+
"2": {
|
|
903
|
+
"name": "entity.name.function.macro.rust"
|
|
904
|
+
},
|
|
905
|
+
"3": {
|
|
906
|
+
"name": "entity.name.type.macro.rust"
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
"comment": "macros",
|
|
910
|
+
"match": "(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",
|
|
911
|
+
"name": "meta.macro.rust"
|
|
912
|
+
}
|
|
913
|
+
]
|
|
914
|
+
},
|
|
915
|
+
"namespaces": {
|
|
916
|
+
"patterns": [
|
|
917
|
+
{
|
|
918
|
+
"captures": {
|
|
919
|
+
"1": {
|
|
920
|
+
"name": "entity.name.namespace.rust"
|
|
921
|
+
},
|
|
922
|
+
"2": {
|
|
923
|
+
"name": "keyword.operator.namespace.rust"
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
"comment": "namespace (non-type, non-function path segment)",
|
|
927
|
+
"match": "(?<![A-Za-z0-9_])([A-Za-z0-9_]+)((?<!super|self)::)"
|
|
928
|
+
}
|
|
929
|
+
]
|
|
930
|
+
},
|
|
931
|
+
"punctuation": {
|
|
932
|
+
"patterns": [
|
|
933
|
+
{
|
|
934
|
+
"comment": "comma",
|
|
935
|
+
"match": ",",
|
|
936
|
+
"name": "punctuation.comma.rust"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
"comment": "curly braces",
|
|
940
|
+
"match": "[{}]",
|
|
941
|
+
"name": "punctuation.brackets.curly.rust"
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
"comment": "parentheses, round brackets",
|
|
945
|
+
"match": "[()]",
|
|
946
|
+
"name": "punctuation.brackets.round.rust"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
"comment": "semicolon",
|
|
950
|
+
"match": ";",
|
|
951
|
+
"name": "punctuation.semi.rust"
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"comment": "square brackets",
|
|
955
|
+
"match": "[\\[\\]]",
|
|
956
|
+
"name": "punctuation.brackets.square.rust"
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
"comment": "angle brackets",
|
|
960
|
+
"match": "(?<!=)[<>]",
|
|
961
|
+
"name": "punctuation.brackets.angle.rust"
|
|
962
|
+
}
|
|
963
|
+
]
|
|
964
|
+
},
|
|
965
|
+
"strings": {
|
|
966
|
+
"patterns": [
|
|
967
|
+
{
|
|
968
|
+
"begin": "(b?)(\")",
|
|
969
|
+
"beginCaptures": {
|
|
970
|
+
"1": {
|
|
971
|
+
"name": "string.quoted.byte.raw.rust"
|
|
972
|
+
},
|
|
973
|
+
"2": {
|
|
974
|
+
"name": "punctuation.definition.string.rust"
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
"comment": "double-quoted strings and byte strings",
|
|
978
|
+
"end": "\"",
|
|
979
|
+
"endCaptures": {
|
|
980
|
+
"0": {
|
|
981
|
+
"name": "punctuation.definition.string.rust"
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
"name": "string.quoted.double.rust",
|
|
985
|
+
"patterns": [
|
|
986
|
+
{
|
|
987
|
+
"include": "#escapes"
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
"include": "#interpolations"
|
|
991
|
+
}
|
|
992
|
+
]
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"begin": "(b?r)(#*)(\")",
|
|
996
|
+
"beginCaptures": {
|
|
997
|
+
"1": {
|
|
998
|
+
"name": "string.quoted.byte.raw.rust"
|
|
999
|
+
},
|
|
1000
|
+
"2": {
|
|
1001
|
+
"name": "punctuation.definition.string.raw.rust"
|
|
1002
|
+
},
|
|
1003
|
+
"3": {
|
|
1004
|
+
"name": "punctuation.definition.string.rust"
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
"comment": "double-quoted raw strings and raw byte strings",
|
|
1008
|
+
"end": "(\")(\\2)",
|
|
1009
|
+
"endCaptures": {
|
|
1010
|
+
"1": {
|
|
1011
|
+
"name": "punctuation.definition.string.rust"
|
|
1012
|
+
},
|
|
1013
|
+
"2": {
|
|
1014
|
+
"name": "punctuation.definition.string.raw.rust"
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
"name": "string.quoted.double.rust"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
"begin": "(b)?(')",
|
|
1021
|
+
"beginCaptures": {
|
|
1022
|
+
"1": {
|
|
1023
|
+
"name": "string.quoted.byte.raw.rust"
|
|
1024
|
+
},
|
|
1025
|
+
"2": {
|
|
1026
|
+
"name": "punctuation.definition.char.rust"
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
"comment": "characters and bytes",
|
|
1030
|
+
"end": "'",
|
|
1031
|
+
"endCaptures": {
|
|
1032
|
+
"0": {
|
|
1033
|
+
"name": "punctuation.definition.char.rust"
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
"name": "string.quoted.single.char.rust",
|
|
1037
|
+
"patterns": [
|
|
1038
|
+
{
|
|
1039
|
+
"include": "#escapes"
|
|
1040
|
+
}
|
|
1041
|
+
]
|
|
1042
|
+
}
|
|
1043
|
+
]
|
|
1044
|
+
},
|
|
1045
|
+
"types": {
|
|
1046
|
+
"patterns": [
|
|
1047
|
+
{
|
|
1048
|
+
"captures": {
|
|
1049
|
+
"1": {
|
|
1050
|
+
"name": "entity.name.type.numeric.rust"
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
"comment": "numeric types",
|
|
1054
|
+
"match": "(?<![A-Za-z])(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)\\b"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
"begin": "\\b(_?[A-Z][A-Za-z0-9_]*)(<)",
|
|
1058
|
+
"beginCaptures": {
|
|
1059
|
+
"1": {
|
|
1060
|
+
"name": "entity.name.type.rust"
|
|
1061
|
+
},
|
|
1062
|
+
"2": {
|
|
1063
|
+
"name": "punctuation.brackets.angle.rust"
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
"comment": "parameterized types",
|
|
1067
|
+
"end": ">",
|
|
1068
|
+
"endCaptures": {
|
|
1069
|
+
"0": {
|
|
1070
|
+
"name": "punctuation.brackets.angle.rust"
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
"patterns": [
|
|
1074
|
+
{
|
|
1075
|
+
"include": "#block-comments"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"include": "#comments"
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
"include": "#keywords"
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
"include": "#lvariables"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"include": "#lifetimes"
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
"include": "#punctuation"
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
"include": "#types"
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
"include": "#variables"
|
|
1097
|
+
}
|
|
1098
|
+
]
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
"comment": "primitive types",
|
|
1102
|
+
"match": "\\b(bool|char|str)\\b",
|
|
1103
|
+
"name": "entity.name.type.primitive.rust"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
"captures": {
|
|
1107
|
+
"1": {
|
|
1108
|
+
"name": "keyword.declaration.trait.rust storage.type.rust"
|
|
1109
|
+
},
|
|
1110
|
+
"2": {
|
|
1111
|
+
"name": "entity.name.type.trait.rust"
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
"comment": "trait declarations",
|
|
1115
|
+
"match": "\\b(trait)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
"captures": {
|
|
1119
|
+
"1": {
|
|
1120
|
+
"name": "keyword.declaration.struct.rust storage.type.rust"
|
|
1121
|
+
},
|
|
1122
|
+
"2": {
|
|
1123
|
+
"name": "entity.name.type.struct.rust"
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
"comment": "struct declarations",
|
|
1127
|
+
"match": "\\b(struct)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
"captures": {
|
|
1131
|
+
"1": {
|
|
1132
|
+
"name": "keyword.declaration.enum.rust storage.type.rust"
|
|
1133
|
+
},
|
|
1134
|
+
"2": {
|
|
1135
|
+
"name": "entity.name.type.enum.rust"
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
"comment": "enum declarations",
|
|
1139
|
+
"match": "\\b(enum)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
"captures": {
|
|
1143
|
+
"1": {
|
|
1144
|
+
"name": "keyword.declaration.type.rust storage.type.rust"
|
|
1145
|
+
},
|
|
1146
|
+
"2": {
|
|
1147
|
+
"name": "entity.name.type.declaration.rust"
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
"comment": "type declarations",
|
|
1151
|
+
"match": "\\b(type)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
"comment": "types",
|
|
1155
|
+
"match": "\\b_?[A-Z][A-Za-z0-9_]*\\b(?!!)",
|
|
1156
|
+
"name": "entity.name.type.rust"
|
|
1157
|
+
}
|
|
1158
|
+
]
|
|
1159
|
+
},
|
|
1160
|
+
"variables": {
|
|
1161
|
+
"patterns": [
|
|
1162
|
+
{
|
|
1163
|
+
"comment": "variables",
|
|
1164
|
+
"match": "\\b(?<!(?<!\\.)\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b",
|
|
1165
|
+
"name": "variable.other.rust"
|
|
1166
|
+
}
|
|
1167
|
+
]
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
"scopeName": "source.rust"
|
|
1171
|
+
}
|