diff options
author | nyamatongwe <unknown> | 2000-08-25 14:12:36 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-08-25 14:12:36 +0000 |
commit | 15ebb96b9cee4f33d9d417ed7d373656d752b809 (patch) | |
tree | 89f13e3fe627e95929ee369843af048bc5c38a75 | |
parent | c52b5d43b1b0dab4513ea6f23d544161d0623809 (diff) | |
download | scintilla-mirror-15ebb96b9cee4f33d9d417ed7d373656d752b809.tar.gz |
Patches from Eric Prmislow and Steffen Goeldner to fix up here docs
some quoting and pos handling.
-rw-r--r-- | src/LexPerl.cxx | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index 3c9972e2d..5c6d57ad6 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -230,7 +230,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, quotes = 0; sookedpos = 0; sooked[sookedpos] = '\0'; - } else if (ch == '=' && isalpha(chNext)) { + } else if (ch == '=' && (chPrev == '\r' || chPrev == '\n') && isalpha(chNext)) { styler.ColourTo(i - 1, state); state = SCE_PL_POD; quotes = 0; @@ -284,7 +284,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, state = SCE_PL_DEFAULT; } } else if (state == SCE_PL_HERE) { - if (isalnum(ch) && quotes < 2) { + if ((isalnum(ch) || ch == '_') && quotes < 2) { sooked[sookedpos++] = ch; sooked[sookedpos] = '\0'; if (quotes == 0) @@ -297,9 +297,11 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, i += sookedpos; chNext = styler.SafeGetCharAt(i); if (chNext == '\n' || chNext == '\r') { + styler.ColourTo(i - 1, SCE_PL_HERE); state = SCE_PL_DEFAULT; } - chNext = ' '; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); } } else if (state == SCE_PL_STRING) { if (ch == '\\') { @@ -338,7 +340,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, chNext = styler.SafeGetCharAt(i + 1); } } else if (state == SCE_PL_POD) { - if (ch == '=') { + if (ch == '=' && (chPrev == '\r' || chPrev == '\n')) { if (isMatch(styler, lengthDoc, i, "=cut")) { styler.ColourTo(i - 1 + 4, state); i += 4; @@ -409,7 +411,32 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, quoteDown = opposite(ch); quotes++; } else { - if (ch == quoteDown && chPrev != '\\') { + if (quotes == 0 && quoteRep == 1) { + /* We matched something like s(...) or tr{...} + * and are looking for the next matcher characters, + * which could be either bracketed ({...}) or non-bracketed + * (/.../). + * + * Number-signs are problematic. If they occur after + * the close of the first part, treat them like + * a quoteUp char, even if they actually start comments. + * + * If we find an alnum, we end the regsubst, and punt. + * + * Eric Promislow ericp@activestate.com Aug 9,2000 + */ + if (isspace(ch)) { + // Keep going + } else if (isalnum(ch)) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } else { + quoteUp = ch; + quoteDown = opposite(ch); + quotes++; + } + } else if (ch == quoteDown && chPrev != '\\') { quotes--; if (quotes == 0) { quoteRep--; |