Go to file
Michael Davis 662426cd85
handle stab clauses without right-hand-sides
Currently a stab clause without a right-hand-side is parsed as an error:

```elixir
Enum.map(xs, fn x ->
end)
```

And the `end` token ends up not being highlighted as a keyword. The
compiler gives a warning about this syntax but it comes up pretty
often when editing (writing a `case` block for example).

Implementation-wise, this might be a bug in tree-sitter? `prec.right`
seems to fight with error recovery when the rightmost token(s) are
`optional`.

```elixir
fn ->
end
```

gets parsed as

```scm
(anonymous_function
  (stab_clause
    right: (body (identifier)))
  (MISSING "end"))
```

although the `optional` should allow this case. I've seen this in
other grammars and it seems like the way around it is to replace
the `prec.right` with a conflict.
2022-04-11 19:23:22 -05:00
.github commit WASM binding to gh-pages branch (#22) 2022-01-10 10:21:52 -06:00
bindings update rust bindings to include scanner and queries (#30) 2022-03-25 14:36:59 -05:00
docs Wording fixes 2021-09-30 16:44:26 +02:00
queries add tags.scm queries (#18) 2022-01-08 13:54:00 +01:00
scripts Add script for testing the parser against popular repositories 2021-09-29 21:41:10 +02:00
src Generate parser 2022-03-04 15:40:04 +00:00
test handle stab clauses without right-hand-sides 2022-04-11 19:23:22 -05:00
.gitattributes Add .gitattributes 2021-09-30 12:57:11 +02:00
.gitignore update rust bindings to include scanner and queries (#30) 2022-03-25 14:36:59 -05:00
Cargo.toml Bump tree-sitter version to 0.20 (#31) 2022-03-28 19:30:40 -05:00
LICENSE Add license 2021-09-30 14:40:11 +02:00
NOTICE Add license 2021-09-30 14:40:11 +02:00
README.md Update README.md 2022-04-02 11:39:21 +02:00
binding.gyp Initial parser implementation 2021-09-25 02:34:29 +02:00
grammar.js handle stab clauses without right-hand-sides 2022-04-11 19:23:22 -05:00
package-lock.json add unit tests for tags.scm queries (#27) 2022-03-04 09:38:31 -06:00
package.json add unit tests for tags.scm queries (#27) 2022-03-04 09:38:31 -06:00

README.md

tree-sitter-elixir

Test

Elixir grammar for tree-sitter.

Ready for production. Currently used by GitHub itself for source code highlighting and code navigation.

Development

See the docs for more details.