| 1 | ; Elixir is macro-heavy and `def`/`defp` are ordinary `call`s, so a general |
| 2 | ; def/scope story can't be expressed without guessing. The one unambiguous |
| 3 | ; binding form is the anonymous function `fn ... -> ... end`. |
| 4 | |
| 5 | ; Scopes |
| 6 | |
| 7 | (anonymous_function) @local.scope |
| 8 | |
| 9 | ; Definitions |
| 10 | |
| 11 | ; `fn x, y -> ... end`: plain identifiers in the clause head are parameters. |
| 12 | ; (Destructuring patterns are intentionally left to highlights.scm.) |
| 13 | (stab_clause |
| 14 | left: (arguments |
| 15 | (identifier) @local.definition.variable.parameter)) |
| 16 | |
| 17 | ; `fn x when guard -> ... end`: the head is wrapped in a `when` binary_operator. |
| 18 | (stab_clause |
| 19 | left: (binary_operator |
| 20 | left: (arguments |
| 21 | (identifier) @local.definition.variable.parameter))) |
| 22 | |
| 23 | ; References |
| 24 | |
| 25 | (identifier) @local.reference |