33 stable releases

5.7.0 Dec 22, 2023
5.6.6 Jul 30, 2023
5.6.4 Apr 15, 2023
5.6.3 Sep 3, 2022
4.3.4 Nov 22, 2020

#1610 in Parser implementations

Download history 50/week @ 2024-06-17 49/week @ 2024-06-24 115/week @ 2024-07-01 46/week @ 2024-07-08 30/week @ 2024-07-15 25/week @ 2024-07-22 77/week @ 2024-07-29 64/week @ 2024-08-05 33/week @ 2024-08-12 17/week @ 2024-08-19 39/week @ 2024-08-26 41/week @ 2024-09-02 44/week @ 2024-09-09 47/week @ 2024-09-16 118/week @ 2024-09-23 79/week @ 2024-09-30

293 downloads per month
Used in 3 crates (2 directly)

MIT license

1.5MB
46K SLoC

C 45K SLoC // 0.0% comments JavaScript 688 SLoC // 0.0% comments Scheme 76 SLoC // 0.1% comments Rust 38 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

~2.8–4MB
~74K SLoC