aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-07-04 22:00:59 +0200
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-07-05 19:48:02 +0200
commit63c1853674f8f6c81bc8883383ad550499410568 (patch)
tree5e06ff1dfc89a06f992715d6c4247cf1be4b55cd
parentUpdate README.md (diff)
downloadnvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.tar
nvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.tar.gz
nvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.tar.bz2
nvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.tar.lz
nvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.tar.xz
nvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.tar.zst
nvim-treesitter-63c1853674f8f6c81bc8883383ad550499410568.zip
C/C++ highlights: update to new syntax
This changed the highlight of "switch" to conditional and of "break" to repeat.
-rw-r--r--queries/c/highlights.scm117
-rw-r--r--queries/c/locals.scm14
-rw-r--r--queries/cpp/highlights.scm51
-rw-r--r--queries/cpp/locals.scm4
4 files changed, 99 insertions, 87 deletions
diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm
index 5a79a2b5e..3fbf4ffa9 100644
--- a/queries/c/highlights.scm
+++ b/queries/c/highlights.scm
@@ -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
diff --git a/queries/c/locals.scm b/queries/c/locals.scm
index 505db5b57..06b5a4c95 100644
--- a/queries/c/locals.scm
+++ b/queries/c/locals.scm
@@ -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
diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm
index 0d8295a1d..49382bdf7 100644
--- a/queries/cpp/highlights.scm
+++ b/queries/cpp/highlights.scm
@@ -60,7 +60,6 @@
(argument_list))
(#match? @constructor "^[A-Z]"))
-(auto) @keyword
; Constants
@@ -72,25 +71,33 @@
; Keywords
-"catch" @exception
-"class" @keyword
-"constexpr" @keyword
-"delete" @keyword
-"explicit" @keyword
-"final" @exception
-"friend" @keyword
-"mutable" @keyword
-"namespace" @keyword
-"noexcept" @keyword
-"new" @keyword
-"override" @keyword
-"private" @keyword
-"protected" @keyword
-"public" @keyword
-"template" @keyword
-"throw" @keyword
-"try" @exception
-"typename" @keyword
-"using" @keyword
-"virtual" @keyword
+[
+ "try"
+ "catch"
+ "noexcept"
+ "throw"
+] @exception
+
+
+[
+ "class"
+ "constexpr"
+ "delete"
+ "explicit"
+ "final"
+ "friend"
+ "mutable"
+ "namespace"
+ "new"
+ "override"
+ "private"
+ "protected"
+ "public"
+ "template"
+ "typename"
+ "using"
+ "virtual"
+ (auto)
+] @keyword
+
"::" @operator
diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm
index e2e32a140..47b69c866 100644
--- a/queries/cpp/locals.scm
+++ b/queries/cpp/locals.scm
@@ -11,14 +11,14 @@
(struct_specifier
name: (scoped_type_identifier
- name: (type_identifier) @definition.type) )
+ name: (type_identifier) @definition.type))
(class_specifier
name: (type_identifier) @definition.type)
(class_specifier
name: (scoped_type_identifier
- name: (type_identifier) @definition.type) )
+ name: (type_identifier) @definition.type))
;; Function defintions
(template_function