summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/qmlcodemarker.cpp
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-12-21 17:38:04 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-12-21 17:38:04 (GMT)
commitea41ba11fc848dbefecb0cde324478ab1986e555 (patch)
treea2a4dd1786ad4e3f0ffbfcb20ad3f964815e3049 /tools/qdoc3/qmlcodemarker.cpp
parent9862f29b3c8d3f23113388b48b1c4b86523137dc (diff)
downloadQt-ea41ba11fc848dbefecb0cde324478ab1986e555.zip
Qt-ea41ba11fc848dbefecb0cde324478ab1986e555.tar.gz
Qt-ea41ba11fc848dbefecb0cde324478ab1986e555.tar.bz2
Enabled error reporting and a plain text fallback for invalid QML.
The location of places where code is included in documentation is now passed into each code marker when highlighted code is needed.
Diffstat (limited to 'tools/qdoc3/qmlcodemarker.cpp')
-rw-r--r--tools/qdoc3/qmlcodemarker.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp
index 1e4ad1e..fc91cbb 100644
--- a/tools/qdoc3/qmlcodemarker.cpp
+++ b/tools/qdoc3/qmlcodemarker.cpp
@@ -134,9 +134,9 @@ QString QmlCodeMarker::plainFullName(const Node *node, const Node *relative)
QString QmlCodeMarker::markedUpCode(const QString &code,
const Node *relative,
- const QString &dirPath)
+ const Location &location)
{
- return addMarkUp(code, relative, dirPath);
+ return addMarkUp(code, relative, location);
}
QString QmlCodeMarker::markedUpName(const Node *node)
@@ -174,7 +174,8 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList& includes)
code += "import " + *inc + "\n";
++inc;
}
- return protect(addMarkUp(code, 0, ""));
+ Location location;
+ return protect(addMarkUp(code, 0, location));
}
QString QmlCodeMarker::functionBeginRegExp(const QString& funcName)
@@ -190,7 +191,7 @@ QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */)
QString QmlCodeMarker::addMarkUp(const QString &code,
const Node * /* relative */,
- const QString & /* dirPath */)
+ const Location &location)
{
QDeclarativeJS::Engine engine;
QDeclarativeJS::Lexer lexer(&engine);
@@ -210,7 +211,13 @@ QString QmlCodeMarker::addMarkUp(const QString &code,
QmlMarkupVisitor visitor(code, pragmas, &engine);
QDeclarativeJS::AST::Node::accept(ast, &visitor);
output = visitor.markedUpCode();
+ } else {
+ location.warning(tr("Unable to parse QML: \"%1\" at line %2, column %3").arg(
+ parser.errorMessage()).arg(parser.errorLineNumber()).arg(
+ parser.errorColumnNumber()));
+ output = protect(code);
}
+
return output;
}