CppEditor: Fix highlighting of raw string literals

... with the built-in highlighter.
Pass the necessary context information in and out of the SimpleLexer.

Task-number: QTCREATORBUG-26211
Fixes: QTCREATORBUG-26425
Fixes: QTCREATORBUG-26615
Change-Id: Id72f743e07ae117ca51b0d5e527b208dda133b7e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-12-08 13:57:24 +01:00
parent 3eef024960
commit a3af941adf
7 changed files with 79 additions and 22 deletions

View File

@@ -67,6 +67,7 @@ Tokens SimpleLexer::operator()(const QString &text, int state)
const char *lastChar = firstChar + bytes.size();
Lexer lex(firstChar, lastChar);
lex.setExpectedRawStringSuffix(_expectedRawStringSuffix);
lex.setLanguageFeatures(_languageFeatures);
lex.setStartWithNewline(true);
lex.setPreprocessorMode(_ppMode);
@@ -108,6 +109,7 @@ Tokens SimpleLexer::operator()(const QString &text, int state)
}
_lastState = lex.state();
_expectedRawStringSuffix = lex.expectedRawStringSuffix();
return tokens;
}