summaryrefslogtreecommitdiff
path: root/vrsite/assets/rust.scm
diff options
context:
space:
mode:
Diffstat (limited to 'vrsite/assets/rust.scm')
-rw-r--r--vrsite/assets/rust.scm48
1 files changed, 48 insertions, 0 deletions
diff --git a/vrsite/assets/rust.scm b/vrsite/assets/rust.scm
new file mode 100644
index 0000000..d23fa2c
--- /dev/null
+++ b/vrsite/assets/rust.scm
@@ -0,0 +1,48 @@
+; Minimal rust highlights. Capture names double as zed syntax theme keys.
+; Order matters: later patterns paint over earlier ones.
+
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+[";" "," "." ":" "::"] @punctuation.delimiter
+["=" "==" "!=" "<" ">" "<=" ">=" "+" "-" "*" "/" "%" "&" "|" "^" "!" "&&" "||"
+ "->" "=>" ".." "..=" "+=" "-=" "*=" "/=" "?" "@" "<<" ">>"] @operator
+
+["as" "async" "await" "break" "const" "continue" "dyn" "else" "enum"
+ "extern" "fn" "for" "if" "impl" "in" "let" "loop" "match" "mod" "move"
+ "pub" "ref" "return" "static" "struct" "trait" "type" "union"
+ "unsafe" "use" "where" "while"] @keyword
+(crate) @keyword
+(super) @keyword
+(mutable_specifier) @keyword
+
+(type_identifier) @type
+(primitive_type) @type
+(field_identifier) @property
+(shorthand_field_initializer (identifier) @property)
+(enum_variant name: (identifier) @constructor)
+(const_item name: (identifier) @constant)
+(static_item name: (identifier) @constant)
+(boolean_literal) @constant
+
+(function_item name: (identifier) @function)
+(function_signature_item name: (identifier) @function)
+(call_expression function: (identifier) @function)
+(call_expression function: (scoped_identifier name: (identifier) @function))
+(call_expression function: (field_expression field: (field_identifier) @function))
+(generic_function function: (identifier) @function)
+(generic_function function: (scoped_identifier name: (identifier) @function))
+(macro_invocation macro: (identifier) @function)
+(macro_invocation macro: (scoped_identifier name: (identifier) @function))
+
+(integer_literal) @number
+(float_literal) @number
+(char_literal) @string
+(string_literal) @string
+(raw_string_literal) @string
+(escape_sequence) @string.escape
+(lifetime) @label
+(self) @variable.special
+
+(attribute_item) @attribute
+(inner_attribute_item) @attribute
+(line_comment) @comment
+(block_comment) @comment