@@ -0,0 +1,135 @@
1+; Identifier conventions
3+; Assume all-caps names are constants
4+((identifier) @constant
5+ (#match? @constant "^[A-Z][A-Z\\d_]+$'"))
7+; Assume that uppercase names in paths are types
9+ path: (identifier) @type)
10+ (#match? @type "^[A-Z]"))
12+ path: (scoped_identifier
13+ name: (identifier) @type))
14+ (#match? @type "^[A-Z]"))
16+; Assume other uppercase names are enum constructors
17+((identifier) @constructor
18+ (#match? @constructor "^[A-Z]"))
23+ function: (identifier) @function)
25+ function: (field_expression
26+ field: (field_identifier) @function.method))
28+ function: (scoped_identifier
30+ name: (identifier) @function))
33+ function: (identifier) @function)
35+ function: (scoped_identifier
36+ name: (identifier) @function))
38+ function: (field_expression
39+ field: (field_identifier) @function.method))
42+ macro: (identifier) @function.macro
45+; Function definitions
47+(function_item (identifier) @function)
48+(function_signature_item (identifier) @function)
52+(type_identifier) @type
53+(primitive_type) @type.builtin
54+(field_identifier) @property
56+(line_comment) @comment
57+(block_comment) @comment
59+"(" @punctuation.bracket
60+")" @punctuation.bracket
61+"[" @punctuation.bracket
62+"]" @punctuation.bracket
65+ "<" @punctuation.bracket
66+ ">" @punctuation.bracket)
68+ "<" @punctuation.bracket
69+ ">" @punctuation.bracket)
71+"::" @punctuation.delimiter
72+"." @punctuation.delimiter
73+";" @punctuation.delimiter
75+(parameter (identifier) @variable.parameter)
77+(lifetime (identifier) @label)
95+"macro_rules!" @keyword
111+(mutable_specifier) @keyword
112+(use_list (self) @keyword)
113+(scoped_use_list (self) @keyword)
114+(scoped_identifier (self) @keyword)
117+(self) @variable.builtin
119+(char_literal) @string
120+(string_literal) @string
121+(raw_string_literal) @string
123+(boolean_literal) @constant.builtin
124+(integer_literal) @constant.builtin
125+(float_literal) @constant.builtin
127+(escape_sequence) @escape
129+(attribute_item) @attribute
130+(inner_attribute_item) @attribute