summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/qmlparser/qqmljsparser.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2015-03-09 10:23:50 +0100
committerMartin Smith <martin.smith@digia.com>2015-03-12 08:32:30 +0000
commitee63462f472d528214b4a5163a36da0bb963c166 (patch)
tree571482bfdbc88b411d693eb478af61dae1cfac71 /src/tools/qdoc/qmlparser/qqmljsparser.cpp
parentfd826c112e01226f40bbfad7e20bdb5461b7ace6 (diff)
qdoc: Bring qdoc's QML parser up to date
qdoc's QML parser has fallen behind the QML: parser in QtDeclarative. Bring it up to date. Change-Id: I12a688873564762434852960350c56655004e460 Task-number: QTBUG-44868 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/qmlparser/qqmljsparser.cpp')
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsparser.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/tools/qdoc/qmlparser/qqmljsparser.cpp b/src/tools/qdoc/qmlparser/qqmljsparser.cpp
index 44279260d7..520c377034 100644
--- a/src/tools/qdoc/qmlparser/qqmljsparser.cpp
+++ b/src/tools/qdoc/qmlparser/qqmljsparser.cpp
@@ -161,7 +161,24 @@ bool Parser::parse(int startToken)
token_buffer[0].token = startToken;
first_token = &token_buffer[0];
- last_token = &token_buffer[1];
+ if (startToken == T_FEED_JS_PROGRAM && !lexer->qmlMode()) {
+ Directives ignoreDirectives;
+ Directives *directives = driver->directives();
+ if (!directives)
+ directives = &ignoreDirectives;
+ DiagnosticMessage error;
+ if (!lexer->scanDirectives(directives, &error)) {
+ diagnostic_messages.append(error);
+ return false;
+ }
+ token_buffer[1].token = lexer->tokenKind();
+ token_buffer[1].dval = lexer->tokenValue();
+ token_buffer[1].loc = location(lexer);
+ token_buffer[1].spell = lexer->tokenSpell();
+ last_token = &token_buffer[2];
+ } else {
+ last_token = &token_buffer[1];
+ }
tos = -1;
program = 0;