/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include #include "private/qdeclarativejsast_p.h" #include "private/qdeclarativejsastfwd_p.h" #include "private/qdeclarativejsengine_p.h" #include "qmlmarkupvisitor.h" QT_BEGIN_NAMESPACE QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, bool debug) { this->source = source; indent = 0; cursor = 0; showDebug = debug; } QmlMarkupVisitor::~QmlMarkupVisitor() { } QString QmlMarkupVisitor::markedUpCode() { if (cursor < source.length()) return output + source.mid(cursor); else return output; } void QmlMarkupVisitor::addMarkedUpToken( QDeclarativeJS::AST::SourceLocation &location, const QString &text) { //qDebug() << "t**" << cursor << location.offset; if (location.offset > cursor) { QString extra = source.mid(cursor, location.offset - cursor); if (extra.trimmed().isEmpty()) output += extra; else output += "<<<" + extra + ">>>"; //qDebug() << "+++" << source.mid(cursor, location.offset - cursor); cursor += location.offset; } //qDebug() << "-->" << text; output += text; cursor += location.length; } QString QmlMarkupVisitor::sourceText(QDeclarativeJS::AST::SourceLocation &location) { return source.mid(location.offset, location.length); } void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last) { quint32 start = first.begin(); //qDebug() << "v**" << cursor << start; quint32 finish; if (last.isValid()) finish = last.end(); else finish = first.end(); if (start > cursor) { QString extra = source.mid(cursor, start - cursor); if (extra.trimmed().isEmpty()) output += extra; else output += "<<<" + extra + ">>>"; //qDebug() << "+++" << source.mid(cursor, start - cursor); cursor = start; } QString text = source.mid(start, finish - start); //qDebug() << "-->" << text; write(text); indent -= 1; output += text; cursor += text.length(); } void QmlMarkupVisitor::write(const QString &text) { if (showDebug) qDebug() << QString().fill(QChar(' '), indent) << text; indent += 1; } void QmlMarkupVisitor::endWrite(const QString &) { indent -= 1; } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) { write(""); addVerbatim(uiimport->importToken); if (!uiimport->importUri) addVerbatim(uiimport->fileNameToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) { endWrite(""); addVerbatim(uiimport->versionToken); addVerbatim(uiimport->asToken); addVerbatim(uiimport->importIdToken); addVerbatim(uiimport->semicolonToken); //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) { write(""); if (member->type == QDeclarativeJS::AST::UiPublicMember::Property) { addVerbatim(member->defaultToken); addVerbatim(member->readonlyToken); addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); addVerbatim(member->typeToken); addVerbatim(member->identifierToken); addVerbatim(member->colonToken); QDeclarativeJS::AST::Node::accept(member->binding, this); } else { addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); addVerbatim(member->typeToken); //addVerbatim(member->identifierToken); QDeclarativeJS::AST::Node::accept(member->parameters, this); } return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) { addVerbatim(member->semicolonToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { write(""); addVerbatim(initializer->lbraceToken, initializer->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { endWrite(""); addVerbatim(initializer->rbraceToken, initializer->rbraceToken); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) { write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); QDeclarativeJS::AST::Node::accept(binding->qualifiedTypeNameId, this); QDeclarativeJS::AST::Node::accept(binding->initializer, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) { write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); QDeclarativeJS::AST::Node::accept(binding->statement, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) { write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); addVerbatim(binding->lbracketToken); QDeclarativeJS::AST::Node::accept(binding->members, this); addVerbatim(binding->rbracketToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) { write(""); for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->member, this); addVerbatim(it->commaToken); } return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { write(""); addVerbatim(id->identifierToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) { write(""); addVerbatim(signature->lparenToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) { addVerbatim(signature->rparenToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) { write(""); addVerbatim(formal->identifierToken); addVerbatim(formal->asToken); addVerbatim(formal->aliasToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) { write(""); addVerbatim(expression->thisToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { write(""); addVerbatim(identifier->identifierToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { write(""); addVerbatim(null->nullToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { write(""); addVerbatim(literal->trueToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { write(""); addVerbatim(literal->falseToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { //write(""); addVerbatim(literal->literalToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) { //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { //write(""); addVerbatim(literal->literalToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) { //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) { write(""); addVerbatim(literal->literalToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) { write(""); addVerbatim(literal->lbracketToken); QDeclarativeJS::AST::Node::accept(literal->elements, this); addVerbatim(literal->rbracketToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) { write(""); addVerbatim(literal->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal) { addVerbatim(literal->rbraceToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) { write(""); for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->expression, this); addVerbatim(it->commaToken); } QDeclarativeJS::AST::Node::accept(list->elision, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) { write(""); addVerbatim(elision->commaToken, elision->commaToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) { write(""); QDeclarativeJS::AST::Node::accept(list->name, this); addVerbatim(list->colonToken, list->colonToken); QDeclarativeJS::AST::Node::accept(list->value, this); addVerbatim(list->commaToken, list->commaToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) { write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lbracketToken); QDeclarativeJS::AST::Node::accept(expression->expression, this); addVerbatim(expression->rbracketToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) { write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->dotToken); addVerbatim(expression->identifierToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) { write(""); addVerbatim(expression->newToken); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lparenToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) { addVerbatim(expression->rparenToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) { write(""); addVerbatim(expression->newToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) { write(""); addVerbatim(list->commaToken, list->commaToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) { write(""); addVerbatim(expression->incrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) { write(""); addVerbatim(expression->decrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) { write(""); addVerbatim(expression->deleteToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) { write(""); addVerbatim(expression->voidToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) { write(""); addVerbatim(expression->typeofToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) { write(""); addVerbatim(expression->incrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) { write(""); addVerbatim(expression->decrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) { write(""); addVerbatim(expression->plusToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) { write(""); addVerbatim(expression->minusToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) { write(""); addVerbatim(expression->tildeToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) { write(""); addVerbatim(expression->notToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); addVerbatim(expression->operatorToken); QDeclarativeJS::AST::Node::accept(expression->right, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) { write(""); addVerbatim(block->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) { addVerbatim(block->rbraceToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) { endWrite(""); addVerbatim(statement->declarationKindToken); QDeclarativeJS::AST::Node::accept(statement->declarations, this); addVerbatim(statement->semicolonToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) { write(""); for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->declaration, this); addVerbatim(it->commaToken); } return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { write(""); addVerbatim(declaration->identifierToken); QDeclarativeJS::AST::Node::accept(declaration->expression, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) { write(""); addVerbatim(statement->semicolonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) { addVerbatim(statement->semicolonToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { write(""); addVerbatim(statement->ifToken); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->ok, this); //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason QDeclarativeJS::AST::Node::accept(statement->ko, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { write(""); addVerbatim(statement->doToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); addVerbatim(statement->whileToken); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); addVerbatim(statement->semicolonToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { write(""); addVerbatim(statement->forToken); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); addVerbatim(statement->firstSemicolonToken); QDeclarativeJS::AST::Node::accept(statement->condition, this); addVerbatim(statement->secondSemicolonToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { write(""); addVerbatim(statement->forToken); addVerbatim(statement->lparenToken); addVerbatim(statement->varToken); QDeclarativeJS::AST::Node::accept(statement->declarations, this); addVerbatim(statement->firstSemicolonToken); QDeclarativeJS::AST::Node::accept(statement->condition, this); addVerbatim(statement->secondSemicolonToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { write(""); addVerbatim(statement->forToken); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); addVerbatim(statement->inToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { write(""); addVerbatim(statement->forToken); addVerbatim(statement->lparenToken); addVerbatim(statement->varToken); QDeclarativeJS::AST::Node::accept(statement->declaration, this); addVerbatim(statement->inToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { write(""); addVerbatim(statement->continueToken); addVerbatim(statement->identifierToken); addVerbatim(statement->semicolonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { write(""); addVerbatim(statement->breakToken); addVerbatim(statement->identifierToken); addVerbatim(statement->semicolonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { write(""); addVerbatim(statement->returnToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) { addVerbatim(statement->semicolonToken); endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { write(""); addVerbatim(statement->withToken); addVerbatim(statement->lparenToken); addVerbatim(statement->rparenToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { write(""); addVerbatim(block->lbraceToken, block->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) { endWrite(""); addVerbatim(block->rbraceToken, block->rbraceToken); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) { write(""); addVerbatim(statement->switchToken); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->block, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { write(""); addVerbatim(clause->caseToken); QDeclarativeJS::AST::Node::accept(clause->expression, this); addVerbatim(clause->colonToken); QDeclarativeJS::AST::Node::accept(clause->statements, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { write(""); addVerbatim(clause->defaultToken, clause->defaultToken); addVerbatim(clause->colonToken, clause->colonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { write(""); addVerbatim(statement->identifierToken); addVerbatim(statement->colonToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { write(""); addVerbatim(statement->throwToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { write(""); addVerbatim(c->catchToken, c->catchToken); addVerbatim(c->lparenToken, c->lparenToken); addVerbatim(c->identifierToken, c->identifierToken); addVerbatim(c->rparenToken, c->rparenToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { write(""); addVerbatim(f->finallyToken); QDeclarativeJS::AST::Node::accept(f->statement, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { write(""); addVerbatim(statement->tryToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); QDeclarativeJS::AST::Node::accept(statement->finallyExpression, this); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { write(""); addVerbatim(expression->functionToken); addVerbatim(expression->identifierToken); addVerbatim(expression->lparenToken); QDeclarativeJS::AST::Node::accept(expression->formals, this); addVerbatim(expression->rparenToken); addVerbatim(expression->lbraceToken); QDeclarativeJS::AST::Node::accept(expression->body, this); addVerbatim(expression->rbraceToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { write(""); addVerbatim(declaration->functionToken); addVerbatim(declaration->identifierToken); addVerbatim(declaration->lparenToken); QDeclarativeJS::AST::Node::accept(declaration->formals, this); addVerbatim(declaration->rparenToken); addVerbatim(declaration->lbraceToken); QDeclarativeJS::AST::Node::accept(declaration->body, this); addVerbatim(declaration->rbraceToken); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { write(""); addVerbatim(list->commaToken, list->commaToken); addVerbatim(list->identifierToken, list->identifierToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) { write(""); addVerbatim(statement->debuggerToken); addVerbatim(statement->semicolonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) { endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) { write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) { endWrite(""); } QT_END_NAMESPACE