aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-05-24 08:49:35 +1000
committerNeil <nyamatongwe@gmail.com>2014-05-24 08:49:35 +1000
commite744d191cb5398139666d188dac7c94358ba512c (patch)
treeeb67c26ecad354013d7471fa820d61d660082998 /lexers/LexCPP.cxx
parentc813c65a565f815d7d01f10d1518f4571a31f45f (diff)
downloadscintilla-mirror-e744d191cb5398139666d188dac7c94358ba512c.tar.gz
Fix raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW.
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r--lexers/LexCPP.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index 7fe680991..e8b705b1f 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -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);
}