diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-06-10 10:02:29 (GMT) |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-06-10 10:02:29 (GMT) |
commit | c0bbe44ab6290dee088138c01724779026d2c033 (patch) | |
tree | f6344fcf5fc9cd5fe58754afbac3c68c3438d33a /src/declarative/qml/qmlscriptparser.cpp | |
parent | bf750d1df7e1474ffddc547205f7f20520559ea7 (diff) | |
download | Qt-c0bbe44ab6290dee088138c01724779026d2c033.zip Qt-c0bbe44ab6290dee088138c01724779026d2c033.tar.gz Qt-c0bbe44ab6290dee088138c01724779026d2c033.tar.bz2 |
Changed the QML parser and the AST to store the position of comma tokens
of QML arrays. Also exposed these positions through the QML DOM.
Diffstat (limited to 'src/declarative/qml/qmlscriptparser.cpp')
-rw-r--r-- | src/declarative/qml/qmlscriptparser.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index cab7915..ee2981e 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -649,7 +649,20 @@ bool ProcessAST::visit(AST::ExpressionStatement *node) return true; } -// UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiObjectMemberList T_RBRACKET ; +static QList<int> collectCommas(AST::UiArrayMemberList *members) +{ + QList<int> commas; + + if (members) { + for (AST::UiArrayMemberList *it = members->next; it; it = it->next) { + commas.append(it->commaToken.offset); + } + } + + return commas; +} + +// UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ; bool ProcessAST::visit(AST::UiArrayBinding *node) { int propertyCount = 0; @@ -667,6 +680,9 @@ bool ProcessAST::visit(AST::UiArrayBinding *node) prop->listValueRange.offset = node->lbracketToken.offset; prop->listValueRange.length = node->rbracketToken.offset + node->rbracketToken.length - node->lbracketToken.offset; + // Store the positions of the comma token too, again for the DOM to be able to retreive it. + prop->listCommaPositions = collectCommas(node->members); + while (propertyCount--) _stateStack.pop(); |