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)
|
2023-07-22 15:29:32 +02:00
|
|
|
] @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
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.type
|
2024-07-27 16:28:19 -07:00
|
|
|
(#set! definition.var.scope "parent"))
|
2022-06-14 17:24:28 +02:00
|
|
|
|
|
|
|
|
(parameters
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.parameter)
|
2022-06-14 17:24:28 +02:00
|
|
|
|
|
|
|
|
(function_declaration
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.function
|
2024-07-27 16:28:19 -07:00
|
|
|
(#set! definition.var.scope "parent"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-06-14 17:24:28 +02:00
|
|
|
(primitive_declaration
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.function
|
2024-07-27 16:28:19 -07:00
|
|
|
(#set! definition.var.scope "parent"))
|
2022-06-14 17:24:28 +02:00
|
|
|
|
|
|
|
|
(variable_declaration
|
2023-07-22 15:29:32 +02:00
|
|
|
name: (identifier) @local.definition.var
|
2024-07-27 16:28:19 -07:00
|
|
|
(#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 {{{
|
2023-07-22 15:29:32 +02:00
|
|
|
(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
|