aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/hare/locals.scm
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/hare/locals.scm')
-rw-r--r--runtime/queries/hare/locals.scm65
1 files changed, 65 insertions, 0 deletions
diff --git a/runtime/queries/hare/locals.scm b/runtime/queries/hare/locals.scm
new file mode 100644
index 000000000..12a214bf7
--- /dev/null
+++ b/runtime/queries/hare/locals.scm
@@ -0,0 +1,65 @@
+; Scopes
+[
+ (module)
+ (function_declaration)
+ (if_statement)
+ (for_statement)
+ (match_expression)
+ (switch_expression)
+] @local.scope
+
+; References
+[
+ (identifier)
+ (scoped_type_identifier)
+] @local.reference
+
+; Definitions
+(global_binding
+ (identifier) @local.definition.constant
+ .
+ ":"
+ (_))
+
+(const_declaration
+ "const"
+ (identifier) @local.definition.constant
+ .
+ "=")
+
+(field
+ .
+ (identifier) @local.definition.field)
+
+(field_assignment
+ .
+ (identifier) @local.definition.field)
+
+(function_declaration
+ "fn"
+ .
+ (identifier) @local.definition.function)
+
+(parameter
+ (_) @local.definition.parameter
+ .
+ ":")
+
+(type_declaration
+ "type"
+ (identifier) @local.definition.type
+ .
+ "=")
+
+(type_declaration
+ "type"
+ (identifier) @local.definition.enum
+ .
+ "="
+ (enum_type))
+
+(let_declaration
+ "let"
+ .
+ (identifier) @local.definition.var
+ ","?)