nvim-treesitter/runtime/queries/tiger/locals.scm

40 lines
944 B
Scheme
Raw Normal View History

2022-06-14 17:24:28 +02:00
; See this issue [1] for support for "lazy scoping" which is somewhat needed
; for Tiger semantics (e.g: one can call a function before it has been defined
; top-to-bottom).
;
; [1]: https://github.com/tree-sitter/tree-sitter/issues/918
; Scopes {{{
[
2024-01-06 15:05:50 +09:00
(for_expression)
(let_expression)
(function_declaration)
] @local.scope
2022-06-14 17:24:28 +02:00
2024-01-06 15:05:50 +09:00
; }}}
2022-06-14 17:24:28 +02:00
; Definitions {{{
(type_declaration
name: (identifier) @local.definition.type
(#set! definition.var.scope "parent"))
2022-06-14 17:24:28 +02:00
(parameters
name: (identifier) @local.definition.parameter)
2022-06-14 17:24:28 +02:00
(function_declaration
name: (identifier) @local.definition.function
(#set! definition.var.scope "parent"))
2024-01-06 15:05:50 +09:00
2022-06-14 17:24:28 +02:00
(primitive_declaration
name: (identifier) @local.definition.function
(#set! definition.var.scope "parent"))
2022-06-14 17:24:28 +02:00
(variable_declaration
name: (identifier) @local.definition.var
(#set! definition.var.scope "parent"))
2022-06-14 17:24:28 +02:00
2024-01-06 15:05:50 +09:00
; }}}
2022-06-14 17:24:28 +02:00
; References {{{
(identifier) @local.reference
2022-06-14 17:24:28 +02:00
2024-01-06 15:05:50 +09:00
; }}}
2022-06-14 17:24:28 +02:00
; vim: sw=2 foldmethod=marker