diff options
Diffstat (limited to 'lexlib/StyleContext.h')
| -rw-r--r-- | lexlib/StyleContext.h | 42 | 
1 files changed, 16 insertions, 26 deletions
diff --git a/lexlib/StyleContext.h b/lexlib/StyleContext.h index 4e175bc29..8b1345432 100644 --- a/lexlib/StyleContext.h +++ b/lexlib/StyleContext.h @@ -5,16 +5,26 @@  // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>  // This file is in the public domain. +#ifndef STYLECONTEXT_H +#define STYLECONTEXT_H +  #ifdef SCI_NAMESPACE  namespace Scintilla {  #endif +static inline int MakeLowerCase(int ch) { +	if (ch < 'A' || ch > 'Z') +		return ch; +	else +		return ch - 'A' + 'a'; +} +  // All languages handled so far can treat all characters >= 0x80 as one class  // which just continues the current token or starts an identifier if in default.  // DBCS treated specially as the second character can be < 0x80 and hence  // syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80  class StyleContext { -	Accessor &styler; +	LexAccessor &styler;  	unsigned int endPos;  	StyleContext &operator=(const StyleContext &);  	void GetNextChar(unsigned int pos) { @@ -41,7 +51,7 @@ public:  	int chNext;  	StyleContext(unsigned int startPos, unsigned int length, -                        int initStyle, Accessor &styler_, char chMask=31) : +                        int initStyle, LexAccessor &styler_, char chMask=31) :  		styler(styler_),  		endPos(startPos + length),  		currentPos(startPos), @@ -131,15 +141,15 @@ public:  		return true;  	}  	bool MatchIgnoreCase(const char *s) { -		if (tolower(ch) != static_cast<unsigned char>(*s)) +		if (MakeLowerCase(ch) != static_cast<unsigned char>(*s))  			return false;  		s++; -		if (tolower(chNext) != static_cast<unsigned char>(*s)) +		if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s))  			return false;  		s++;  		for (int n=2; *s; n++) {  			if (static_cast<unsigned char>(*s) != -				tolower(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n)))) +				MakeLowerCase(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))  				return false;  			s++;  		} @@ -154,24 +164,4 @@ public:  }  #endif -inline bool IsASpace(unsigned int ch) { -    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -inline bool IsASpaceOrTab(unsigned int ch) { -	return (ch == ' ') || (ch == '\t'); -} - -inline bool IsADigit(unsigned int ch) { -	return (ch >= '0') && (ch <= '9'); -} - -inline bool IsADigit(unsigned int ch, unsigned int base) { -	if (base <= 10) { -		return (ch >= '0') && (ch < '0' + base); -	} else { -		return ((ch >= '0') && (ch <= '9')) || -		       ((ch >= 'A') && (ch < 'A' + base - 10)) || -		       ((ch >= 'a') && (ch < 'a' + base - 10)); -	} -} +#endif  | 
