| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
"?" @special |
| 7 |
|
| 8 |
(type_identifier) @type |
| 9 |
(identifier) @variable |
| 10 |
(field_identifier) @variable.other.member |
| 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 |
"<<" |
| 49 |
">>=" |
| 50 |
"<<=" |
| 51 |
"@" |
| 52 |
".." |
| 53 |
"..=" |
| 54 |
"..." |
| 55 |
"'" |
| 56 |
] @operator |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
(use_declaration |
| 63 |
argument: (identifier) @namespace) |
| 64 |
(use_wildcard |
| 65 |
(identifier) @namespace) |
| 66 |
(extern_crate_declaration |
| 67 |
name: (identifier) @namespace |
| 68 |
alias: (identifier)? @namespace) |
| 69 |
(mod_item |
| 70 |
name: (identifier) @namespace) |
| 71 |
(scoped_use_list |
| 72 |
path: (identifier)? @namespace) |
| 73 |
(use_list |
| 74 |
(identifier) @namespace) |
| 75 |
(use_as_clause |
| 76 |
path: (identifier)? @namespace |
| 77 |
alias: (identifier) @namespace) |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
(type_parameter |
| 84 |
name: (type_identifier) @type.parameter) |
| 85 |
((type_arguments (type_identifier) @constant) |
| 86 |
(#match? @constant "^[A-Z_]+$")) |
| 87 |
(type_arguments (type_identifier) @type) |
| 88 |
|
| 89 |
|
| 90 |
("_" @comment.unused) |
| 91 |
|
| 92 |
((type_arguments (type_identifier) @comment.unused) |
| 93 |
(#eq? @comment.unused "_")) |
| 94 |
|
| 95 |
((array_type (type_identifier) @comment.unused) |
| 96 |
(#eq? @comment.unused "_")) |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
(escape_sequence) @constant.character.escape |
| 103 |
(primitive_type) @type.builtin |
| 104 |
(boolean_literal) @constant.builtin.boolean |
| 105 |
(integer_literal) @constant.numeric.integer |
| 106 |
(float_literal) @constant.numeric.float |
| 107 |
(char_literal) @constant.character |
| 108 |
[ |
| 109 |
(string_literal) |
| 110 |
(raw_string_literal) |
| 111 |
] @string |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
(shebang) @comment |
| 118 |
(line_comment) @comment.line |
| 119 |
(block_comment) @comment.block |
| 120 |
|
| 121 |
|
| 122 |
(line_comment |
| 123 |
(outer_doc_comment_marker "/" @comment.line.documentation) |
| 124 |
(doc_comment)) @comment.line.documentation |
| 125 |
(line_comment |
| 126 |
(inner_doc_comment_marker "!" @comment.line.documentation) |
| 127 |
(doc_comment)) @comment.line.documentation |
| 128 |
|
| 129 |
(block_comment |
| 130 |
(outer_doc_comment_marker) @comment.block.documentation |
| 131 |
(doc_comment) "*/" @comment.block.documentation) @comment.block.documentation |
| 132 |
(block_comment |
| 133 |
(inner_doc_comment_marker) @comment.block.documentation |
| 134 |
(doc_comment) "*/" @comment.block.documentation) @comment.block.documentation |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
(self) @variable.builtin |
| 141 |
|
| 142 |
(field_initializer |
| 143 |
(field_identifier) @variable.other.member) |
| 144 |
(shorthand_field_initializer |
| 145 |
(identifier) @variable.other.member) |
| 146 |
(shorthand_field_identifier) @variable.other.member |
| 147 |
|
| 148 |
(lifetime |
| 149 |
"'" @label |
| 150 |
(identifier) @label) |
| 151 |
(label |
| 152 |
"'" @label |
| 153 |
(identifier) @label) |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
[ |
| 160 |
"::" |
| 161 |
"." |
| 162 |
";" |
| 163 |
"," |
| 164 |
":" |
| 165 |
] @punctuation.delimiter |
| 166 |
|
| 167 |
[ |
| 168 |
"(" |
| 169 |
")" |
| 170 |
"[" |
| 171 |
"]" |
| 172 |
"{" |
| 173 |
"}" |
| 174 |
"#" |
| 175 |
] @punctuation.bracket |
| 176 |
(type_arguments |
| 177 |
[ |
| 178 |
"<" |
| 179 |
">" |
| 180 |
] @punctuation.bracket) |
| 181 |
(type_parameters |
| 182 |
[ |
| 183 |
"<" |
| 184 |
">" |
| 185 |
] @punctuation.bracket) |
| 186 |
(for_lifetimes ["<" ">"] @punctuation.bracket) |
| 187 |
(closure_parameters |
| 188 |
"|" @punctuation.bracket) |
| 189 |
(bracketed_type ["<" ">"] @punctuation.bracket) |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
(let_declaration |
| 196 |
pattern: [ |
| 197 |
((identifier) @variable) |
| 198 |
((tuple_pattern |
| 199 |
(identifier) @variable)) |
| 200 |
]) |
| 201 |
|
| 202 |
|
| 203 |
(_ |
| 204 |
value: (field_expression |
| 205 |
value: (identifier)? @variable |
| 206 |
field: (field_identifier) @variable.other.member)) |
| 207 |
|
| 208 |
(parameter |
| 209 |
pattern: (identifier) @variable.parameter) |
| 210 |
(closure_parameters |
| 211 |
(identifier) @variable.parameter) |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
(let_declaration |
| 216 |
(mutable_specifier) |
| 217 |
pattern: (identifier) @variable.mutable) |
| 218 |
(mut_pattern |
| 219 |
(mutable_specifier) |
| 220 |
(identifier) @variable.mutable) |
| 221 |
|
| 222 |
(parameter |
| 223 |
(mutable_specifier) |
| 224 |
pattern: (identifier) @variable.parameter.mutable) |
| 225 |
|
| 226 |
(self_parameter |
| 227 |
(mutable_specifier) |
| 228 |
(self) @variable.builtin.mutable) |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
"in" @keyword.control |
| 235 |
|
| 236 |
[ |
| 237 |
"match" |
| 238 |
"if" |
| 239 |
"else" |
| 240 |
"try" |
| 241 |
] @keyword.control.conditional |
| 242 |
|
| 243 |
[ |
| 244 |
"while" |
| 245 |
"loop" |
| 246 |
] @keyword.control.repeat |
| 247 |
|
| 248 |
[ |
| 249 |
"break" |
| 250 |
"continue" |
| 251 |
"return" |
| 252 |
"await" |
| 253 |
"yield" |
| 254 |
] @keyword.control.return |
| 255 |
|
| 256 |
"use" @keyword.control.import |
| 257 |
(mod_item "mod" @keyword.control.import !body) |
| 258 |
(use_as_clause "as" @keyword.control.import) |
| 259 |
|
| 260 |
(type_cast_expression "as" @keyword.operator) |
| 261 |
|
| 262 |
[ |
| 263 |
(crate) |
| 264 |
(super) |
| 265 |
"as" |
| 266 |
"pub" |
| 267 |
"mod" |
| 268 |
"extern" |
| 269 |
|
| 270 |
"impl" |
| 271 |
"where" |
| 272 |
"trait" |
| 273 |
"for" |
| 274 |
|
| 275 |
"default" |
| 276 |
"async" |
| 277 |
] @keyword |
| 278 |
|
| 279 |
(for_expression |
| 280 |
"for" @keyword.control.repeat) |
| 281 |
(gen_block "gen" @keyword.control) |
| 282 |
|
| 283 |
[ |
| 284 |
"struct" |
| 285 |
"enum" |
| 286 |
"union" |
| 287 |
"type" |
| 288 |
] @keyword.storage.type |
| 289 |
|
| 290 |
"let" @keyword.storage |
| 291 |
"fn" @keyword.function |
| 292 |
"unsafe" @keyword.storage.modifier |
| 293 |
"macro_rules!" @function.macro |
| 294 |
|
| 295 |
(mutable_specifier) @keyword.storage.modifier.mut |
| 296 |
|
| 297 |
(reference_type "&" @keyword.storage.modifier.ref) |
| 298 |
(self_parameter "&" @keyword.storage.modifier.ref) |
| 299 |
|
| 300 |
[ |
| 301 |
"static" |
| 302 |
"const" |
| 303 |
"raw" |
| 304 |
"ref" |
| 305 |
"move" |
| 306 |
"dyn" |
| 307 |
] @keyword.storage.modifier |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
(scoped_identifier |
| 314 |
path: (identifier)? @namespace |
| 315 |
name: (identifier) @namespace) |
| 316 |
(scoped_type_identifier |
| 317 |
path: (identifier) @namespace) |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
(call_expression |
| 334 |
function: _ |
| 335 |
arguments: (arguments |
| 336 |
(scoped_identifier |
| 337 |
path: _ |
| 338 |
name: (identifier) @function))) |
| 339 |
|
| 340 |
(call_expression |
| 341 |
function: [ |
| 342 |
((identifier) @function) |
| 343 |
(scoped_identifier |
| 344 |
name: (identifier) @function) |
| 345 |
ow |
| 346 |
(field_expression |
| 347 |
field: (field_identifier) @function.method) |
| 348 |
]) |
| 349 |
(generic_function |
| 350 |
function: [ |
| 351 |
((identifier) @function) |
| 352 |
(scoped_identifier |
| 353 |
name: (identifier) @function) |
| 354 |
(field_expression |
| 355 |
field: (field_identifier) @function.method) |
| 356 |
]) |
| 357 |
|
| 358 |
(function_item |
| 359 |
name: (identifier) @function) |
| 360 |
|
| 361 |
(function_signature_item |
| 362 |
name: (identifier) @function) |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
((identifier) @type |
| 370 |
(#match? @type "^[A-Z]")) |
| 371 |
|
| 372 |
(never_type "!" @type) |
| 373 |
|
| 374 |
((identifier) @constant |
| 375 |
(#match? @constant "^[A-Z][A-Z\\d_]*$")) |
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
(call_expression |
| 383 |
function: [ |
| 384 |
((identifier) @constructor |
| 385 |
(#match? @constructor "^[A-Z]")) |
| 386 |
(scoped_identifier |
| 387 |
name: ((identifier) @constructor |
| 388 |
(#match? @constructor "^[A-Z]"))) |
| 389 |
]) |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
(field_expression |
| 397 |
value: (scoped_identifier |
| 398 |
path: [ |
| 399 |
(identifier) @type |
| 400 |
(scoped_identifier |
| 401 |
name: (identifier) @type) |
| 402 |
] |
| 403 |
name: (identifier) @constructor |
| 404 |
(#match? @type "^[A-Z]") |
| 405 |
(#match? @constructor "^[A-Z]"))) |
| 406 |
|
| 407 |
(enum_variant (identifier) @type.enum.variant) |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
(struct_expression |
| 416 |
name: (type_identifier) @constructor) |
| 417 |
|
| 418 |
(tuple_struct_pattern |
| 419 |
type: [ |
| 420 |
(identifier) @constructor |
| 421 |
(scoped_identifier |
| 422 |
name: (identifier) @constructor) |
| 423 |
]) |
| 424 |
(struct_pattern |
| 425 |
type: [ |
| 426 |
((type_identifier) @constructor) |
| 427 |
(scoped_type_identifier |
| 428 |
name: (type_identifier) @constructor) |
| 429 |
]) |
| 430 |
(match_pattern |
| 431 |
((identifier) @constructor) (#match? @constructor "^[A-Z]")) |
| 432 |
(or_pattern |
| 433 |
((identifier) @constructor) |
| 434 |
((identifier) @constructor) |
| 435 |
(#match? @constructor "^[A-Z]")) |
| 436 |
|
| 437 |
(match_pattern |
| 438 |
(scoped_identifier |
| 439 |
path: [(identifier) @type (scoped_identifier name: (identifier) @type)] |
| 440 |
name: (identifier) @type.enum.variant |
| 441 |
(#match? @type "^[A-Z]") |
| 442 |
(#match? @type.enum.variant "^[A-Z]"))) |
| 443 |
|
| 444 |
(match_pattern |
| 445 |
(struct_pattern |
| 446 |
type: (scoped_type_identifier |
| 447 |
path: [(identifier) @type (scoped_identifier name: (identifier) @type)] |
| 448 |
name: (type_identifier) @type.enum.variant |
| 449 |
(#match? @type "^[A-Z]") |
| 450 |
(#match? @type.enum.variant "^[A-Z]")))) |
| 451 |
|
| 452 |
(match_pattern |
| 453 |
(tuple_struct_pattern |
| 454 |
type: (scoped_identifier |
| 455 |
path: [(identifier) @type (scoped_identifier name: (identifier) @type)] |
| 456 |
name: (identifier) @type.enum.variant |
| 457 |
(#match? @type "^[A-Z]") |
| 458 |
(#match? @type.enum.variant "^[A-Z]")))) |
| 459 |
|
| 460 |
(match_pattern |
| 461 |
(scoped_identifier |
| 462 |
name: (identifier) @constant |
| 463 |
(#match? @constant "^[A-Z_]+$"))) |
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
(attribute |
| 470 |
(identifier) @function.macro) |
| 471 |
(inner_attribute_item "!" @punctuation) |
| 472 |
(attribute |
| 473 |
[ |
| 474 |
(identifier) @function.macro |
| 475 |
(scoped_identifier |
| 476 |
name: (identifier) @function.macro) |
| 477 |
] |
| 478 |
(token_tree (identifier) @function.macro)?) |
| 479 |
|
| 480 |
(inner_attribute_item) @attribute |
| 481 |
|
| 482 |
(macro_definition |
| 483 |
name: (identifier) @function.macro) |
| 484 |
(macro_invocation |
| 485 |
macro: [ |
| 486 |
((identifier) @function.macro) |
| 487 |
(scoped_identifier |
| 488 |
name: (identifier) @function.macro) |
| 489 |
] |
| 490 |
"!" @function.macro) |
| 491 |
|
| 492 |
(metavariable) @variable.parameter |
| 493 |
(fragment_specifier) @type |
| 494 |
|
| 495 |
(attribute |
| 496 |
(identifier) @special |
| 497 |
arguments: (token_tree (identifier) @type) |
| 498 |
(#eq? @special "derive") |
| 499 |
) |
| 500 |
|
| 501 |
(token_repetition_pattern) @punctuation.delimiter |
| 502 |
(token_repetition_pattern [")" "(" "$"] @punctuation.special) |
| 503 |
(token_repetition_pattern "?" @operator) |
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
((identifier) @type.enum.variant.builtin |
| 510 |
(#any-of? @type.enum.variant.builtin "Some" "None" "Ok" "Err")) |
| 511 |
|
| 512 |
|
| 513 |
(call_expression |
| 514 |
(identifier) @function.builtin |
| 515 |
(#any-of? @function.builtin |
| 516 |
"drop" |
| 517 |
"size_of" |
| 518 |
"size_of_val" |
| 519 |
"align_of" |
| 520 |
"align_of_val")) |
| 521 |
|
| 522 |
((type_identifier) @type.builtin |
| 523 |
(#any-of? |
| 524 |
@type.builtin |
| 525 |
"Send" |
| 526 |
"Sized" |
| 527 |
"Sync" |
| 528 |
"Unpin" |
| 529 |
"Drop" |
| 530 |
"Fn" |
| 531 |
"FnMut" |
| 532 |
"FnOnce" |
| 533 |
"AsMut" |
| 534 |
"AsRef" |
| 535 |
"From" |
| 536 |
"Into" |
| 537 |
"DoubleEndedIterator" |
| 538 |
"ExactSizeIterator" |
| 539 |
"Extend" |
| 540 |
"IntoIterator" |
| 541 |
"Iterator" |
| 542 |
"Option" |
| 543 |
"Result" |
| 544 |
"Clone" |
| 545 |
"Copy" |
| 546 |
"Debug" |
| 547 |
"Default" |
| 548 |
"Eq" |
| 549 |
"Hash" |
| 550 |
"Ord" |
| 551 |
"PartialEq" |
| 552 |
"PartialOrd" |
| 553 |
"ToOwned" |
| 554 |
"Box" |
| 555 |
"String" |
| 556 |
"ToString" |
| 557 |
"Vec" |
| 558 |
"FromIterator" |
| 559 |
"TryFrom" |
| 560 |
"TryInto")) |