[Development] Toolability of mixing QML and JS
Thomas.Hartmann at digia.com
Wed Jun 26 15:27:45 CEST 2013
Am 26/06/2013 14:26, schrieb Rutledge Shawn:
> On 26 Jun 2013, at 12:00 PM, Thomas Hartmann wrote:
>>> - Editors: A lot of IDE's out there understand .js files. Writing a parser for only the declarative parts of QML is relatively easy. Writing a parser for .qml files that also understands all of JS, not so easy.
>> We provide a QML parser that includes Java Script as open source. Anyone
>> who wants to parse QML is most likely to use this one and even if not he
>> has access to the complete grammar. So this is not really an issue.
ng needs them whereas the interpreter does not.
The problem with that approach is that an AST is read only by design.
What you need for tooling that modifies QML is something like a DOM.
In the early days there was a QmlDom class if I remember correctly, but
it was not properly maintained and did not have the required features.
In the Qt Quick Designer we have a DOM like structure that is slightly
more abstract than an AST. We called it just "model" and it can modify
QML code by using a rewriter and it can instantiate the corresponding
objects using the qml(2)puppet.
More information about the Development