1(type_identifier) @type
2(primitive_type) @type.builtin
3
4(field_identifier) @property
5
6(call_expression
7 function: [
8 (identifier) @function
9 (scoped_identifier
10 name: (identifier) @function)
11 (field_expression
12 field: (field_identifier) @function.method)
13 ])
14
15(function_item name: (identifier) @function.definition)
16(function_signature_item name: (identifier) @function.definition)
17
18; Identifier conventions
19
20; Assume uppercase names are enum constructors
21((identifier) @variant
22 (#match? @variant "^[A-Z]"))
23
24; Assume that uppercase names in paths are types
25((scoped_identifier
26 path: (identifier) @type)
27 (#match? @type "^[A-Z]"))
28((scoped_identifier
29 path: (scoped_identifier
30 name: (identifier) @type))
31 (#match? @type "^[A-Z]"))
32
33; Assume all-caps names are constants
34((identifier) @constant
35 (#match? @constant "^[A-Z][A-Z\\d_]+$"))
36
37[
38 "("
39 ")"
40 "{"
41 "}"
42 "["
43 "]"
44] @punctuation.bracket
45
46(_
47 .
48 "<" @punctuation.bracket
49 ">" @punctuation.bracket)
50
51[
52 "as"
53 "async"
54 "break"
55 "const"
56 "continue"
57 "default"
58 "dyn"
59 "else"
60 "enum"
61 "extern"
62 "for"
63 "fn"
64 "if"
65 "in"
66 "impl"
67 "let"
68 "loop"
69 "macro_rules!"
70 "match"
71 "mod"
72 "move"
73 "pub"
74 "return"
75 "static"
76 "struct"
77 "trait"
78 "type"
79 "use"
80 "where"
81 "while"
82 "union"
83 "unsafe"
84 (mutable_specifier)
85 (super)
86] @keyword
87
88[
89 (string_literal)
90 (raw_string_literal)
91 (char_literal)
92] @string
93
94[
95 (line_comment)
96 (block_comment)
97] @comment