Commit Graph

43 Commits

Author SHA1 Message Date
the-mikedavis 1dabc1c790 Generate parser 2022-04-12 14:20:51 +00:00
Michael Davis 108cdd550f
allow only one stab clause without a right-hand-side
Only one stab clause in a multi-stab-clause expression may be empty.
Multiple is a syntax error.

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2022-04-12 09:16:45 -05:00
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
José Valim c68c4ad72f
Update README.md
Closes #32.
2022-04-02 11:39:21 +02:00
Vítor Luís dos Santos Trindade 60863fc6e2
Bump tree-sitter version to 0.20 (#31) 2022-03-28 19:30:40 -05:00
Michael Davis c8d69759a7
update rust bindings to include scanner and queries (#30)
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2022-03-25 14:36:59 -05:00
the-mikedavis b4027d7cfc Generate parser 2022-03-04 15:40:04 +00:00
Michael Davis 6702d11ec4
add unit tests for tags.scm queries (#27) 2022-03-04 09:38:31 -06:00
jonatanklosko 1344bb095f Generate parser 2022-03-04 15:34:54 +00:00
Jonatan Kłosko 8c8c14af1a
Ignore heredoc end delimiter unless in a new line (#28) 2022-03-04 16:33:24 +01:00
the-mikedavis a11a686303 Generate parser 2022-02-13 19:21:30 +00: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
Michael Davis de20391afe
bump tree-sitter-cli version to v0.20.1 (#23) 2022-01-10 10:35:12 -06:00
Michael Davis 89bd108897
commit WASM binding to gh-pages branch (#22) 2022-01-10 10:21:52 -06:00
Michael Davis 15169596d1
add tags.scm queries (#18)
* add tags.scm queries

* mark defimpl modules as references to the interface

* mark modules as module references instead of calls

* define protocol modules as modules, remove interface references
2022-01-08 13:54:00 +01:00
Jonatan Kłosko 94d6471cc8
Fix multiline stab clause with trailing identifier (#20) 2021-12-27 22:56:00 +01: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 de3ec57591 Add issue template 2021-10-22 18:07:49 +02:00
Jonatan Kłosko c3b82ff916
Highlight 'not in' as keyword (#11) 2021-10-14 20:30:28 +02:00
jonatanklosko f5d7bda543 Generate parser 2021-10-14 18:10:50 +00:00
Jonatan Kłosko 5d3f7edbc2
Make hidden scanned tokens visible as regular literals (#10) 2021-10-14 20:10:10 +02:00
Jonatan Kłosko dda17b01c2
Make C++ source compatible with older standards (#7) 2021-10-13 16:04:04 +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
jonatanklosko 7ae20df181 Generate parser 2021-10-04 08:26:45 +00:00
Jonatan Kłosko ab50f8bbda
Parse digits in sigil modifiers (#3) 2021-10-04 10:26:04 +02:00
Jonatan Kłosko 3817c5f986 Wording fixes 2021-09-30 16:44:26 +02:00
Jonatan Kłosko d7f4f08a81 Add license 2021-09-30 14:40:11 +02:00
Jonatan Kłosko fe4a3cff57 Add .gitattributes 2021-09-30 12:57:11 +02:00
Jonatan Kłosko d9f0b7887a Automate parser generation 2021-09-30 12:42:15 +02:00
Jonatan Kłosko 8f1f7bc427 Add test workflow 2021-09-30 12:36:21 +02:00
Jonatan Kłosko e846449ef6 Add script for testing the parser against popular repositories 2021-09-29 21:41:10 +02:00
Jonatan Kłosko 01d428d3a6 Add docs on highlighting 2021-09-29 20:33:13 +02:00
Jonatan Kłosko 7357885bbc Add highlighting tests 2021-09-29 19:44:04 +02:00
Jonatan Kłosko 30128092d4 Add highlight rules 2021-09-29 18:45:17 +02:00
Jonatan Kłosko 18f6c6cc5d Use the same AST node for all identifiers 2021-09-29 12:44:04 +02:00
Jonatan Kłosko 3cf73a2529 Add field names to quoted delimiters 2021-09-29 11:54:52 +02:00
Jonatan Kłosko e35f31122f Fix stab clause ambiguities 2021-09-28 20:40:20 +02:00
Jonatan Kłosko bb5f90516e Add field names 2021-09-28 17:26:43 +02:00
Jonatan Kłosko d229dddf66 Cleanup and documentation 2021-09-28 16:03:43 +02:00
Jonatan Kłosko dad92d2b87 Initial parser implementation 2021-09-25 02:34:29 +02:00
Jonatan Kłosko 3f19b87c70 Add parser tests 2021-09-01 16:59:04 +02:00
Jonatan Kłosko da75c9ee6b Generate files 2021-09-01 16:44:03 +02:00
Jonatan Kłosko 769b9f184f Initial commit 2021-09-01 16:38:27 +02:00