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