aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexPerl.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2011-08-03 21:20:34 +1000
committernyamatongwe <unknown>2011-08-03 21:20:34 +1000
commitf13c4e804a0e2a832466d42fb3cf0a5852bf67f6 (patch)
tree2a88f5aa54acb2253fb3647b94a5ea27b56797c2 /lexers/LexPerl.cxx
parent0b9954621a5f1219b4394c6c4e225d087edc1414 (diff)
downloadscintilla-mirror-f13c4e804a0e2a832466d42fb3cf0a5852bf67f6.tar.gz
Patch from Kein-Hong Man:
- bkend adjust - removal of isMatch() No changes to behaviour or highlighting, _except_ for CRLF line endings, highlighting will stop at the end of the HEREDOC delimiter instead of eating up the CR as well.
Diffstat (limited to 'lexers/LexPerl.cxx')
-rw-r--r--lexers/LexPerl.cxx31
1 files changed, 12 insertions, 19 deletions
diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx
index 7f0cbcf62..8a4456273 100644
--- a/lexers/LexPerl.cxx
+++ b/lexers/LexPerl.cxx
@@ -246,14 +246,6 @@ static bool styleCheckSubPrototype(LexAccessor &styler, unsigned int bk) {
return true;
}
-static bool isMatch(const char *sref, char *s) {
- // match per-line delimiter - must kill trailing CR if CRLF
- int i = strlen(s);
- if (i != 0 && s[i - 1] == '\r')
- s[i - 1] = '\0';
- return (strcmp(sref, s) == 0);
-}
-
static int actualNumStyle(int numberStyle) {
if (numberStyle == PERLNUM_VECTOR || numberStyle == PERLNUM_V_VECTOR) {
return SCE_PL_STRING;
@@ -773,16 +765,17 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
case SCE_PL_HERE_QX: {
// also implies HereDoc.State == 2
sc.Complete();
- while (!sc.atLineEnd)
- sc.Forward();
- char s[HERE_DELIM_MAX];
- sc.GetCurrent(s, sizeof(s));
- if (isMatch(HereDoc.Delimiter, s)) {
+ if (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter)) {
+ sc.Forward(HereDoc.DelimiterLength);
+ if (sc.atLineEnd || ((sc.ch == '\r' && sc.chNext == '\n'))) {
sc.SetState(SCE_PL_DEFAULT);
backFlag = BACK_NONE;
HereDoc.State = 0;
}
}
+ while (!sc.atLineEnd)
+ sc.Forward();
+ }
break;
case SCE_PL_POD:
case SCE_PL_POD_VERB: {
@@ -910,13 +903,14 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
break;
case SCE_PL_FORMAT: {
sc.Complete();
- while (!sc.atLineEnd)
+ if (sc.Match('.')) {
sc.Forward();
- char s[10];
- sc.GetCurrent(s, sizeof(s));
- if (isMatch(".", s))
+ if (sc.atLineEnd || ((sc.ch == '\r' && sc.chNext == '\n')))
sc.SetState(SCE_PL_DEFAULT);
}
+ while (!sc.atLineEnd)
+ sc.Forward();
+ }
break;
case SCE_PL_ERROR:
break;
@@ -1127,7 +1121,6 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
bool isHereDoc = sc.Match('<', '<');
bool hereDocSpace = false; // for: SCALAR [whitespace] '<<'
unsigned int bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0;
- unsigned int bkend;
sc.Complete();
styler.Flush();
if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
@@ -1196,7 +1189,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
// keywords always forced as /PATTERN/: split, if, elsif, while
// everything else /PATTERN/ unless digit/space immediately after '/'
// for '//', defined-or favoured unless special keywords
- bkend = bk + 1;
+ unsigned int bkend = bk + 1;
while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) {
bk--;
}