diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-22 06:08:41 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-22 06:08:41 (GMT) |
commit | 58b9468d70fcfdd178f17e89d163c6f9879221d8 (patch) | |
tree | 8a68ef3e21de397e5e30b7c04cbb1fae8ad40874 /src/declarative/qml/parser | |
parent | 91215b48022b3b3980960f1b5f301ac84f14d49d (diff) | |
download | Qt-58b9468d70fcfdd178f17e89d163c6f9879221d8.zip Qt-58b9468d70fcfdd178f17e89d163c6f9879221d8.tar.gz Qt-58b9468d70fcfdd178f17e89d163c6f9879221d8.tar.bz2 |
Reuse QML lexer to simplify .pragma script logic
Diffstat (limited to 'src/declarative/qml/parser')
-rw-r--r-- | src/declarative/qml/parser/qdeclarativejslexer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp index fcaaece..65a6af2 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer.cpp +++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp @@ -103,7 +103,7 @@ Lexer::Lexer(Engine *eng, bool tokenizeComments) prohibitAutomaticSemicolon(false), tokenizeComments(tokenizeComments) { - driver->setLexer(this); + if (driver) driver->setLexer(this); // allocate space for read buffers buffer8 = new char[size8]; buffer16 = new QChar[size16]; @@ -677,9 +677,9 @@ int Lexer::lex() setDone(Other); } else state = Start; - driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); } else if (current == 0) { - driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); setDone(Eof); } @@ -689,14 +689,14 @@ int Lexer::lex() setDone(Bad); err = UnclosedComment; errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed comment at end of file"); - driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); } else if (isLineTerminator()) { shiftWindowsLineBreak(); yylineno++; } else if (current == '*' && next1 == '/') { state = Start; shift(1); - driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); } break; |