#tree-sitter #incremental #parser #qml

tree-sitter-qmljs

QML grammar for the tree-sitter parsing library

4 releases

0.2.0 Jan 2, 2025
0.1.2 Oct 12, 2022
0.1.1 Jul 7, 2022
0.1.0 Dec 29, 2021

#98 in Text editors

Download history 98/week @ 2024-10-26 86/week @ 2024-11-02 35/week @ 2024-11-09 25/week @ 2024-11-16 3/week @ 2024-11-23 57/week @ 2024-11-30 55/week @ 2024-12-07 38/week @ 2024-12-14 26/week @ 2024-12-21 176/week @ 2024-12-28 109/week @ 2025-01-04 45/week @ 2025-01-11 18/week @ 2025-01-18 26/week @ 2025-01-25 43/week @ 2025-02-01 121/week @ 2025-02-08

209 downloads per month

MIT license

10MB
317K SLoC

C 315K SLoC JavaScript 1.5K SLoC // 0.1% comments Scheme 46 SLoC // 0.1% comments Rust 40 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

~3–4.5MB
~80K SLoC