#parser #incremental #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

#233 in Text editors

Download history 17/week @ 2024-03-17 56/week @ 2024-03-24 48/week @ 2024-03-31 6/week @ 2024-04-07 115/week @ 2024-04-14 12/week @ 2024-04-21 16/week @ 2024-04-28 49/week @ 2024-05-05 50/week @ 2024-05-12 19/week @ 2024-05-19 13/week @ 2024-05-26 8/week @ 2024-06-02 22/week @ 2024-06-09 3/week @ 2024-06-16 45/week @ 2024-06-23 29/week @ 2024-06-30

99 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
~71K SLoC