Add cpp/locals.scm

This commit is contained in:
Stephan Seitz 2020-05-23 21:23:05 +02:00
parent b95e0af73b
commit 1badceea81
2 changed files with 57 additions and 3 deletions

49
queries/cpp/locals.scm Normal file
View 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)