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."
7 "version": "https://github.com/zargony/atom-language-rust/commit/7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f",
9 "scopeName": "source.rust",
12 "comment": "Implementation",
13 "begin": "\\b(impl)\\b",
17 "name": "storage.type.rust"
22 "include": "#block_comment"
25 "include": "#line_comment"
37 "include": "#ref_lifetime"
40 "include": "#core_types"
43 "include": "#core_marker"
46 "include": "#core_traits"
49 "include": "#std_types"
52 "include": "#std_traits"
55 "include": "#type_params"
61 "name": "storage.type.rust",
70 "include": "#block_doc_comment"
73 "include": "#block_comment"
76 "include": "#line_doc_comment"
79 "include": "#line_comment"
82 "comment": "Attribute",
83 "name": "meta.attribute.rust",
88 "include": "#string_literal"
91 "include": "#block_doc_comment"
94 "include": "#block_comment"
97 "include": "#line_doc_comment"
100 "include": "#line_comment"
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]?|.))'"
110 "include": "#string_literal"
113 "include": "#raw_string_literal"
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"
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"
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"
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"
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"
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"
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"
151 "comment": "Static storage modifier",
152 "name": "storage.modifier.static.rust",
153 "match": "\\bstatic\\b"
156 "comment": "Boolean constant",
157 "name": "constant.language.boolean.rust",
158 "match": "\\b(true|false)\\b"
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"
166 "comment": "Keyword",
167 "name": "keyword.other.rust",
168 "match": "\\b(crate|extern|mod|let|ref|use|super|move)\\b"
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"
197 "include": "#lifetime"
200 "include": "#ref_lifetime"
209 "comment": "Miscellaneous operator",
210 "name": "keyword.operator.misc.rust",
211 "match": "(=>|::|\\bas\\b)"
214 "comment": "Comparison operator",
215 "name": "keyword.operator.comparison.rust",
216 "match": "(&&|\\|\\||==|!=)"
219 "comment": "Assignment operator",
220 "name": "keyword.operator.assignment.rust",
221 "match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)"
224 "comment": "Arithmetic operator",
225 "name": "keyword.operator.arithmetic.rust",
226 "match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)"
229 "comment": "Comparison operator (second group because of regex precedence)",
230 "name": "keyword.operator.comparison.rust",
231 "match": "(<=|>=|<|>)"
234 "include": "#core_types"
237 "include": "#core_vars"
240 "include": "#core_marker"
243 "include": "#core_traits"
246 "include": "#std_types"
249 "include": "#std_traits"
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)!"
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)!"
262 "comment": "Standard library macro",
263 "name": "support.function.std.rust",
264 "match": "\\b(format|print|println|eprint|eprintln|select|vec)!"
267 "comment": "Logging macro",
268 "name": "support.function.log.rust",
269 "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!"
272 "comment": "Invokation of a macro",
273 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]",
276 "name": "entity.name.function.macro.rust"
281 "comment": "Function call",
282 "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(",
285 "name": "entity.name.function.rust"
290 "comment": "Function call with type parameters",
291 "begin": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*(::)(?=\\s*<.*>\\s*\\()",
295 "name": "entity.name.function.rust"
298 "name": "keyword.operator.misc.rust"
303 "include": "#type_params"
308 "comment": "Function definition",
309 "begin": "\\b(fn)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)",
313 "name": "keyword.other.fn.rust"
316 "name": "entity.name.function.rust"
321 "include": "#block_comment"
324 "include": "#line_comment"
342 "include": "#ref_lifetime"
345 "include": "#core_types"
348 "include": "#core_marker"
351 "include": "#core_traits"
354 "include": "#std_types"
357 "include": "#std_traits"
360 "include": "#type_params"
372 "comment": "Function arguments",
374 "name": "keyword.other.fn.rust"
379 "comment": "Type declaration",
380 "begin": "\\b(enum|struct|trait|union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
384 "name": "storage.type.rust"
387 "name": "entity.name.type.rust"
392 "include": "#block_comment"
395 "include": "#line_comment"
398 "include": "#core_traits"
401 "include": "#std_traits"
404 "include": "#type_params"
407 "include": "#core_types"
418 "comment": "Type alias",
419 "begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
423 "name": "storage.type.rust"
426 "name": "entity.name.type.rust"
431 "include": "#block_comment"
434 "include": "#line_comment"
449 "include": "#lifetime"
452 "include": "#ref_lifetime"
455 "include": "#core_types"
458 "include": "#core_marker"
461 "include": "#core_traits"
464 "include": "#std_types"
467 "include": "#std_traits"
470 "include": "#type_params"
476 "block_doc_comment": {
477 "comment": "Block documentation comment",
478 "name": "comment.block.documentation.rust",
479 "begin": "/\\*[\\*!](?![\\*/])",
483 "include": "#block_doc_comment"
486 "include": "#block_comment"
491 "comment": "Block comment",
492 "name": "comment.block.rust",
497 "include": "#block_doc_comment"
500 "include": "#block_comment"
504 "line_doc_comment": {
505 "comment": "Single-line documentation comment",
506 "name": "comment.line.documentation.rust",
507 "begin": "//[!/](?=[^/])",
511 "comment": "Single-line comment",
512 "name": "comment.line.double-slash.rust",
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]?|.)"
521 "comment": "Double-quote string literal",
522 "name": "string.quoted.double.rust",
527 "include": "#escaped_character"
531 "raw_string_literal": {
532 "comment": "Raw double-quote string literal",
533 "name": "string.quoted.double.raw.rust",
534 "begin": "b?r(#*)\"",
539 "name": "keyword.other.sigil.rust",
540 "match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)"
543 "comment": "Self variable",
544 "name": "variable.language.rust",
545 "match": "\\bself\\b"
548 "comment": "Mutable storage modifier",
549 "name": "storage.modifier.mut.rust",
553 "comment": "Dynamic modifier",
554 "name": "storage.modifier.dyn.rust",
558 "comment": "Existential type modifier",
559 "name": "storage.modifier.impl.rust",
560 "match": "\\bimpl\\b"
563 "comment": "Box storage modifier",
564 "name": "storage.modifier.box.rust",
568 "comment": "Const storage modifier",
569 "name": "storage.modifier.const.rust",
570 "match": "\\bconst\\b"
573 "comment": "Visibility modifier",
574 "name": "storage.modifier.visibility.rust",
578 "comment": "Unsafe code keyword",
579 "name": "keyword.other.unsafe.rust",
580 "match": "\\bunsafe\\b"
583 "comment": "Generic where clause",
584 "name": "keyword.other.where.rust",
585 "match": "\\bwhere\\b"
588 "comment": "Named lifetime",
589 "name": "entity.name.type.lifetime.rust",
590 "match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b"
593 "comment": "Reference with named lifetime",
594 "match": "&('[a-zA-Z_][a-zA-Z0-9_]*)\\b",
597 "name": "entity.name.type.lifetime.rust"
602 "comment": "Built-in/core type",
603 "name": "entity.name.type.core.rust",
604 "match": "\\b(bool|char|usize|isize|u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|f32|f64|str|Self|Option|Result)\\b"
607 "comment": "Core type variant",
608 "name": "support.constant.core.rust",
609 "match": "\\b(Some|None|Ok|Err)\\b"
612 "comment": "Core trait (marker)",
613 "name": "entity.name.type.marker.rust",
614 "match": "\\b(Copy|Send|Sized|Sync)\\b"
617 "comment": "Core trait",
618 "name": "entity.name.type.core.rust",
619 "match": "\\b(Drop|Fn|FnMut|FnOnce|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator)\\b"
622 "comment": "Standard library type",
623 "name": "entity.name.type.class.std.rust",
624 "match": "\\b(Box|String|Vec|Path|PathBuf)\\b"
627 "comment": "Standard library trait",
628 "name": "entity.name.type.std.rust",
629 "match": "\\b(ToOwned|ToString)\\b"
633 "name": "entity.name.type.rust",
634 "match": "\\b([A-Za-z][_A-Za-z0-9]*|_[_A-Za-z0-9]+)\\b"
637 "comment": "Type parameters",
638 "name": "meta.type_params.rust",
639 "begin": "<(?![=<])",
643 "include": "#block_comment"
646 "include": "#line_comment"
661 "include": "#lifetime"
664 "include": "#core_types"
667 "include": "#core_marker"
670 "include": "#core_traits"
673 "include": "#std_types"
676 "include": "#std_traits"
679 "include": "#type_params"