aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/ocaml/locals.scm
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/ocaml/locals.scm
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/ocaml/locals.scm')
-rw-r--r--runtime/queries/ocaml/locals.scm87
1 files changed, 87 insertions, 0 deletions
diff --git a/runtime/queries/ocaml/locals.scm b/runtime/queries/ocaml/locals.scm
new file mode 100644
index 000000000..38d392609
--- /dev/null
+++ b/runtime/queries/ocaml/locals.scm
@@ -0,0 +1,87 @@
+; Scopes
+;-------
+[
+ (compilation_unit)
+ (structure)
+ (signature)
+ (module_binding)
+ (functor)
+ (let_binding)
+ (match_case)
+ (class_binding)
+ (class_function)
+ (method_definition)
+ (let_expression)
+ (fun_expression)
+ (for_expression)
+ (let_class_expression)
+ (object_expression)
+ (attribute_payload)
+] @local.scope
+
+; Definitions
+;------------
+(value_pattern) @local.definition.var
+
+(let_binding
+ pattern: (value_name) @local.definition.var
+ (#set! definition.var.scope "parent"))
+
+(let_binding
+ pattern: (tuple_pattern
+ (value_name) @local.definition.var)
+ (#set! definition.var.scope "parent"))
+
+(let_binding
+ pattern: (record_pattern
+ (field_pattern
+ (value_name) @local.definition.var))
+ (#set! definition.var.scope "parent"))
+
+(external
+ (value_name) @local.definition.var)
+
+(type_binding
+ (type_constructor) @local.definition.type)
+
+(abstract_type
+ (type_constructor) @local.definition.type)
+
+(method_definition
+ (method_name) @local.definition.method)
+
+(module_binding
+ (module_name) @local.definition.namespace
+ (#set! definition.namespace.scope "parent"))
+
+(module_parameter
+ (module_name) @local.definition.namespace)
+
+(module_type_definition
+ (module_type_name) @local.definition.type)
+
+; References
+;------------
+(value_path
+ .
+ (value_name) @local.reference
+ (#set! reference.kind "var"))
+
+(type_constructor_path
+ .
+ (type_constructor) @local.reference
+ (#set! reference.kind "type"))
+
+(method_invocation
+ (method_name) @local.reference
+ (#set! reference.kind "method"))
+
+(module_path
+ .
+ (module_name) @local.reference
+ (#set! reference.kind "type"))
+
+(module_type_path
+ .
+ (module_type_name) @local.reference
+ (#set! reference.kind "type"))