summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qdoc3/cppcodemarker.cpp1
-rw-r--r--tools/qdoc3/cppcodemarker.h56
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp4
-rw-r--r--tools/qdoc3/ditaxmlgenerator.h2
-rw-r--r--tools/qdoc3/generator.h2
-rw-r--r--tools/qdoc3/htmlgenerator.cpp26
-rw-r--r--tools/qdoc3/htmlgenerator.h5
-rw-r--r--tools/qdoc3/main.cpp12
-rw-r--r--tools/qdoc3/node.cpp1
-rw-r--r--tools/qdoc3/pagegenerator.cpp14
-rw-r--r--tools/qdoc3/pagegenerator.h4
-rw-r--r--tools/qdoc3/qdoc3.pro9
-rw-r--r--tools/qdoc3/qmlcodeparser.cpp18
-rw-r--r--tools/qdoc3/qmlcodeparser.h12
-rw-r--r--tools/qdoc3/qmlmarkupvisitor.cpp1415
-rw-r--r--tools/qdoc3/qmlmarkupvisitor.h338
-rw-r--r--tools/qdoc3/qmlvisitor.cpp48
-rw-r--r--tools/qdoc3/qmlvisitor.h36
18 files changed, 1877 insertions, 126 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index 576d103..55a455f 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -43,7 +43,6 @@
cppcodemarker.cpp
*/
-#include <qdebug.h>
#include "atom.h"
#include "cppcodemarker.h"
#include "node.h"
diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h
index 804a302..40695c5 100644
--- a/tools/qdoc3/cppcodemarker.h
+++ b/tools/qdoc3/cppcodemarker.h
@@ -56,36 +56,36 @@ class CppCodeMarker : public CodeMarker
CppCodeMarker();
~CppCodeMarker();
- bool recognizeCode(const QString& code);
- bool recognizeExtension(const QString& ext);
- bool recognizeLanguage(const QString& lang);
- QString plainName(const Node *node);
- QString plainFullName(const Node *node, const Node *relative);
- QString markedUpCode(const QString& code,
- const Node *relative,
- const QString& dirPath);
- QString markedUpSynopsis(const Node *node,
- const Node *relative,
- SynopsisStyle style);
+ virtual bool recognizeCode(const QString& code);
+ virtual bool recognizeExtension(const QString& ext);
+ virtual bool recognizeLanguage(const QString& lang);
+ virtual QString plainName(const Node *node);
+ virtual QString plainFullName(const Node *node, const Node *relative);
+ virtual QString markedUpCode(const QString& code,
+ const Node *relative,
+ const QString& dirPath);
+ virtual QString markedUpSynopsis(const Node *node,
+ const Node *relative,
+ SynopsisStyle style);
#ifdef QDOC_QML
- QString markedUpQmlItem(const Node *node, bool summary);
+ virtual QString markedUpQmlItem(const Node *node, bool summary);
#endif
- QString markedUpName(const Node *node);
- QString markedUpFullName(const Node *node, const Node *relative);
- QString markedUpEnumValue(const QString &enumValue, const Node *relative);
- QString markedUpIncludes(const QStringList& includes);
- QString functionBeginRegExp(const QString& funcName);
- QString functionEndRegExp(const QString& funcName);
- QList<Section> sections(const InnerNode *innerNode,
- SynopsisStyle style,
- Status status);
- QList<Section> qmlSections(const QmlClassNode* qmlClassNode,
- SynopsisStyle style,
- const Tree* tree);
- const Node* resolveTarget(const QString& target,
- const Tree* tree,
- const Node* relative,
- const Node* self = 0);
+ virtual QString markedUpName(const Node *node);
+ virtual QString markedUpFullName(const Node *node, const Node *relative);
+ virtual QString markedUpEnumValue(const QString &enumValue, const Node *relative);
+ virtual QString markedUpIncludes(const QStringList& includes);
+ virtual QString functionBeginRegExp(const QString& funcName);
+ virtual QString functionEndRegExp(const QString& funcName);
+ virtual QList<Section> sections(const InnerNode *innerNode,
+ SynopsisStyle style,
+ Status status);
+ virtual QList<Section> qmlSections(const QmlClassNode* qmlClassNode,
+ SynopsisStyle style,
+ const Tree* tree);
+ virtual const Node* resolveTarget(const QString& target,
+ const Tree* tree,
+ const Node* relative,
+ const Node* self = 0);
private:
QString addMarkUp(const QString& protectedCode,
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index ce597f2..1014f79 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -533,7 +533,7 @@ QString DitaXmlGenerator::lookupGuid(QString text)
\note The file generation is done in the base class,
PageGenerator::generateTree().
*/
-void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
+void DitaXmlGenerator::generateTree(const Tree *tree)
{
myTree = tree;
nonCompatClasses.clear();
@@ -552,7 +552,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
findAllNamespaces(tree->root());
findAllSince(tree->root());
- PageGenerator::generateTree(tree, marker);
+ PageGenerator::generateTree(tree);
}
void DitaXmlGenerator::startText(const Node* /* relative */,
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 36bd990..a29df77 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -91,7 +91,7 @@ class DitaXmlGenerator : public PageGenerator
virtual void initializeGenerator(const Config& config);
virtual void terminateGenerator();
virtual QString format();
- virtual void generateTree(const Tree *tree, CodeMarker *marker);
+ virtual void generateTree(const Tree *tree);
QString protectEnc(const QString &string);
static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 326a247..18c3855 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -78,7 +78,7 @@ class Generator
virtual void terminateGenerator();
virtual QString format() = 0;
virtual bool canHandleFormat(const QString &format) { return format == this->format(); }
- virtual void generateTree(const Tree *tree, CodeMarker *marker) = 0;
+ virtual void generateTree(const Tree *tree) = 0;
static void initialize(const Config& config);
static void terminate();
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 3f76204..9f5f182 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -217,9 +217,9 @@ HtmlGenerator::HtmlGenerator()
threeColumnEnumValueTable(true),
funcLeftParen("\\S(\\()"),
myTree(0),
+ inObsoleteLink(false),
slow(false),
- obsoleteLinks(false),
- inObsoleteLink(false)
+ obsoleteLinks(false)
{
}
@@ -356,7 +356,7 @@ QString HtmlGenerator::format()
\note The HTML file generation is done in the base class,
PageGenerator::generateTree().
*/
-void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
+void HtmlGenerator::generateTree(const Tree *tree)
{
myTree = tree;
nonCompatClasses.clear();
@@ -375,11 +375,11 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
findAllNamespaces(tree->root());
findAllSince(tree->root());
- PageGenerator::generateTree(tree, marker);
+ PageGenerator::generateTree(tree);
QString fileBase = project.toLower().simplified().replace(" ", "-");
generateIndex(fileBase, projectUrl, projectDescription);
- generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker);
+ generatePageIndex(outputDir() + "/" + fileBase + ".pageindex");
helpProjectWriter->generate(myTree);
}
@@ -2913,18 +2913,6 @@ void HtmlGenerator::generateLink(const Atom* atom,
}
inLink = false;
out() << protectEnc(atom->string().mid(k));
- } else if (marker->recognizeLanguage("Java")) {
- // hack for Java: remove () and use <tt> when appropriate
- bool func = atom->string().endsWith("()");
- bool tt = (func || atom->string().contains(camelCase));
- if (tt)
- out() << "<tt>";
- if (func) {
- out() << protectEnc(atom->string().left(atom->string().length() - 2));
- } else {
- out() << protectEnc(atom->string());
- }
- out() << "</tt>";
} else {
out() << protectEnc(atom->string());
}
@@ -4168,12 +4156,14 @@ void HtmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* n
/*!
Outputs the file containing the index used for searching the html docs.
*/
-void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const
+void HtmlGenerator::generatePageIndex(const QString& fileName) const
{
QFile file(fileName);
if (!file.open(QFile::WriteOnly | QFile::Text))
return ;
+ CodeMarker *marker = CodeMarker::markerForFileName(fileName);
+
QXmlStreamWriter writer(&file);
writer.setAutoFormatting(true);
writer.writeStartDocument();
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index 547cf2f..4276475 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -92,7 +92,7 @@ class HtmlGenerator : public PageGenerator
virtual void initializeGenerator(const Config& config);
virtual void terminateGenerator();
virtual QString format();
- virtual void generateTree(const Tree *tree, CodeMarker *marker);
+ virtual void generateTree(const Tree *tree);
QString protectEnc(const QString &string);
static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
@@ -247,8 +247,7 @@ class HtmlGenerator : public PageGenerator
void generatePageElements(QXmlStreamWriter& writer,
const Node* node,
CodeMarker* marker) const;
- void generatePageIndex(const QString& fileName,
- CodeMarker* marker) const;
+ void generatePageIndex(const QString& fileName) const;
void generateExtractionMark(const Node *node, ExtractionMarkType markType);
QMap<QString, QString> refMap;
diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp
index 2d3f034..ac1c5de 100644
--- a/tools/qdoc3/main.cpp
+++ b/tools/qdoc3/main.cpp
@@ -55,6 +55,7 @@
#include "htmlgenerator.h"
#include "plaincodemarker.h"
#include "puredocparser.h"
+#include "qmlcodemarker.h"
#include "qmlcodeparser.h"
#include "tokenizer.h"
#include "tree.h"
@@ -243,14 +244,6 @@ static void processQdocconfFile(const QString &fileName)
Location outputFormatsLocation = config.lastLocation();
/*
- There must be a code marker for the source code language, e.g. C++.
- If there isn't one, give up.
- */
- CodeMarker *marker = CodeMarker::markerForLanguage(lang);
- if (!marker && !outputFormats.isEmpty())
- langLocation.fatal(tr("Cannot output documentation for programming language '%1'").arg(lang));
-
- /*
Read some XML indexes containing definitions from other documentation sets.
*/
QStringList indexFiles = config.getStringList(CONFIG_INDEXES);
@@ -334,7 +327,7 @@ static void processQdocconfFile(const QString &fileName)
if (generator == 0)
outputFormatsLocation.fatal(tr("Unknown output format '%1'")
.arg(*of));
- generator->generateTree(tree, marker);
+ generator->generateTree(tree);
++of;
}
@@ -390,6 +383,7 @@ int main(int argc, char **argv)
*/
PlainCodeMarker plainMarker;
CppCodeMarker cppMarker;
+ QmlCodeMarker qmlMarker;
HtmlGenerator htmlGenerator;
DitaXmlGenerator ditaxmlGenerator;
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 3e8230c..838bbfb 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -45,7 +45,6 @@
#include "node.h"
#include "tree.h"
-#include "codemarker.h"
#include <qdebug.h>
QT_BEGIN_NAMESPACE
diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp
index 37dc191..60b40c9 100644
--- a/tools/qdoc3/pagegenerator.cpp
+++ b/tools/qdoc3/pagegenerator.cpp
@@ -46,6 +46,7 @@
#include <qfile.h>
#include <qfileinfo.h>
#include <qdebug.h>
+#include "codemarker.h"
#include "pagegenerator.h"
#include "tree.h"
@@ -175,9 +176,9 @@ bool PageGenerator::parseArg(const QString& src,
/*!
This function is recursive.
*/
-void PageGenerator::generateTree(const Tree *tree, CodeMarker *marker)
+void PageGenerator::generateTree(const Tree *tree)
{
- generateInnerNode(tree->root(), marker);
+ generateInnerNode(tree->root());
}
QString PageGenerator::fileBase(const Node *node) const
@@ -301,7 +302,7 @@ QTextStream &PageGenerator::out()
Recursive writing of html files from the root \a node.
*/
void
-PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker)
+PageGenerator::generateInnerNode(const InnerNode* node)
{
if (!node->url().isNull())
return;
@@ -320,6 +321,11 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker)
}
}
+ /*
+ Obtain a code marker for the source file.
+ */
+ CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath());
+
if (node->parent() != 0) {
beginSubPage(node->location(), fileName(node));
if (node->type() == Node::Namespace || node->type() == Node::Class) {
@@ -334,7 +340,7 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker)
NodeList::ConstIterator c = node->childNodes().begin();
while (c != node->childNodes().end()) {
if ((*c)->isInnerNode() && (*c)->access() != Node::Private)
- generateInnerNode((const InnerNode *) *c, marker);
+ generateInnerNode((const InnerNode *) *c);
++c;
}
}
diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h
index 1aa24a1..abb8f1c 100644
--- a/tools/qdoc3/pagegenerator.h
+++ b/tools/qdoc3/pagegenerator.h
@@ -66,7 +66,7 @@ class PageGenerator : public Generator
PageGenerator();
~PageGenerator();
- virtual void generateTree(const Tree *tree, CodeMarker *marker);
+ virtual void generateTree(const Tree *tree);
protected:
virtual QString fileBase(const Node *node) const;
@@ -75,7 +75,7 @@ class PageGenerator : public Generator
QString outFileName();
void beginSubPage(const Location& location, const QString& fileName);
void endSubPage();
- virtual void generateInnerNode(const InnerNode *node, CodeMarker *marker);
+ virtual void generateInnerNode(const InnerNode *node);
QTextStream& out();
QString naturalLanguage;
diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
index 2c91a9c..23ff7bd 100644
--- a/tools/qdoc3/qdoc3.pro
+++ b/tools/qdoc3/qdoc3.pro
@@ -43,7 +43,9 @@ HEADERS += atom.h \
pagegenerator.h \
plaincodemarker.h \
puredocparser.h \
+ qmlcodemarker.h \
qmlcodeparser.h \
+ qmlmarkupvisitor.h \
qmlvisitor.h \
quoter.h \
separator.h \
@@ -71,7 +73,9 @@ SOURCES += atom.cpp \
pagegenerator.cpp \
plaincodemarker.cpp \
puredocparser.cpp \
+ qmlcodemarker.cpp \
qmlcodeparser.cpp \
+ qmlmarkupvisitor.cpp \
qmlvisitor.cpp \
quoter.cpp \
separator.cpp \
@@ -80,10 +84,9 @@ SOURCES += atom.cpp \
tree.cpp \
yyindent.cpp
-# Include the QML parsing library from Qt Creator.
+INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative
-LIBS += -L$$(QTCREATOR_LIBPATH) -lQmlJS -lUtils
-INCLUDEPATH += $$(QTCREATOR_INCPATH)
+include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri)
### Documentation for qdoc3 ###
diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp
index c6ace7d..329912c 100644
--- a/tools/qdoc3/qmlcodeparser.cpp
+++ b/tools/qdoc3/qmlcodeparser.cpp
@@ -43,9 +43,9 @@
qmlcodeparser.cpp
*/
-#include "parser/qmljsast_p.h"
-#include "parser/qmljsastvisitor_p.h"
-#include "parser/qmljsnodepool_p.h"
+#include "private/qdeclarativejsast_p.h"
+#include "private/qdeclarativejsastvisitor_p.h"
+#include "private/qdeclarativejsnodepool_p.h"
#include "qmlcodeparser.h"
#include "node.h"
@@ -84,8 +84,8 @@ void QmlCodeParser::initializeParser(const Config &config)
{
CodeParser::initializeParser(config);
- lexer = new QmlJS::Lexer(&engine);
- parser = new QmlJS::Parser(&engine);
+ lexer = new QDeclarativeJS::Lexer(&engine);
+ parser = new QDeclarativeJS::Parser(&engine);
}
void QmlCodeParser::terminateParser()
@@ -125,12 +125,12 @@ void QmlCodeParser::parseSourceFile(const Location& location,
QSet<QString> metacommandsAllowed = topicCommandsAllowed +
otherMetacommandsAllowed;
- QmlJS::NodePool m_nodePool(filePath, &engine);
+ QDeclarativeJS::NodePool m_nodePool(filePath, &engine);
if (parser->parse()) {
- QmlJS::AST::UiProgram *ast = parser->ast();
- DocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed);
- QmlJS::AST::Node::accept(ast, &visitor);
+ QDeclarativeJS::AST::UiProgram *ast = parser->ast();
+ QmlDocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed);
+ QDeclarativeJS::AST::Node::accept(ast, &visitor);
}
}
diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h
index f6d6684..a99e8a3 100644
--- a/tools/qdoc3/qmlcodeparser.h
+++ b/tools/qdoc3/qmlcodeparser.h
@@ -47,9 +47,9 @@
#define QMLCODEPARSER_H
#include <QSet>
-#include "parser/qmljsengine_p.h"
-#include "parser/qmljslexer_p.h"
-#include "parser/qmljsparser_p.h"
+#include "private/qdeclarativejsengine_p.h"
+#include "private/qdeclarativejslexer_p.h"
+#include "private/qdeclarativejsparser_p.h"
#include "codeparser.h"
#include "location.h"
@@ -80,9 +80,9 @@ protected:
virtual QSet<QString> otherMetaCommands();
private:
- QmlJS::Engine engine;
- QmlJS::Lexer *lexer;
- QmlJS::Parser *parser;
+ QDeclarativeJS::Engine engine;
+ QDeclarativeJS::Lexer *lexer;
+ QDeclarativeJS::Parser *parser;
};
QT_END_NAMESPACE
diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp
new file mode 100644
index 0000000..72a2334
--- /dev/null
+++ b/tools/qdoc3/qmlmarkupvisitor.cpp
@@ -0,0 +1,1415 @@
+/****************************************************************************
+**
+** 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 <QDebug>
+#include <QFileInfo>
+#include <QStringList>
+#include <QtGlobal>
+#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("<UiProgram>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *)
+{
+ endWrite("<UiProgram>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport)
+{
+ write("<UiImport>");
+ addVerbatim(uiimport->importToken);
+ if (!uiimport->importUri)
+ addVerbatim(uiimport->fileNameToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport)
+{
+ endWrite("<UiImport>");
+ addVerbatim(uiimport->versionToken);
+ addVerbatim(uiimport->asToken);
+ addVerbatim(uiimport->importIdToken);
+ addVerbatim(uiimport->semicolonToken);
+ //endWrite("<UiImport>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member)
+{
+ write("<UiPublicMember>");
+ 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("<UiPublicMember>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *)
+{
+ write("<UiSourceElement>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *)
+{
+ endWrite("<UiSourceElement>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *)
+{
+ write("<UiParameterList>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *)
+{
+ endWrite("<UiParameterList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer)
+{
+ write("<UiObjectInitializer>");
+ addVerbatim(initializer->lbraceToken, initializer->lbraceToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer)
+{
+ endWrite("<UiObjectInitializer>");
+ addVerbatim(initializer->rbraceToken, initializer->rbraceToken);
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding)
+{
+ write("<UiObjectBinding>");
+ 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("<UiObjectBinding>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding)
+{
+ write("<UiScriptBinding>");
+ 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("<UiScriptBinding>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding)
+{
+ write("<UiArrayBinding>");
+ 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("<UiArrayBinding>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list)
+{
+ write("<UiArrayMemberList>");
+ 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("<UiArrayMemberList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id)
+{
+ write("<UiQualifiedId>");
+ addVerbatim(id->identifierToken);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *)
+{
+ endWrite("<UiQualifiedId>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature)
+{
+ write("<UiSignature>");
+ addVerbatim(signature->lparenToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature)
+{
+ addVerbatim(signature->rparenToken);
+ endWrite("<UiSignature>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal)
+{
+ write("<UiFormal>");
+ addVerbatim(formal->identifierToken);
+ addVerbatim(formal->asToken);
+ addVerbatim(formal->aliasToken);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *)
+{
+ endWrite("<UiFormal>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression)
+{
+ write("<ThisExpression>");
+ addVerbatim(expression->thisToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *)
+{
+ endWrite("<ThisExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier)
+{
+ write("<IdentifierExpression>");
+ addVerbatim(identifier->identifierToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *)
+{
+ endWrite("<IdentifierExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null)
+{
+ write("<NullExpression>");
+ addVerbatim(null->nullToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *)
+{
+ endWrite("<NullExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal)
+{
+ write("<TrueLiteral>");
+ addVerbatim(literal->trueToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *)
+{
+ endWrite("<TrueLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal)
+{
+ write("<FalseLiteral>");
+ addVerbatim(literal->falseToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *)
+{
+ endWrite("<FalseLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal)
+{
+ //write("<NumericLiteral>");
+ addVerbatim(literal->literalToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *)
+{
+ //endWrite("<NumericLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal)
+{
+ //write("<StringLiteral>");
+ addVerbatim(literal->literalToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *)
+{
+ //endWrite("<StringLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal)
+{
+ write("<RegExpLiteral>");
+ addVerbatim(literal->literalToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *)
+{
+ endWrite("<RegExpLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal)
+{
+ write("<ArrayLiteral>");
+ addVerbatim(literal->lbracketToken);
+ QDeclarativeJS::AST::Node::accept(literal->elements, this);
+ addVerbatim(literal->rbracketToken);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *)
+{
+ endWrite("<ArrayLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal)
+{
+ write("<ObjectLiteral>");
+ addVerbatim(literal->lbraceToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal)
+{
+ addVerbatim(literal->rbraceToken);
+ endWrite("<ObjectLiteral>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list)
+{
+ write("<ElementList>");
+ 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("<ElementList>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision)
+{
+ write("<Elision>");
+ addVerbatim(elision->commaToken, elision->commaToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *)
+{
+ endWrite("<Elision>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *)
+{
+ write("<IdentifierPropertyName>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *)
+{
+ endWrite("<IdentifierPropertyName>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *)
+{
+ write("<StringLiteralPropertyName>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *)
+{
+ endWrite("<StringLiteralPropertyName>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *)
+{
+ write("<NumericLiteralPropertyName>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *)
+{
+ endWrite("<NumericLiteralPropertyName>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list)
+{
+ write("<PropertyNameAndValueList>");
+ 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("<PropertyNameAndValueList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression)
+{
+ write("<NestedExpression>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *)
+{
+ endWrite("<NestedExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression)
+{
+ write("<ArrayMemberExpression>");
+ 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("<ArrayMemberExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression)
+{
+ write("<FieldMemberExpression>");
+ QDeclarativeJS::AST::Node::accept(expression->base, this);
+ addVerbatim(expression->dotToken);
+ addVerbatim(expression->identifierToken);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression)
+{
+ endWrite("<FieldMemberExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression)
+{
+ write("<NewMemberExpression>");
+ 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("<NewMemberExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression)
+{
+ write("<NewExpression>");
+ addVerbatim(expression->newToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *)
+{
+ endWrite("<NewExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression)
+{
+ write("<CallExpression>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *)
+{
+ endWrite("<CallExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list)
+{
+ write("<ArgumentList>");
+ addVerbatim(list->commaToken, list->commaToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *)
+{
+ endWrite("<ArgumentList>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression)
+{
+ write("<PostIncrementExpression>");
+ addVerbatim(expression->incrementToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *)
+{
+ endWrite("<PostIncrementExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression)
+{
+ write("<PostDecrementExpression>");
+ addVerbatim(expression->decrementToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *)
+{
+ endWrite("<PostDecrementExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression)
+{
+ write("<DeleteExpression>");
+ addVerbatim(expression->deleteToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *)
+{
+ endWrite("<DeleteExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression)
+{
+ write("<VoidExpression>");
+ addVerbatim(expression->voidToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *)
+{
+ endWrite("<VoidExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression)
+{
+ write("<TypeOfExpression>");
+ addVerbatim(expression->typeofToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *)
+{
+ endWrite("<TypeOfExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression)
+{
+ write("<PreIncrementExpression>");
+ addVerbatim(expression->incrementToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *)
+{
+ endWrite("<PreIncrementExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression)
+{
+ write("<PreDecrementExpression>");
+ addVerbatim(expression->decrementToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *)
+{
+ endWrite("<PreDecrementExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression)
+{
+ write("<UnaryPlusExpression>");
+ addVerbatim(expression->plusToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *)
+{
+ endWrite("<UnaryPlusExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression)
+{
+ write("<UnaryMinusExpression>");
+ addVerbatim(expression->minusToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *)
+{
+ endWrite("<UnaryMinusExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression)
+{
+ write("<TildeExpression>");
+ addVerbatim(expression->tildeToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *)
+{
+ endWrite("<TildeExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression)
+{
+ write("<NotExpression>");
+ addVerbatim(expression->notToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *)
+{
+ endWrite("<NotExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression)
+{
+ write("<BinaryExpression>");
+ 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("<BinaryExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression)
+{
+ write("<ConditionalExpression>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *)
+{
+ endWrite("<ConditionalExpression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression)
+{
+ write("<Expression>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *)
+{
+ endWrite("<Expression>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block)
+{
+ write("<Block>");
+ addVerbatim(block->lbraceToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block)
+{
+ addVerbatim(block->rbraceToken);
+ endWrite("<Block>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *)
+{
+ write("<StatementList>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *)
+{
+ endWrite("<StatementList");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement)
+{
+ write("<VariableStatement>");
+ addVerbatim(statement->declarationKindToken);
+ QDeclarativeJS::AST::Node::accept(statement->declarations, this);
+ addVerbatim(statement->semicolonToken);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *)
+{
+ endWrite("<VariableStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list)
+{
+ write("<VariableDeclarationList>");
+ 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("<VariableDeclarationList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration)
+{
+ write("<VariableDeclaration>");
+ addVerbatim(declaration->identifierToken);
+ QDeclarativeJS::AST::Node::accept(declaration->expression, this);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *)
+{
+ endWrite("<VariableDeclaration>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement)
+{
+ write("<EmptyStatement>");
+ addVerbatim(statement->semicolonToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *)
+{
+ endWrite("<EmptyStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *)
+{
+ write("<ExpressionStatement>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement)
+{
+ addVerbatim(statement->semicolonToken);
+ endWrite("<ExpressionStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement)
+{
+ write("<IfStatement>");
+ 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("<IfStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement)
+{
+ write("<DoWhileStatement>");
+ 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("<DoWhileStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement)
+{
+ write("<WhileStatement>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *)
+{
+ endWrite("<WhileStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement)
+{
+ write("<ForStatement>");
+ 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("<ForStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement)
+{
+ write("<LocalForStatement>");
+ 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("<LocalForStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement)
+{
+ write("<ForEachStatement>");
+ 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("<ForEachStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement)
+{
+ write("<LocalForEachStatement>");
+ 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("<LocalForEachStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement)
+{
+ write("<ContinueStatement>");
+ addVerbatim(statement->continueToken);
+ addVerbatim(statement->identifierToken);
+ addVerbatim(statement->semicolonToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *)
+{
+ endWrite("<ContinueStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement)
+{
+ write("<BreakStatement>");
+ addVerbatim(statement->breakToken);
+ addVerbatim(statement->identifierToken);
+ addVerbatim(statement->semicolonToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *)
+{
+ endWrite("<BreakStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement)
+{
+ write("<ReturnStatement>");
+ addVerbatim(statement->returnToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement)
+{
+ addVerbatim(statement->semicolonToken);
+ endWrite("<ReturnStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement)
+{
+ write("<WithStatement>");
+ addVerbatim(statement->withToken);
+ addVerbatim(statement->lparenToken);
+ addVerbatim(statement->rparenToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *)
+{
+ endWrite("<WithStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block)
+{
+ write("<CaseBlock>");
+ addVerbatim(block->lbraceToken, block->lbraceToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block)
+{
+ endWrite("<CaseBlock>");
+ addVerbatim(block->rbraceToken, block->rbraceToken);
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement)
+{
+ write("<SwitchStatement>");
+ 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("<SwitchStatement>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *)
+{
+ write("<CaseClauses>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *)
+{
+ endWrite("<CaseClauses>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause)
+{
+ write("<CaseClause>");
+ 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("<CaseClause>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause)
+{
+ write("<DefaultClause>");
+ addVerbatim(clause->defaultToken, clause->defaultToken);
+ addVerbatim(clause->colonToken, clause->colonToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *)
+{
+ endWrite("<DefaultClause>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement)
+{
+ write("<LabelledStatement>");
+ addVerbatim(statement->identifierToken);
+ addVerbatim(statement->colonToken);
+ QDeclarativeJS::AST::Node::accept(statement->statement, this);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *)
+{
+ endWrite("<LabelledStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement)
+{
+ write("<ThrowStatement>");
+ addVerbatim(statement->throwToken);
+ QDeclarativeJS::AST::Node::accept(statement->expression, this);
+ addVerbatim(statement->semicolonToken);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *)
+{
+ endWrite("<ThrowStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c)
+{
+ write("<Catch>");
+ 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("<Catch>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f)
+{
+ write("<Finally>");
+ addVerbatim(f->finallyToken);
+ QDeclarativeJS::AST::Node::accept(f->statement, this);
+ return false;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *)
+{
+ endWrite("<Finally>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement)
+{
+ write("<TryStatement>");
+ 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("<TryStatement>");
+}
+
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression)
+{
+ write("<FunctionExpression>");
+ 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("<FunctionExpression>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration)
+{
+ write("<FunctionDeclaration>");
+ 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("<FunctionDeclaration>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list)
+{
+ write("<FormalParameterList>");
+ addVerbatim(list->commaToken, list->commaToken);
+ addVerbatim(list->identifierToken, list->identifierToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *)
+{
+ endWrite("<FormalParameterList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body)
+{
+ write("<FunctionBody>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body)
+{
+ endWrite("<FunctionBody>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement)
+{
+ write("<DebuggerStatement>");
+ addVerbatim(statement->debuggerToken);
+ addVerbatim(statement->semicolonToken);
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *)
+{
+ endWrite("<DebuggerStatement>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *)
+{
+ write("<FunctionSourceElement>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *)
+{
+ endWrite("<FunctionSourceElement>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *)
+{
+ write("<StatementSourceElement>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *)
+{
+ endWrite("<StatementSourceElement>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *)
+{
+ write("<UiObjectDefinition>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *)
+{
+ endWrite("<UiObjectDefinition>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *)
+{
+ write("<UiImportList>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *)
+{
+ endWrite("<UiImportList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *)
+{
+ write("<UiObjectMemberList>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *)
+{
+ endWrite("<UiObjectMemberList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *)
+{
+ write("<UiFormalList>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *)
+{
+ endWrite("<UiFormalList>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *)
+{
+ write("<Program>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *)
+{
+ endWrite("<Program>");
+}
+
+bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *)
+{
+ write("<SourceElements>");
+ return true;
+}
+
+void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *)
+{
+ endWrite("<SourceElements>");
+}
+
+QT_END_NAMESPACE
diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h
new file mode 100644
index 0000000..86e1ac2
--- /dev/null
+++ b/tools/qdoc3/qmlmarkupvisitor.h
@@ -0,0 +1,338 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QMLVISITOR_H
+#define QMLVISITOR_H
+
+#include <QString>
+#include "private/qdeclarativejsastvisitor_p.h"
+#include "node.h"
+#include "tree.h"
+
+QT_BEGIN_NAMESPACE
+
+class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor
+{
+public:
+ QmlMarkupVisitor(const QString &code, bool debug = false);
+ virtual ~QmlMarkupVisitor();
+
+ QString markedUpCode();
+
+ virtual bool visit(QDeclarativeJS::AST::UiProgram *);
+ virtual bool visit(QDeclarativeJS::AST::UiImportList *);
+ virtual bool visit(QDeclarativeJS::AST::UiImport *);
+ virtual bool visit(QDeclarativeJS::AST::UiPublicMember *);
+ virtual bool visit(QDeclarativeJS::AST::UiSourceElement *);
+ virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *);
+ virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *);
+ virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *);
+ virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *);
+ virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *);
+ virtual bool visit(QDeclarativeJS::AST::UiObjectMemberList *);
+ virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *);
+ virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *);
+ virtual bool visit(QDeclarativeJS::AST::UiSignature *);
+ virtual bool visit(QDeclarativeJS::AST::UiFormalList *);
+ virtual bool visit(QDeclarativeJS::AST::UiFormal *);
+
+ virtual void endVisit(QDeclarativeJS::AST::UiProgram *);
+ virtual void endVisit(QDeclarativeJS::AST::UiImportList *);
+ virtual void endVisit(QDeclarativeJS::AST::UiImport *);
+ virtual void endVisit(QDeclarativeJS::AST::UiPublicMember *);
+ virtual void endVisit(QDeclarativeJS::AST::UiSourceElement *);
+ virtual void endVisit(QDeclarativeJS::AST::UiObjectDefinition *);
+ virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *);
+ virtual void endVisit(QDeclarativeJS::AST::UiObjectBinding *);
+ virtual void endVisit(QDeclarativeJS::AST::UiScriptBinding *);
+ virtual void endVisit(QDeclarativeJS::AST::UiArrayBinding *);
+ virtual void endVisit(QDeclarativeJS::AST::UiObjectMemberList *);
+ virtual void endVisit(QDeclarativeJS::AST::UiArrayMemberList *);
+ virtual void endVisit(QDeclarativeJS::AST::UiQualifiedId *);
+ virtual void endVisit(QDeclarativeJS::AST::UiSignature *);
+ virtual void endVisit(QDeclarativeJS::AST::UiFormalList *);
+ virtual void endVisit(QDeclarativeJS::AST::UiFormal *);
+
+ // QDeclarativeJS
+ virtual bool visit(QDeclarativeJS::AST::ThisExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::ThisExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::IdentifierExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::NullExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::NullExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::TrueLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::TrueLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::FalseLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::FalseLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::NumericLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::NumericLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::StringLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::StringLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::RegExpLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::ArrayLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *);
+ virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *);
+
+ virtual bool visit(QDeclarativeJS::AST::ElementList *);
+ virtual void endVisit(QDeclarativeJS::AST::ElementList *);
+
+ virtual bool visit(QDeclarativeJS::AST::Elision *);
+ virtual void endVisit(QDeclarativeJS::AST::Elision *);
+
+ virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *);
+ virtual void endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *);
+
+ virtual bool visit(QDeclarativeJS::AST::NestedExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::NestedExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::IdentifierPropertyName *);
+ virtual void endVisit(QDeclarativeJS::AST::IdentifierPropertyName *);
+
+ virtual bool visit(QDeclarativeJS::AST::StringLiteralPropertyName *);
+ virtual void endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *);
+
+ virtual bool visit(QDeclarativeJS::AST::NumericLiteralPropertyName *);
+ virtual void endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *);
+
+ virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::ArrayMemberExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::FieldMemberExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::NewMemberExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::NewExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::NewExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::CallExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::CallExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::ArgumentList *);
+ virtual void endVisit(QDeclarativeJS::AST::ArgumentList *);
+
+ virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::PostIncrementExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::PostDecrementExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::DeleteExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::DeleteExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::VoidExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::VoidExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::TypeOfExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::PreIncrementExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::PreDecrementExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::UnaryPlusExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::UnaryMinusExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::TildeExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::TildeExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::NotExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::NotExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::BinaryExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::BinaryExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::ConditionalExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::Expression *);
+ virtual void endVisit(QDeclarativeJS::AST::Expression *);
+
+ virtual bool visit(QDeclarativeJS::AST::Block *);
+ virtual void endVisit(QDeclarativeJS::AST::Block *);
+
+ virtual bool visit(QDeclarativeJS::AST::StatementList *);
+ virtual void endVisit(QDeclarativeJS::AST::StatementList *);
+
+ virtual bool visit(QDeclarativeJS::AST::VariableStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::VariableStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *);
+ virtual void endVisit(QDeclarativeJS::AST::VariableDeclarationList *);
+
+ virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *);
+ virtual void endVisit(QDeclarativeJS::AST::VariableDeclaration *);
+
+ virtual bool visit(QDeclarativeJS::AST::EmptyStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::EmptyStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::ExpressionStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::IfStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::IfStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::DoWhileStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::WhileStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::WhileStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::ForStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::ForStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::LocalForStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::LocalForStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::ForEachStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::ForEachStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::LocalForEachStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::ContinueStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::ContinueStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::BreakStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::BreakStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::ReturnStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::ReturnStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::WithStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::WithStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::CaseBlock *);
+ virtual void endVisit(QDeclarativeJS::AST::CaseBlock *);
+
+ virtual bool visit(QDeclarativeJS::AST::SwitchStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::SwitchStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::CaseClauses *);
+ virtual void endVisit(QDeclarativeJS::AST::CaseClauses *);
+
+ virtual bool visit(QDeclarativeJS::AST::CaseClause *);
+ virtual void endVisit(QDeclarativeJS::AST::CaseClause *);
+
+ virtual bool visit(QDeclarativeJS::AST::DefaultClause *);
+ virtual void endVisit(QDeclarativeJS::AST::DefaultClause *);
+
+ virtual bool visit(QDeclarativeJS::AST::LabelledStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::LabelledStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::ThrowStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::ThrowStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::TryStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::TryStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::Catch *);
+ virtual void endVisit(QDeclarativeJS::AST::Catch *);
+
+ virtual bool visit(QDeclarativeJS::AST::Finally *);
+ virtual void endVisit(QDeclarativeJS::AST::Finally *);
+
+ virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *);
+ virtual void endVisit(QDeclarativeJS::AST::FunctionDeclaration *);
+
+ virtual bool visit(QDeclarativeJS::AST::FunctionExpression *);
+ virtual void endVisit(QDeclarativeJS::AST::FunctionExpression *);
+
+ virtual bool visit(QDeclarativeJS::AST::FormalParameterList *);
+ virtual void endVisit(QDeclarativeJS::AST::FormalParameterList *);
+
+ virtual bool visit(QDeclarativeJS::AST::FunctionBody *);
+ virtual void endVisit(QDeclarativeJS::AST::FunctionBody *);
+
+ virtual bool visit(QDeclarativeJS::AST::Program *);
+ virtual void endVisit(QDeclarativeJS::AST::Program *);
+
+ virtual bool visit(QDeclarativeJS::AST::SourceElements *);
+ virtual void endVisit(QDeclarativeJS::AST::SourceElements *);
+
+ virtual bool visit(QDeclarativeJS::AST::FunctionSourceElement *);
+ virtual void endVisit(QDeclarativeJS::AST::FunctionSourceElement *);
+
+ virtual bool visit(QDeclarativeJS::AST::StatementSourceElement *);
+ virtual void endVisit(QDeclarativeJS::AST::StatementSourceElement *);
+
+ virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *);
+ virtual void endVisit(QDeclarativeJS::AST::DebuggerStatement *);
+
+ virtual bool visit(QDeclarativeJS::AST::UiParameterList *);
+ virtual void endVisit(QDeclarativeJS::AST::UiParameterList *);
+
+private:
+ void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location,
+ const QString &text);
+ void addVerbatim(QDeclarativeJS::AST::SourceLocation first,
+ QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation());
+ QString sourceText(QDeclarativeJS::AST::SourceLocation &location);
+ void write(const QString &text);
+ void endWrite(const QString &text);
+
+ QString source;
+ QString output;
+ quint32 cursor;
+ int indent;
+ bool showDebug;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp
index 1d65c3d..9295624 100644
--- a/tools/qdoc3/qmlvisitor.cpp
+++ b/tools/qdoc3/qmlvisitor.cpp
@@ -42,15 +42,17 @@
#include <QFileInfo>
#include <QStringList>
#include <QtGlobal>
-#include "parser/qmljsast_p.h"
-#include "parser/qmljsastfwd_p.h"
-#include "parser/qmljsengine_p.h"
+#include "private/qdeclarativejsast_p.h"
+#include "private/qdeclarativejsastfwd_p.h"
+#include "private/qdeclarativejsengine_p.h"
#include "node.h"
#include "qmlvisitor.h"
-DocVisitor::DocVisitor(const QString &filePath, const QString &code,
- QmlJS::Engine *engine, Tree *tree, QSet<QString> &commands)
+QT_BEGIN_NAMESPACE
+
+QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code,
+ QDeclarativeJS::Engine *engine, Tree *tree, QSet<QString> &commands)
{
this->filePath = filePath;
this->name = QFileInfo(filePath).baseName();
@@ -61,17 +63,17 @@ DocVisitor::DocVisitor(const QString &filePath, const QString &code,
current = tree->root();
}
-DocVisitor::~DocVisitor()
+QmlDocVisitor::~QmlDocVisitor()
{
}
-QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const
+QDeclarativeJS::AST::SourceLocation QmlDocVisitor::precedingComment(unsigned offset) const
{
- QmlJS::AST::SourceLocation currentLoc;
+ QDeclarativeJS::AST::SourceLocation currentLoc;
- foreach (const QmlJS::AST::SourceLocation &loc, engine->comments()) {
+ foreach (const QDeclarativeJS::AST::SourceLocation &loc, engine->comments()) {
if (loc.begin() > lastEndOffset && loc.end() < offset)
- currentLoc = loc;
+ currentLoc = loc;
else
break;
}
@@ -81,13 +83,13 @@ QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const
return currentLoc;
}
- return QmlJS::AST::SourceLocation();
+ return QDeclarativeJS::AST::SourceLocation();
}
-void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location,
+void QmlDocVisitor::applyDocumentation(QDeclarativeJS::AST::SourceLocation location,
Node *node)
{
- QmlJS::AST::SourceLocation loc = precedingComment(location.begin());
+ QDeclarativeJS::AST::SourceLocation loc = precedingComment(location.begin());
if (loc.isValid()) {
QString source = document.mid(loc.offset, loc.length);
@@ -111,7 +113,7 @@ void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location,
/*!
Visits element definitions, recording them in a tree structure.
*/
-bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition)
+bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition)
{
QString type = definition->qualifiedTypeNameId->name->asString();
@@ -130,12 +132,12 @@ bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition)
return true;
}
-void DocVisitor::endVisit(QmlJS::AST::UiObjectDefinition *definition)
+void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition)
{
lastEndOffset = definition->lastSourceLocation().end();
}
-bool DocVisitor::visit(QmlJS::AST::UiImportList *imports)
+bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiImportList *imports)
{
// Note that the imports list can be traversed by iteration to obtain
// all the imports in the document at once, having found just one:
@@ -154,10 +156,10 @@ bool DocVisitor::visit(QmlJS::AST::UiImportList *imports)
Visits public member declarations, such as signals and properties.
These only include custom signals and properties.
*/
-bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member)
+bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member)
{
switch (member->type) {
- case QmlJS::AST::UiPublicMember::Signal:
+ case QDeclarativeJS::AST::UiPublicMember::Signal:
{
if (current->type() == Node::Fake) {
QmlClassNode *qmlClass = static_cast<QmlClassNode *>(current);
@@ -167,7 +169,7 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member)
FunctionNode *qmlSignal = new FunctionNode(Node::QmlSignal, current, name, false);
QList<Parameter> parameters;
- for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) {
+ for (QDeclarativeJS::AST::UiParameterList *it = member->parameters; it; it = it->next) {
if (it->type && it->name)
parameters.append(Parameter(it->type->asString(), "", it->name->asString()));
}
@@ -178,7 +180,7 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member)
}
break;
}
- case QmlJS::AST::UiPublicMember::Property:
+ case QDeclarativeJS::AST::UiPublicMember::Property:
{
QString type = member->memberType->asString();
QString name = member->name->asString();
@@ -206,12 +208,14 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member)
return true;
}
-void DocVisitor::endVisit(QmlJS::AST::UiPublicMember *definition)
+void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *definition)
{
lastEndOffset = definition->lastSourceLocation().end();
}
-bool DocVisitor::visit(QmlJS::AST::IdentifierPropertyName *idproperty)
+bool QmlDocVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty)
{
return true;
}
+
+QT_END_NAMESPACE
diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h
index a830793..c7b4bda 100644
--- a/tools/qdoc3/qmlvisitor.h
+++ b/tools/qdoc3/qmlvisitor.h
@@ -39,36 +39,38 @@
**
****************************************************************************/
-#ifndef DOCVISITOR_H
-#define DOCVISITOR_H
+#ifndef QMLVISITOR_H
+#define QMLVISITOR_H
#include <QString>
-#include "parser/qmljsastvisitor_p.h"
+#include "private/qdeclarativejsastvisitor_p.h"
#include "node.h"
#include "tree.h"
-class DocVisitor : public QmlJS::AST::Visitor
+QT_BEGIN_NAMESPACE
+
+class QmlDocVisitor : public QDeclarativeJS::AST::Visitor
{
public:
- DocVisitor(const QString &filePath, const QString &code,
- QmlJS::Engine *engine, Tree *tree, QSet<QString> &commands);
- virtual ~DocVisitor();
+ QmlDocVisitor(const QString &filePath, const QString &code,
+ QDeclarativeJS::Engine *engine, Tree *tree, QSet<QString> &commands);
+ virtual ~QmlDocVisitor();
- bool visit(QmlJS::AST::UiImportList *imports);
+ bool visit(QDeclarativeJS::AST::UiImportList *imports);
- bool visit(QmlJS::AST::UiObjectDefinition *definition);
- void endVisit(QmlJS::AST::UiObjectDefinition *definition);
+ bool visit(QDeclarativeJS::AST::UiObjectDefinition *definition);
+ void endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition);
- bool visit(QmlJS::AST::UiPublicMember *member);
- void endVisit(QmlJS::AST::UiPublicMember *definition);
+ bool visit(QDeclarativeJS::AST::UiPublicMember *member);
+ void endVisit(QDeclarativeJS::AST::UiPublicMember *definition);
- bool visit(QmlJS::AST::IdentifierPropertyName *idproperty);
+ bool visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty);
private:
- QmlJS::AST::SourceLocation precedingComment(unsigned offset) const;
- void applyDocumentation(QmlJS::AST::SourceLocation location, Node *node);
+ QDeclarativeJS::AST::SourceLocation precedingComment(unsigned offset) const;
+ void applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node);
- QmlJS::Engine *engine;
+ QDeclarativeJS::Engine *engine;
quint32 lastEndOffset;
QString filePath;
QString name;
@@ -79,4 +81,6 @@ private:
InnerNode *current;
};
+QT_END_NAMESPACE
+
#endif