mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 17:30:08 -04:00
Add cpp/locals.scm
This commit is contained in:
parent
b95e0af73b
commit
1badceea81
2 changed files with 57 additions and 3 deletions
|
|
@ -61,7 +61,11 @@
|
||||||
(match? @constructor "^[A-Z]"))
|
(match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
(auto) @keyword
|
(auto) @keyword
|
||||||
(class_specifier)
|
|
||||||
|
;; Parameters
|
||||||
|
; normals
|
||||||
|
(parameter_list
|
||||||
|
(parameter_declaration) @parameter)
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
|
|
||||||
|
|
@ -77,14 +81,14 @@
|
||||||
"catch" @exception
|
"catch" @exception
|
||||||
"class" @keyword
|
"class" @keyword
|
||||||
"constexpr" @keyword
|
"constexpr" @keyword
|
||||||
"delete" @operator
|
"delete" @keyword
|
||||||
"explicit" @keyword
|
"explicit" @keyword
|
||||||
"final" @exception
|
"final" @exception
|
||||||
"friend" @keyword
|
"friend" @keyword
|
||||||
"mutable" @keyword
|
"mutable" @keyword
|
||||||
"namespace" @keyword
|
"namespace" @keyword
|
||||||
"noexcept" @keyword
|
"noexcept" @keyword
|
||||||
"new" @operator
|
"new" @keyword
|
||||||
"override" @keyword
|
"override" @keyword
|
||||||
"private" @keyword
|
"private" @keyword
|
||||||
"protected" @keyword
|
"protected" @keyword
|
||||||
|
|
@ -95,3 +99,4 @@
|
||||||
"typename" @keyword
|
"typename" @keyword
|
||||||
"using" @keyword
|
"using" @keyword
|
||||||
"virtual" @keyword
|
"virtual" @keyword
|
||||||
|
"::" @operator
|
||||||
|
|
|
||||||
49
queries/cpp/locals.scm
Normal file
49
queries/cpp/locals.scm
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
;; Class / struct defintions
|
||||||
|
(class_specifier) @scope
|
||||||
|
(struct_specifier) @scope
|
||||||
|
|
||||||
|
|
||||||
|
(struct_specifier
|
||||||
|
name: (type_identifier) @definition.type)
|
||||||
|
|
||||||
|
(struct_specifier
|
||||||
|
name: (scoped_type_identifier
|
||||||
|
name: (type_identifier) @definition.type) )
|
||||||
|
|
||||||
|
(class_specifier
|
||||||
|
name: (type_identifier) @definition.type)
|
||||||
|
|
||||||
|
(class_specifier
|
||||||
|
name: (scoped_type_identifier
|
||||||
|
name: (type_identifier) @definition.type) )
|
||||||
|
|
||||||
|
;; Function defintions
|
||||||
|
(template_function
|
||||||
|
name: (identifier) @definition.function) @scope
|
||||||
|
|
||||||
|
(template_method
|
||||||
|
name: (field_identifier) @definition.method) @scope
|
||||||
|
|
||||||
|
(template_function
|
||||||
|
name: (scoped_identifier
|
||||||
|
name: (identifier) @definition.function)) @scope
|
||||||
|
|
||||||
|
(function_declarator
|
||||||
|
declarator: (scoped_identifier
|
||||||
|
name: (type_identifier) @definition.function)) @scope
|
||||||
|
|
||||||
|
(field_declaration
|
||||||
|
declarator: (function_declarator
|
||||||
|
(field_identifier) @definition.method))
|
||||||
|
|
||||||
|
(lambda_expression) @scope
|
||||||
|
|
||||||
|
;; Control structures
|
||||||
|
(try_statement
|
||||||
|
body: (*) @scope)
|
||||||
|
|
||||||
|
(catch_clause) @scope
|
||||||
|
|
||||||
|
(destructor_name
|
||||||
|
name: (*) @constructor)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue