3 "scopeName": "source.rust",
6 "comment": "Implementation",
7 "begin": "\\b(impl)\\b",
11 "name": "storage.type.rust"
16 "include": "#block_comment"
19 "include": "#line_comment"
31 "include": "#ref_lifetime"
34 "include": "#core_types"
37 "include": "#core_marker"
40 "include": "#core_traits"
43 "include": "#std_types"
46 "include": "#std_traits"
49 "include": "#type_params"
55 "name": "storage.type.rust",
64 "include": "#block_doc_comment"
67 "include": "#block_comment"
70 "include": "#line_doc_comment"
73 "include": "#line_comment"
76 "comment": "Attribute",
77 "name": "meta.attribute.rust",
82 "include": "#string_literal"
85 "include": "#block_doc_comment"
88 "include": "#block_comment"
91 "include": "#line_doc_comment"
94 "include": "#line_comment"
99 "comment": "Single-quote string literal (character)",
100 "name": "string.quoted.single.rust",
101 "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]?|.))'"
104 "include": "#string_literal"
107 "include": "#raw_string_literal"
110 "comment": "Floating point literal (fraction)",
111 "name": "constant.numeric.float.rust",
112 "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b"
115 "comment": "Floating point literal (exponent)",
116 "name": "constant.numeric.float.rust",
117 "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b"
120 "comment": "Floating point literal (typed)",
121 "name": "constant.numeric.float.rust",
122 "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b"
125 "comment": "Integer literal (decimal)",
126 "name": "constant.numeric.integer.decimal.rust",
127 "match": "\\b[0-9][0-9_]*([ui](8|16|32|64|128|s|size))?\\b"
130 "comment": "Integer literal (hexadecimal)",
131 "name": "constant.numeric.integer.hexadecimal.rust",
132 "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128|s|size))?\\b"
135 "comment": "Integer literal (octal)",
136 "name": "constant.numeric.integer.octal.rust",
137 "match": "\\b0o[0-7_]+([ui](8|16|32|64|128|s|size))?\\b"
140 "comment": "Integer literal (binary)",
141 "name": "constant.numeric.integer.binary.rust",
142 "match": "\\b0b[01_]+([ui](8|16|32|64|128|s|size))?\\b"
145 "comment": "Static storage modifier",
146 "name": "storage.modifier.static.rust",
147 "match": "\\bstatic\\b"
150 "comment": "Boolean constant",
151 "name": "constant.language.boolean.rust",
152 "match": "\\b(true|false)\\b"
155 "comment": "Control keyword",
156 "name": "keyword.control.rust",
157 "match": "\\b(async|await|break|continue|else|if|in|for|loop|match|return|try|while)\\b"
160 "comment": "Keyword",
161 "name": "keyword.other.rust",
162 "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b"
165 "comment": "Reserved keyword",
166 "name": "invalid.deprecated.rust",
167 "match": "\\b(abstract|alignof|become|do|final|macro|offsetof|override|priv|proc|pure|sizeof|typeof|virtual|yield)\\b"
191 "include": "#lifetime"
194 "include": "#ref_lifetime"
203 "comment": "Miscellaneous operator",
204 "name": "keyword.operator.misc.rust",
205 "match": "(=>|::|\\bas\\b)"
208 "comment": "Comparison operator",
209 "name": "keyword.operator.comparison.rust",
210 "match": "(&&|\\|\\||==|!=)"
213 "comment": "Assignment operator",
214 "name": "keyword.operator.assignment.rust",
215 "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)"
218 "comment": "Arithmetic operator",
219 "name": "keyword.operator.arithmetic.rust",
220 "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)"
223 "comment": "Comparison operator (second group because of regex precedence)",
224 "name": "keyword.operator.comparison.rust",
225 "match": "(<=|>=|<|>)"
228 "include": "#core_types"
231 "include": "#core_vars"
234 "include": "#core_marker"
237 "include": "#core_traits"
240 "include": "#std_types"
243 "include": "#std_traits"
246 "comment": "Built-in macro",
247 "name": "support.function.builtin.rust",
248 "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)!"
251 "comment": "Core macro",
252 "name": "support.function.core.rust",
253 "match": "\\b(panic|assert|assert_eq|assert_ne|debug_assert|debug_assert_eq|debug_assert_ne|try|write|writeln|unreachable|unimplemented)!"
256 "comment": "Standard library macro",
257 "name": "support.function.std.rust",
258 "match": "\\b(format|print|println|eprint|eprintln|select|vec)!"
261 "comment": "Logging macro",
262 "name": "support.function.log.rust",
263 "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!"
266 "comment": "Invokation of a macro",
267 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]",
270 "name": "entity.name.function.macro.rust"
275 "comment": "Function call",
276 "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(",
279 "name": "entity.name.function.rust"
284 "comment": "Function call with type parameters",
285 "begin": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*(::)(?=\\s*<.*>\\s*\\()",
289 "name": "entity.name.function.rust"
292 "name": "keyword.operator.misc.rust"
297 "include": "#type_params"
302 "comment": "Function definition",
303 "begin": "\\b(fn)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)",
307 "name": "keyword.other.fn.rust"
310 "name": "entity.name.function.rust"
315 "include": "#block_comment"
318 "include": "#line_comment"
336 "include": "#ref_lifetime"
339 "include": "#core_types"
342 "include": "#core_marker"
345 "include": "#core_traits"
348 "include": "#std_types"
351 "include": "#std_traits"
354 "include": "#type_params"
366 "comment": "Function arguments",
368 "name": "keyword.other.fn.rust"
373 "comment": "Type declaration",
374 "begin": "\\b(enum|struct|trait|union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
378 "name": "storage.type.rust"
381 "name": "entity.name.type.rust"
386 "include": "#block_comment"
389 "include": "#line_comment"
392 "include": "#core_traits"
395 "include": "#std_traits"
398 "include": "#type_params"
401 "include": "#core_types"
412 "comment": "Type alias",
413 "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
417 "name": "storage.type.rust"
420 "name": "entity.name.type.rust"
425 "include": "#block_comment"
428 "include": "#line_comment"
443 "include": "#lifetime"
446 "include": "#ref_lifetime"
449 "include": "#core_types"
452 "include": "#core_marker"
455 "include": "#core_traits"
458 "include": "#std_types"
461 "include": "#std_traits"
464 "include": "#type_params"
470 "block_doc_comment": {
471 "comment": "Block documentation comment",
472 "name": "comment.block.documentation.rust",
473 "begin": "/\\*[\\*!](?![\\*/])",
477 "include": "#block_doc_comment"
480 "include": "#block_comment"
485 "comment": "Block comment",
486 "name": "comment.block.rust",
491 "include": "#block_doc_comment"
494 "include": "#block_comment"
498 "line_doc_comment": {
499 "comment": "Single-line documentation comment",
500 "name": "comment.line.documentation.rust",
501 "begin": "//[!/](?=[^/])",
505 "comment": "Single-line comment",
506 "name": "comment.line.double-slash.rust",
510 "escaped_character": {
511 "name": "constant.character.escape.rust",
512 "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]?|.)"
515 "comment": "Double-quote string literal",
516 "name": "string.quoted.double.rust",
521 "include": "#escaped_character"
525 "raw_string_literal": {
526 "comment": "Raw double-quote string literal",
527 "name": "string.quoted.double.raw.rust",
528 "begin": "b?r(#*)\"",
533 "name": "keyword.other.sigil.rust",
534 "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)"
537 "comment": "Self variable",
538 "name": "variable.language.rust",
539 "match": "\\bself\\b"
542 "comment": "Mutable storage modifier",
543 "name": "storage.modifier.mut.rust",
547 "comment": "Dynamic modifier",
548 "name": "storage.modifier.dyn.rust",
552 "comment": "Existential type modifier",
553 "name": "storage.modifier.impl.rust",
554 "match": "\\bimpl\\b"
557 "comment": "Box storage modifier",
558 "name": "storage.modifier.box.rust",
562 "comment": "Const storage modifier",
563 "name": "storage.modifier.const.rust",
564 "match": "\\bconst\\b"
567 "comment": "Visibility modifier",
568 "name": "storage.modifier.visibility.rust",
572 "comment": "Unsafe code keyword",
573 "name": "keyword.other.unsafe.rust",
574 "match": "\\bunsafe\\b"
577 "comment": "Generic where clause",
578 "name": "keyword.other.where.rust",
579 "match": "\\bwhere\\b"
582 "comment": "Named lifetime",
583 "name": "entity.name.type.lifetime.rust",
584 "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b"
587 "comment": "Reference with named lifetime",
588 "match": "&('[a-zA-Z_][a-zA-Z0-9_]*)\\b",
591 "name": "entity.name.type.lifetime.rust"
596 "comment": "Built-in/core type",
597 "name": "entity.name.type.core.rust",
598 "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b"
601 "comment": "Core type variant",
602 "name": "support.constant.core.rust",
603 "match": "\\b(Some|None|Ok|Err)\\b"
606 "comment": "Core trait (marker)",
607 "name": "entity.name.type.marker.rust",
608 "match": "\\b(Copy|Send|Sized|Sync)\\b"
611 "comment": "Core trait",
612 "name": "entity.name.type.core.rust",
613 "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b"
616 "comment": "Standard library type",
617 "name": "entity.name.type.class.std.rust",
618 "match": "\\b(Box|String|Vec|Path|PathBuf)\\b"
621 "comment": "Standard library trait",
622 "name": "entity.name.type.std.rust",
623 "match": "\\b(ToOwned|ToString)\\b"
627 "name": "entity.name.type.rust",
628 "match": "\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b"
631 "comment": "Type parameters",
632 "name": "meta.type_params.rust",
633 "begin": "<(?![=<])",
637 "include": "#block_comment"
640 "include": "#line_comment"
655 "include": "#lifetime"
658 "include": "#core_types"
661 "include": "#core_marker"
664 "include": "#core_traits"
667 "include": "#std_types"
670 "include": "#std_traits"
673 "include": "#type_params"