#elm #tree #parsing #incremental #sitter

tree-sitter-elm

elm grammar for the tree-sitter parsing library

20 stable releases

5.3.5 May 30, 2021
5.3.4 May 23, 2021
5.3.3 Mar 18, 2021
5.2.3 Feb 27, 2021
4.3.4 Nov 22, 2020

#47 in Parser tooling

Download history 109/week @ 2021-02-20 49/week @ 2021-02-27 45/week @ 2021-03-06 17/week @ 2021-03-13 42/week @ 2021-03-20 36/week @ 2021-03-27 36/week @ 2021-04-03 54/week @ 2021-04-10 29/week @ 2021-04-17 9/week @ 2021-04-24 24/week @ 2021-05-01 9/week @ 2021-05-08 49/week @ 2021-05-15 28/week @ 2021-05-22 24/week @ 2021-05-29 23/week @ 2021-06-05

135 downloads per month

MIT license

1MB
43K SLoC

C 42K SLoC JavaScript 682 SLoC // 0.0% comments C++ 390 SLoC // 0.0% comments Scheme 65 SLoC // 0.1% comments Rust 44 SLoC // 0.2% comments

Build Status

Elm tree sitter

Why am I doing this?

I believe that Elm would greatly benefit from better tooling, the ultimate goal is to write a language server integration. This is a possible building block for that.

What it brings to the table:

  • Very fast parsing, should enable parsing on each keystroke.
  • Resilient, even if you use wrong syntax, most of the file should still be recognized alright.
  • Should also be useful to the elm atom maintainers, as atom is using tree sitter as the new default for code highlighting (our ast might be too expressive). Highlight implementation still needs to be done if wanted.

What is this tested with?

This is tested against the tests included in the repo and:

So it should work fine for a fair amount of code. What's not tested right now is behavior in error cases.

Thanks

Very very big thanks goes out to @klazuka and the people of intellij-elm as I basically stole how they're creating their parser minus the GLSL implementation.

Want to help?

Help writing some tests or simply find valid elm files, that fail parsing. Test are located in the test folder and separated in parser tests and highlighting tests.

Dependencies

~1.4–2MB
~52K SLoC