aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/parser/qqmljslexer.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-11 07:50:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-11 14:50:32 +0100
commit8147bc2f70306f4dff95c933e97566e75afb18f8 (patch)
treeaef91a4ae3ca2f159f9548a668403585d28f8f43 /src/qml/qml/parser/qqmljslexer.cpp
parent163b0056096a9d7eca2272fe7e969f99ecd1cab8 (diff)
Don't bail out on 0 chars in comments
Gets a few more parser tests in the test suite to pass. Change-Id: Id9ac5211f64aafdd621f6187ad7061ff967bc947 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/qml/qml/parser/qqmljslexer.cpp')
-rw-r--r--src/qml/qml/parser/qqmljslexer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/parser/qqmljslexer.cpp b/src/qml/qml/parser/qqmljslexer.cpp
index 1270fdbc91..4e15065e30 100644
--- a/src/qml/qml/parser/qqmljslexer.cpp
+++ b/src/qml/qml/parser/qqmljslexer.cpp
@@ -136,6 +136,7 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode)
_tokenSpell = QStringRef();
_codePtr = code.unicode();
+ _endPtr = _codePtr + code.length();
_lastLinePtr = _codePtr;
_tokenLinePtr = _codePtr;
_tokenStartPtr = _codePtr;
@@ -448,7 +449,7 @@ again:
case '/':
if (_char == QLatin1Char('*')) {
scanChar();
- while (!_char.isNull()) {
+ while (_codePtr <= _endPtr) {
if (_char == QLatin1Char('*')) {
scanChar();
if (_char == QLatin1Char('/')) {
@@ -466,7 +467,7 @@ again:
}
}
} else if (_char == QLatin1Char('/')) {
- while (!_char.isNull() && !isLineTerminator()) {
+ while (_codePtr <= _endPtr && !isLineTerminator()) {
scanChar();
}
if (_engine) {