We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
qt-declarative 中的解析器位于 src/qml/qml/parser 中,其中很大一部分它是使用 qlalr 生成的(与上一个链接相同的位置,但使用 qlalr 而不是 qtdeclarative)。
您可能还想查看 qt-creator src/libs/qmljs/parser 中使用的解析器它源自 qt 声明式。
The parser in qt-declarative is in src/qml/qml/parser, and a big part of it is generated with qlalr (same place as the previous link, but with qlalr instead of qtdeclarative).
You might want also to look at the parser used in qt-creator src/libs/qmljs/parser which is derived from the qt-declarative one.
您可以查看附带的 QML Viewer 的源代码SDK。 源代码可在 Gitorious 上获取。 QML 查看器代码是 C++ 语言,而不是 Python 或 Perl。
另一种可能的解决方案是使用不依赖于 Qt 的 Python,即使用标准的 Javascript 解析器并对其进行修改,以便它可以理解 QML。从您提供的维基链接:
我发现 pynarcissus 它是 Python 中的 Javascript 解释器。也许你可以稍微修改它,以便它可以正确解释 QML 文件?
You could look at the source code of the QML Viewer that comes with the SDK. The source code is available on Gitorious. QML Viewer code is in C++ not Python nor Perl.
Another possible solution, to use Python with no dependencies with Qt, is to use a standard Javascript parser and modify it so it can understand QML. From the wiki link you provided :
I found pynarcissus which is a Javascript interpreter in Python. May be you could modify it slightly so it can interprete corretly QML files?