PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.11.1
Code Block Pro – Beautiful Syntax Highlighting v1.11.1
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / rust.tmLanguage.json

rust.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.11.1, at build/shiki/languages/rust.tmLanguage.json

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