treehouse/static/syntax/rust.json

120 lines
4.7 KiB
JSON

{
"patterns": [
{ "regex": "\\/\\/.*", "is": "comment" },
{
"regex": "\\/\\*.*?\\*\\/",
"flags": ["dotMatchesNewline"],
"is": "comment"
},
{ "regex": "'(\\\\'|[^'])'", "is": "string" },
{ "regex": "\"(\\\\\"|[^\"])*\"", "is": "string" },
{ "regex": "b'(\\\\'|[^'])'", "is": "string" },
{ "regex": "b\"(\\\\\"|[^\"])*\"", "is": "string" },
{ "regex": "r\"(\\\\\"|[^\"])*\"", "is": "string" },
{ "regex": "r#\"(\\\\\"|[^\"])*\"#", "is": "string" },
{ "regex": "r##\"(\\\\\"|[^\"])*\"##", "is": "string" },
{ "regex": "r###\"(\\\\\"|[^\"])*\"###", "is": "string" },
{ "regex": "0[bB][01_]+([uif](8|16|32|64|128))?", "is": "literal" },
{ "regex": "0[oO][0-7_]+([uif](8|16|32|64|128))?", "is": "literal" },
{
"regex": "0[xX][0-9a-fA-F_]+([uif](8|16|32|64|128))?",
"is": "literal"
},
{ "regex": "[0-9_]+n", "is": "literal" },
{ "regex": "[0-9_]+(\\.[0-9_]*([eE][-+]?[0-9_]+)?)?", "is": "literal" },
{ "regex": "[+=/*^%<>!~|&\\.?:@-]+", "is": "operator" },
{ "regex": "#!\\[", "is": "default" },
{
"regex": "[a-zA-Z_][a-zA-Z0-9_]*(\\()",
"is": { "default": "function", "captures": ["default"] }
},
{ "regex": "[a-zA-Z_][a-zA-Z0-9_]*!", "is": "function" },
{ "regex": "[A-Z_][a-zA-Z0-9_]*", "is": "keyword2" },
{
"regex": "union\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"is": {
"default": "keyword1",
"captures": ["keyword2"]
}
},
{ "regex": "[a-zA-Z_][a-zA-Z0-9_]*", "is": "identifier" },
{ "regex": "'[a-zA-Z_][a-zA-Z0-9_]*", "is": "literal" }
],
"keywords": {
"_": { "into": "keyword1" },
"as": { "into": "keyword1" },
"async": { "into": "keyword1" },
"await": { "into": "keyword1" },
"break": { "into": "keyword1" },
"const": { "into": "keyword1" },
"continue": { "into": "keyword1" },
"dyn": { "into": "keyword1" },
"else": { "into": "keyword1" },
"enum": { "into": "keyword1" },
"extern": { "into": "keyword1" },
"fn": { "into": "keyword1" },
"for": { "into": "keyword1" },
"if": { "into": "keyword1" },
"impl": { "into": "keyword1" },
"in": { "into": "keyword1" },
"let": { "into": "keyword1" },
"loop": { "into": "keyword1" },
"macro_rules!": { "into": "keyword1" },
"match": { "into": "keyword1" },
"mod": { "into": "keyword1" },
"move": { "into": "keyword1" },
"mut": { "into": "keyword1" },
"pub": { "into": "keyword1" },
"ref": { "into": "keyword1" },
"return": { "into": "keyword1" },
"static": { "into": "keyword1" },
"struct": { "into": "keyword1" },
"trait": { "into": "keyword1" },
"type": { "into": "keyword1" },
"unsafe": { "into": "keyword1" },
"use": { "into": "keyword1" },
"where": { "into": "keyword1" },
"while": { "into": "keyword1" },
"crate": { "into": "keyword2" },
"self": { "into": "keyword2" },
"Self": { "into": "keyword2" },
"super": { "into": "keyword2" },
"bool": { "into": "keyword2" },
"i8": { "into": "keyword2" },
"i16": { "into": "keyword2" },
"i32": { "into": "keyword2" },
"i64": { "into": "keyword2" },
"i128": { "into": "keyword2" },
"isize": { "into": "keyword2" },
"u8": { "into": "keyword2" },
"u16": { "into": "keyword2" },
"u32": { "into": "keyword2" },
"u64": { "into": "keyword2" },
"u128": { "into": "keyword2" },
"usize": { "into": "keyword2" },
"f32": { "into": "keyword2" },
"f64": { "into": "keyword2" },
"char": { "into": "keyword2" },
"str": { "into": "keyword2" },
"true": { "into": "literal" },
"false": { "into": "literal" },
"abstract": { "into": "error reserved-word" },
"become": { "into": "error reserved-word" },
"box": { "into": "error reserved-word" },
"do": { "into": "error reserved-word" },
"final": { "into": "error reserved-word" },
"macro": { "into": "error reserved-word" },
"override": { "into": "error reserved-word" },
"priv": { "into": "error reserved-word" },
"try": { "into": "error reserved-word" },
"typeof": { "into": "error reserved-word" },
"unsized": { "into": "error reserved-word" },
"virtual": { "into": "error reserved-word" },
"yield": { "into": "error reserved-word" }
}
}