diff options
author | nyamatongwe <devnull@localhost> | 2003-10-23 21:15:28 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2003-10-23 21:15:28 +0000 |
commit | 009f05b0111d7c00ad457ef04e5feda935ae274e (patch) | |
tree | cd261a51794af47e4eb84506678ab75baf32dc6e | |
parent | e83c33ef533c6f97e70d449f389b15281f5ac002 (diff) | |
download | scintilla-mirror-009f05b0111d7c00ad457ef04e5feda935ae274e.tar.gz |
Kein-Hong Man
- Added recognition for numbers with underscores.
(More cute Perl syntax...)
- Added _ as non-symbol when trying to recognise
quoted pairs in cases like "s_identifier".
- Added test notes on ' and :: operators possible
confusion with quoted pair syntax. ' is okay,
:: has ambiguous cases but such cases ought to
be rare. No need to fix unless someone actually
writes this kind of code...
-rw-r--r-- | src/LexPerl.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index 4edb3ccde..b3709fb6c 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -68,6 +68,10 @@ static inline bool isEndVar(char ch) { ch != '_' && ch != '\''; } +static inline bool isNonQuote(char ch) { + return isalnum(ch) || ch == '_'; +} + static inline char actualNumStyle(int numberStyle) { switch (numberStyle) { case PERLNUM_VECTOR: @@ -271,24 +275,24 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, numState = PERLNUM_V_VECTOR; } } else if (iswordstart(ch)) { - if (ch == 's' && !isalnum(chNext)) { + if (ch == 's' && !isNonQuote(chNext)) { state = SCE_PL_REGSUBST; Quote.New(2); - } else if (ch == 'm' && !isalnum(chNext)) { + } else if (ch == 'm' && !isNonQuote(chNext)) { state = SCE_PL_REGEX; Quote.New(1); - } else if (ch == 'q' && !isalnum(chNext)) { + } else if (ch == 'q' && !isNonQuote(chNext)) { state = SCE_PL_STRING_Q; Quote.New(1); - } else if (ch == 'y' && !isalnum(chNext)) { + } else if (ch == 'y' && !isNonQuote(chNext)) { state = SCE_PL_REGSUBST; Quote.New(2); - } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) { + } else if (ch == 't' && chNext == 'r' && !isNonQuote(chNext2)) { state = SCE_PL_REGSUBST; Quote.New(2); i++; chNext = chNext2; - } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) { + } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isNonQuote(chNext2)) { if (chNext == 'q') state = SCE_PL_STRING_QQ; else if (chNext == 'x') state = SCE_PL_STRING_QX; else if (chNext == 'r') state = SCE_PL_STRING_QR; @@ -498,6 +502,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, goto numAtEnd; } } + } else if (ch == '_' && numState == PERLNUM_DECIMAL) { + if (!isdigit(chNext)) { + goto numAtEnd; + } } else if (isalnum(ch)) { if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) { if (isalpha(ch)) { |