summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/qmlcodemarker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qdoc3/qmlcodemarker.cpp')
-rw-r--r--tools/qdoc3/qmlcodemarker.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp
index 1e4ad1e..a7dc5a0 100644
--- a/tools/qdoc3/qmlcodemarker.cpp
+++ b/tools/qdoc3/qmlcodemarker.cpp
@@ -103,6 +103,14 @@ bool QmlCodeMarker::recognizeLanguage(const QString &language)
}
/*!
+ Returns the type of atom used to represent QML code in the documentation.
+*/
+Atom::Type QmlCodeMarker::atomType() const
+{
+ return Atom::Qml;
+}
+
+/*!
Returns the name of the \a node. Method names include are returned with a
trailing set of parentheses.
*/
@@ -134,9 +142,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 +182,8 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList& includes)
code += "import " + *inc + "\n";
++inc;
}
- return protect(addMarkUp(code, 0, ""));
+ Location location;
+ return addMarkUp(code, 0, location);
}
QString QmlCodeMarker::functionBeginRegExp(const QString& funcName)
@@ -190,7 +199,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 +219,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;
}