summaryrefslogtreecommitdiff
path: root/web/assets/rust.scm
blob: d23fa2caecfc47041906055f0ee1e18367b7fd03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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