aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJad Altahan <xviyy@aol.com>2019-01-06 08:50:53 +1100
committerJad Altahan <xviyy@aol.com>2019-01-06 08:50:53 +1100
commitb7937365db8e0a049155fda1b31d2c3ff5321547 (patch)
tree62de8869b72bc06f67ac928cdc7677b24dd25b5c
parentf9a1fdae50f2854bfdbbaf28dd4baece1cf1fac0 (diff)
downloadscintilla-mirror-b7937365db8e0a049155fda1b31d2c3ff5321547.tar.gz
Backport: Feature [feature-requests:#1251]. Properly ignore backslash in raw strings.
Backport of changeset 7193:c7115cdddcfe.
-rw-r--r--lexers/LexNim.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx
index 57635adee..c2bc83ffd 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 {