tree-sitter-qmljs

QML grammar for the tree-sitter parsing library

3 releases

0.1.2 Oct 12, 2022
0.1.1 Jul 7, 2022
0.1.0 Dec 29, 2021

#1800 in Parser implementations

Download history 41/week @ 2024-07-20 37/week @ 2024-07-27 59/week @ 2024-08-03 115/week @ 2024-08-10 9/week @ 2024-08-17 25/week @ 2024-08-24 17/week @ 2024-08-31 55/week @ 2024-09-07 19/week @ 2024-09-14 64/week @ 2024-09-21 60/week @ 2024-09-28 33/week @ 2024-10-05 5/week @ 2024-10-12 75/week @ 2024-10-19 98/week @ 2024-10-26 85/week @ 2024-11-02

263 downloads per month

MIT license

8MB
253K SLoC

C 252K SLoC JavaScript 264 SLoC // 0.1% comments Scheme 231 SLoC // 0.1% comments Rust 44 SLoC // 0.1% comments

tree-sitter-qmljs

QML grammar for the tree-sitter parsing library.

References

Pitfalls

Since grouped binding notation is syntactically ambiguous, it is parsed as an object definition.

// (ui_object_definition type_name: (identifier "Button") ...)
Button {
    // (ui_object_definition type_name: (identifier "icon") ...)
    icon { source: "foo.png"; color: "transparent" }
}

Building

Use the master branch, which contains all generated files.

$ git checkout master
$ npm install
$ cargo build --release

Hacking

Use the dev branch, but you'll first need to run npm install in the master branch.

$ git checkout master
$ npm install
$ git checkout dev

Generate code and run tests:

$ make generate tests

Make sure example QML files can be parsed:

$ make fetch-examples parse-examples

Dependencies

~2.7–4MB
~75K SLoC