aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/ponylang/locals.scm
blob: e9efd69e7f95975d87437dda89108c72e5361772 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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_]*")
)