aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-04-12 12:15:12 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-04-13 11:36:12 +0000
commitb795b42980d24b8c3febb7d9c7c1fd6b6ff1ba9a (patch)
tree13f56f1e4e20a720ee3f696528a41b583b41cd1f /src/libs/3rdparty/cplusplus
parent8fb258b85e82e2d520d1ae20226c3f89af22d019 (diff)
CppEditor: More special rendering for string literals
Display prefixes and suffixes different from the actual string, like we already did for raw string literals. This uncovered some minor bugs in both lexer and highlighter: - Wrong length for a setFormat() call in highlightRawStringLiteral() - Missing check for user-defined literal in raw string literals - Missing check for user-defined literal in multi-line strings Fixes: QTCREATORBUG-28869 Change-Id: I018717c50ddc1d09c609556161c85dfb0cc29fab Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus')
-rw-r--r--src/libs/3rdparty/cplusplus/Lexer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp
index e2f1b4e0e6..fc1b72cb7d 100644
--- a/src/libs/3rdparty/cplusplus/Lexer.cpp
+++ b/src/libs/3rdparty/cplusplus/Lexer.cpp
@@ -217,14 +217,17 @@ void Lexer::scan_helper(Token *tok)
tok->f.kind = s._tokenKind;
const bool found = _expectedRawStringSuffix.isEmpty()
? scanUntilRawStringLiteralEndSimple() : scanUntilRawStringLiteralEndPrecise();
- if (found)
+ if (found) {
+ scanOptionalUserDefinedLiteral(tok);
_state = 0;
+ }
return;
} else { // non-raw strings
tok->f.joined = true;
tok->f.kind = s._tokenKind;
_state = 0;
scanUntilQuote(tok, '"');
+ scanOptionalUserDefinedLiteral(tok);
return;
}
@@ -829,6 +832,8 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
_expectedRawStringSuffix.prepend(')');
_expectedRawStringSuffix.append('"');
}
+ if (closed)
+ scanOptionalUserDefinedLiteral(tok);
}
bool Lexer::scanUntilRawStringLiteralEndPrecise()