diff options
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | lexers/LexBaan.cxx | 23 | 
2 files changed, 24 insertions, 3 deletions
| diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index fd6648a55..48dc829aa 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -545,6 +545,10 @@  	Updated case conversion and character categories to Unicode 9.  	</li>  	<li> +	The Baan lexer recognizes numeric literals in a more compliant manner including +	hexadecimal numbers and exponentials. +	</li> +	<li>  	The Bash lexer recognizes strings in lists in more cases.  	<a href="http://sourceforge.net/p/scintilla/bugs/1944/">Bug #1944</a>.  	</li> diff --git a/lexers/LexBaan.cxx b/lexers/LexBaan.cxx index ddf5b9385..ab96a0db5 100644 --- a/lexers/LexBaan.cxx +++ b/lexers/LexBaan.cxx @@ -505,6 +505,7 @@ void SCI_METHOD LexerBaan::Lex(Sci_PositionU startPos, Sci_Position length, int  	bool lineHasPreProc = false;  	bool lineIgnoreString = false;  	bool lineHasDefines = false; +	bool numberIsHex = false;  	char word[1000];  	int wordlen = 0; @@ -521,10 +522,19 @@ void SCI_METHOD LexerBaan::Lex(Sci_PositionU startPos, Sci_Position length, int  		case SCE_BAAN_OPERATOR:  			sc.SetState(SCE_BAAN_DEFAULT);  			break; -		case SCE_BAAN_NUMBER: -			if (!IsAWordChar(sc.ch)) { +		case SCE_BAAN_NUMBER:  +			if (IsASpaceOrTab(sc.ch) || sc.ch == '\r' || sc.ch == '\n') {  				sc.SetState(SCE_BAAN_DEFAULT);  			} +			else if ((numberIsHex && !(MakeLowerCase(sc.ch) == 'x' || MakeLowerCase(sc.ch) == 'e' || +				IsADigit(sc.ch, 16) || sc.ch == '.' || sc.ch == '-' || sc.ch == '+')) || +				(!numberIsHex && !(MakeLowerCase(sc.ch) == 'e' || IsADigit(sc.ch) +				|| sc.ch == '.' || sc.ch == '-' || sc.ch == '+'))) { +					// check '-' for possible -10e-5. Add '+' as well. +					numberIsHex = false; +					sc.ChangeState(SCE_BAAN_IDENTIFIER); +					sc.SetState(SCE_BAAN_DEFAULT); +			}  			break;  		case SCE_BAAN_IDENTIFIER:  			if (!IsAWordChar(sc.ch)) { @@ -639,7 +649,13 @@ void SCI_METHOD LexerBaan::Lex(Sci_PositionU startPos, Sci_Position length, int  		// Determine if a new state should be entered.  		if (sc.state == SCE_BAAN_DEFAULT) { -			if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { +			if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) +				|| ((sc.ch == '-' || sc.ch == '+') && (IsADigit(sc.chNext) || sc.chNext == '.')) +				|| (MakeLowerCase(sc.ch) == 'e' && (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-'))) { +				if ((sc.ch == '0' && MakeLowerCase(sc.chNext) == 'x') || +					((sc.ch == '-' || sc.ch == '+') && sc.chNext == '0' && MakeLowerCase(sc.GetRelativeCharacter(2)) == 'x')){ +					numberIsHex = true; +				}  				sc.SetState(SCE_BAAN_NUMBER);  			}  			else if (sc.MatchIgnoreCase("dllusage") || sc.MatchIgnoreCase("functionusage")) { @@ -698,6 +714,7 @@ void SCI_METHOD LexerBaan::Lex(Sci_PositionU startPos, Sci_Position length, int  			lineHasPreProc = false;  			lineIgnoreString = false;  			lineHasDefines = false; +			numberIsHex = false;  		}  		if (!IsASpace(sc.ch)) {  			visibleChars++; | 
