#tree-sitter #incremental #parser #qml

tree-sitter-qmljs

QML grammar for the tree-sitter parsing library

4 releases

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

#100 in Text editors

Download history 34/week @ 2024-09-11 44/week @ 2024-09-18 51/week @ 2024-09-25 48/week @ 2024-10-02 19/week @ 2024-10-09 39/week @ 2024-10-16 95/week @ 2024-10-23 71/week @ 2024-10-30 79/week @ 2024-11-06 33/week @ 2024-11-13 7/week @ 2024-11-20 8/week @ 2024-11-27 65/week @ 2024-12-04 63/week @ 2024-12-11 37/week @ 2024-12-18 9/week @ 2024-12-25

179 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

~2.8–4MB
~79K SLoC