From 1ee64b2b5d2b0c3d62dfbc1e1f8ac6ced290a9b1 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 24 May 2014 08:49:35 +1000 Subject: Fix raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW. --- lexers/LexCPP.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lexers') 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); } -- cgit v1.2.3