highlights(rust): update operators

- sort operators
- remove duplicated `*`
- add missing `<<=`

- highlight `as` correctly in path aliasing
- highlight leading quote `'` as part of a label (not an operator)
- highlight never type `!` as a type

- sort and format punctuation
This commit is contained in:
Sergio Alejandro Vargas 2021-11-05 11:18:39 -05:00 committed by Stephan Seitz
parent 08243017f2
commit 81f75a54ff

View file

@ -133,8 +133,8 @@
(parameter (identifier) @parameter) (parameter (identifier) @parameter)
(closure_parameters (_) @parameter) (closure_parameters (_) @parameter)
(lifetime (identifier) @label) (lifetime ["'" (identifier)] @label)
(loop_label (identifier) @label) (loop_label ["'" (identifier)] @label)
(self) @variable.builtin (self) @variable.builtin
@ -203,76 +203,56 @@
(escape_sequence) @string.escape (escape_sequence) @string.escape
[ (type_cast_expression "as" @keyword.operator)
"as" (use_as_clause "as" @include) ; path aliasing
] @keyword.operator
[ [
"*" "!"
"'" "!="
"->" "%"
"=>" "%="
"<=" "&"
"=" "&&"
"==" "&="
"!" "*"
"!=" "*="
"%" "+"
"%=" "+="
"&" "-"
"&=" "-="
"&&" "->"
"|" ".."
"|=" "..="
"||" "/"
"^" "/="
"^=" "<"
"*" "<<"
"*=" "<<="
"-" "<="
"-=" "="
"+" "=="
"+=" "=>"
"/" ">"
"/=" ">="
">" ">>"
"<" ">>="
">=" "?"
">>" "@"
"<<" "^"
">>=" "^="
"@" "|"
".." "|="
"..=" "||"
"?"
] @operator ] @operator
[ ["(" ")" "[" "]" "{" "}"] @punctuation.bracket
"(" (closure_parameters "|" @punctuation.bracket)
")" (type_arguments ["<" ">"] @punctuation.bracket)
"[" (type_parameters ["<" ">"] @punctuation.bracket)
"]"
"{"
"}"
] @punctuation.bracket
(closure_parameters "|" @punctuation.bracket) ["," "." ":" "::" ";"] @punctuation.delimiter
(type_arguments
"<" @punctuation.bracket
">" @punctuation.bracket)
(type_parameters
"<" @punctuation.bracket
">" @punctuation.bracket)
[
":"
"::"
"."
";"
","
] @punctuation.delimiter
(attribute_item "#" @punctuation.special) (attribute_item "#" @punctuation.special)
(inner_attribute_item ["#" "!"] @punctuation.special) (inner_attribute_item ["!" "#"] @punctuation.special)
(macro_invocation "!" @function.macro) ; don't highlight `!` as an operator here (macro_invocation "!" @function.macro)
(empty_type "!" @type.builtin)