diff options
author | nyamatongwe <unknown> | 2006-08-11 00:18:08 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2006-08-11 00:18:08 +0000 |
commit | 02eefb5c2ff456cc3a5d43a10547e56f24af07f3 (patch) | |
tree | 7faa76a2a9b71a42d94f718a7d8e1c1e641866c7 | |
parent | 18d52665a7977802032ed5ca8876ee0429cc4ced (diff) | |
download | scintilla-mirror-02eefb5c2ff456cc3a5d43a10547e56f24af07f3.tar.gz |
Patch from Kein-Hong Man :
* check for & and not && for bareword disambiguation
* improved lexing for variables starting with '::'
-rw-r--r-- | src/LexPerl.cxx | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index cb9152eca..975fa79ad 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -371,7 +371,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, if (ch2 == '{' && !moreback) { // {bareword: possible variable spec brace = true; - } else if ((ch2 == '&') + } else if ((ch2 == '&' && styler.SafeGetCharAt(j - 1) != '&') // &bareword: subroutine call || (ch2 == '>' && styler.SafeGetCharAt(j - 1) == '-') // ->bareword: part of variable spec @@ -462,7 +462,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, styler.ColourTo(i, SCE_PL_SCALAR); } else { state = SCE_PL_SCALAR; - if (chNext == '`' && chNext2 == '`') { + if ((chNext == '`' && chNext2 == '`') + || (chNext == ':' && chNext2 == ':')) { i += 2; ch = styler.SafeGetCharAt(i); chNext = styler.SafeGetCharAt(i + 1); @@ -477,6 +478,11 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_' || chNext == '+' || chNext == '-') { state = SCE_PL_ARRAY; + } else if (chNext == ':' && chNext2 == ':') { + state = SCE_PL_ARRAY; + i += 2; + ch = styler.SafeGetCharAt(i); + chNext = styler.SafeGetCharAt(i + 1); } else if (chNext != '{' && chNext != '[') { styler.ColourTo(i, SCE_PL_ARRAY); } else { @@ -490,6 +496,11 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, i++; ch = chNext; chNext = chNext2; + } else if (chNext == ':' && chNext2 == ':') { + state = SCE_PL_HASH; + i += 2; + ch = styler.SafeGetCharAt(i); + chNext = styler.SafeGetCharAt(i + 1); } else if (chNext == '{') { styler.ColourTo(i, SCE_PL_HASH); } else { @@ -500,7 +511,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, char strch[2]; strch[0] = chNext; strch[1] = '\0'; - if (isalpha(chNext) || chNext == '_' || + if (chNext == ':' && chNext2 == ':') { + state = SCE_PL_SYMBOLTABLE; + i += 2; + ch = styler.SafeGetCharAt(i); + chNext = styler.SafeGetCharAt(i + 1); + } else if (isalpha(chNext) || chNext == '_' || NULL != strstr("^/|,\\\";#%^:?<>)[]", strch)) { state = SCE_PL_SYMBOLTABLE; i++; |