diff options
author | Jad Altahan <xviyy@aol.com> | 2019-01-06 08:50:53 +1100 |
---|---|---|
committer | Jad Altahan <xviyy@aol.com> | 2019-01-06 08:50:53 +1100 |
commit | c3caf294be67a3de63c607689f28cbc390900754 (patch) | |
tree | 8d88af4edcb84e1154225d365933ee17e4be46b2 | |
parent | 0379ebb29967c02b31d619651861494ea00b212b (diff) | |
download | scintilla-mirror-c3caf294be67a3de63c607689f28cbc390900754.tar.gz |
Feature [feature-requests:#1251]. Properly ignore backslash in raw strings.
-rw-r--r-- | lexers/LexNim.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx index 304f93463..40755cd9d 100644 --- a/lexers/LexNim.cxx +++ b/lexers/LexNim.cxx @@ -297,6 +297,7 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, int decimalCount = 0; bool funcNameExists = false; + bool isStylingRawString = false; for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { @@ -310,7 +311,7 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, // Handle string line continuation if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') && - (sc.state == SCE_NIM_STRING || sc.state == SCE_NIM_CHARACTER)) { + (sc.state == SCE_NIM_STRING || sc.state == SCE_NIM_CHARACTER) && !isStylingRawString) { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { @@ -477,7 +478,7 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, } break; case SCE_NIM_STRING: - if (sc.ch == '\\') { + if (sc.ch == '\\' && !isStylingRawString) { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } @@ -543,11 +544,15 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, } // Raw string else if ((sc.ch == 'r' || sc.ch == 'R') && sc.chNext == '\"') { + isStylingRawString = true; + sc.SetState(SCE_NIM_STRING); sc.Forward(); } // String and triple double literal else if (sc.ch == '\"') { + isStylingRawString = false; + if (sc.Match(R"(""")")) { sc.SetState(SCE_NIM_TRIPLEDOUBLE); } else { |