{ "fileTypes": [ "rs", "rc" ], "foldingStartMarker": "^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$", "foldingStopMarker": "^\\s*\\}", "name": "Rust", "patterns": [ { "include": "#rust_comment_doc_block" }, { "include": "#rust_comment_block" }, { "include": "#rust_ref_lifetime" }, { "include": "#rust_lifetime" }, { "include": "#rust_self" }, { "include": "#rust_string" }, { "include": "#rust_raw_string" }, { "match": "\\'([^\\'\\\\]|\\\\(x\\h{2}|u\\{\\h{1,6}\\}|.))\\'", "name": "string.quoted.single.source.rust" }, { "captures": { "1": { "name": "keyword.source.rust" }, "2": { "name": "entity.name.function.source.rust" } }, "match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]?[\\w\\:,+ \\'<>?]*)\\s*(?:\\()", "name": "meta.function.source.rust" }, { "captures": { "1": { "name": "keyword.source.rust" }, "2": { "name": "keyword.source.rust" }, "3": { "name": "variable.other.rust" }, "4": { "name": "storage.type.source.rust" }, "5": { "name": "keyword.operator.rust" } }, "comment": "This matches the 'let x = val' style of variable intitialization.", "match": "(let)\\s+(mut\\s+)?([[:alpha:]_][[:alnum:]_]*)\\s*(:.+?)?(=)", "name": "meta.initialization.rust" }, { "captures": { "1": { "name": "keyword.source.rust" }, "2": { "name": "support" } }, "match": "(extern\\s+crate)\\s+(\\w+)", "name": "meta.import.rust" }, { "captures": { "1": { "name": "keyword.source.rust" }, "2": { "name": "entity.name.macro.source.rust" } }, "match": "\\b(macro_rules!)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?:\\{)", "name": "meta.macro.source.rust" }, { "match": "\\b(as|box|break|claim|const|continue|copy|Copy|crate|do|drop|else|extern|for|if|impl|in|let|loop|match|mod|move|mut|Owned|priv|pub|pure|ref|return|unsafe|use|while|mod|Send|static|trait|struct|enum|type|where)\\b", "name": "keyword.source.rust" }, { "match": "\\b(Self|m32|m64|m128|f80|f16|f128|int|uint|isize|usize|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|Option|Either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b", "name": "storage.type.source.rust" }, { "match": "\\bself\\b", "name": "variable.language.source.rust" }, { "match": "\\b(true|false|Some|None|Ok|Err)\\b", "name": "constant.language.source.rust" }, { "match": "\\b(EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b", "name": "support.constant.source.rust" }, { "begin": "#!?\\[", "end": "\\]", "name": "comment.block.attribute.rust", "patterns": [ { "include": "#rust_string" }, { "include": "#rust_raw_string" } ] }, { "match": "\\b(([0-9][0-9_]*)|([0-9][0-9_]*(usize|u8|u16|u32|u64))|([0-9][0-9_]*(isize|i8|i16|i32|i64)))\\b", "name": "constant.numeric.integer.source.rust" }, { "match": "\\b((0x[a-fA-F0-9_]+)|(0x[a-fA-F0-9_]+(usize|u8|u16|u32|u64))|(0x[a-fA-F0-9_]+(isize|i8|i16|i32|i64)))\\b", "name": "constant.numeric.hex.source.rust" }, { "match": "\\b((0b[01_]+)|(0b[01_]+(usize|u8|u16|u32|u64))|(0b[01_]+(isize|i8|i16|i32|i64)))\\b", "name": "constant.numeric.binary.source.rust" }, { "match": "\\b(([0-9][0-9_]*(f32|f64|f))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f32|f64|f))|([0-9][0-9_]*\\.[0-9_]+)|([0-9][0-9_]*\\.[0-9_]+(f32|f64|f))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+)(f32|f64|f)))\\b", "name": "constant.numeric.float.source.rust" }, { "begin": "//[!/][^/\\n].*", "end": "$\\n", "name": "comment.line.documentation.source.rust" }, { "begin": "//", "end": "$\\n", "name": "comment.line.double-dash.source.rust" }, { "match": "(=>)|(->)|[-:=*,!.+|%/&~@<>;]", "name": "keyword.operator.rust" }, { "match": "\\b_\\b", "name": "support.function.rust" }, { "match": "\\b(\\w+)\\b(?=\\()", "name": "support.function.rust" }, { "match": "\\b(\\w+!)(?=\\()", "name": "support.macro.rust" }, { "match": "\\b(\\w+)::", "name": "meta.namespace-block.rust" }, { "captures": { "1": { "name": "meta.preprocessor.rust" } }, "match": "\\b(\\w+!)\\s*[({\\[]", "name": "meta.macro.source.rust" }, { "match": "(\\[|\\]|{|}|\\(|\\))", "name": "punctuation.definition.bracket.rust" }, { "match": "\\b(Box|Vec|StrBuf|Path|Option|Result|Reader|Writer|Stream|Seek|Buffer|IoError|IoResult|Sender|SyncSender|Receiver|Cell|RefCell|Any)\\b", "name": "support.class.std.source.rust" }, { "match": "\\b(Send|Sized|Copy|Share)\\b", "name": "support.type.kind.source.rust" }, { "match": "\\bbox\\b", "name": "storage.modifier.box.source.rust" }, { "match": "\\bmut\\b", "name": "storage.modifier.mut.source.rust" } ], "repository": { "rust_comment_block": { "begin": "/\\*", "end": "\\*/", "name": "comment.block.source.rust", "patterns": [ { "include": "#rust_comment_block" } ] }, "rust_comment_doc_block": { "begin": "/\\*[!\\*][^\\*]", "end": "\\*/", "name": "comment.block.documentation.source.rust", "patterns": [ { "include": "#rust_comment_doc_block" } ] }, "rust_escaped_character": { "match": "\\\\(x\\h{2}|u\\{\\h{1,6}\\}|.)", "name": "constant.character.escape.source.rust" }, "rust_lifetime": { "captures": { "1": { "name": "entity.name.lifetime.source.rust" } }, "match": "\\'([a-zA-Z_][a-zA-Z0-9_]*)(?!\\')\\b", "name": "storage.modifier.lifetime.source.rust" }, "rust_raw_string": { "begin": "r(#*)\"", "end": "\"(\\1)", "name": "string.quoted.double.raw.source.rust" }, "rust_ref_lifetime": { "captures": { "1": { "name": "storage.modifier.lifetime.source.rust" }, "2": { "name": "entity.name.lifetime.source.rust" } }, "match": "(&\\'([a-zA-Z_][a-zA-Z0-9_]*)(?!\\'))\\b" }, "rust_self": { "match": "\\bself\\b", "name": "variable.language.source.rust" }, "rust_string": { "begin": "\"", "end": "\"", "name": "string.quoted.double.source.rust", "patterns": [ { "include": "#rust_escaped_character" } ] } }, "scopeName": "source.rust", "uuid": "4339386b-4d67-4f0e-9e78-09ecbcddf71d" }