2024-01-06 15:05:50 +09:00
|
|
|
; Functions definitions
|
2020-05-15 11:45:25 +02:00
|
|
|
(function_declarator
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (identifier) @local.definition.function)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(preproc_function_def
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.macro) @local.scope
|
2020-05-15 11:45:25 +02:00
|
|
|
|
|
|
|
|
(preproc_def
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.macro)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(pointer_declarator
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (identifier) @local.definition.var)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(parameter_declaration
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (identifier) @local.definition.parameter)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(init_declarator
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (identifier) @local.definition.var)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(array_declarator
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (identifier) @local.definition.var)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(declaration
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (identifier) @local.definition.var)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(enum_specifier
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (_) @local.definition.type
|
2020-05-15 11:45:25 +02:00
|
|
|
(enumerator_list
|
2024-01-06 15:05:50 +09:00
|
|
|
(enumerator
|
|
|
|
|
name: (identifier) @local.definition.var)))
|
2020-05-15 11:45:25 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Type / Struct / Enum
|
2020-05-15 11:45:25 +02:00
|
|
|
(field_declaration
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (field_identifier) @local.definition.field)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-05-15 11:45:25 +02:00
|
|
|
(type_definition
|
2023-07-22 15:29:32 +02:00
|
|
|
declarator: (type_identifier) @local.definition.type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-11 01:47:05 +02:00
|
|
|
(struct_specifier
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (type_identifier) @local.definition.type)
|
2020-05-15 11:45:25 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; goto
|
|
|
|
|
(labeled_statement
|
|
|
|
|
(statement_identifier) @local.definition)
|
2021-01-22 11:36:27 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; References
|
2023-07-22 15:29:32 +02:00
|
|
|
(identifier) @local.reference
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-07-22 15:29:32 +02:00
|
|
|
((field_identifier) @local.reference
|
2024-01-06 15:05:50 +09:00
|
|
|
(#set! reference.kind "field"))
|
|
|
|
|
|
2023-07-22 15:29:32 +02:00
|
|
|
((type_identifier) @local.reference
|
2024-01-06 15:05:50 +09:00
|
|
|
(#set! reference.kind "type"))
|
2020-05-15 11:45:25 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(goto_statement
|
|
|
|
|
(statement_identifier) @local.reference)
|
2021-01-22 11:36:27 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Scope
|
2020-07-04 22:00:59 +02:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
(for_statement)
|
|
|
|
|
(if_statement)
|
|
|
|
|
(while_statement)
|
|
|
|
|
(translation_unit)
|
|
|
|
|
(function_definition)
|
|
|
|
|
(compound_statement) ; a block in curly braces
|
|
|
|
|
(struct_specifier)
|
2023-07-22 15:29:32 +02:00
|
|
|
] @local.scope
|