diff options
author | nyamatongwe <unknown> | 2013-03-18 20:42:55 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2013-03-18 20:42:55 +1100 |
commit | 612bdefb4bb1e41412f76d1a189bf65bc5052a07 (patch) | |
tree | af0d8bc61cf88090a89818560591b89930f092b9 /lexers/LexCPP.cxx | |
parent | 3188cfac86cf4f47137b370cfb570adeca64648d (diff) | |
download | scintilla-mirror-612bdefb4bb1e41412f76d1a189bf65bc5052a07.tar.gz |
Bug: [#1454]. Reject raw strings when character after " is in " )\\\t\v\f\n".
See C++11 standard 2.14.5 String literals.
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r-- | lexers/LexCPP.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
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 = |