mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -04:00
C/C++ highlights: update to new syntax
This changed the highlight of "switch" to conditional and of "break" to repeat.
This commit is contained in:
parent
bf015c168f
commit
63c1853674
4 changed files with 99 additions and 87 deletions
|
|
@ -1,24 +1,34 @@
|
|||
"break" @keyword
|
||||
"case" @conditional
|
||||
"const" @keyword
|
||||
"continue" @repeat
|
||||
"default" @keyword
|
||||
"do" @repeat
|
||||
"else" @conditional
|
||||
"enum" @keyword
|
||||
"extern" @keyword
|
||||
"for" @repeat
|
||||
"if" @conditional
|
||||
"inline" @keyword
|
||||
"return" @keyword
|
||||
"sizeof" @keyword
|
||||
"static" @keyword
|
||||
"struct" @keyword
|
||||
"switch" @keyword
|
||||
"typedef" @keyword
|
||||
"union" @keyword
|
||||
"volatile" @keyword
|
||||
"while" @repeat
|
||||
[
|
||||
"const"
|
||||
"default"
|
||||
"enum"
|
||||
"extern"
|
||||
"inline"
|
||||
"return"
|
||||
"sizeof"
|
||||
"static"
|
||||
"struct"
|
||||
"typedef"
|
||||
"union"
|
||||
"volatile"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"break"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @conditional
|
||||
|
||||
(conditional_expression [ "?" ":" ] @conditional)
|
||||
|
||||
"#define" @constant.macro
|
||||
[
|
||||
|
|
@ -32,45 +42,38 @@
|
|||
(preproc_directive)
|
||||
] @keyword
|
||||
|
||||
"--" @operator
|
||||
"-" @operator
|
||||
"->" @operator
|
||||
"!=" @operator
|
||||
"*" @operator
|
||||
"/" @operator
|
||||
"&" @operator
|
||||
"&&" @operator
|
||||
"+" @operator
|
||||
"++" @operator
|
||||
"<" @operator
|
||||
"<=" @operator
|
||||
"==" @operator
|
||||
"=" @operator
|
||||
"~" @operator
|
||||
">" @operator
|
||||
">=" @operator
|
||||
"!" @operator
|
||||
"||" @operator
|
||||
(conditional_expression [ "?" ":" ] @conditional)
|
||||
[
|
||||
"--"
|
||||
"-"
|
||||
"->"
|
||||
"!="
|
||||
"*"
|
||||
"/"
|
||||
"&"
|
||||
"&&"
|
||||
"+"
|
||||
"++"
|
||||
"<"
|
||||
"<="
|
||||
"=="
|
||||
"="
|
||||
"~"
|
||||
">"
|
||||
">="
|
||||
"!"
|
||||
"||"
|
||||
|
||||
"-=" @operator
|
||||
"+=" @operator
|
||||
"*=" @operator
|
||||
"/=" @operator
|
||||
"|=" @operator
|
||||
"&=" @operator
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"|="
|
||||
"&="
|
||||
] @operator
|
||||
|
||||
"." @punctuation.delimiter
|
||||
";" @punctuation.delimiter
|
||||
":" @punctuation.delimiter
|
||||
"," @punctuation.delimiter
|
||||
[ "." ";" ":" "," ] @punctuation.delimiter
|
||||
|
||||
"(" @punctuation.bracket
|
||||
")" @punctuation.bracket
|
||||
"[" @punctuation.bracket
|
||||
"]" @punctuation.bracket
|
||||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
||||
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
(string_literal) @string
|
||||
(system_lib_string) @string
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@
|
|||
(identifier) @reference
|
||||
|
||||
;; Scope
|
||||
(for_statement) @scope
|
||||
(if_statement) @scope
|
||||
(while_statement) @scope
|
||||
(translation_unit) @scope
|
||||
(function_definition) @scope
|
||||
(compound_statement) @scope ; a block in curly braces
|
||||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(translation_unit)
|
||||
(function_definition)
|
||||
(compound_statement) ; a block in curly braces
|
||||
] @scope
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue