#elm #tree #parsing #incremental #sitter

tree-sitter-elm

Rust bindings for the tree sitter elm language parser

14 stable releases

new 5.2.3 Feb 27, 2021
5.2.2 Feb 23, 2021
4.5.0 Jan 9, 2021
4.4.1 Dec 13, 2020
4.3.4 Nov 22, 2020

#148 in Parser implementations

Download history 88/week @ 2020-11-19 52/week @ 2020-11-26 124/week @ 2020-12-03 82/week @ 2020-12-10 3/week @ 2020-12-17 1/week @ 2020-12-31 17/week @ 2021-01-07 13/week @ 2021-01-14 6/week @ 2021-01-21 3/week @ 2021-02-04 19/week @ 2021-02-11 108/week @ 2021-02-18

137 downloads per month

MIT license

1MB
42K SLoC

C 41K SLoC C++ 404 SLoC // 0.0% comments Rust 58 SLoC

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

~2MB
~53K SLoC