Unnamed repository; edit this file 'description' to name the repository.
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
; Elixir is macro-heavy and `def`/`defp` are ordinary `call`s, so a general
; def/scope story can't be expressed without guessing. The one unambiguous
; binding form is the anonymous function `fn ... -> ... end`.

; Scopes

(anonymous_function) @local.scope

; Definitions

; `fn x, y -> ... end`: plain identifiers in the clause head are parameters.
; (Destructuring patterns are intentionally left to highlights.scm.)
(stab_clause
  left: (arguments
    (identifier) @local.definition.variable.parameter))

; `fn x when guard -> ... end`: the head is wrapped in a `when` binary_operator.
(stab_clause
  left: (binary_operator
    left: (arguments
      (identifier) @local.definition.variable.parameter)))

; References

(identifier) @local.reference