aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2001-01-24 07:16:01 +0000
committernyamatongwe <devnull@localhost>2001-01-24 07:16:01 +0000
commit6aaed7ef7aa920c1ef8e6fee5a2d404137654b79 (patch)
tree1dec2ca388e0bc7468cc390a1270c846c8972941
parentd0382da733c8acd1099c346d44e067f99118b042 (diff)
downloadscintilla-mirror-6aaed7ef7aa920c1ef8e6fee5a2d404137654b79.tar.gz
Made special scalars like $( and $_ work.
Made some variables unsigned to avoid warnings.
-rw-r--r--src/LexPerl.cxx22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx
index d28c88c6c..4ba835c56 100644
--- a/src/LexPerl.cxx
+++ b/src/LexPerl.cxx
@@ -144,7 +144,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
bool preferRE = true;
sooked[sookedpos] = '\0';
int state = initStyle;
- int lengthDoc = startPos + length;
+ unsigned int lengthDoc = startPos + length;
// If in a long distance lexical state, seek to the beginning to find quote characters
if (state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX) {
@@ -175,7 +175,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
char chNext = styler[startPos];
styler.StartSegment(startPos);
- for (int i = startPos; i < lengthDoc; i++) {
+ for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -285,16 +285,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == '$') {
preferRE = false;
styler.ColourTo(i - 1, state);
- if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
- state = SCE_PL_SCALAR;
- } else if (chNext != '{' && chNext != '[') {
- styler.ColourTo(i, SCE_PL_SCALAR);
- i++;
- ch = ' ';
- chNext = ' ';
- } else {
- styler.ColourTo(i, SCE_PL_SCALAR);
- }
+ state = SCE_PL_SCALAR;
} else if (ch == '@') {
preferRE = false;
styler.ColourTo(i - 1, state);
@@ -476,7 +467,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
}
} else if (state == SCE_PL_SCALAR) {
if (isEndVar(ch)) {
- styler.ColourTo(i - 1, state);
+ if (i == (styler.GetStartSegment() + 1)) {
+ // Special variable: $(, $_ etc.
+ styler.ColourTo(i, state);
+ } else {
+ styler.ColourTo(i - 1, state);
+ }
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_ARRAY) {