diff options
author | George Fraser <[email protected]> | 2020-05-09 20:24:59 +0100 |
---|---|---|
committer | George Fraser <[email protected]> | 2020-05-10 21:07:28 +0100 |
commit | a91d15c80c337dd1afb0eddd5eb048010d098ac7 (patch) | |
tree | 0e3ea6003923f4da2ba644267891eaac452a3911 /editors | |
parent | cff0d6b6e667832a3822d84718dd0e1d44272cf7 (diff) |
Import built-in textmate grammar, with no changes
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/.vscodeignore | 1 | ||||
-rw-r--r-- | editors/code/package.json | 5 | ||||
-rw-r--r-- | editors/code/rust.tmGrammar.json | 692 |
3 files changed, 698 insertions, 0 deletions
diff --git a/editors/code/.vscodeignore b/editors/code/.vscodeignore index ac411f8e2..257b744bf 100644 --- a/editors/code/.vscodeignore +++ b/editors/code/.vscodeignore | |||
@@ -3,5 +3,6 @@ | |||
3 | !package.json | 3 | !package.json |
4 | !package-lock.json | 4 | !package-lock.json |
5 | !ra_syntax_tree.tmGrammar.json | 5 | !ra_syntax_tree.tmGrammar.json |
6 | !rust.tmGrammar.json | ||
6 | !icon.png | 7 | !icon.png |
7 | !README.md | 8 | !README.md |
diff --git a/editors/code/package.json b/editors/code/package.json index a86d0ad0d..40ae3ab9e 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -479,6 +479,11 @@ | |||
479 | ], | 479 | ], |
480 | "grammars": [ | 480 | "grammars": [ |
481 | { | 481 | { |
482 | "language": "rust", | ||
483 | "scopeName": "source.rust", | ||
484 | "path": "rust.tmGrammar.json" | ||
485 | }, | ||
486 | { | ||
482 | "language": "ra_syntax_tree", | 487 | "language": "ra_syntax_tree", |
483 | "scopeName": "source.ra_syntax_tree", | 488 | "scopeName": "source.ra_syntax_tree", |
484 | "path": "ra_syntax_tree.tmGrammar.json" | 489 | "path": "ra_syntax_tree.tmGrammar.json" |
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json new file mode 100644 index 000000000..784bd8c9a --- /dev/null +++ b/editors/code/rust.tmGrammar.json | |||
@@ -0,0 +1,692 @@ | |||
1 | { | ||
2 | "information_for_contributors": [ | ||
3 | "This file has been converted from https://github.com/zargony/atom-language-rust/blob/master/grammars/rust.cson", | ||
4 | "If you want to provide a fix or improvement, please create a pull request against the original repository.", | ||
5 | "Once accepted there, we are happy to receive an update request." | ||
6 | ], | ||
7 | "version": "https://github.com/zargony/atom-language-rust/commit/7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f", | ||
8 | "name": "Rust", | ||
9 | "scopeName": "source.rust", | ||
10 | "patterns": [ | ||
11 | { | ||
12 | "comment": "Implementation", | ||
13 | "begin": "\\b(impl)\\b", | ||
14 | "end": "\\{", | ||
15 | "beginCaptures": { | ||
16 | "1": { | ||
17 | "name": "storage.type.rust" | ||
18 | } | ||
19 | }, | ||
20 | "patterns": [ | ||
21 | { | ||
22 | "include": "#block_comment" | ||
23 | }, | ||
24 | { | ||
25 | "include": "#line_comment" | ||
26 | }, | ||
27 | { | ||
28 | "include": "#sigils" | ||
29 | }, | ||
30 | { | ||
31 | "include": "#mut" | ||
32 | }, | ||
33 | { | ||
34 | "include": "#dyn" | ||
35 | }, | ||
36 | { | ||
37 | "include": "#ref_lifetime" | ||
38 | }, | ||
39 | { | ||
40 | "include": "#core_types" | ||
41 | }, | ||
42 | { | ||
43 | "include": "#core_marker" | ||
44 | }, | ||
45 | { | ||
46 | "include": "#core_traits" | ||
47 | }, | ||
48 | { | ||
49 | "include": "#std_types" | ||
50 | }, | ||
51 | { | ||
52 | "include": "#std_traits" | ||
53 | }, | ||
54 | { | ||
55 | "include": "#type_params" | ||
56 | }, | ||
57 | { | ||
58 | "include": "#where" | ||
59 | }, | ||
60 | { | ||
61 | "name": "storage.type.rust", | ||
62 | "match": "\\bfor\\b" | ||
63 | }, | ||
64 | { | ||
65 | "include": "#type" | ||
66 | } | ||
67 | ] | ||
68 | }, | ||
69 | { | ||
70 | "include": "#block_doc_comment" | ||
71 | }, | ||
72 | { | ||
73 | "include": "#block_comment" | ||
74 | }, | ||
75 | { | ||
76 | "include": "#line_doc_comment" | ||
77 | }, | ||
78 | { | ||
79 | "include": "#line_comment" | ||
80 | }, | ||
81 | { | ||
82 | "comment": "Attribute", | ||
83 | "name": "meta.attribute.rust", | ||
84 | "begin": "#\\!?\\[", | ||
85 | "end": "\\]", | ||
86 | "patterns": [ | ||
87 | { | ||
88 | "include": "#string_literal" | ||
89 | }, | ||
90 | { | ||
91 | "include": "#block_doc_comment" | ||
92 | }, | ||
93 | { | ||
94 | "include": "#block_comment" | ||
95 | }, | ||
96 | { | ||
97 | "include": "#line_doc_comment" | ||
98 | }, | ||
99 | { | ||
100 | "include": "#line_comment" | ||
101 | } | ||
102 | ] | ||
103 | }, | ||
104 | { | ||
105 | "comment": "Single-quote string literal (character)", | ||
106 | "name": "string.quoted.single.rust", | ||
107 | "match": "b?'([^'\\\\]|\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.))'" | ||
108 | }, | ||
109 | { | ||
110 | "include": "#string_literal" | ||
111 | }, | ||
112 | { | ||
113 | "include": "#raw_string_literal" | ||
114 | }, | ||
115 | { | ||
116 | "comment": "Floating point literal (fraction)", | ||
117 | "name": "constant.numeric.float.rust", | ||
118 | "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b" | ||
119 | }, | ||
120 | { | ||
121 | "comment": "Floating point literal (exponent)", | ||
122 | "name": "constant.numeric.float.rust", | ||
123 | "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b" | ||
124 | }, | ||
125 | { | ||
126 | "comment": "Floating point literal (typed)", | ||
127 | "name": "constant.numeric.float.rust", | ||
128 | "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b" | ||
129 | }, | ||
130 | { | ||
131 | "comment": "Integer literal (decimal)", | ||
132 | "name": "constant.numeric.integer.decimal.rust", | ||
133 | "match": "\\b[0-9][0-9_]*([ui](8|16|32|64|128|s|size))?\\b" | ||
134 | }, | ||
135 | { | ||
136 | "comment": "Integer literal (hexadecimal)", | ||
137 | "name": "constant.numeric.integer.hexadecimal.rust", | ||
138 | "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128|s|size))?\\b" | ||
139 | }, | ||
140 | { | ||
141 | "comment": "Integer literal (octal)", | ||
142 | "name": "constant.numeric.integer.octal.rust", | ||
143 | "match": "\\b0o[0-7_]+([ui](8|16|32|64|128|s|size))?\\b" | ||
144 | }, | ||
145 | { | ||
146 | "comment": "Integer literal (binary)", | ||
147 | "name": "constant.numeric.integer.binary.rust", | ||
148 | "match": "\\b0b[01_]+([ui](8|16|32|64|128|s|size))?\\b" | ||
149 | }, | ||
150 | { | ||
151 | "comment": "Static storage modifier", | ||
152 | "name": "storage.modifier.static.rust", | ||
153 | "match": "\\bstatic\\b" | ||
154 | }, | ||
155 | { | ||
156 | "comment": "Boolean constant", | ||
157 | "name": "constant.language.boolean.rust", | ||
158 | "match": "\\b(true|false)\\b" | ||
159 | }, | ||
160 | { | ||
161 | "comment": "Control keyword", | ||
162 | "name": "keyword.control.rust", | ||
163 | "match": "\\b(async|await|break|continue|else|if|in|for|loop|match|return|try|while)\\b" | ||
164 | }, | ||
165 | { | ||
166 | "comment": "Keyword", | ||
167 | "name": "keyword.other.rust", | ||
168 | "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b" | ||
169 | }, | ||
170 | { | ||
171 | "comment": "Reserved keyword", | ||
172 | "name": "invalid.deprecated.rust", | ||
173 | "match": "\\b(abstract|alignof|become|do|final|macro|offsetof|override|priv|proc|pure|sizeof|typeof|virtual|yield)\\b" | ||
174 | }, | ||
175 | { | ||
176 | "include": "#unsafe" | ||
177 | }, | ||
178 | { | ||
179 | "include": "#sigils" | ||
180 | }, | ||
181 | { | ||
182 | "include": "#self" | ||
183 | }, | ||
184 | { | ||
185 | "include": "#mut" | ||
186 | }, | ||
187 | { | ||
188 | "include": "#dyn" | ||
189 | }, | ||
190 | { | ||
191 | "include": "#impl" | ||
192 | }, | ||
193 | { | ||
194 | "include": "#box" | ||
195 | }, | ||
196 | { | ||
197 | "include": "#lifetime" | ||
198 | }, | ||
199 | { | ||
200 | "include": "#ref_lifetime" | ||
201 | }, | ||
202 | { | ||
203 | "include": "#const" | ||
204 | }, | ||
205 | { | ||
206 | "include": "#pub" | ||
207 | }, | ||
208 | { | ||
209 | "comment": "Miscellaneous operator", | ||
210 | "name": "keyword.operator.misc.rust", | ||
211 | "match": "(=>|::|\\bas\\b)" | ||
212 | }, | ||
213 | { | ||
214 | "comment": "Comparison operator", | ||
215 | "name": "keyword.operator.comparison.rust", | ||
216 | "match": "(&&|\\|\\||==|!=)" | ||
217 | }, | ||
218 | { | ||
219 | "comment": "Assignment operator", | ||
220 | "name": "keyword.operator.assignment.rust", | ||
221 | "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)" | ||
222 | }, | ||
223 | { | ||
224 | "comment": "Arithmetic operator", | ||
225 | "name": "keyword.operator.arithmetic.rust", | ||
226 | "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)" | ||
227 | }, | ||
228 | { | ||
229 | "comment": "Comparison operator (second group because of regex precedence)", | ||
230 | "name": "keyword.operator.comparison.rust", | ||
231 | "match": "(<=|>=|<|>)" | ||
232 | }, | ||
233 | { | ||
234 | "include": "#core_types" | ||
235 | }, | ||
236 | { | ||
237 | "include": "#core_vars" | ||
238 | }, | ||
239 | { | ||
240 | "include": "#core_marker" | ||
241 | }, | ||
242 | { | ||
243 | "include": "#core_traits" | ||
244 | }, | ||
245 | { | ||
246 | "include": "#std_types" | ||
247 | }, | ||
248 | { | ||
249 | "include": "#std_traits" | ||
250 | }, | ||
251 | { | ||
252 | "comment": "Built-in macro", | ||
253 | "name": "support.function.builtin.rust", | ||
254 | "match": "\\b(macro_rules|compile_error|format_args|env|option_env|concat_idents|concat|line|column|file|stringify|include|include_str|include_bytes|module_path|cfg)!" | ||
255 | }, | ||
256 | { | ||
257 | "comment": "Core macro", | ||
258 | "name": "support.function.core.rust", | ||
259 | "match": "\\b(panic|assert|assert_eq|assert_ne|debug_assert|debug_assert_eq|debug_assert_ne|try|write|writeln|unreachable|unimplemented)!" | ||
260 | }, | ||
261 | { | ||
262 | "comment": "Standard library macro", | ||
263 | "name": "support.function.std.rust", | ||
264 | "match": "\\b(format|print|println|eprint|eprintln|select|vec)!" | ||
265 | }, | ||
266 | { | ||
267 | "comment": "Logging macro", | ||
268 | "name": "support.function.log.rust", | ||
269 | "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!" | ||
270 | }, | ||
271 | { | ||
272 | "comment": "Invokation of a macro", | ||
273 | "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]", | ||
274 | "captures": { | ||
275 | "1": { | ||
276 | "name": "entity.name.function.macro.rust" | ||
277 | } | ||
278 | } | ||
279 | }, | ||
280 | { | ||
281 | "comment": "Function call", | ||
282 | "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", | ||
283 | "captures": { | ||
284 | "1": { | ||
285 | "name": "entity.name.function.rust" | ||
286 | } | ||
287 | } | ||
288 | }, | ||
289 | { | ||
290 | "comment": "Function call with type parameters", | ||
291 | "begin": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*(::)(?=\\s*<.*>\\s*\\()", | ||
292 | "end": "\\(", | ||
293 | "captures": { | ||
294 | "1": { | ||
295 | "name": "entity.name.function.rust" | ||
296 | }, | ||
297 | "2": { | ||
298 | "name": "keyword.operator.misc.rust" | ||
299 | } | ||
300 | }, | ||
301 | "patterns": [ | ||
302 | { | ||
303 | "include": "#type_params" | ||
304 | } | ||
305 | ] | ||
306 | }, | ||
307 | { | ||
308 | "comment": "Function definition", | ||
309 | "begin": "\\b(fn)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)", | ||
310 | "end": "[\\{;]", | ||
311 | "beginCaptures": { | ||
312 | "1": { | ||
313 | "name": "keyword.other.fn.rust" | ||
314 | }, | ||
315 | "2": { | ||
316 | "name": "entity.name.function.rust" | ||
317 | } | ||
318 | }, | ||
319 | "patterns": [ | ||
320 | { | ||
321 | "include": "#block_comment" | ||
322 | }, | ||
323 | { | ||
324 | "include": "#line_comment" | ||
325 | }, | ||
326 | { | ||
327 | "include": "#sigils" | ||
328 | }, | ||
329 | { | ||
330 | "include": "#self" | ||
331 | }, | ||
332 | { | ||
333 | "include": "#mut" | ||
334 | }, | ||
335 | { | ||
336 | "include": "#dyn" | ||
337 | }, | ||
338 | { | ||
339 | "include": "#impl" | ||
340 | }, | ||
341 | { | ||
342 | "include": "#ref_lifetime" | ||
343 | }, | ||
344 | { | ||
345 | "include": "#core_types" | ||
346 | }, | ||
347 | { | ||
348 | "include": "#core_marker" | ||
349 | }, | ||
350 | { | ||
351 | "include": "#core_traits" | ||
352 | }, | ||
353 | { | ||
354 | "include": "#std_types" | ||
355 | }, | ||
356 | { | ||
357 | "include": "#std_traits" | ||
358 | }, | ||
359 | { | ||
360 | "include": "#type_params" | ||
361 | }, | ||
362 | { | ||
363 | "include": "#const" | ||
364 | }, | ||
365 | { | ||
366 | "include": "#where" | ||
367 | }, | ||
368 | { | ||
369 | "include": "#unsafe" | ||
370 | }, | ||
371 | { | ||
372 | "comment": "Function arguments", | ||
373 | "match": "\bfn\b", | ||
374 | "name": "keyword.other.fn.rust" | ||
375 | } | ||
376 | ] | ||
377 | }, | ||
378 | { | ||
379 | "comment": "Type declaration", | ||
380 | "begin": "\\b(enum|struct|trait|union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", | ||
381 | "end": "[\\{\\(;]", | ||
382 | "beginCaptures": { | ||
383 | "1": { | ||
384 | "name": "storage.type.rust" | ||
385 | }, | ||
386 | "2": { | ||
387 | "name": "entity.name.type.rust" | ||
388 | } | ||
389 | }, | ||
390 | "patterns": [ | ||
391 | { | ||
392 | "include": "#block_comment" | ||
393 | }, | ||
394 | { | ||
395 | "include": "#line_comment" | ||
396 | }, | ||
397 | { | ||
398 | "include": "#core_traits" | ||
399 | }, | ||
400 | { | ||
401 | "include": "#std_traits" | ||
402 | }, | ||
403 | { | ||
404 | "include": "#type_params" | ||
405 | }, | ||
406 | { | ||
407 | "include": "#core_types" | ||
408 | }, | ||
409 | { | ||
410 | "include": "#pub" | ||
411 | }, | ||
412 | { | ||
413 | "include": "#where" | ||
414 | } | ||
415 | ] | ||
416 | }, | ||
417 | { | ||
418 | "comment": "Type alias", | ||
419 | "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", | ||
420 | "end": ";", | ||
421 | "beginCaptures": { | ||
422 | "1": { | ||
423 | "name": "storage.type.rust" | ||
424 | }, | ||
425 | "2": { | ||
426 | "name": "entity.name.type.rust" | ||
427 | } | ||
428 | }, | ||
429 | "patterns": [ | ||
430 | { | ||
431 | "include": "#block_comment" | ||
432 | }, | ||
433 | { | ||
434 | "include": "#line_comment" | ||
435 | }, | ||
436 | { | ||
437 | "include": "#sigils" | ||
438 | }, | ||
439 | { | ||
440 | "include": "#mut" | ||
441 | }, | ||
442 | { | ||
443 | "include": "#dyn" | ||
444 | }, | ||
445 | { | ||
446 | "include": "#impl" | ||
447 | }, | ||
448 | { | ||
449 | "include": "#lifetime" | ||
450 | }, | ||
451 | { | ||
452 | "include": "#ref_lifetime" | ||
453 | }, | ||
454 | { | ||
455 | "include": "#core_types" | ||
456 | }, | ||
457 | { | ||
458 | "include": "#core_marker" | ||
459 | }, | ||
460 | { | ||
461 | "include": "#core_traits" | ||
462 | }, | ||
463 | { | ||
464 | "include": "#std_types" | ||
465 | }, | ||
466 | { | ||
467 | "include": "#std_traits" | ||
468 | }, | ||
469 | { | ||
470 | "include": "#type_params" | ||
471 | } | ||
472 | ] | ||
473 | } | ||
474 | ], | ||
475 | "repository": { | ||
476 | "block_doc_comment": { | ||
477 | "comment": "Block documentation comment", | ||
478 | "name": "comment.block.documentation.rust", | ||
479 | "begin": "/\\*[\\*!](?![\\*/])", | ||
480 | "end": "\\*/", | ||
481 | "patterns": [ | ||
482 | { | ||
483 | "include": "#block_doc_comment" | ||
484 | }, | ||
485 | { | ||
486 | "include": "#block_comment" | ||
487 | } | ||
488 | ] | ||
489 | }, | ||
490 | "block_comment": { | ||
491 | "comment": "Block comment", | ||
492 | "name": "comment.block.rust", | ||
493 | "begin": "/\\*", | ||
494 | "end": "\\*/", | ||
495 | "patterns": [ | ||
496 | { | ||
497 | "include": "#block_doc_comment" | ||
498 | }, | ||
499 | { | ||
500 | "include": "#block_comment" | ||
501 | } | ||
502 | ] | ||
503 | }, | ||
504 | "line_doc_comment": { | ||
505 | "comment": "Single-line documentation comment", | ||
506 | "name": "comment.line.documentation.rust", | ||
507 | "begin": "//[!/](?=[^/])", | ||
508 | "end": "$" | ||
509 | }, | ||
510 | "line_comment": { | ||
511 | "comment": "Single-line comment", | ||
512 | "name": "comment.line.double-slash.rust", | ||
513 | "begin": "//", | ||
514 | "end": "$" | ||
515 | }, | ||
516 | "escaped_character": { | ||
517 | "name": "constant.character.escape.rust", | ||
518 | "match": "\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)" | ||
519 | }, | ||
520 | "string_literal": { | ||
521 | "comment": "Double-quote string literal", | ||
522 | "name": "string.quoted.double.rust", | ||
523 | "begin": "b?\"", | ||
524 | "end": "\"", | ||
525 | "patterns": [ | ||
526 | { | ||
527 | "include": "#escaped_character" | ||
528 | } | ||
529 | ] | ||
530 | }, | ||
531 | "raw_string_literal": { | ||
532 | "comment": "Raw double-quote string literal", | ||
533 | "name": "string.quoted.double.raw.rust", | ||
534 | "begin": "b?r(#*)\"", | ||
535 | "end": "\"\\1" | ||
536 | }, | ||
537 | "sigils": { | ||
538 | "comment": "Sigil", | ||
539 | "name": "keyword.operator.sigil.rust", | ||
540 | "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)" | ||
541 | }, | ||
542 | "self": { | ||
543 | "comment": "Self variable", | ||
544 | "name": "variable.language.rust", | ||
545 | "match": "\\bself\\b" | ||
546 | }, | ||
547 | "mut": { | ||
548 | "comment": "Mutable storage modifier", | ||
549 | "name": "storage.modifier.mut.rust", | ||
550 | "match": "\\bmut\\b" | ||
551 | }, | ||
552 | "dyn": { | ||
553 | "comment": "Dynamic modifier", | ||
554 | "name": "storage.modifier.dyn.rust", | ||
555 | "match": "\\bdyn\\b" | ||
556 | }, | ||
557 | "impl": { | ||
558 | "comment": "Existential type modifier", | ||
559 | "name": "storage.modifier.impl.rust", | ||
560 | "match": "\\bimpl\\b" | ||
561 | }, | ||
562 | "box": { | ||
563 | "comment": "Box storage modifier", | ||
564 | "name": "storage.modifier.box.rust", | ||
565 | "match": "\\bbox\\b" | ||
566 | }, | ||
567 | "const": { | ||
568 | "comment": "Const storage modifier", | ||
569 | "name": "storage.modifier.const.rust", | ||
570 | "match": "\\bconst\\b" | ||
571 | }, | ||
572 | "pub": { | ||
573 | "comment": "Visibility modifier", | ||
574 | "name": "storage.modifier.visibility.rust", | ||
575 | "match": "\\bpub\\b" | ||
576 | }, | ||
577 | "unsafe": { | ||
578 | "comment": "Unsafe code keyword", | ||
579 | "name": "keyword.other.unsafe.rust", | ||
580 | "match": "\\bunsafe\\b" | ||
581 | }, | ||
582 | "where": { | ||
583 | "comment": "Generic where clause", | ||
584 | "name": "keyword.other.where.rust", | ||
585 | "match": "\\bwhere\\b" | ||
586 | }, | ||
587 | "lifetime": { | ||
588 | "comment": "Named lifetime", | ||
589 | "name": "storage.modifier.lifetime.rust", | ||
590 | "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b", | ||
591 | "captures": { | ||
592 | "1": { | ||
593 | "name": "entity.name.lifetime.rust" | ||
594 | } | ||
595 | } | ||
596 | }, | ||
597 | "ref_lifetime": { | ||
598 | "comment": "Reference with named lifetime", | ||
599 | "match": "&('([a-zA-Z_][a-zA-Z0-9_]*))\\b", | ||
600 | "captures": { | ||
601 | "1": { | ||
602 | "name": "storage.modifier.lifetime.rust" | ||
603 | }, | ||
604 | "2": { | ||
605 | "name": "entity.name.lifetime.rust" | ||
606 | } | ||
607 | } | ||
608 | }, | ||
609 | "core_types": { | ||
610 | "comment": "Built-in/core type", | ||
611 | "name": "storage.type.core.rust", | ||
612 | "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b" | ||
613 | }, | ||
614 | "core_vars": { | ||
615 | "comment": "Core type variant", | ||
616 | "name": "support.constant.core.rust", | ||
617 | "match": "\\b(Some|None|Ok|Err)\\b" | ||
618 | }, | ||
619 | "core_marker": { | ||
620 | "comment": "Core trait (marker)", | ||
621 | "name": "support.type.marker.rust", | ||
622 | "match": "\\b(Copy|Send|Sized|Sync)\\b" | ||
623 | }, | ||
624 | "core_traits": { | ||
625 | "comment": "Core trait", | ||
626 | "name": "support.type.core.rust", | ||
627 | "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b" | ||
628 | }, | ||
629 | "std_types": { | ||
630 | "comment": "Standard library type", | ||
631 | "name": "storage.class.std.rust", | ||
632 | "match": "\\b(Box|String|Vec|Path|PathBuf)\\b" | ||
633 | }, | ||
634 | "std_traits": { | ||
635 | "comment": "Standard library trait", | ||
636 | "name": "support.type.std.rust", | ||
637 | "match": "\\b(ToOwned|ToString)\\b" | ||
638 | }, | ||
639 | "type": { | ||
640 | "comment": "A type", | ||
641 | "name": "entity.name.type.rust", | ||
642 | "match": "\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b" | ||
643 | }, | ||
644 | "type_params": { | ||
645 | "comment": "Type parameters", | ||
646 | "name": "meta.type_params.rust", | ||
647 | "begin": "<(?![=<])", | ||
648 | "end": "(?<![-])>", | ||
649 | "patterns": [ | ||
650 | { | ||
651 | "include": "#block_comment" | ||
652 | }, | ||
653 | { | ||
654 | "include": "#line_comment" | ||
655 | }, | ||
656 | { | ||
657 | "include": "#sigils" | ||
658 | }, | ||
659 | { | ||
660 | "include": "#mut" | ||
661 | }, | ||
662 | { | ||
663 | "include": "#dyn" | ||
664 | }, | ||
665 | { | ||
666 | "include": "#impl" | ||
667 | }, | ||
668 | { | ||
669 | "include": "#lifetime" | ||
670 | }, | ||
671 | { | ||
672 | "include": "#core_types" | ||
673 | }, | ||
674 | { | ||
675 | "include": "#core_marker" | ||
676 | }, | ||
677 | { | ||
678 | "include": "#core_traits" | ||
679 | }, | ||
680 | { | ||
681 | "include": "#std_types" | ||
682 | }, | ||
683 | { | ||
684 | "include": "#std_traits" | ||
685 | }, | ||
686 | { | ||
687 | "include": "#type_params" | ||
688 | } | ||
689 | ] | ||
690 | } | ||
691 | } | ||
692 | } \ No newline at end of file | ||