aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2000-08-25 14:12:36 +0000
committernyamatongwe <devnull@localhost>2000-08-25 14:12:36 +0000
commitf67319305972bdb081cf43a8c08c12877e2ed262 (patch)
tree89f13e3fe627e95929ee369843af048bc5c38a75 /src
parente6f015379b8d378ca2db95272ae8323a0897b558 (diff)
downloadscintilla-mirror-f67319305972bdb081cf43a8c08c12877e2ed262.tar.gz
Patches from Eric Prmislow and Steffen Goeldner to fix up here docs
some quoting and pos handling.
Diffstat (limited to 'src')
-rw-r--r--src/LexPerl.cxx37
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--;