mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-20 20:30:05 -04:00
feat(snl): add parser and queries
This commit is contained in:
parent
6ac9f2e512
commit
53819acac2
7 changed files with 520 additions and 0 deletions
65
runtime/queries/snl/locals.scm
Normal file
65
runtime/queries/snl/locals.scm
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
; Functions definitions
|
||||
(function_declarator
|
||||
declarator: (identifier) @local.definition.function)
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @local.definition.macro) @local.scope
|
||||
|
||||
(preproc_def
|
||||
name: (identifier) @local.definition.macro)
|
||||
|
||||
((identifier) @local.definition.parameter
|
||||
(#has-ancestor? @local.definition.parameter param_decl))
|
||||
|
||||
(init_declarator
|
||||
(declarator
|
||||
(identifier)) @local.definition.var)
|
||||
|
||||
(array_declarator
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
; Struct
|
||||
(member_decl
|
||||
(declarator
|
||||
(identifier)) @local.definition.field)
|
||||
|
||||
(structdef
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
; References
|
||||
((field_expression
|
||||
field: (identifier) @local.reference)
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @local.reference)
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
((basetype
|
||||
(identifier) @local.reference)
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
; SNL specific
|
||||
(state_set
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(state
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(state_statement
|
||||
name: (identifier) @local.reference)
|
||||
|
||||
(transition
|
||||
name: (identifier) @local.reference)
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(source_file)
|
||||
(block)
|
||||
(state_set)
|
||||
(state_block)
|
||||
] @local.scope
|
||||
Loading…
Add table
Add a link
Reference in a new issue