From 612bdefb4bb1e41412f76d1a189bf65bc5052a07 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 18 Mar 2013 20:42:55 +1100 Subject: Bug: [#1454]. Reject raw strings when character after " is in " )\\\t\v\f\n". See C++11 standard 2.14.5 String literals. --- lexers/LexCPP.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 4f3b4f509..116ea7279 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -494,6 +494,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); + CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n"); + if (options.identifiersAllowDollars) { setWordStart.Add('$'); } @@ -654,7 +656,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, const bool literalString = sc.ch == '\"'; if (literalString || sc.ch == '\'') { size_t lenS = strlen(s); - const bool raw = literalString && sc.chPrev == 'R'; + const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext); if (raw) s[lenS--] = '\0'; bool valid = -- cgit v1.2.3