mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 01:10:02 -04:00
Update C/C++ highlights to new query syntax
This commit is contained in:
parent
e46baab8ca
commit
a5fc7b13cc
4 changed files with 17 additions and 16 deletions
|
|
@ -94,10 +94,10 @@
|
||||||
(sized_type_specifier) @type
|
(sized_type_specifier) @type
|
||||||
|
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(match? @type "^[A-Z]"))
|
(#match? @type "^[A-Z]"))
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(match? @constant "^[A-Z][A-Z\\d_]+$"))
|
(#match? @constant "^[A-Z][A-Z\\d_]+$"))
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
|
|
@ -109,3 +109,4 @@
|
||||||
(identifier)) @parameter
|
(identifier)) @parameter
|
||||||
|
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
(declaration
|
(declaration
|
||||||
declarator: (identifier) @definition.var)
|
declarator: (identifier) @definition.var)
|
||||||
(enum_specifier
|
(enum_specifier
|
||||||
name: (*) @definition.type
|
name: (_) @definition.type
|
||||||
(enumerator_list
|
(enumerator_list
|
||||||
(enumerator name: (identifier) @definition.var)))
|
(enumerator name: (identifier) @definition.var)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
((identifier) @field
|
((identifier) @field
|
||||||
(match? @field "^_"))
|
(#match? @field "^_"))
|
||||||
|
|
||||||
((identifier) @field
|
((identifier) @field
|
||||||
(match? @field "^m_"))
|
(#match? @field "^m_"))
|
||||||
|
|
||||||
((identifier) @field
|
((identifier) @field
|
||||||
(match? @field "_$"))
|
(#match? @field "_$"))
|
||||||
|
|
||||||
;(field_expression) @parameter ;; How to highlight this?
|
;(field_expression) @parameter ;; How to highlight this?
|
||||||
(template_function
|
(template_function
|
||||||
|
|
@ -21,12 +21,12 @@
|
||||||
(namespace_identifier) @constant
|
(namespace_identifier) @constant
|
||||||
|
|
||||||
((namespace_identifier) @type
|
((namespace_identifier) @type
|
||||||
(match? @type "^[A-Z]"))
|
(#match? @type "^[A-Z]"))
|
||||||
((namespace_identifier) @constant
|
((namespace_identifier) @constant
|
||||||
(match? @constant "^[A-Z][A-Z_1-9]*$"))
|
(#match? @constant "^[A-Z][A-Z_1-9]*$"))
|
||||||
|
|
||||||
(destructor_name
|
(destructor_name
|
||||||
name: (*) @function)
|
name: (_) @function)
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (scoped_identifier
|
declarator: (scoped_identifier
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
((function_declarator
|
((function_declarator
|
||||||
declarator: (scoped_identifier
|
declarator: (scoped_identifier
|
||||||
name: (identifier) @constructor))
|
name: (identifier) @constructor))
|
||||||
(match? @constructor "^[A-Z]"))
|
(#match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (scoped_identifier
|
function: (scoped_identifier
|
||||||
|
|
@ -47,18 +47,18 @@
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (scoped_identifier
|
function: (scoped_identifier
|
||||||
name: (identifier) @constructor))
|
name: (identifier) @constructor))
|
||||||
(match? @constructor "^[A-Z]"))
|
(#match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (field_expression
|
function: (field_expression
|
||||||
field: (field_identifier) @function))
|
field: (field_identifier) @constructor))
|
||||||
(match? @function "^[A-Z]"))
|
(#match? @function "^[A-Z]"))
|
||||||
|
|
||||||
;; constructing a type in a intizializer list: Constructor (): **SuperType (1)**
|
;; constructing a type in a intizializer list: Constructor (): **SuperType (1)**
|
||||||
((field_initializer
|
((field_initializer
|
||||||
(field_identifier) @constructor
|
(field_identifier) @constructor
|
||||||
(argument_list))
|
(argument_list))
|
||||||
(match? @constructor "^[A-Z]"))
|
(#match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
(auto) @keyword
|
(auto) @keyword
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@
|
||||||
|
|
||||||
;; Control structures
|
;; Control structures
|
||||||
(try_statement
|
(try_statement
|
||||||
body: (*) @scope)
|
body: (_) @scope)
|
||||||
|
|
||||||
(catch_clause) @scope
|
(catch_clause) @scope
|
||||||
|
|
||||||
(destructor_name
|
(destructor_name
|
||||||
name: (*) @constructor)
|
name: (_) @constructor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue