aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r--lexers/LexCPP.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index 7fe680991..b8b48aa52 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -8,10 +8,10 @@
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
+#include <ctype.h>
#include <string>
#include <vector>
@@ -821,10 +821,18 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
if (valid) {
- if (literalString)
- sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
- else
+ if (literalString) {
+ if (raw) {
+ // Set the style of the string prefix to SCE_C_STRINGRAW but then change to
+ // SCE_C_DEFAULT as that allows the raw string start code to run.
+ sc.ChangeState(SCE_C_STRINGRAW|activitySet);
+ sc.SetState(SCE_C_DEFAULT|activitySet);
+ } else {
+ sc.ChangeState(SCE_C_STRING|activitySet);
+ }
+ } else {
sc.ChangeState(SCE_C_CHARACTER|activitySet);
+ }
} else {
sc.SetState(SCE_C_DEFAULT | activitySet);
}