aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/parser
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-11 07:51:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-11 14:50:32 +0100
commit8077a5ea7cb8536307f24fb9b4dd605dd64ed711 (patch)
tree2b573aa3712aac6fa1a6c187f8c11a7ec64508cc /src/qml/qml/parser
parent8147bc2f70306f4dff95c933e97566e75afb18f8 (diff)
Bail out on stray newlines in strings in JS mode
Still allow newlines in QML mode to keep compatibility for existing code. Change-Id: I11dbd5a73ea8958f5ddc199b77a919969f8a5214 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/qml/qml/parser')
-rw-r--r--src/qml/qml/parser/qqmljslexer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/qml/parser/qqmljslexer.cpp b/src/qml/qml/parser/qqmljslexer.cpp
index 4e15065e30..158640c47e 100644
--- a/src/qml/qml/parser/qqmljslexer.cpp
+++ b/src/qml/qml/parser/qqmljslexer.cpp
@@ -610,7 +610,13 @@ again:
if (_engine) {
while (!_char.isNull()) {
- if (isLineTerminator() || _char == QLatin1Char('\\')) {
+ if (isLineTerminator()) {
+ if (qmlMode())
+ break;
+ _errorCode = IllegalCharacter;
+ _errorMessage = QCoreApplication::translate("QQmlParser", "Stray newline in string literal");
+ return T_ERROR;
+ } else if (_char == QLatin1Char('\\')) {
break;
} else if (_char == quote) {
_tokenSpell = _engine->midRef(startCode - _code.unicode() - 1, _codePtr - startCode);