From 3b0138cc5fdd87143fdce276a505453d9ebc35b2 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 8 Nov 2000 23:28:16 +0000 Subject: Patch from Steffen for regex. --- src/LexPerl.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index a7186fe55..7bc08f333 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -380,8 +380,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, quoteUp = ch; quoteDown = opposite(ch); quotes++; + } else if (ch == '\\' && quoteUp != '\\') { + // SG: Is it save to skip *every* escaped char? + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); } else { - if (ch == quoteDown && chPrev != '\\') { + if (ch == quoteDown /*&& chPrev != '\\'*/) { quotes--; if (quotes == 0) { quoteRep--; @@ -396,7 +401,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, ch = ' '; } } - } else if (ch == quoteUp && chPrev != '\\') { + } else if (ch == quoteUp /*&& chPrev != '\\'*/) { quotes++; } else if (!isalpha(chNext)) { if (quoteRep <= 0) { @@ -411,6 +416,11 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, quoteUp = ch; quoteDown = opposite(ch); quotes++; + } else if (ch == '\\' && quoteUp != '\\') { + // SG: Is it save to skip *every* escaped char? + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); } else { if (quotes == 0 && quoteRep == 1) { /* We matched something like s(...) or tr{...} @@ -437,7 +447,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, quoteDown = opposite(ch); quotes++; } - } else if (ch == quoteDown && chPrev != '\\') { + } else if (ch == quoteDown /*&& chPrev != '\\'*/) { quotes--; if (quotes == 0) { quoteRep--; @@ -452,7 +462,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, if (quoteUp == quoteDown) { quotes++; } - } else if (ch == quoteUp && chPrev != '\\') { + } else if (ch == quoteUp /*&& chPrev != '\\'*/) { quotes++; } else if (!isalpha(chNext)) { if (quoteRep <= 0) { -- cgit v1.2.3