diff options
| author | nyamatongwe <unknown> | 2007-07-12 10:00:05 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2007-07-12 10:00:05 +0000 | 
| commit | e8cdcc988c23dab37c019db5155f407e67946948 (patch) | |
| tree | 2f7956bf76b99a73eca8edf0eda595f1365d3b6f /src | |
| parent | eca03ce2e6a61be3594e36bee096d09c6d535c9f (diff) | |
| download | scintilla-mirror-e8cdcc988c23dab37c019db5155f407e67946948.tar.gz | |
Patch from Kein-Hong Man treats invalid octal lierals as hex numbers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/LexBash.cxx | 23 | 
1 files changed, 19 insertions, 4 deletions
| diff --git a/src/LexBash.cxx b/src/LexBash.cxx index 269192500..f0376b947 100644 --- a/src/LexBash.cxx +++ b/src/LexBash.cxx @@ -2,7 +2,7 @@  /** @file LexBash.cxx   ** Lexer for Bash.   **/ -// Copyright 2004-2005 by Neil Hodgson <neilh@scintilla.org> +// Copyright 2004-2007 by Neil Hodgson <neilh@scintilla.org>  // Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004  // The License.txt file describes the conditions under which this software may be distributed. @@ -20,11 +20,17 @@  #include "Scintilla.h"  #include "SciLexer.h" +// define this if you want 'invalid octals' to be marked as errors +// usually, this is not a good idea, permissive lexing is better +#undef PEDANTIC_OCTAL +  #define BASH_BASE_ERROR		65  #define BASH_BASE_DECIMAL	66  #define BASH_BASE_HEX		67 +#ifdef PEDANTIC_OCTAL  #define BASH_BASE_OCTAL		68  #define BASH_BASE_OCTAL_ERROR	69 +#endif  #define HERE_DELIM_MAX 256 @@ -277,7 +283,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,  						ch = chNext;  						chNext = chNext2;  					} else if (isdigit(chNext)) { +#ifdef PEDANTIC_OCTAL  						numBase = BASH_BASE_OCTAL; +#else +						numBase = BASH_BASE_HEX; +#endif  					}  				}  			} else if (iswordstart(ch)) { @@ -369,14 +379,16 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,  					// hex digit 0-9a-fA-F  				} else  					goto numAtEnd; +#ifdef PEDANTIC_OCTAL  			} else if (numBase == BASH_BASE_OCTAL ||  				   numBase == BASH_BASE_OCTAL_ERROR) {  				if (digit > 7) {  					if (digit <= 9) { -						numBase = BASH_BASE_OCTAL_ERROR; +                                                numBase = BASH_BASE_OCTAL_ERROR;  					} else  						goto numAtEnd;  				} +#endif  			} else if (numBase == BASH_BASE_ERROR) {  				if (digit > 9)  					goto numAtEnd; @@ -394,8 +406,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,  					}  				} else {  			numAtEnd: -					if (numBase == BASH_BASE_ERROR || -					    numBase == BASH_BASE_OCTAL_ERROR) +					if (numBase == BASH_BASE_ERROR +#ifdef PEDANTIC_OCTAL +					    || numBase == BASH_BASE_OCTAL_ERROR +#endif +                                           )  						state = SCE_SH_ERROR;  					styler.ColourTo(i - 1, state);  					state = SCE_SH_DEFAULT; | 
