QmlJS: Fix line number for string literals

When a string value's first line ends with an EOL the
line number for the next line got wrong which in turn
confused the syntax highlighter.

Fixes: QTCREATORBUG-23777
Change-Id: I37eed839a2e63cf470b9bc2ac0596ab8bc8d373c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Christian Stenger
2020-04-29 15:38:02 +02:00
parent 5feec21cbd
commit 626807c94e

View File

@@ -881,8 +881,10 @@ int Lexer::scanString(ScanStringMode mode)
if (_engine) {
while (_codePtr <= _endPtr) {
if (isLineTerminator()) {
if ((quote == QLatin1Char('`') || qmlMode()))
if ((quote == QLatin1Char('`') || qmlMode())) {
--_currentLineNumber;
break;
}
_errorCode = IllegalCharacter;
_errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal");
return T_ERROR;