1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 06:20:05 +08:00
SpaceVim/bundle/nvim-treesitter/queries/c/locals.scm
2022-04-14 12:01:23 +08:00

54 lines
1.3 KiB
Scheme
Vendored

;; Functions definitions
(function_declarator
declarator: (identifier) @definition.function)
(preproc_function_def
name: (identifier) @definition.macro) @scope
(preproc_def
name: (identifier) @definition.macro)
(pointer_declarator
declarator: (identifier) @definition.var)
(parameter_declaration
declarator: (identifier) @definition.parameter)
(init_declarator
declarator: (identifier) @definition.var)
(array_declarator
declarator: (identifier) @definition.var)
(declaration
declarator: (identifier) @definition.var)
(enum_specifier
name: (_) @definition.type
(enumerator_list
(enumerator name: (identifier) @definition.var)))
;; Type / Struct / Enum
(field_declaration
declarator: (field_identifier) @definition.field)
(type_definition
declarator: (type_identifier) @definition.type)
(struct_specifier
name: (type_identifier) @definition.type)
;; goto
(labeled_statement (statement_identifier) @definition)
;; References
(identifier) @reference
((field_identifier) @reference
(set! reference.kind "field"))
((type_identifier) @reference
(set! reference.kind "type"))
(goto_statement (statement_identifier) @reference)
;; Scope
[
(for_statement)
(if_statement)
(while_statement)
(translation_unit)
(function_definition)
(compound_statement) ; a block in curly braces
(struct_specifier)
] @scope