Commit Graph

6 Commits

Author SHA1 Message Date
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
Michael Davis 08dbe8978c
parse nullary range operator (#25)
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2022-02-13 13:19:53 -06:00
Jonatan Kłosko 1b3ecf7765
Rename module highlight token (#16)
* Rename module highlight token

* Fix CRLF in scanner lookahead
2021-12-15 23:29:48 +01:00
Jonatan Kłosko c3b82ff916
Highlight 'not in' as keyword (#11) 2021-10-14 20:30:28 +02:00
Michael Davis 24a9eaeaa9
highlight calls to erlang modules as types (#5)
* highlight calls to erlang modules as types

* Add test

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-10-12 23:11:14 +02:00
Jonatan Kłosko 7357885bbc Add highlighting tests 2021-09-29 19:44:04 +02:00