summaryrefslogtreecommitdiff
path: root/runtime/queries/ponylang/locals.scm
diff options
context:
space:
mode:
authorMatthias Wahl2023-01-11 01:54:19 +0000
committerGitHub2023-01-11 01:54:19 +0000
commite65f28d41af0b095eb7ff340f20c7d0d4193e287 (patch)
treeed0878fa67a7202980b168bda8ba070ae419a9df /runtime/queries/ponylang/locals.scm
parent3ca42f7787085ca1c435147da2fcc696a87f6e21 (diff)
Add language support for ponylang (#5416)
See https://www.ponylang.io
Diffstat (limited to 'runtime/queries/ponylang/locals.scm')
-rw-r--r--runtime/queries/ponylang/locals.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/runtime/queries/ponylang/locals.scm b/runtime/queries/ponylang/locals.scm
new file mode 100644
index 00000000..e9efd69e
--- /dev/null
+++ b/runtime/queries/ponylang/locals.scm
@@ -0,0 +1,37 @@
+[
+ (entity)
+ (method)
+ (behavior)
+ (constructor)
+ ("if")
+ (elseif)
+ (ifdef)
+ (elseifdef)
+ (iftype)
+ (elseiftype)
+ (match)
+ (match_case)
+ ("while")
+ ("repeat")
+ ("for")
+ (lambda)
+ (try_block)
+ (with)
+] @local.scope
+(match else_block: (block) @local.scope)
+(try_block else_block: (block) @local.scope)
+(try_block then_block: (block) @local.scope)
+(with else_block: (block) @local.scope)
+
+(field name: (identifier) @local.definition)
+(local name: (identifier) @local.definition)
+(param name: (identifier) @local.definition)
+(lambdaparam name: (identifier) @local.definition)
+("for" element: (idseq (identifier) @local.definition))
+(withelem name: (idseq (identifier) @local.definition))
+
+; only lower case identifiers are references
+(
+ (identifier) @local.reference
+ (#match? @local.reference "^[a-z_][a-zA-Z_]*")
+)