| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
(type_identifier) @type |
| 9 |
(identifier) @variable |
| 10 |
(field_identifier) @variable.other.member |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
(type_parameters |
| 17 |
(type_identifier) @type.parameter) |
| 18 |
(constrained_type_parameter |
| 19 |
left: (type_identifier) @type.parameter) |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
(primitive_type) @type.builtin |
| 26 |
(boolean_literal) @constant.builtin.boolean |
| 27 |
(numeric_literal) @constant.numeric.integer |
| 28 |
[ |
| 29 |
(string_literal) |
| 30 |
(shortstring_literal) |
| 31 |
] @string |
| 32 |
[ |
| 33 |
(line_comment) |
| 34 |
] @comment |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
(enum_variant (identifier) @type.enum.variant) |
| 41 |
|
| 42 |
(field_initializer |
| 43 |
(field_identifier) @variable.other.member) |
| 44 |
(shorthand_field_initializer |
| 45 |
(identifier) @variable.other.member) |
| 46 |
(shorthand_field_identifier) @variable.other.member |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
[ |
| 54 |
"::" |
| 55 |
"." |
| 56 |
";" |
| 57 |
"," |
| 58 |
] @punctuation.delimiter |
| 59 |
|
| 60 |
[ |
| 61 |
"(" |
| 62 |
")" |
| 63 |
"[" |
| 64 |
"]" |
| 65 |
"{" |
| 66 |
"}" |
| 67 |
] @punctuation.bracket |
| 68 |
(type_arguments |
| 69 |
[ |
| 70 |
"<" |
| 71 |
">" |
| 72 |
] @punctuation.bracket) |
| 73 |
(type_parameters |
| 74 |
[ |
| 75 |
"<" |
| 76 |
">" |
| 77 |
] @punctuation.bracket) |
| 78 |
(closure_parameters |
| 79 |
"|" @punctuation.bracket) |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
(let_declaration |
| 86 |
pattern: [ |
| 87 |
((identifier) @variable) |
| 88 |
((tuple_pattern |
| 89 |
(identifier) @variable)) |
| 90 |
]) |
| 91 |
|
| 92 |
|
| 93 |
(_ |
| 94 |
value: (field_expression |
| 95 |
value: (identifier)? @variable |
| 96 |
field: (field_identifier) @variable.other.member)) |
| 97 |
|
| 98 |
(parameter |
| 99 |
pattern: (identifier) @variable.parameter) |
| 100 |
|
| 101 |
(closure_parameters |
| 102 |
(identifier) @variable.parameter) |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
(for_expression |
| 108 |
"for" @keyword.control.repeat) |
| 109 |
|
| 110 |
"in" @keyword.control |
| 111 |
|
| 112 |
[ |
| 113 |
"match" |
| 114 |
"if" |
| 115 |
"else" |
| 116 |
] @keyword.control.conditional |
| 117 |
|
| 118 |
[ |
| 119 |
"while" |
| 120 |
"loop" |
| 121 |
] @keyword.control.repeat |
| 122 |
|
| 123 |
[ |
| 124 |
"break" |
| 125 |
"continue" |
| 126 |
"return" |
| 127 |
] @keyword.control.return |
| 128 |
|
| 129 |
"use" @keyword.control.import |
| 130 |
(mod_item "mod" @keyword.control.import !body) |
| 131 |
(use_as_clause "as" @keyword.control.import) |
| 132 |
|
| 133 |
|
| 134 |
[ |
| 135 |
(crate) |
| 136 |
(super) |
| 137 |
"as" |
| 138 |
"pub" |
| 139 |
"mod" |
| 140 |
(extern) |
| 141 |
(nopanic) |
| 142 |
|
| 143 |
"impl" |
| 144 |
"trait" |
| 145 |
"of" |
| 146 |
|
| 147 |
"default" |
| 148 |
] @keyword |
| 149 |
|
| 150 |
[ |
| 151 |
"struct" |
| 152 |
"enum" |
| 153 |
"type" |
| 154 |
] @keyword.storage.type |
| 155 |
|
| 156 |
"let" @keyword.storage |
| 157 |
"fn" @keyword.function |
| 158 |
|
| 159 |
(mutable_specifier) @keyword.storage.modifier.mut |
| 160 |
(ref_specifier) @keyword.storage.modifier.ref |
| 161 |
|
| 162 |
(snapshot_type "@" @keyword.storage.modifier.ref) |
| 163 |
|
| 164 |
[ |
| 165 |
"const" |
| 166 |
"ref" |
| 167 |
] @keyword.storage.modifier |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
(struct_expression |
| 177 |
name: (type_identifier) @constructor) |
| 178 |
|
| 179 |
(tuple_enum_pattern |
| 180 |
type: [ |
| 181 |
(identifier) @constructor |
| 182 |
(scoped_identifier |
| 183 |
name: (identifier) @constructor) |
| 184 |
]) |
| 185 |
(struct_pattern |
| 186 |
type: [ |
| 187 |
((type_identifier) @constructor) |
| 188 |
(scoped_type_identifier |
| 189 |
name: (type_identifier) @constructor) |
| 190 |
]) |
| 191 |
(match_pattern |
| 192 |
((identifier) @constructor) (#match? @constructor "^[A-Z]")) |
| 193 |
(or_pattern |
| 194 |
((identifier) @constructor) |
| 195 |
((identifier) @constructor) |
| 196 |
(#match? @constructor "^[A-Z]")) |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
((identifier) @constant |
| 203 |
(#match? @constant "^[A-Z][A-Z\\d_]*$")) |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
(call_expression |
| 211 |
function: [ |
| 212 |
((identifier) @constructor |
| 213 |
(#match? @constructor "^[A-Z]")) |
| 214 |
(scoped_identifier |
| 215 |
name: ((identifier) @constructor |
| 216 |
(#match? @constructor "^[A-Z]"))) |
| 217 |
]) |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
(field_expression |
| 225 |
value: (scoped_identifier |
| 226 |
path: [ |
| 227 |
(identifier) @type |
| 228 |
(scoped_identifier |
| 229 |
name: (identifier) @type) |
| 230 |
] |
| 231 |
name: (identifier) @constructor |
| 232 |
(#match? @type "^[A-Z]") |
| 233 |
(#match? @constructor "^[A-Z]"))) |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
((identifier) @type |
| 240 |
(#match? @type "^[A-Z]")) |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
(call_expression |
| 247 |
function: [ |
| 248 |
((identifier) @function) |
| 249 |
(scoped_identifier |
| 250 |
name: (identifier) @function) |
| 251 |
(field_expression |
| 252 |
field: (field_identifier) @function) |
| 253 |
]) |
| 254 |
(generic_function |
| 255 |
function: [ |
| 256 |
((identifier) @function) |
| 257 |
(scoped_identifier |
| 258 |
name: (identifier) @function) |
| 259 |
(field_expression |
| 260 |
field: (field_identifier) @function.method) |
| 261 |
]) |
| 262 |
(function_item |
| 263 |
(function |
| 264 |
name: (identifier) @function)) |
| 265 |
|
| 266 |
(function_signature_item |
| 267 |
(function |
| 268 |
name: (identifier) @function)) |
| 269 |
|
| 270 |
(external_function_item |
| 271 |
(function |
| 272 |
name: (identifier) @function)) |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
(attribute |
| 279 |
(identifier) @special |
| 280 |
arguments: (token_tree (identifier) @type) |
| 281 |
(#eq? @special "derive") |
| 282 |
) |
| 283 |
|
| 284 |
(attribute |
| 285 |
(identifier) @function.macro) |
| 286 |
(attribute |
| 287 |
[ |
| 288 |
(identifier) @function.macro |
| 289 |
(scoped_identifier |
| 290 |
name: (identifier) @function.macro) |
| 291 |
] |
| 292 |
(token_tree (identifier) @function.macro)?) |
| 293 |
|
| 294 |
(inner_attribute_item) @attribute |
| 295 |
|
| 296 |
(macro_invocation |
| 297 |
macro: [ |
| 298 |
((identifier) @function.macro) |
| 299 |
(scoped_identifier |
| 300 |
name: (identifier) @function.macro) |
| 301 |
] |
| 302 |
"!" @function.macro) |
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
[ |
| 310 |
"*" |
| 311 |
"->" |
| 312 |
"=>" |
| 313 |
"<=" |
| 314 |
"=" |
| 315 |
"==" |
| 316 |
"!" |
| 317 |
"!=" |
| 318 |
"%" |
| 319 |
"%=" |
| 320 |
"@" |
| 321 |
"&&" |
| 322 |
"|" |
| 323 |
"||" |
| 324 |
"^" |
| 325 |
"*" |
| 326 |
"*=" |
| 327 |
"-" |
| 328 |
"-=" |
| 329 |
"+" |
| 330 |
"+=" |
| 331 |
"/" |
| 332 |
"/=" |
| 333 |
">" |
| 334 |
"<" |
| 335 |
">=" |
| 336 |
">>" |
| 337 |
"<<" |
| 338 |
] @operator |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
(use_declaration |
| 345 |
argument: (identifier) @namespace) |
| 346 |
(use_wildcard |
| 347 |
(identifier) @namespace) |
| 348 |
(mod_item |
| 349 |
name: (identifier) @namespace) |
| 350 |
(scoped_use_list |
| 351 |
path: (identifier)? @namespace) |
| 352 |
(use_list |
| 353 |
(identifier) @namespace) |
| 354 |
(use_as_clause |
| 355 |
path: (identifier)? @namespace |
| 356 |
alias: (identifier) @namespace) |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
(scoped_identifier |
| 363 |
path: (identifier)? @namespace |
| 364 |
name: (identifier) @namespace) |
| 365 |
(scoped_type_identifier |
| 366 |
path: (identifier) @namespace) |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
"?" @special |