#incremental #parsing #qml

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

#62 in Text editors

Download history 44/week @ 2022-12-01 46/week @ 2022-12-08 70/week @ 2022-12-15 56/week @ 2022-12-22 51/week @ 2022-12-29 58/week @ 2023-01-05 35/week @ 2023-01-12 15/week @ 2023-01-19 19/week @ 2023-01-26 46/week @ 2023-02-02 34/week @ 2023-02-09 43/week @ 2023-02-16 26/week @ 2023-02-23 42/week @ 2023-03-02 78/week @ 2023-03-09 120/week @ 2023-03-16

283 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

~1.3–1.9MB
~51K SLoC