forked from qt-creator/qt-creator
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:
@@ -881,8 +881,10 @@ int Lexer::scanString(ScanStringMode mode)
|
|||||||
if (_engine) {
|
if (_engine) {
|
||||||
while (_codePtr <= _endPtr) {
|
while (_codePtr <= _endPtr) {
|
||||||
if (isLineTerminator()) {
|
if (isLineTerminator()) {
|
||||||
if ((quote == QLatin1Char('`') || qmlMode()))
|
if ((quote == QLatin1Char('`') || qmlMode())) {
|
||||||
|
--_currentLineNumber;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
_errorCode = IllegalCharacter;
|
_errorCode = IllegalCharacter;
|
||||||
_errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal");
|
_errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal");
|
||||||
return T_ERROR;
|
return T_ERROR;
|
||||||
|
Reference in New Issue
Block a user