From 8077a5ea7cb8536307f24fb9b4dd605dd64ed711 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 11 Dec 2012 07:51:22 +0100 Subject: 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 --- src/qml/qml/parser/qqmljslexer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/qml/qml/parser') 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); -- cgit v1.2.3