diff options
| author | nyamatongwe <unknown> | 2010-07-13 21:31:10 +1000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2010-07-13 21:31:10 +1000 | 
| commit | 4a42ef938d5cc3b13f42b4a3f4e7310a6b5cbf4b (patch) | |
| tree | 640b660b0e2dc77efb9531e2ab21218f589b4362 /lexlib/StyleContext.h | |
| parent | e57e6904030c8df384b5f4b33b892ffa5dad4fe6 (diff) | |
| download | scintilla-mirror-4a42ef938d5cc3b13f42b4a3f4e7310a6b5cbf4b.tar.gz | |
Changed files for new lexer design.
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 | 
