diff options
77 files changed, 1262 insertions, 960 deletions
diff --git a/lexers/LexAPDL.cxx b/lexers/LexAPDL.cxx index 7bf597b42..da4674489 100644 --- a/lexers/LexAPDL.cxx +++ b/lexers/LexAPDL.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexASY.cxx b/lexers/LexASY.cxx index 5bf979fd3..0b3ecce5a 100644 --- a/lexers/LexASY.cxx +++ b/lexers/LexASY.cxx @@ -4,25 +4,27 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif -static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,  +static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,  		WordList *keywordlists[], Accessor &styler) {  	WordList &keywords = *keywordlists[0]; @@ -118,7 +120,7 @@ static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,  				sc.SetState(SCE_ASY_IDENTIFIER);  			} else if (sc.Match('/', '*')) {  				sc.SetState(SCE_ASY_COMMENT); -				sc.Forward();	//  +				sc.Forward();	//  			} else if (sc.Match('/', '/')) {  				sc.SetState(SCE_ASY_COMMENTLINE);  			} else if (sc.ch == '\"') { @@ -162,14 +164,14 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)            length++;            ch=styler.SafeGetCharAt(pos+length);    } -  word[length]=0;    +  word[length]=0;    return length;  }  static bool IsASYDrawingLine(int line, Accessor &styler) {  	int pos = styler.LineStart(line);  	int eol_pos = styler.LineStart(line + 1) - 1; -	 +  	int startpos = pos;  	char buffer[100]=""; @@ -181,11 +183,11 @@ static bool IsASYDrawingLine(int line, Accessor &styler) {  		if (!drawcommands && ch!=' ') return false;  		else if (drawcommands) return true;  		startpos++; -	}		 +	}  	return false;  } -static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,  +static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,  					   WordList *[], Accessor &styler) {  	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;  	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; @@ -236,7 +238,7 @@ static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,  			else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) &&  				!IsASYDrawingLine(lineCurrent+1, styler))  				levelNext--; -		}	 +		}  		if (atEOL) {  			int levelUse = levelCurrent; diff --git a/lexers/LexAU3.cxx b/lexers/LexAU3.cxx index cfff9279d..0f456b850 100644 --- a/lexers/LexAU3.cxx +++ b/lexers/LexAU3.cxx @@ -1,15 +1,15 @@  // Scintilla source code edit control  // @file LexAU3.cxx  // Lexer for AutoIt3  http://www.hiddensoft.com/autoit3 -// by Jos van der Zande, jvdzande@yahoo.com  +// by Jos van der Zande, jvdzande@yahoo.com  //  // Changes:  // March 28, 2004 - Added the standard Folding code  // April 21, 2004 - Added Preprosessor Table + Syntax Highlighting  //                  Fixed Number highlighting  //                  Changed default isoperator to IsAOperator to have a better match to AutoIt3 -//                  Fixed "#comments_start" -> "#comments-start"   -//                  Fixed "#comments_end" -> "#comments-end"   +//                  Fixed "#comments_start" -> "#comments-start" +//                  Fixed "#comments_end" -> "#comments-end"  //                  Fixed Sendkeys in Strings when not terminated with }  //                  Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down}  // April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color. @@ -25,9 +25,9 @@  //                  Added fold.compact support set with fold.compact=1  //                  Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1  //                        it will now only happen when fold.comment=2. -// Sep 5, 2004    - Added logic to handle colourizing words on the last line.  +// Sep 5, 2004    - Added logic to handle colourizing words on the last line.  //                        Typed Characters now show as "default" till they match any table. -// Oct 10, 2004   - Added logic to show Comments in "Special" directives.  +// Oct 10, 2004   - Added logic to show Comments in "Special" directives.  // Nov  1, 2004   - Added better testing for Numbers supporting x and e notation.  // Nov 28, 2004   - Added logic to handle continuation lines for syntax highlighting.  // Jan 10, 2005   - Added Abbreviations Keyword used for expansion @@ -52,18 +52,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -127,7 +131,7 @@ static int GetSendKey(const char *szLine, char *szKey)  			}  			else if (cTemp == ' ')  			{ -				// skip other spaces  +				// skip other spaces  			}  			else if (nFlag == 0)  			{ @@ -139,7 +143,7 @@ static int GetSendKey(const char *szLine, char *szKey)  				// Save second portion into var...  				szSpecial[nSpecPos++] = cTemp;  				// check if Second portion is all numbers for repeat fuction -				if (isdigit(cTemp) == false) {nSpecNum = 0;}  +				if (isdigit(cTemp) == false) {nSpecNum = 0;}  			}  		}  		nPos++;									// skip to next char @@ -151,7 +155,7 @@ static int GetSendKey(const char *szLine, char *szKey)  	szKey[nKeyPos] = '\0';  	szSpecial[nSpecPos] = '\0';  	if (strcmp(szSpecial,"down")== 0    || strcmp(szSpecial,"up")== 0  || -		strcmp(szSpecial,"on")== 0      || strcmp(szSpecial,"off")== 0 ||  +		strcmp(szSpecial,"on")== 0      || strcmp(szSpecial,"off")== 0 ||  		strcmp(szSpecial,"toggle")== 0  || nSpecNum == 1 )  	{  		nFlag = 0; @@ -160,13 +164,13 @@ static int GetSendKey(const char *szLine, char *szKey)  	{  		nFlag = 1;  	} -	return nFlag;  // 1 is bad, 0 is good  +	return nFlag;  // 1 is bad, 0 is good -} // GetSendKey()  +} // GetSendKey()  //  // Routine to check the last "none comment" character on a line to see if its a continuation -//  +//  static bool IsContinuationLine(unsigned int szLine, Accessor &styler)  {  	int nsPos = styler.LineStart(szLine); @@ -192,7 +196,7 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler)  //  // syntax highlighting logic -static void ColouriseAU3Doc(unsigned int startPos,  +static void ColouriseAU3Doc(unsigned int startPos,  							int length, int initStyle,  							WordList *keywordlists[],  							Accessor &styler) { @@ -214,19 +218,19 @@ static void ColouriseAU3Doc(unsigned int startPos,  			   (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) {  			lineCurrent--;  			startPos = styler.LineStart(lineCurrent); // get start position -			initStyle =  0;                           // reset the start style to 0  +			initStyle =  0;                           // reset the start style to 0  		}  	}  	// Set the new length to include it from the start and set the start position  	length = length + s_startPos - startPos;      // correct the total length to process      styler.StartAt(startPos); -	 +      StyleContext sc(startPos, length, initStyle, styler);  	char si;     // string indicator "=1 '=2  	char ni;     // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3 -	char ci;     // comment indicator 0=not linecomment(;)  +	char ci;     // comment indicator 0=not linecomment(;)  	char s_save[100]; -	si=0;   +	si=0;  	ni=0;  	ci=0;  	//$$$ @@ -234,8 +238,8 @@ static void ColouriseAU3Doc(unsigned int startPos,  		char s[100];  		sc.GetCurrentLowered(s, sizeof(s));  		// ********************************************** -		// save the total current word for eof processing  -		if (IsAWordChar(sc.ch) || sc.ch == '}')  +		// save the total current word for eof processing +		if (IsAWordChar(sc.ch) || sc.ch == '}')  		{  			strcpy(s_save,s);  			int tp = strlen(s_save); @@ -254,9 +258,9 @@ static void ColouriseAU3Doc(unsigned int startPos,  				if (sc.atLineEnd) {  					ci=0;  					if (strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0) { -						if (sc.atLineEnd)  +						if (sc.atLineEnd)  							sc.SetState(SCE_AU3_DEFAULT); -						else	 +						else  							sc.SetState(SCE_AU3_COMMENTBLOCK);  					}  					break; @@ -267,9 +271,9 @@ static void ColouriseAU3Doc(unsigned int startPos,  					sc.SetState(SCE_AU3_COMMENTBLOCK);  				}  				// skip rest of the line -				if (ci==2)  +				if (ci==2)  					break; -				// check when first character is detected on the line  +				// check when first character is detected on the line  				if (ci==0) {  					if (IsAWordStart(static_cast<char>(sc.ch)) || IsAOperator(static_cast<char>(sc.ch))) {  						ci=1; @@ -292,10 +296,10 @@ static void ColouriseAU3Doc(unsigned int startPos,              }              case SCE_AU3_OPERATOR:              { -                // check if its a COMobject  +                // check if its a COMobject  				if (sc.chPrev == '.' && IsAWordChar(sc.ch)) {  					sc.SetState(SCE_AU3_COMOBJ); -				}	 +				}  				else {  					sc.SetState(SCE_AU3_DEFAULT);  				} @@ -360,7 +364,7 @@ static void ColouriseAU3Doc(unsigned int startPos,  							sc.SetState(SCE_AU3_DEFAULT);  						}  					} -				}	 +				}                  if (sc.atLineEnd) {  					sc.SetState(SCE_AU3_DEFAULT);}                  break; @@ -433,7 +437,7 @@ static void ColouriseAU3Doc(unsigned int startPos,              case SCE_AU3_STRING:              {  				// check for " to end a double qouted string or -				// check for ' to end a single qouted string  +				// check for ' to end a single qouted string  	            if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))  				{  					sc.ForwardSetState(SCE_AU3_DEFAULT); @@ -445,7 +449,7 @@ static void ColouriseAU3Doc(unsigned int startPos,  					si=0;  					// at line end and not found a continuation char then reset to default  					int lineCurrent = styler.GetLine(sc.currentPos); -					if (!IsContinuationLine(lineCurrent,styler))  +					if (!IsContinuationLine(lineCurrent,styler))  					{  						sc.SetState(SCE_AU3_DEFAULT);  						break; @@ -456,27 +460,27 @@ static void ColouriseAU3Doc(unsigned int startPos,  					sc.SetState(SCE_AU3_SENT);}  				break;              } -             +              case SCE_AU3_SENT:              { -				// Send key string ended  -				if (sc.chPrev == '}' && sc.ch != '}')  +				// Send key string ended +				if (sc.chPrev == '}' && sc.ch != '}')  				{  					// set color to SENDKEY when valid sendkey .. else set back to regular string  					char sk[100];  					// split {111 222} and return {111} and check if 222 is valid.  					// if return code = 1 then invalid 222 so must be string -					if (GetSendKey(s,sk))    +					if (GetSendKey(s,sk))  					{  						sc.ChangeState(SCE_AU3_STRING);  					}  					// if single char between {?} then its ok as sendkey for a single character -					else if (strlen(sk) == 3)   +					else if (strlen(sk) == 3)  					{  						sc.ChangeState(SCE_AU3_SENT);  					}  					// if sendkey {111} is in table then ok as sendkey -					else if (keywords4.InList(sk))  +					else if (keywords4.InList(sk))  					{  						sc.ChangeState(SCE_AU3_SENT);  					} @@ -492,9 +496,9 @@ static void ColouriseAU3Doc(unsigned int startPos,  					int		nPos	= 0;  					int		nState	= 1;  					char	cTemp; -					while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))  +					while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))  					{ -						if (cTemp == '{' && nState == 1)  +						if (cTemp == '{' && nState == 1)  						{  							nState = 2;  						} @@ -509,14 +513,14 @@ static void ColouriseAU3Doc(unsigned int startPos,  						sc.ChangeState(SCE_AU3_STRING);  						sc.SetState(SCE_AU3_STRING);  					} -					// If invalid character found then assume its a regular string	 +					// If invalid character found then assume its a regular string  					if (nState == 0) {  						sc.ChangeState(SCE_AU3_STRING);  						sc.SetState(SCE_AU3_STRING);  					}  				}  				// check if next portion is again a sendkey -				if (sc.atLineEnd)  +				if (sc.atLineEnd)  				{  					sc.ChangeState(SCE_AU3_STRING);  					sc.SetState(SCE_AU3_DEFAULT); @@ -547,14 +551,14 @@ static void ColouriseAU3Doc(unsigned int startPos,              else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}              else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}              //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);} -            else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);}  // string after #include  +            else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);}  // string after #include              else if (sc.ch == '\"') {  				sc.SetState(SCE_AU3_STRING);  				si = 1;	}              else if (sc.ch == '\'') {  				sc.SetState(SCE_AU3_STRING);  				si = 2;	} -            else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))  +            else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))  			{  				sc.SetState(SCE_AU3_NUMBER);  				ni = 0; @@ -566,7 +570,7 @@ static void ColouriseAU3Doc(unsigned int startPos,      }      //for (; sc.More(); sc.Forward())  	//************************************* -	// Colourize the last word correctly  +	// Colourize the last word correctly  	//*************************************  	if (sc.state == SCE_AU3_KEYWORD)  		{ @@ -610,24 +614,24 @@ static void ColouriseAU3Doc(unsigned int startPos,  	}  	if (sc.state == SCE_AU3_SENT)      { -		// Send key string ended  -		if (sc.chPrev == '}' && sc.ch != '}')  +		// Send key string ended +		if (sc.chPrev == '}' && sc.ch != '}')  		{  			// set color to SENDKEY when valid sendkey .. else set back to regular string  			char sk[100];  			// split {111 222} and return {111} and check if 222 is valid.  			// if return code = 1 then invalid 222 so must be string -			if (GetSendKey(s_save,sk))    +			if (GetSendKey(s_save,sk))  			{  				sc.ChangeState(SCE_AU3_STRING);  			}  			// if single char between {?} then its ok as sendkey for a single character -			else if (strlen(sk) == 3)   +			else if (strlen(sk) == 3)  			{  				sc.ChangeState(SCE_AU3_SENT);  			}  			// if sendkey {111} is in table then ok as sendkey -			else if (keywords4.InList(sk))  +			else if (keywords4.InList(sk))  			{  				sc.ChangeState(SCE_AU3_SENT);  			} @@ -638,7 +642,7 @@ static void ColouriseAU3Doc(unsigned int startPos,  			sc.SetState(SCE_AU3_STRING);  		}  		// check if next portion is again a sendkey -		if (sc.atLineEnd)  +		if (sc.atLineEnd)  		{  			sc.ChangeState(SCE_AU3_STRING);  			sc.SetState(SCE_AU3_DEFAULT); @@ -655,7 +659,7 @@ static bool IsStreamCommentStyle(int style) {  //  // Routine to find first none space on the current line and return its Style -// needed for comment lines not starting on pos 1  +// needed for comment lines not starting on pos 1  static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)  {  	int nsPos = styler.LineStart(szLine); @@ -687,7 +691,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  			startPos = styler.LineStart(lineCurrent);  		}  	} -	// vars for style of previous/current/next lines  +	// vars for style of previous/current/next lines  	int style = GetStyleFirstWord(lineCurrent,styler);  	int stylePrev = 0;  	// find the first previous line without continuation character at the end @@ -712,7 +716,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  	if (lineCurrent > 0)  		levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;  	int levelNext = levelCurrent; -	//   +	//  	int	visibleChars = 0;  	char chNext = styler.SafeGetCharAt(startPos);  	char chPrev = ' '; @@ -737,7 +741,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  				}  			}  		} -		// start the capture of the first word  +		// start the capture of the first word  		if (!(FirstWordStart)) {  			if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') {  				FirstWordStart = true; @@ -749,7 +753,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  			if (ThenFoundLast) {  				if (IsAWordChar(ch)) {  					ThenFoundLast = false; -				}		 +				}  			}  			// find out if the word "then" is the last on a "if" line  			if (FirstWordEnd && strcmp(szKeyword,"if") == 0) { @@ -770,21 +774,21 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  				}  			}  		} -		// End of Line found so process the information  +		// End of Line found so process the information  		if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {  			// **************************  			// Folding logic for Keywords  			// **************************  			// if a keyword is found on the current line and the line doesn't end with _ (continuation)  			//    and we are not inside a commentblock. -			if (szKeywordlen > 0 && (!(chPrev == '_')) &&  +			if (szKeywordlen > 0 && (!(chPrev == '_')) &&  				((!(IsStreamCommentStyle(style)) || foldInComment)) ) {  				szKeyword[szKeywordlen] = '\0';  				// only fold "if" last keyword is "then"  (else its a one line if)  				if (strcmp(szKeyword,"if") == 0  && ThenFoundLast) {  						levelNext++;  				} -				// create new fold for these words  +				// create new fold for these words  				if (strcmp(szKeyword,"do") == 0   || strcmp(szKeyword,"for") == 0 ||  					strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0||  					strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) { @@ -797,12 +801,12 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  				}  				// end the fold for these words before the current line  				if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 || -					strcmp(szKeyword,"next") == 0    || strcmp(szKeyword,"until") == 0 ||  +					strcmp(szKeyword,"next") == 0    || strcmp(szKeyword,"until") == 0 ||  					strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){  						levelNext--;  						levelCurrent--;  				} -				// end the fold for these words before the current line and Start new fold  +				// end the fold for these words before the current line and Start new fold  				if (strcmp(szKeyword,"case") == 0      || strcmp(szKeyword,"else") == 0 ||  					strcmp(szKeyword,"elseif") == 0 ) {  						levelCurrent--; @@ -841,16 +845,16 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc  				// Start of a comment block  				if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) {  				    levelNext++; -				}  +				}  				// fold till the last line for normal comment lines -				else if (IsStreamCommentStyle(stylePrev)  +				else if (IsStreamCommentStyle(stylePrev)  						&& !(styleNext == SCE_AU3_COMMENT) -						&& stylePrev == SCE_AU3_COMMENT  +						&& stylePrev == SCE_AU3_COMMENT  						&& style == SCE_AU3_COMMENT) {  					levelNext--;  				}  				// fold till the one but last line for Blockcomment lines -				else if (IsStreamCommentStyle(stylePrev)  +				else if (IsStreamCommentStyle(stylePrev)  						&& !(styleNext == SCE_AU3_COMMENTBLOCK)  						&& style == SCE_AU3_COMMENTBLOCK) {  					levelNext--; diff --git a/lexers/LexAVE.cxx b/lexers/LexAVE.cxx index 09b393343..310b1aa3a 100644 --- a/lexers/LexAVE.cxx +++ b/lexers/LexAVE.cxx @@ -9,18 +9,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h> -#include <stdarg.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexAbaqus.cxx b/lexers/LexAbaqus.cxx index 10e8b76b1..cf4051f33 100644 --- a/lexers/LexAbaqus.cxx +++ b/lexers/LexAbaqus.cxx @@ -10,18 +10,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexAda.cxx b/lexers/LexAda.cxx index 654bfbeba..64c8d1c0d 100644 --- a/lexers/LexAda.cxx +++ b/lexers/LexAda.cxx @@ -6,19 +6,24 @@  // The License.txt file describes the conditions under which this software may be distributed.  #include <stdlib.h> -#include <ctype.h>  #include <string.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h>  #include <string> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "PropSet.h" -#include "KeyWords.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx index 17c938420..8c0f998d7 100644 --- a/lexers/LexAsm.cxx +++ b/lexers/LexAsm.cxx @@ -10,18 +10,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexAsn1.cxx b/lexers/LexAsn1.cxx index 36f1d5dc2..21f0fcca3 100644 --- a/lexers/LexAsn1.cxx +++ b/lexers/LexAsn1.cxx @@ -5,20 +5,24 @@  // Copyright 2004 by Herr Pfarrer rpfarrer <at> yahoo <dot> de  // Last Updated: 20/07/2004  // The License.txt file describes the conditions under which this software may be distributed. +  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexBaan.cxx b/lexers/LexBaan.cxx index a6847db71..549a54c42 100644 --- a/lexers/LexBaan.cxx +++ b/lexers/LexBaan.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx index 1f97e4829..5038bd1ef 100644 --- a/lexers/LexBash.cxx +++ b/lexers/LexBash.cxx @@ -8,19 +8,21 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexBasic.cxx b/lexers/LexBasic.cxx index 1c5d7b425..fc1c6c7d8 100644 --- a/lexers/LexBasic.cxx +++ b/lexers/LexBasic.cxx @@ -19,17 +19,20 @@  #include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexBullant.cxx b/lexers/LexBullant.cxx index 28e2e7543..ce1302a23 100644 --- a/lexers/LexBullant.cxx +++ b/lexers/LexBullant.cxx @@ -3,18 +3,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexCLW.cxx b/lexers/LexCLW.cxx index 624ef0f2b..d4ae5d7e7 100644 --- a/lexers/LexCLW.cxx +++ b/lexers/LexCLW.cxx @@ -10,16 +10,20 @@  #include <string.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h>  #include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -60,10 +64,10 @@ inline bool IsALabelStart(const int iChar) {  // Is a label character  inline bool IsALabelCharacter(const int iChar) { -	return(isalnum(iChar) || iChar == '_' || iChar == ':');  +	return(isalnum(iChar) || iChar == '_' || iChar == ':');  } -// Is the character is a ! and the the next character is not a !  +// Is the character is a ! and the the next character is not a !  inline bool IsACommentStart(const int iChar) {  	return(iChar == '!'); @@ -126,7 +130,7 @@ inline bool SetNumericConstantState(StyleContext &scDoc) {  				break;  			default :  				break; -		}	 +		}  	}  	// If points found (can be more than one for improper formatted number  	if (iPoints > 0) { @@ -186,12 +190,12 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  	WordList &wlLabelReservedWords = *wlKeywords[7];		// Clarion Reserved Keywords (Labels)  	WordList &wlProcLabelReservedWords = *wlKeywords[8];	// Clarion Reserved Keywords (Procedure Labels) -	const char wlProcReservedKeywordList[] =  +	const char wlProcReservedKeywordList[] =  	"PROCEDURE FUNCTION";  	WordList wlProcReservedKeywords;  	wlProcReservedKeywords.Set(wlProcReservedKeywordList); -	const char wlCompilerKeywordList[] =  +	const char wlCompilerKeywordList[] =  	"COMPILE OMIT";  	WordList wlCompilerKeywords;  	wlCompilerKeywords.Set(wlCompilerKeywordList); @@ -243,7 +247,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  						// change the label to error state  						scDoc.ChangeState(SCE_CLW_ERROR);  					} -					// Else if UPPERCASE label string is  +					// Else if UPPERCASE label string is  					else if (wlProcLabelReservedWords.InList(cLabel) && iColumn1Label) {  						char cWord[512];	// Word buffer  						// Get the next word from the current position @@ -368,13 +372,13 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  				// Increment the parenthese level  				iParenthesesLevel++;  			} -			// Else if the character is a ) (close parenthese)  +			// Else if the character is a ) (close parenthese)  			else if (scDoc.ch == ')') {  				// If the parenthese level is set to zero  				// parentheses matched  				if (!iParenthesesLevel) {  					scDoc.SetState(SCE_CLW_DEFAULT); -				}  +				}  				// Else parenthese level is greater than zero  				// still looking for matching parentheses  				else { @@ -399,7 +403,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  			|| IsAHexCharacter(scDoc.ch, bCaseSensitive)  			|| scDoc.ch == '.'  			|| IsANumericBaseCharacter(scDoc.ch, bCaseSensitive))) { -				// If the number was a real  +				// If the number was a real  				if (SetNumericConstantState(scDoc)) {  					// Colour the matched string to the real constant state  					scDoc.ChangeState(SCE_CLW_REAL_CONSTANT); @@ -461,7 +465,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  		}  		// Default Handling  		else { -			// If in default state  +			// If in default state  			if (scDoc.state == SCE_CLW_DEFAULT) {  				// If is a letter could be a possible statement  				if (isalpha(scDoc.ch)) { @@ -477,10 +481,10 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  				else if (IsACommentStart(scDoc.ch) || scDoc.ch == '|') {  					// then set the state to comment.  					scDoc.SetState(SCE_CLW_COMMENT); -				}		 +				}  				// else if the character is a ' (single quote)  				else if (scDoc.ch == '\'') { -					// If the character is also a ' (single quote)  +					// If the character is also a ' (single quote)  					// Embedded Apostrophe  					if (scDoc.chNext == '\'') {  						// Move forward colouring it as default state @@ -490,7 +494,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  						// move to the next character and then set the state to comment.  						scDoc.ForwardSetState(SCE_CLW_STRING);  					} -				}		 +				}  				// else the character is an @ (ampersand)  				else if (scDoc.ch == '@') {  					// Case insensitive. @@ -509,7 +513,7 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS  							scDoc.SetState(SCE_CLW_PICTURE_STRING);  						}  					} -				}		 +				}  			}  		}  	} @@ -616,7 +620,7 @@ static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle,  		iStyle = iStyleNext;  		iStyleNext = accStyler.StyleAt(uiPos + 1);  		bool bEOL = (chChar == '\r' && chNext != '\n') || (chChar == '\n'); -	 +  		if (iStylePrev == SCE_CLW_DEFAULT) {  			if (iStyle == SCE_CLW_KEYWORD || iStyle == SCE_CLW_STRUCTURE_DATA_TYPE) {  				// Store last word start point. @@ -647,7 +651,7 @@ static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle,  			iLevelPrev = iLevelCurrent;  			iVisibleChars = 0;  		} -		 +  		if (!isspacechar(chChar))  			iVisibleChars++;  	} diff --git a/lexers/LexCOBOL.cxx b/lexers/LexCOBOL.cxx index 05bf1d973..b9c8f4dc3 100644 --- a/lexers/LexCOBOL.cxx +++ b/lexers/LexCOBOL.cxx @@ -10,18 +10,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexCSS.cxx b/lexers/LexCSS.cxx index f63103de3..fba8dac1b 100644 --- a/lexers/LexCSS.cxx +++ b/lexers/LexCSS.cxx @@ -9,18 +9,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexCaml.cxx b/lexers/LexCaml.cxx index ca1b65f38..f576e3e23 100644 --- a/lexers/LexCaml.cxx +++ b/lexers/LexCaml.cxx @@ -20,19 +20,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h"  #include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  //	Since the Microsoft __iscsym[f] funcs are not ANSI...  inline int  iscaml(int c) {return isalnum(c) || c == '_';} @@ -51,9 +54,13 @@ using namespace Scintilla;  /*  	(actually seems to work!)  */ +#include <string>  #include "WindowAccessor.h"  #include "ExternalLexer.h" +#undef EXT_LEXER_DECL +#define EXT_LEXER_DECL __declspec( dllexport ) __stdcall +  #if PLAT_WIN  #include <windows.h>  #endif diff --git a/lexers/LexCmake.cxx b/lexers/LexCmake.cxx index 1f51f474e..c43974d42 100644 --- a/lexers/LexCmake.cxx +++ b/lexers/LexCmake.cxx @@ -5,21 +5,26 @@  // Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net>  // based on the NSIS lexer  // The License.txt file describes the conditions under which this software may be distributed. +  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "CharClassify.h" -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexConf.cxx b/lexers/LexConf.cxx index 7b066af7b..114bd7d12 100644 --- a/lexers/LexConf.cxx +++ b/lexers/LexConf.cxx @@ -11,18 +11,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexCrontab.cxx b/lexers/LexCrontab.cxx index f6c4d42f1..be4cd082b 100644 --- a/lexers/LexCrontab.cxx +++ b/lexers/LexCrontab.cxx @@ -9,18 +9,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexCsound.cxx b/lexers/LexCsound.cxx index 3aa2eb897..3f80cf373 100644 --- a/lexers/LexCsound.cxx +++ b/lexers/LexCsound.cxx @@ -8,18 +8,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> -#include "Platform.h" +#include <assert.h> +#include <ctype.h> -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif @@ -72,7 +77,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle,  				continue;  			}  		} -               +  		// Determine if the current state should terminate.  		if (sc.state == SCE_CSOUND_OPERATOR) {  			if (!IsCsoundOperator(static_cast<char>(sc.ch))) { @@ -119,7 +124,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle,  				sc.SetState(SCE_CSOUND_DEFAULT);  			}  		} -		 +  		// Determine if a new state should be entered.  		if (sc.state == SCE_CSOUND_DEFAULT) {  			if (sc.ch == ';'){ @@ -146,7 +151,7 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle,  	sc.Complete();  } -static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],  +static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],  		Accessor &styler) {  	unsigned int lengthDoc = startPos + length;  	int visibleChars = 0; diff --git a/lexers/LexD.cxx b/lexers/LexD.cxx index 4c4bcb343..78b23dcdf 100644 --- a/lexers/LexD.cxx +++ b/lexers/LexD.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexEScript.cxx b/lexers/LexEScript.cxx index 295aaec53..0e65f7312 100644 --- a/lexers/LexEScript.cxx +++ b/lexers/LexEScript.cxx @@ -9,15 +9,19 @@  #include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -198,7 +202,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor  		styleNext = styler.StyleAt(i + 1);  		bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); -             +  		if (foldComment && IsStreamCommentStyle(style)) {  			if (!IsStreamCommentStyle(stylePrev)) {  				levelCurrent++; diff --git a/lexers/LexEiffel.cxx b/lexers/LexEiffel.cxx index 03dea5e73..bc10db847 100644 --- a/lexers/LexEiffel.cxx +++ b/lexers/LexEiffel.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h> -#include <stdarg.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexErlang.cxx b/lexers/LexErlang.cxx index 45577bda4..00f18b56b 100644 --- a/lexers/LexErlang.cxx +++ b/lexers/LexErlang.cxx @@ -4,24 +4,29 @@  /** @file LexErlang.cxx   ** Lexer for Erlang.   ** Enhanced by Etienne 'Lenain' Girondel (lenaing@gmail.com) - ** Originally wrote by Peter-Henry Mander,  + ** Originally wrote by Peter-Henry Mander,   ** based on Matlab lexer by José Fonseca.   **/  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif @@ -152,7 +157,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,  						// Try to match documentation comment  						sc.GetCurrent(cur, sizeof(cur)); -						if (parse_state == COMMENT_DOC_MACRO  +						if (parse_state == COMMENT_DOC_MACRO  							&& erlangDocMacro.InList(cur)) {  								sc.ChangeState(SCE_ERLANG_COMMENT_DOC_MACRO);  								while (sc.ch != '}' && !sc.atLineEnd) @@ -340,7 +345,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,  				case NUMERAL_BASE_VALUE : {  					if (!is_radix(radix_digits,sc.ch)) {  						radix_digits = 0; -				 +  						if (!isalnum(sc.ch))  							sc.ChangeState(SCE_ERLANG_NUMBER); @@ -380,7 +385,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,  			/* Preprocessor --------------------------------------------------*/  				case PREPROCESSOR : {  					if (!IsAWordChar(sc.ch)) { -						 +  						sc.GetCurrent(cur, sizeof(cur));  						if (erlangPreproc.InList(cur)) {  							style = SCE_ERLANG_PREPROC; @@ -421,7 +426,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,  				} break;  				case SCE_ERLANG_OPERATOR : {  					if (sc.chPrev == '.') { -						if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\'  +						if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\'  							|| sc.ch == '^') {  							sc.ForwardSetState(SCE_ERLANG_DEFAULT);  						} else if (sc.ch == '\'') { diff --git a/lexers/LexFlagship.cxx b/lexers/LexFlagship.cxx index e3a8b9f25..6cc6ac569 100644 --- a/lexers/LexFlagship.cxx +++ b/lexers/LexFlagship.cxx @@ -10,19 +10,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexForth.cxx b/lexers/LexForth.cxx index e52543fa5..da52338fa 100644 --- a/lexers/LexForth.cxx +++ b/lexers/LexForth.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -130,7 +134,7 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle,  				sc.SetState(SCE_FORTH_NUMBER);  				while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))  					sc.Forward(); -			} else if (	isascii(sc.ch) &&  +			} else if (	isascii(sc.ch) &&  						(isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) )  					){  				sc.SetState(SCE_FORTH_NUMBER); @@ -173,4 +177,4 @@ static const char * const forthWordLists[] = {  LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists); - 	  	  + diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx index 0b3f2777c..67a58a0cf 100644 --- a/lexers/LexFortran.cxx +++ b/lexers/LexFortran.cxx @@ -8,18 +8,24 @@  /***************************************/  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h>  /***************************************/ -#include "Platform.h" -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +/***************************************/ +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexGAP.cxx b/lexers/LexGAP.cxx index fb6e739bd..3a3c2b308 100644 --- a/lexers/LexGAP.cxx +++ b/lexers/LexGAP.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexGui4Cli.cxx b/lexers/LexGui4Cli.cxx index 1c92de72e..e80b8ac9b 100644 --- a/lexers/LexGui4Cli.cxx +++ b/lexers/LexGui4Cli.cxx @@ -23,18 +23,22 @@ val SCE_GC_OPERATOR=9  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index ed9db9763..4f9fa9c92 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -7,19 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -54,13 +57,6 @@ inline bool IsOperator(int ch) {  	return false;  } -static inline int MakeLowerCase(int ch) { -	if (ch < 'A' || ch > 'Z') -		return ch; -	else -		return ch - 'A' + 'a'; -} -  static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {  	size_t i = 0;  	for (; (i < end - start + 1) && (i < len-1); i++) { diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx index b528f3f0e..2f34c66aa 100644 --- a/lexers/LexHaskell.cxx +++ b/lexers/LexHaskell.cxx @@ -18,19 +18,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h"  #include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexInno.cxx b/lexers/LexInno.cxx index 6d1102c65..4b617125d 100644 --- a/lexers/LexInno.cxx +++ b/lexers/LexInno.cxx @@ -7,19 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "CharClassify.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexKix.cxx b/lexers/LexKix.cxx index 06e7c1791..a63e054ad 100644 --- a/lexers/LexKix.cxx +++ b/lexers/LexKix.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexLisp.cxx b/lexers/LexLisp.cxx index ad5535f14..4c5f3a8d6 100644 --- a/lexers/LexLisp.cxx +++ b/lexers/LexLisp.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -44,7 +48,7 @@ static inline bool isLispwordstart(char ch) {  static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) { -	PLATFORM_ASSERT(end >= start); +	assert(end >= start);  	char s[100];  	unsigned int i;  	bool digit_flag = true; diff --git a/lexers/LexLout.cxx b/lexers/LexLout.cxx index 492e4ed6d..3946a8048 100644 --- a/lexers/LexLout.cxx +++ b/lexers/LexLout.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx index a1e579f26..ac3d6d5ac 100644 --- a/lexers/LexLua.cxx +++ b/lexers/LexLua.cxx @@ -9,19 +9,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h> -#include <stdarg.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexMMIXAL.cxx b/lexers/LexMMIXAL.cxx index 369929998..0d74b9505 100644 --- a/lexers/LexMMIXAL.cxx +++ b/lexers/LexMMIXAL.cxx @@ -9,18 +9,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexMPT.cxx b/lexers/LexMPT.cxx index a69fe5464..e8abaa2c4 100644 --- a/lexers/LexMPT.cxx +++ b/lexers/LexMPT.cxx @@ -7,21 +7,26 @@  // Copyright 2003 by Marius Gheorghe <mgheorghe@cabletest.com>  // The License.txt file describes the conditions under which this software may be distributed. +#include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h> -#include <stdlib.h> +#include <stdarg.h> +#include <assert.h>  #include <string> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif @@ -66,7 +71,7 @@ static int GetLotLineState(std::string &line) {  				return SCE_LOT_ABORT;  			}  			else { -				return i ? SCE_LOT_PASS : SCE_LOT_DEFAULT;			 +				return i ? SCE_LOT_PASS : SCE_LOT_DEFAULT;  			}  		}  	} @@ -135,10 +140,10 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc  		if (ch == '\r' && chNext == '\n') {  			// TO DO:  			// Should really get the state of the previous line from the styler -			int stylePrev = style;	 +			int stylePrev = style;  			style = styleNext;  			styleNext = styler.StyleAt(i + 2); -		 +  			switch (style) {  /*  			case SCE_LOT_SET: @@ -147,7 +152,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc  */  			case SCE_LOT_FAIL:  /* -				if (stylePrev != SCE_LOT_FAIL)  +				if (stylePrev != SCE_LOT_FAIL)  					lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;  				else  					lev = SC_FOLDLEVELBASE + 1; @@ -156,7 +161,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc  				break;  			default: -				if (lineCurrent == 0 || stylePrev == SCE_LOT_FAIL)  +				if (lineCurrent == 0 || stylePrev == SCE_LOT_FAIL)  					lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;  				else  					lev = SC_FOLDLEVELBASE + 1; @@ -166,7 +171,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc  				break;  			} -			if (lev != styler.LevelAt(lineCurrent))  +			if (lev != styler.LevelAt(lineCurrent))  				styler.SetLevel(lineCurrent, lev);  			lineCurrent++; diff --git a/lexers/LexMSSQL.cxx b/lexers/LexMSSQL.cxx index 4a3f3bed8..587b6056e 100644 --- a/lexers/LexMSSQL.cxx +++ b/lexers/LexMSSQL.cxx @@ -7,18 +7,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexMagik.cxx b/lexers/LexMagik.cxx index c6f6585b3..bf3a2cbf7 100644 --- a/lexers/LexMagik.cxx +++ b/lexers/LexMagik.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexMarkdown.cxx b/lexers/LexMarkdown.cxx index f7fc48f40..df081de31 100644 --- a/lexers/LexMarkdown.cxx +++ b/lexers/LexMarkdown.cxx @@ -2,31 +2,31 @@   *  LexMarkdown.cxx   *   *  A simple Markdown lexer for scintilla. - *    + *   *  Includes highlighting for some extra features from the - *  Pandoc implementation; strikeout, using '#.' as a default  + *  Pandoc implementation; strikeout, using '#.' as a default   *  ordered list item marker, and delimited code blocks. - *  + *   *  Limitations: - *  + *   *  Standard indented code blocks are not highlighted at all, - *  as it would conflict with other indentation schemes. Use  + *  as it would conflict with other indentation schemes. Use   *  delimited code blocks for blanket highlighting of an   *  entire code block.  Embedded HTML is not highlighted either.   *  Blanket HTML highlighting has issues, because some Markdown   *  implementations allow Markdown markup inside of the HTML. Also, - *  there is a following blank line issue that can't be ignored,  - *  explained in the next paragraph. Embedded HTML and code  - *  blocks would be better supported with language specific  + *  there is a following blank line issue that can't be ignored, + *  explained in the next paragraph. Embedded HTML and code + *  blocks would be better supported with language specific   *  highlighting. - *  + *   *  The highlighting aims to accurately reflect correct syntax,   *  but a few restrictions are relaxed. Delimited code blocks are - *  highlighted, even if the line following the code block is not blank.   + *  highlighted, even if the line following the code block is not blank.   *  Requiring a blank line after a block, breaks the highlighting   *  in certain cases, because of the way Scintilla ends up calling   *  the lexer. - *  + *   *  Written by Jon Strait - jstrait@moonloop.net   *   *  The License.txt file describes the conditions under which this @@ -34,20 +34,23 @@   *   *****************************************************************/ -#include <stdlib.h>          +#include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -74,7 +77,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en      else return false;  } -// Set the state on text section from current to length characters,  +// Set the state on text section from current to length characters,  // then set the rest until the newline to default, except for any characters matching token  static void SetStateAndZoom(const int state, const int length, const int token, StyleContext &sc) {      sc.SetState(state); @@ -100,7 +103,7 @@ static void SetStateAndZoom(const int state, const int length, const int token,  static bool HasPrevLineContent(StyleContext &sc) {      int i = 0;      // Go back to the previous newline -    while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))  +    while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))          ;      while (--i + sc.currentPos) {          if (IsNewline(sc.GetRelative(i))) @@ -116,12 +119,12 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {      unsigned int i = 0;      while (++i) {          c = sc.GetRelative(i); -        if (c == sc.ch)  +        if (c == sc.ch)              ++count;          // hit a terminating character          else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) {              // Are we a valid HRULE -            if ((IsNewline(c) || sc.currentPos + i == endPos) &&  +            if ((IsNewline(c) || sc.currentPos + i == endPos) &&                      count >= 3 && !HasPrevLineContent(sc)) {                  sc.SetState(SCE_MARKDOWN_HRULE);                  sc.Forward(i); @@ -145,7 +148,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle      // Useful in the corner case of having to start at the beginning file position      // in the default state.      bool freezeCursor = false; -     +      StyleContext sc(startPos, length, initStyle, styler);      while (sc.More()) { @@ -154,18 +157,18 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle              sc.Forward();              continue;          } -         +          // A blockquotes resets the line semantics          if (sc.state == SCE_MARKDOWN_BLOCKQUOTE)              sc.SetState(SCE_MARKDOWN_LINE_BEGIN); -         +          // Conditional state-based actions          if (sc.state == SCE_MARKDOWN_CODE2) {              if (sc.Match("``") && sc.GetRelative(-2) != ' ') {                  sc.Forward(2);                  sc.SetState(SCE_MARKDOWN_DEFAULT);              } -        }     +        }          else if (sc.state == SCE_MARKDOWN_CODE) {              if (sc.ch == '`' && sc.chPrev != ' ')                  sc.ForwardSetState(SCE_MARKDOWN_DEFAULT); @@ -201,14 +204,14 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle                  sc.Forward(2);                  sc.SetState(SCE_MARKDOWN_DEFAULT);              } -        }  -        else if (sc.state == SCE_MARKDOWN_STRONG2) {   -            if (sc.Match("__") && sc.chPrev != ' ') {   +        } +        else if (sc.state == SCE_MARKDOWN_STRONG2) { +            if (sc.Match("__") && sc.chPrev != ' ') {                  sc.Forward(2);                  sc.SetState(SCE_MARKDOWN_DEFAULT);              }          } -        // Emphasis     +        // Emphasis          else if (sc.state == SCE_MARKDOWN_EM1) {              if (sc.ch == '*' && sc.chPrev != ' ')                  sc.ForwardSetState(SCE_MARKDOWN_DEFAULT); @@ -281,7 +284,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle                  sc.SetState(SCE_MARKDOWN_PRECHAR);              }          } -                 +          // The header lasts until the newline          else if (sc.state == SCE_MARKDOWN_HEADER1 || sc.state == SCE_MARKDOWN_HEADER2 ||                  sc.state == SCE_MARKDOWN_HEADER3 || sc.state == SCE_MARKDOWN_HEADER4 || @@ -289,7 +292,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle              if (IsNewline(sc.ch))                  sc.SetState(SCE_MARKDOWN_LINE_BEGIN);          } -         +          // New state only within the initial whitespace          if (sc.state == SCE_MARKDOWN_PRECHAR) {              // Blockquote @@ -300,8 +303,8 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle              else if (!HasPrevLineContent(sc) && (sc.chPrev == '\t' || precharCount >= 4))                  sc.SetState(SCE_MARKDOWN_CODEBK);              */ -            // HRule - Total of three or more hyphens, asterisks, or underscores  -            // on a line by themselves     +            // HRule - Total of three or more hyphens, asterisks, or underscores +            // on a line by themselves              else if ((sc.ch == '-' || sc.ch == '*' || sc.ch == '_') && IsValidHrule(endPos, sc))                  ;              // Unordered list @@ -314,7 +317,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle                  int digitCount = 0;                  while (IsADigit(sc.GetRelative(++digitCount)))                      ; -                if (sc.GetRelative(digitCount) == '.' &&  +                if (sc.GetRelative(digitCount) == '.' &&                          IsASpaceOrTab(sc.GetRelative(digitCount + 1))) {                      sc.SetState(SCE_MARKDOWN_OLIST_ITEM);                      sc.Forward(digitCount + 1); @@ -332,7 +335,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle              else                  ++precharCount;          } -         +          // New state anywhere in doc          if (sc.state == SCE_MARKDOWN_DEFAULT) {              if (sc.atLineStart && sc.ch == '#') { diff --git a/lexers/LexMatlab.cxx b/lexers/LexMatlab.cxx index 4e467bd2f..af26ff9c4 100644 --- a/lexers/LexMatlab.cxx +++ b/lexers/LexMatlab.cxx @@ -12,18 +12,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexMetapost.cxx b/lexers/LexMetapost.cxx index 6afc9d826..8fcca42a5 100644 --- a/lexers/LexMetapost.cxx +++ b/lexers/LexMetapost.cxx @@ -14,18 +14,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -326,11 +330,11 @@ static const char * const metapostWordListDesc[] = {  static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) {  	WordList& keywordsStart=*keywordlists[3];  	WordList& keywordsStop1=*keywordlists[4]; -	 +  	if (keywordsStart.InList(s)) {return 1;}  	else if (keywordsStop1.InList(s)) {return -1;}  	return 0; -	 +  }  static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word) @@ -344,11 +348,11 @@ static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)            length++;            ch=styler.SafeGetCharAt(pos+length);    } -  word[length]=0;    +  word[length]=0;    return length;  } -  -static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)  + +static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)  {  	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;  	unsigned int endPos = startPos+length; @@ -357,9 +361,9 @@ static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *ke  	int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;  	int levelCurrent=levelPrev;  	char chNext=styler[startPos]; -	 +  	char buffer[100]=""; -	 +  	for (unsigned int i=startPos; i < endPos; i++) {  		char ch=chNext;  		chNext=styler.SafeGetCharAt(i+1); @@ -371,7 +375,7 @@ static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *ke              ParseMetapostWord(i, styler, buffer);  			levelCurrent += classifyFoldPointMetapost(buffer,keywordlists);  		} -		 +  		if (atEOL) {  			int lev = levelPrev;  			if (visibleChars == 0 && foldCompact) diff --git a/lexers/LexMySQL.cxx b/lexers/LexMySQL.cxx index e8496ceea..2e4fcef13 100644 --- a/lexers/LexMySQL.cxx +++ b/lexers/LexMySQL.cxx @@ -12,18 +12,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -113,12 +117,12 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,          if (!IsAWordChar(sc.ch))          {            CheckForKeyword(sc, keywordlists); -           +            // Additional check for function keywords needed.            // A function name must be followed by an opening parenthesis.            if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(')              sc.ChangeState(SCE_MYSQL_DEFAULT); -             +            sc.SetState(SCE_MYSQL_DEFAULT);          }          break; @@ -137,7 +141,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,            if (keywordlists[4]->InList(&s[2]))              sc.ChangeState(SCE_MYSQL_KNOWNSYSTEMVARIABLE);            delete [] s; -           +            sc.SetState(SCE_MYSQL_DEFAULT);          }          break; @@ -232,7 +236,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,                if (sc.Match('/', '*'))                {                  sc.SetState(SCE_MYSQL_COMMENT); -                 +                  // Skip comment introducer and check for hidden command.                  sc.Forward(2);                  if (sc.ch == '!') @@ -247,7 +251,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,                    // Special MySQL single line comment.                    sc.SetState(SCE_MYSQL_COMMENTLINE);                    sc.Forward(2); -                   +                    // Check the third character too. It must be a space or EOL.                    if (sc.ch != ' ' && sc.ch != '\n' && sc.ch != '\r')                      sc.ChangeState(SCE_MYSQL_OPERATOR); @@ -258,7 +262,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,        }      }    } -   +    // Do a final check for keywords if we currently have an identifier, to highlight them    // also at the end of a line.    if (sc.state == SCE_MYSQL_IDENTIFIER) @@ -270,7 +274,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,      if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(')        sc.ChangeState(SCE_MYSQL_DEFAULT);    } -	 +    sc.Complete();  } @@ -320,7 +324,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL  	int styleNext = styler.StyleAt(startPos);  	int style = initStyle; -	 +    bool endFound = false;  	bool whenFound = false;  	bool elseFound = false; @@ -331,11 +335,11 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL  		int stylePrev = style;  		style = styleNext;  		styleNext = styler.StyleAt(i + 1); -     +      char currentChar = nextChar;      nextChar = styler.SafeGetCharAt(i + 1);  		bool atEOL = (currentChar == '\r' && nextChar != '\n') || (currentChar == '\n'); -	 +      switch (style)      {        case SCE_MYSQL_COMMENT: @@ -357,7 +361,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL          break;        case SCE_MYSQL_COMMENTLINE:          if (foldComment) -        {  +        {            // Not really a standard, but we add support for single line comments            // with special curly braces syntax as foldable comments too.            // MySQL needs -- comments to be followed by space or control char @@ -400,14 +404,14 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL            bool whileFound = MatchIgnoreCase(styler, i, "while");            bool loopFound = MatchIgnoreCase(styler, i, "loop");            bool repeatFound = MatchIgnoreCase(styler, i, "repeat"); -           +            if (!foldOnlyBegin && endFound && (ifFound || whileFound || loopFound))            {              endFound = false;              levelNext--;              if (levelNext < SC_FOLDLEVELBASE)                levelNext = SC_FOLDLEVELBASE; -             +              // Note that "else" is special here. It may or may not be followed by an "if .. then",              // but in any case the level stays the same. When followed by an "if .. then" the level              // will be increased later, if not, then at eol. @@ -461,7 +465,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL          }          break;      } -     +      // Handle the case of a trailing end without an if / while etc, as in the case of a begin.  		if (endFound)      { @@ -470,7 +474,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL  			if (levelNext < SC_FOLDLEVELBASE)          levelNext = SC_FOLDLEVELBASE;  		} -     +  		if (atEOL)      {  			if (elseFound) @@ -487,14 +491,14 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL  				lev |= SC_FOLDLEVELHEADERFLAG;  			if (lev != styler.LevelAt(lineCurrent))  				styler.SetLevel(lineCurrent, lev); -       +  			lineCurrent++;  			levelCurrent = levelNext;  			visibleChars = 0;  			endFound = false;  			whenFound = false;  		} -     +  		if (!isspacechar(currentChar))  			visibleChars++;  	} diff --git a/lexers/LexNimrod.cxx b/lexers/LexNimrod.cxx index 8c4d04360..80f1cb93a 100644 --- a/lexers/LexNimrod.cxx +++ b/lexers/LexNimrod.cxx @@ -9,18 +9,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -113,7 +117,7 @@ static int scanNumber(Accessor &styler, int pos) {        if (ch == '_' || (ch >= '0' && ch <= '1')) ++pos;        else break;      } -  } else if (ch == '0' &&  +  } else if (ch == '0' &&              (ch2 == 'o' || ch2 == 'O' || ch2 == 'c' || ch2 == 'C')) {      /* octal number: */      pos += 2; @@ -203,7 +207,7 @@ static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle,        case '#': {          bool doccomment = (styler.SafeGetCharAt(pos+1) == '#');          while (pos < max && !isNewLine(styler.SafeGetCharAt(pos, LF))) pos++; -        if (doccomment)  +        if (doccomment)            styler.ColourTo(pos, SCE_C_COMMENTLINEDOC);          else            styler.ColourTo(pos, SCE_P_COMMENTLINE); @@ -280,7 +284,7 @@ static bool IsQuoteLine(int line, Accessor &styler) {  } -static void FoldNimrodDoc(unsigned int startPos, int length,  +static void FoldNimrodDoc(unsigned int startPos, int length,                            int /*initStyle - unused*/,                            WordList *[], Accessor &styler) {  	const int maxPos = startPos + length; @@ -311,7 +315,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,  	int prev_state = SCE_P_DEFAULT & 31;  	if (lineCurrent >= 1)  		prev_state = styler.StyleAt(startPos - 1) & 31; -	int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) ||  +	int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) ||  	                               (prev_state == SCE_P_TRIPLEDOUBLE));  	int prevComment = 0;  	if (lineCurrent >= 1) @@ -320,7 +324,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,  	// Process all characters to end of requested range or end of any triple quote  	// or comment that hangs over the end of the range.  Cap processing in all cases  	// to end of document (in case of unclosed quote or comment at end). -	while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) ||  +	while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) ||  	                                      prevQuote || prevComment)) {  		// Gather info @@ -338,7 +342,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,  		const int quote_continue = (quote && prevQuote);  		const int comment = foldComment && IsCommentLine(lineCurrent, styler);  		const int comment_start = (comment && !prevComment && (lineNext <= docLines) && -		                           IsCommentLine(lineNext, styler) &&  +		                           IsCommentLine(lineNext, styler) &&  		                           (lev > SC_FOLDLEVELBASE));  		const int comment_continue = (comment && prevComment);  		if ((!quote || !prevQuote) && !comment) @@ -377,8 +381,8 @@ static void FoldNimrodDoc(unsigned int startPos, int length,  		}  		const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; -		const int levelBeforeComments =  -		    Platform::Maximum(indentCurrentLevel,levelAfterComments); +		const int levelBeforeComments = +		    Maximum(indentCurrentLevel,levelAfterComments);  		// Now set all the indent levels on the lines we skipped  		// Do this from end to start.  Once we encounter one line @@ -401,7 +405,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,  		// Set fold header on non-quote/non-comment line  		if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) { -			if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) <  +			if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) <  			     (indentNext & SC_FOLDLEVELNUMBERMASK))  				lev |= SC_FOLDLEVELHEADERFLAG;  		} diff --git a/lexers/LexNsis.cxx b/lexers/LexNsis.cxx index 43ddc4706..820a5d126 100644 --- a/lexers/LexNsis.cxx +++ b/lexers/LexNsis.cxx @@ -5,21 +5,26 @@  // Copyright 2003 - 2005 by Angelo Mandato <angelo [at] spaceblue [dot] com>  // Last Updated: 03/13/2005  // The License.txt file describes the conditions under which this software may be distributed. +  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "CharClassify.h" -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexOpal.cxx b/lexers/LexOpal.cxx index 46cf43f7c..e2209abb2 100644 --- a/lexers/LexOpal.cxx +++ b/lexers/LexOpal.cxx @@ -6,18 +6,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -92,7 +96,7 @@ inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accesso  inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )  {  	char ch; -	 +  	if( could_fail )  	{  		cur++; @@ -101,7 +105,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A  			styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );  			return false; // STOP  		} -		 +  		ch = styler.SafeGetCharAt( cur );  		if( ch != '*' )  		{ @@ -110,7 +114,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A  			return true;  		}  	} -	 +  	// Wait for comment close  	cur++;  	bool star_found = false; @@ -121,7 +125,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A  			styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK );  			return false; // STOP  		} -		 +  		ch = styler.SafeGetCharAt( cur );  		if( star_found )  		{ @@ -155,7 +159,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A  inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )  {  	char ch; -	 +  	if( could_fail )  	{  		cur++; @@ -164,7 +168,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac  			styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );  			return false; // STOP  		} -		 +  		ch = styler.SafeGetCharAt( cur );  		if( ch != '-' )  		{ @@ -179,7 +183,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac  			styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );  			return false; // STOP  		} -		 +  		ch = styler.SafeGetCharAt( cur );  		if( ( ch != ' ' ) && ( ch != '\t' ) )  		{ @@ -224,7 +228,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac  		{  			if( ch == '\015' )  			{ -				fifteen_found = true;	 +				fifteen_found = true;  			}  			else if( ch == '\012' )  			{ @@ -259,7 +263,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor  			styler.ColourTo( cur - 1, SCE_OPAL_SPACE );  			return false;  		} -		 +  		ch = styler.SafeGetCharAt( cur );  		switch( ch )  		{ @@ -269,7 +273,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor  		case '\012':  			cur++;  			break; -		 +  		default:  			styler.ColourTo( cur - 1, SCE_OPAL_SPACE );  			styler.StartSegment( cur ); @@ -314,7 +318,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor  			!( isascii( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break;  		cur++; -		if( cur >= one_too_much )  +		if( cur >= one_too_much )  		{  			break;  		} @@ -323,7 +327,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor  	const int ide_len = cur - beg + 1;  	char * ide = new char[ ide_len ];  	getRange( beg, cur, styler, ide, ide_len ); -	 +  	WordList & keywords    = *keywordlists[ 0 ];  	WordList & classwords  = *keywordlists[ 1 ]; @@ -338,8 +342,8 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor  		}  		else  		{ -			styler.StartSegment( cur );	 -			return true;			 +			styler.StartSegment( cur ); +			return true;  		}  	}  	else if( classwords.InList( ide ) ) // Sort @@ -353,8 +357,8 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor  		}  		else  		{ -			styler.StartSegment( cur );	 -			return true;			 +			styler.StartSegment( cur ); +			return true;  		}  	}  	else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const @@ -368,8 +372,8 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor  		}  		else  		{ -			styler.StartSegment( cur );	 -			return true;			 +			styler.StartSegment( cur ); +			return true;  		}  	}  	else // Unknown keyword @@ -384,7 +388,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor  		else  		{  			styler.StartSegment( cur ); -			return true;			 +			return true;  		}  	} @@ -400,7 +404,7 @@ inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor  	}  	else  	{ -		styler.StartSegment( cur );	 +		styler.StartSegment( cur );  		return true;  	}  } @@ -444,11 +448,11 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle,  			if( !HandleString( cur, one_too_much, styler ) ) return;  			state = SCE_OPAL_DEFAULT;  			break; -			 +  		default: // SCE_OPAL_DEFAULT:  			{  				char ch = styler.SafeGetCharAt( cur ); -				 +  				switch( ch )  				{  				// String @@ -483,7 +487,7 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle,  				case '\012':  					if( !HandleSpace( cur, one_too_much, styler ) ) return;  					break; -				 +  				default:  					{  						// Integer @@ -496,7 +500,7 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle,  						else if( isascii( ch ) && ( islower( ch ) || isupper( ch ) ) )  						{  							if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return; -							 +  						}  						// Skip diff --git a/lexers/LexOthers.cxx b/lexers/LexOthers.cxx index c8f6ca977..c583c93a1 100644 --- a/lexers/LexOthers.cxx +++ b/lexers/LexOthers.cxx @@ -8,19 +8,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "CharClassify.h" -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif diff --git a/lexers/LexPB.cxx b/lexers/LexPB.cxx index abc0ddc79..6142eb5ae 100644 --- a/lexers/LexPB.cxx +++ b/lexers/LexPB.cxx @@ -35,18 +35,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexPLM.cxx b/lexers/LexPLM.cxx index 604850fbe..52ebe0815 100644 --- a/lexers/LexPLM.cxx +++ b/lexers/LexPLM.cxx @@ -4,18 +4,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexPOV.cxx b/lexers/LexPOV.cxx index b845b2d47..943bbd3f6 100644 --- a/lexers/LexPOV.cxx +++ b/lexers/LexPOV.cxx @@ -16,18 +16,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexPS.cxx b/lexers/LexPS.cxx index 2edcff150..af6886657 100644 --- a/lexers/LexPS.cxx +++ b/lexers/LexPS.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h> -#include <stdarg.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexPascal.cxx b/lexers/LexPascal.cxx index 3dcf35ad5..1243d3823 100644 --- a/lexers/LexPascal.cxx +++ b/lexers/LexPascal.cxx @@ -11,20 +11,20 @@  A few words about features of the new completely rewritten LexPascal... -Generally speaking LexPascal tries to support all available Delphi features (up  +Generally speaking LexPascal tries to support all available Delphi features (up  to Delphi 2009 at this time), including .NET specific features.  ~ HIGHLIGHTING: -If you enable "lexer.pascal.smart.highlighting" property, some keywords will  -only be highlighted in appropriate context. As implemented those are keywords  -related to property and DLL exports declarations (similar to how Delphi IDE  -works).  +If you enable "lexer.pascal.smart.highlighting" property, some keywords will +only be highlighted in appropriate context. As implemented those are keywords +related to property and DLL exports declarations (similar to how Delphi IDE +works). -For example, keywords "read" and "write" will only be highlighted if they are in  +For example, keywords "read" and "write" will only be highlighted if they are in  property declaration: -property MyProperty: boolean read FMyProperty write FMyProperty;  +property MyProperty: boolean read FMyProperty write FMyProperty;  ~ FOLDING: @@ -32,34 +32,34 @@ Folding is supported in the following cases:  - Folding of stream-like comments  - Folding of groups of consecutive line comments -- Folding of preprocessor blocks (the following preprocessor blocks are  -supported: IF / IFEND; IFDEF, IFNDEF, IFOPT / ENDIF and REGION / ENDREGION  +- Folding of preprocessor blocks (the following preprocessor blocks are +supported: IF / IFEND; IFDEF, IFNDEF, IFOPT / ENDIF and REGION / ENDREGION  blocks), including nesting of preprocessor blocks up to 255 levels -- Folding of code blocks on appropriate keywords (the following code blocks are  -supported: "begin, asm, record, try, case / end" blocks, class & object  +- Folding of code blocks on appropriate keywords (the following code blocks are +supported: "begin, asm, record, try, case / end" blocks, class & object  declarations and interface declarations)  Remarks: -- Folding of code blocks tries to handle all special cases in which folding  +- Folding of code blocks tries to handle all special cases in which folding  should not occur. As implemented those are: -1. Structure "record case / end" (there's only one "end" statement and "case" is  +1. Structure "record case / end" (there's only one "end" statement and "case" is  ignored as fold point) -2. Forward class declarations ("type TMyClass = class;") and object method  -declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") are  +2. Forward class declarations ("type TMyClass = class;") and object method +declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") are  ignored as fold points -3. Simplified complete class declarations ("type TMyClass = class(TObject);")  +3. Simplified complete class declarations ("type TMyClass = class(TObject);")  are ignored as fold points -4. Every other situation when class keyword doesn't actually start class  -declaration ("class procedure", "class function", "class of", "class var",  +4. Every other situation when class keyword doesn't actually start class +declaration ("class procedure", "class function", "class of", "class var",  "class property" and "class operator") -- Folding of code blocks inside preprocessor blocks is disabled (any comments  -inside them will be folded fine) because there is no guarantee that complete  -code block will be contained inside folded preprocessor block in which case  -folded code block could end prematurely at the end of preprocessor block if  -there is no closing statement inside. This was done in order to properly process  +- Folding of code blocks inside preprocessor blocks is disabled (any comments +inside them will be folded fine) because there is no guarantee that complete +code block will be contained inside folded preprocessor block in which case +folded code block could end prematurely at the end of preprocessor block if +there is no closing statement inside. This was done in order to properly process  document that may contain something like this:  type @@ -76,52 +76,55 @@ type    ...  end; -If class declarations were folded, then the second class declaration would end  -at "$ENDIF" statement, first class statement would end at "end;" statement and  -preprocessor "$IFDEF" block would go all the way to the end of document.  -However, having in mind all this, if you want to enable folding of code blocks  -inside preprocessor blocks, you can disable folding of preprocessor blocks by  -changing "fold.preprocessor" property, in which case everything inside them  +If class declarations were folded, then the second class declaration would end +at "$ENDIF" statement, first class statement would end at "end;" statement and +preprocessor "$IFDEF" block would go all the way to the end of document. +However, having in mind all this, if you want to enable folding of code blocks +inside preprocessor blocks, you can disable folding of preprocessor blocks by +changing "fold.preprocessor" property, in which case everything inside them  would be folded.  ~ KEYWORDS: -The list of keywords that can be used in pascal.properties file (up to Delphi  +The list of keywords that can be used in pascal.properties file (up to Delphi  2009): -- Keywords: absolute abstract and array as asm assembler automated begin case  -cdecl class const constructor deprecated destructor dispid dispinterface div do  -downto dynamic else end except export exports external far file final  -finalization finally for forward function goto if implementation in inherited  -initialization inline interface is label library message mod near nil not object  -of on or out overload override packed pascal platform private procedure program  -property protected public published raise record register reintroduce repeat  -resourcestring safecall sealed set shl shr static stdcall strict string then  +- Keywords: absolute abstract and array as asm assembler automated begin case +cdecl class const constructor deprecated destructor dispid dispinterface div do +downto dynamic else end except export exports external far file final +finalization finally for forward function goto if implementation in inherited +initialization inline interface is label library message mod near nil not object +of on or out overload override packed pascal platform private procedure program +property protected public published raise record register reintroduce repeat +resourcestring safecall sealed set shl shr static stdcall strict string then  threadvar to try type unit unsafe until uses var varargs virtual while with xor -- Keywords related to the "smart highlithing" feature: add default implements  +- Keywords related to the "smart highlithing" feature: add default implements  index name nodefault read readonly remove stored write writeonly -- Keywords related to Delphi packages (in addition to all above): package  +- Keywords related to Delphi packages (in addition to all above): package  contains requires  */  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -155,12 +158,12 @@ static void GetForwardRangeLowered(unsigned int start,  }  enum { -	stateInAsm = 0x1000,  -	stateInProperty = 0x2000,  -	stateInExport = 0x4000,  -	stateFoldInPreprocessor = 0x0100,  -	stateFoldInRecord = 0x0200,  -	stateFoldInPreprocessorLevelMask = 0x00FF,  +	stateInAsm = 0x1000, +	stateInProperty = 0x2000, +	stateInExport = 0x4000, +	stateFoldInPreprocessor = 0x0100, +	stateFoldInRecord = 0x0200, +	stateFoldInPreprocessorLevelMask = 0x00FF,  	stateFoldMaskAll = 0x0FFF  }; @@ -190,11 +193,11 @@ static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &  					ignoreKeyword = true;  				} else if (!(curLineState & stateInExport) && strcmp(s, "name") == 0) {  					ignoreKeyword = true; -				} else if (!(curLineState & stateInProperty) &&  -					(strcmp(s, "read") == 0 || strcmp(s, "write") == 0 ||  -					 strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 ||  -					 strcmp(s, "stored") == 0 || strcmp(s, "implements") == 0 ||  -					 strcmp(s, "readonly") == 0 || strcmp(s, "writeonly") == 0 ||  +				} else if (!(curLineState & stateInProperty) && +					(strcmp(s, "read") == 0 || strcmp(s, "write") == 0 || +					 strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 || +					 strcmp(s, "stored") == 0 || strcmp(s, "implements") == 0 || +					 strcmp(s, "readonly") == 0 || strcmp(s, "writeonly") == 0 ||  					 strcmp(s, "add") == 0 || strcmp(s, "remove") == 0)) {  					ignoreKeyword = true;  				} @@ -367,7 +370,7 @@ static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned i  	lineFoldStateCurrent |= nestLevel & stateFoldInPreprocessorLevelMask;  } -static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,  +static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,  		unsigned int startPos, Accessor &styler) {  	CharacterSet setWord(CharacterSet::setAlpha); @@ -376,17 +379,17 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold  	unsigned int nestLevel = GetFoldInPreprocessorLevelFlag(lineFoldStateCurrent); -	if (strcmp(s, "if") == 0 ||  -		strcmp(s, "ifdef") == 0 ||  -		strcmp(s, "ifndef") == 0 ||  -		strcmp(s, "ifopt") == 0 ||  +	if (strcmp(s, "if") == 0 || +		strcmp(s, "ifdef") == 0 || +		strcmp(s, "ifndef") == 0 || +		strcmp(s, "ifopt") == 0 ||  		strcmp(s, "region") == 0) {  		nestLevel++;  		SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);  		lineFoldStateCurrent |= stateFoldInPreprocessor;  		levelCurrent++; -	} else if (strcmp(s, "endif") == 0 ||  -		strcmp(s, "ifend") == 0 ||  +	} else if (strcmp(s, "endif") == 0 || +		strcmp(s, "ifend") == 0 ||  		strcmp(s, "endregion") == 0) {  		nestLevel--;  		SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel); @@ -400,12 +403,12 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold  	}  } -static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,  +static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,  		Accessor &styler, bool includeChars = false) {  	CharacterSet setWord(CharacterSet::setAlphaNum, "_");  	unsigned int j = currentPos + 1;  	char ch = styler.SafeGetCharAt(j); -	while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||  +	while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||  		IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) {  		j++;  		ch = styler.SafeGetCharAt(j); @@ -413,8 +416,8 @@ static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,  	return j;  } -static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,  -		int startPos, unsigned int endPos,  +static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, +		int startPos, unsigned int endPos,  		unsigned int lastStart, unsigned int currentPos, Accessor &styler) {  	char s[100];  	GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); @@ -422,9 +425,9 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur  	if (strcmp(s, "record") == 0) {  		lineFoldStateCurrent |= stateFoldInRecord;  		levelCurrent++; -	} else if (strcmp(s, "begin") == 0 ||  -		strcmp(s, "asm") == 0 ||  -		strcmp(s, "try") == 0 ||  +	} else if (strcmp(s, "begin") == 0 || +		strcmp(s, "asm") == 0 || +		strcmp(s, "try") == 0 ||  		(strcmp(s, "case") == 0 && !(lineFoldStateCurrent & stateFoldInRecord))) {  		levelCurrent++;  	} else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) { @@ -436,13 +439,13 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur  			CharacterSet setWord(CharacterSet::setAlphaNum, "_");  			if (styler.SafeGetCharAt(j) == ';') { -				// Handle forward class declarations ("type TMyClass = class;")  +				// Handle forward class declarations ("type TMyClass = class;")  				// and object method declarations ("TNotifyEvent = procedure(Sender: TObject) of object;")  				ignoreKeyword = true;  			} else if (strcmp(s, "class") == 0) {  				// "class" keyword has a few more special cases...  				if (styler.SafeGetCharAt(j) == '(') { -					// Handle simplified complete class declarations ("type TMyClass = class(TObject);")  +					// Handle simplified complete class declarations ("type TMyClass = class(TObject);")  					j = SkipWhiteSpace(j, endPos, styler, true);  					if (j < endPos && styler.SafeGetCharAt(j) == ')') {  						j = SkipWhiteSpace(j, endPos, styler); @@ -454,11 +457,11 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur  					char s2[11];	// Size of the longest possible keyword + one additional character + null  					GetForwardRangeLowered(j, setWord, styler, s2, sizeof(s2)); -					if (strcmp(s2, "procedure") == 0 ||  -						strcmp(s2, "function") == 0 ||  -						strcmp(s2, "of") == 0 ||  -						strcmp(s2, "var") == 0 ||  -						strcmp(s2, "property") == 0 ||  +					if (strcmp(s2, "procedure") == 0 || +						strcmp(s2, "function") == 0 || +						strcmp(s2, "of") == 0 || +						strcmp(s2, "var") == 0 || +						strcmp(s2, "property") == 0 ||  						strcmp(s2, "operator") == 0) {  						ignoreKeyword = true;  					} @@ -473,7 +476,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur  		bool ignoreKeyword = true;  		int j = lastStart - 1;  		char ch = styler.SafeGetCharAt(j); -		while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||  +		while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||  			IsStreamCommentStyle(styler.StyleAt(j)))) {  			j--;  			ch = styler.SafeGetCharAt(j); @@ -539,7 +542,7 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word  		if (foldPreprocessor) {  			if (style == SCE_PAS_PREPROCESSOR && ch == '{' && chNext == '$') {  				ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 2, styler); -			} else if (style == SCE_PAS_PREPROCESSOR2 && ch == '(' && chNext == '*'  +			} else if (style == SCE_PAS_PREPROCESSOR2 && ch == '(' && chNext == '*'  			           && styler.SafeGetCharAt(i + 2) == '$') {  				ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 3, styler);  			} diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx index bca78f57c..e5b66eebb 100644 --- a/lexers/LexPerl.cxx +++ b/lexers/LexPerl.cxx @@ -8,19 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -1187,12 +1190,12 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],  	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;  	// Custom folding of POD and packages -	// property fold.perl.pod  -	//	Enable folding Pod blocks when using the Perl lexer.  +	// property fold.perl.pod +	//	Enable folding Pod blocks when using the Perl lexer.  	bool foldPOD = styler.GetPropertyInt("fold.perl.pod", 1) != 0; -	// property fold.perl.package  -	//	Enable folding packages when using the Perl lexer.  +	// property fold.perl.package +	//	Enable folding packages when using the Perl lexer.  	bool foldPackage = styler.GetPropertyInt("fold.perl.package", 1) != 0;  	unsigned int endPos = startPos + length; diff --git a/lexers/LexPowerPro.cxx b/lexers/LexPowerPro.cxx index 9320baf94..c21d0ab22 100644 --- a/lexers/LexPowerPro.cxx +++ b/lexers/LexPowerPro.cxx @@ -3,42 +3,46 @@  // PowerPro utility, written by Bruce Switzer, is available from http://powerpro.webeddie.com  // PowerPro lexer is written by Christopher Bean (cbean@cb-software.net)  // -// Lexer code heavily borrowed from:  +// Lexer code heavily borrowed from:  //	LexAU3.cxx by Jos van der Zande  //	LexCPP.cxx by Neil Hodgson  //	LexVB.cxx by Neil Hodgson  //  // Changes:  // 	2008-10-25 - Initial release -//	2008-10-26 - Changed how <name> is hilighted in  'function <name>' so that  +//	2008-10-26 - Changed how <name> is hilighted in  'function <name>' so that  //				 local isFunction = "" and local functions = "" don't get falsely highlighted  //	2008-12-14 - Added bounds checking for szKeyword and szDo  //			   - Replaced SetOfCharacters with CharacterSet  //			   - Made sure that CharacterSet::Contains is passed only positive values -//			   - Made sure that the return value of Accessor::SafeGetCharAt is positive before  +//			   - Made sure that the return value of Accessor::SafeGetCharAt is positive before  //				 passsing to functions that require positive values like isspacechar()  //			   - Removed unused visibleChars processing from ColourisePowerProDoc() -//			   - Fixed bug with folding logic where line continuations didn't end where  +//			   - Fixed bug with folding logic where line continuations didn't end where  //				 they were supposed to  //			   - Moved all helper functions to the top of the file  //  // Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed. -#include <ctype.h> -#include <stdarg.h> -#include <stdio.h>  #include <stdlib.h>  #include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h"  #include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -72,13 +76,13 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler)  }  // Routine to find first none space on the current line and return its Style -// needed for comment lines not starting on pos 1  +// needed for comment lines not starting on pos 1  static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)  {  	int nsPos = styler.LineStart(szLine);  	int nePos = styler.LineStart(szLine+1) - 1;  	char ch = styler.SafeGetCharAt(nsPos); -	 +  	while (ch > 0 && isspacechar(ch) && nsPos < nePos)  	{  		nsPos++; // skip to next char @@ -91,10 +95,10 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)  //returns true if there is a function to highlight  //used to highlight <name> in 'function <name>'  static bool HasFunction(Accessor &styler, unsigned int currentPos) { -	 +  	//check for presence of 'function ' -	return 	(styler.SafeGetCharAt(currentPos) == ' ' 	 -	&& tolower(styler.SafeGetCharAt(currentPos-1)) == 'n'  +	return 	(styler.SafeGetCharAt(currentPos) == ' ' +	&& tolower(styler.SafeGetCharAt(currentPos-1)) == 'n'  	&& tolower(styler.SafeGetCharAt(currentPos-2)) == 'o'  	&& tolower(styler.SafeGetCharAt(currentPos-3)) == 'i'  	&& tolower(styler.SafeGetCharAt(currentPos-4)) == 't' @@ -103,7 +107,7 @@ static bool HasFunction(Accessor &styler, unsigned int currentPos) {  	&& tolower(styler.SafeGetCharAt(currentPos-7)) == 'u'  	&& tolower(styler.SafeGetCharAt(currentPos-8)) == 'f'  	//only allow 'function ' to appear at the beginning of a line -	&& (styler.SafeGetCharAt(currentPos-9) == '\n'   		 +	&& (styler.SafeGetCharAt(currentPos-9) == '\n'  		|| styler.SafeGetCharAt(currentPos-9) == '\r'  		|| (styler.SafeGetCharAt(currentPos -9, '\0')) == '\0') //is the first line  	); @@ -116,22 +120,22 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl  	WordList &keywords2 = *keywordlists[1];  	WordList &keywords3 = *keywordlists[2];  	WordList &keywords4 = *keywordlists[3]; -	 -	//define the character sets  + +	//define the character sets  	CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);  	CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);  	StyleContext sc(startPos, length, initStyle, styler);  	char s_save[100]; //for last line highlighting -	 +  	for (; sc.More(); sc.Forward()) { -			 +  		// **********************************************  		// save the total current word for eof processing  		char s[100];  		sc.GetCurrentLowered(s, sizeof(s)); -		  -		if ((sc.ch > 0) && setWord.Contains(sc.ch))  + +		if ((sc.ch > 0) && setWord.Contains(sc.ch))  		{  			strcpy(s_save,s);  			int tp = strlen(s_save); @@ -156,12 +160,12 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl  			case SCE_POWERPRO_OPERATOR:  				sc.SetState(SCE_POWERPRO_DEFAULT);  				break; -			 +  			case SCE_POWERPRO_NUMBER:  				if (!IsADigit(sc.ch))  					sc.SetState(SCE_POWERPRO_DEFAULT); -				 +  				break;  			case SCE_POWERPRO_IDENTIFIER: @@ -256,7 +260,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl  					}  				}  				break; -				 +  			case SCE_POWERPRO_FUNCTION:  				if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ' ' || sc.ch == '(') {  					sc.SetState(SCE_POWERPRO_DEFAULT); @@ -277,12 +281,12 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl  					sc.Forward();  				}  			} else if (HasFunction(styler, sc.currentPos)) {	//highlight <name> in 'function <name>' -				sc.SetState(SCE_POWERPRO_FUNCTION);  +				sc.SetState(SCE_POWERPRO_FUNCTION);  			} else if (sc.ch == '@' && sc.atLineStart) { 		//alternate function definition [label]  				sc.SetState(SCE_POWERPRO_FUNCTION);  			} else if ((sc.ch > 0) && (setWordStart.Contains(sc.ch) || (sc.ch == '?'))) {  				sc.SetState(SCE_POWERPRO_IDENTIFIER); -			} else if (sc.Match(";;+")) {  +			} else if (sc.Match(";;+")) {  				sc.SetState(SCE_POWERPRO_LINECONTINUE);  			} else if (sc.Match('/', '*')) {  				sc.SetState(SCE_POWERPRO_COMMENTBLOCK); @@ -304,7 +308,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl  	}  	//************************************* -	// Colourize the last word correctly  +	// Colourize the last word correctly  	//*************************************  	if (sc.state == SCE_POWERPRO_IDENTIFIER)  	{ @@ -345,7 +349,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;  	bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;  	bool foldCompact = true; -	 +  	// Backtrack to previous line in case need to fix its fold status  	int lineCurrent = styler.GetLine(startPos);  	if (startPos > 0) { @@ -355,10 +359,10 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  			startPos = styler.LineStart(lineCurrent);  		}  	} -	// vars for style of previous/current/next lines  +	// vars for style of previous/current/next lines  	int style = GetStyleFirstWord(lineCurrent,styler);  	int stylePrev = 0; -	 +  	// find the first previous line without continuation character at the end  	while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||  	       (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { @@ -371,42 +375,42 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  	// vars for getting first word to check for keywords  	bool FirstWordStart = false;  	bool FirstWordEnd = false; -		 +  	const unsigned int KEYWORD_MAX = 10;  	char szKeyword[KEYWORD_MAX]="";  	unsigned int	 szKeywordlen = 0; -	 +  	char szDo[3]="";  	int	 szDolen = 0;  	bool DoFoundLast = false; -	 +  	// var for indentlevel  	int levelCurrent = SC_FOLDLEVELBASE;  	if (lineCurrent > 0) {  		levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;  	}  	int levelNext = levelCurrent; -	 +  	int	visibleChars = 0;  	int functionCount = 0; -	 +  	char chNext = styler.SafeGetCharAt(startPos);  	char chPrev = '\0';  	char chPrevPrev = '\0';  	char chPrevPrevPrev = '\0'; -	 +  	for (int i = startPos; i < endPos; i++) {  		char ch = chNext;  		chNext = styler.SafeGetCharAt(i + 1); -		 +  		if ((ch > 0) && setWord.Contains(ch)) {  			visibleChars++;  		} -		 +  		// get the syle for the current character neede to check in comment  		int stylech = styler.StyleAt(i); -		 +  		// get first word for the line for indent check max 9 characters  		if (FirstWordStart && (!(FirstWordEnd))) {  			if ((ch > 0) && !setWord.Contains(ch)) { @@ -417,8 +421,8 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  				szKeyword[szKeywordlen] = '\0';  			}  		} -		 -		// start the capture of the first word  + +		// start the capture of the first word  		if (!(FirstWordStart)) {  			if ((ch > 0) && (setWord.Contains(ch) || setWordStart.Contains(ch) || ch == ';' || ch == '/')) {  				FirstWordStart = true; @@ -433,7 +437,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  			if (DoFoundLast) {  				if (DoFoundLast && (ch > 0) && setWord.Contains(ch)) {  					DoFoundLast = false; -				}		 +				}  			}  			// find out if the word "do" is the last on a "if" line  			if (FirstWordEnd && strcmp(szKeyword,"if") == 0) { @@ -452,53 +456,53 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  			}  		} -		// End of Line found so process the information  +		// End of Line found so process the information  		 if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { -		  +  			// **************************  			// Folding logic for Keywords  			// ************************** -			 +  			// if a keyword is found on the current line and the line doesn't end with ;;+ (continuation)  			//    and we are not inside a commentblock. -			if (szKeywordlen > 0 &&  -				(!(chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev ==';')) &&  +			if (szKeywordlen > 0 && +				(!(chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev ==';')) &&  				((!(IsStreamCommentStyle(style)) || foldInComment)) ) { -			 +  				// only fold "if" last keyword is "then"  (else its a one line if)  				if (strcmp(szKeyword,"if") == 0  && DoFoundLast) {  						levelNext++;  				} -				// create new fold for these words  +				// create new fold for these words  				if (strcmp(szKeyword,"for") == 0) {  					levelNext++;  				} -				 +  				//handle folding for functions/labels  				//Note: Functions and labels don't have an explicit end like [end function]  				//	1. functions/labels end at the start of another function  				//	2. functions/labels end at the end of the file  				if ((strcmp(szKeyword,"function") == 0) || (szKeywordlen > 0 && szKeyword[0] == '@')) {  					if (isFoldingAll) { //if we're folding the whole document (recursivly by lua script) -						 +  						if (functionCount > 0) {  							levelCurrent--;  						} else {  							levelNext++;  						} -						functionCount++;	 -						 +						functionCount++; +  					} else { //if just folding a small piece (by clicking on the minus sign next to the word)  						levelCurrent--;  					}  				} -												 +  				// end the fold for these words before the current line  				if (strcmp(szKeyword,"endif") == 0 || strcmp(szKeyword,"endfor") == 0) {  						levelNext--;  						levelCurrent--;  				} -				// end the fold for these words before the current line and Start new fold  +				// end the fold for these words before the current line and Start new fold  				if (strcmp(szKeyword,"else") == 0 || strcmp(szKeyword,"elseif") == 0 ) {  						levelCurrent--;  				} @@ -513,16 +517,16 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  				// Start of a comment block  				if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) {  				    levelNext++; -				}  +				}  				// fold till the last line for normal comment lines -				else if (IsStreamCommentStyle(stylePrev)  +				else if (IsStreamCommentStyle(stylePrev)  						&& !(styleNext == SCE_POWERPRO_COMMENTLINE) -						&& stylePrev == SCE_POWERPRO_COMMENTLINE  +						&& stylePrev == SCE_POWERPRO_COMMENTLINE  						&& style == SCE_POWERPRO_COMMENTLINE) {  					levelNext--;  				}  				// fold till the one but last line for Blockcomment lines -				else if (IsStreamCommentStyle(stylePrev)  +				else if (IsStreamCommentStyle(stylePrev)  						&& !(styleNext == SCE_POWERPRO_COMMENTBLOCK)  						&& style == SCE_POWERPRO_COMMENTBLOCK) {  					levelNext--; @@ -547,7 +551,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  			style = styleNext;  			levelCurrent = levelNext;  			visibleChars = 0; -			 +  			// if the last characters are ;;+ then don't reset since the line continues on the next line.  			if (chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev == ';') {  				//do nothing @@ -573,7 +577,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]  		}  	} -	//close folds on the last line - without this a 'phantom'  +	//close folds on the last line - without this a 'phantom'  	//fold can appear when an open fold is on the last line  	//this can occur because functions and labels don't have an explicit end  	if (lineCurrent >= lastLine) { diff --git a/lexers/LexPowerShell.cxx b/lexers/LexPowerShell.cxx index f2014ca8d..2416ab0d4 100644 --- a/lexers/LexPowerShell.cxx +++ b/lexers/LexPowerShell.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexProgress.cxx b/lexers/LexProgress.cxx index 9e1940e29..6184677d6 100644 --- a/lexers/LexProgress.cxx +++ b/lexers/LexProgress.cxx @@ -13,18 +13,22 @@ Support more than 6 comments levels  **/  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -47,7 +51,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo      WordList &keywords2 = *keywordlists[1];   // block opening keywords, only when SentenceStart      WordList &keywords3 = *keywordlists[2];   // block opening keywords      //WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented -     +  	int visibleChars = 0;  	int mask; @@ -180,7 +184,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo  			} else if (isoperator(static_cast<char>(sc.ch))) {  		/* 	This code allows highlight of handles. Alas, it would cause the phrase "last-event:function"  			to be recognized as a BlockBegin */ -			 +  				if (sc.ch == ':')  					sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);  				/* else */ diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx index b8921865c..5e7c5b29c 100644 --- a/lexers/LexPython.cxx +++ b/lexers/LexPython.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -507,7 +511,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse  		}  		const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; -		const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments); +		const int levelBeforeComments = Maximum(indentCurrentLevel,levelAfterComments);  		// Now set all the indent levels on the lines we skipped  		// Do this from end to start.  Once we encounter one line diff --git a/lexers/LexR.cxx b/lexers/LexR.cxx index cabbf5788..9947c7235 100644 --- a/lexers/LexR.cxx +++ b/lexers/LexR.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexRebol.cxx b/lexers/LexRebol.cxx index 7139b8dbd..9d8227652 100644 --- a/lexers/LexRebol.cxx +++ b/lexers/LexRebol.cxx @@ -13,18 +13,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx index 8d6dc90b8..af8535243 100644 --- a/lexers/LexRuby.cxx +++ b/lexers/LexRuby.cxx @@ -7,18 +7,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif @@ -78,7 +83,7 @@ static bool followsDot(unsigned int pos, Accessor &styler) {                      return false;                  }                  break; -                 +              case SCE_RB_OPERATOR:                  return styler[pos] == '.'; @@ -118,7 +123,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor      else if (keywords.InList(s) && !followsDot(start - 1, styler)) {          if (keywordIsAmbiguous(s)              && keywordIsModifier(s, start, styler)) { -             +              // Demoted keywords are colored as keywords,              // but do not affect changes in indentation.              // @@ -127,7 +132,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor              // 2. <<stmt if test>> : demoted              // 3. <<lhs = if ...>> : normal: start a new indent level              // 4. <<obj.if = 10>> : color as identifer, since it follows '.' -             +              chAttr = SCE_RB_WORD_DEMOTED;          } else {              chAttr = SCE_RB_WORD; @@ -224,7 +229,7 @@ static bool currLineContainsHereDelims(int& startPos,              // Leave the pointers where they are -- there are no              // here doc delims on the current line, even if              // the EOL isn't default style -             +              return false;          } else {              styler.Flush(); @@ -276,7 +281,7 @@ class QuoteCls {          }  		return *this;      } -             +  }; @@ -352,7 +357,7 @@ static int skipWhitespace(int startPos,      }      return endPos;  } -     +  // This routine looks for false positives like  // undef foo, <<  // There aren't too many. @@ -362,7 +367,7 @@ static int skipWhitespace(int startPos,  static bool sureThisIsHeredoc(int iPrev,                                Accessor &styler,                                char *prevWord) { -                     +      // Not so fast, since Ruby's so dynamic.  Check the context      // to make sure we're OK.      int prevStyle; @@ -453,7 +458,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,      styler.Flush();      const bool definitely_not_a_here_doc = true;      const bool looks_like_a_here_doc = false; -     +      // Find the first word after some whitespace      int firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);      if (firstWordPosn >= lt2StartPos) { @@ -531,7 +536,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,          target_quote = styler[j];          j += 1;      } -     +      if (isSafeAlnum(styler[j])) {          // Init target_end because some compilers think it won't          // be initialized by the time it's used @@ -549,7 +554,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,              // And for now make sure that it's a newline              // don't handle arbitrary expressions yet -             +              target_end = j;  			if (target_quote) {  				// Now we can move to the character after the string delimiter. @@ -592,7 +597,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,  }  //todo: if we aren't looking at a stdio character, -// move to the start of the first line that is not in a  +// move to the start of the first line that is not in a  // multi-line construct  static void synchronizeDocStart(unsigned int& startPos, @@ -610,7 +615,7 @@ static void synchronizeDocStart(unsigned int& startPos,              // Don't do anything else with these.              return;      } -     +      int pos = startPos;      // Quick way to characterize each line      int lineStart; @@ -651,7 +656,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,  	// Lexer for Ruby often has to backtrack to start of current style to determine  	// which characters are being used as quotes, how deeply nested is the  	// start position and what the termination string is for here documents -     +  	WordList &keywords = *keywordlists[0];  	class HereDocCls { @@ -674,7 +679,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,              CanBeIndented = false;  		}  	}; -	HereDocCls HereDoc;	 +	HereDocCls HereDoc;  	QuoteCls Quote; @@ -750,7 +755,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,  			i += 1;  			continue;  		} -		 +          // skip on DOS/Windows          //No, don't, because some things will get tagged on,          // so we won't recognize keywords, for example @@ -759,7 +764,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,  	    	continue;          }  #endif -             +          if (HereDoc.State == 1 && isEOLChar(ch)) {  			// Begin of here-doc (the line after the here-doc delimiter):  			HereDoc.State = 2; @@ -1003,7 +1008,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                  // So if we don't have one of these chars,                  // we aren't ending an object exp'n, and ops                  // like : << / are unary operators. -                 +                  if (ch == '{') {                      ++brace_counts;                      preferRE = true; @@ -1035,7 +1040,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                  // Default accessor treats '.' as word-chars,                  // but we don't for now. -                 +                  if (ch == '='                      && isSafeWordcharOrHigh(chPrev)                      && (chNext == '(' @@ -1066,11 +1071,11 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                          case SCE_RB_WORD:                              preferRE = RE_CanFollowKeyword(prevWord);  							break; -                             +                          case SCE_RB_WORD_DEMOTED:                              preferRE = true;  							break; -                             +                          case SCE_RB_IDENTIFIER:                              if (isMatch(styler, lengthDoc, wordStartPos, "print")) {                                  preferRE = true; @@ -1087,7 +1092,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                          // We might be redefining an operator-method                          preferRE = false;                      } -                    // And if it's the first  +                    // And if it's the first                      redo_char(i, ch, chNext, chNext2, state); // pass by ref                  }              } @@ -1141,7 +1146,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,              // See the comment for SCE_RB_HERE_DELIM in LexPerl.cxx              // Slightly different: if we find an immediate '-',              // the target can appear indented. -             +  			if (HereDoc.State == 0) { // '<<' encountered  				HereDoc.State = 1;                  HereDoc.DelimiterLength = 0; @@ -1157,7 +1162,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                      preferRE = false;                  } else {                      HereDoc.Quote = ch; -                 +                      if (ch == '\'' || ch == '"' || ch == '`') {                          HereDoc.Quoted = true;                          HereDoc.Delimiter[0] = '\0'; @@ -1291,7 +1296,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,              } else if (ch == Quote.Up) {                  // Only if close quoter != open quoter                  Quote.Count++; -                 +              } else if (ch == '#' ) {                  if (chNext == '{'                      && inner_string_count < INNER_STRINGS_MAX_COUNT) { @@ -1336,7 +1341,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                  }              }          // Quotes of all kinds... -        } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ ||  +        } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ ||                     state == SCE_RB_STRING_QX || state == SCE_RB_STRING_QW ||                     state == SCE_RB_STRING || state == SCE_RB_CHARACTER ||                     state == SCE_RB_BACKTICKS) { @@ -1373,7 +1378,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,                  advance_char(i, ch, chNext, chNext2);              }          } -             +          if (state == SCE_RB_ERROR) {              break;          } @@ -1389,7 +1394,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,  }  // Helper functions for folding, disambiguation keywords -// Assert that there are no high-bit chars  +// Assert that there are no high-bit chars  static void getPrevWord(int pos,                          char *prevWord, @@ -1430,7 +1435,7 @@ static bool keywordIsAmbiguous(const char *prevWord)  // Demote keywords in the following conditions:  // if, while, unless, until modify a statement -// do after a while or until, as a noise word (like then after if)  +// do after a while or until, as a noise word (like then after if)  static bool keywordIsModifier(const char *word,                                int pos, @@ -1490,7 +1495,7 @@ static bool keywordIsModifier(const char *word,      // Assume that if the keyword follows an operator,      // usually it's a block assignment, like      // a << if x then y else z -     +      ch = styler[pos];      switch (ch) {          case ')': @@ -1561,25 +1566,25 @@ static bool keywordDoStartsLoop(int pos,  /*   *  Folding Ruby - *  + *   *  The language is quite complex to analyze without a full parse.   *  For example, this line shouldn't affect fold level: - *  + *   *   print "hello" if feeling_friendly? - *  + *   *  Neither should this: - *  + *   *   print "hello" \   *      if feeling_friendly? - *  - *  + * + *   *  But this should: - *  + *   *   if feeling_friendly?  #++   *     print "hello" \   *     print "goodbye"   *   end                   #-- - *  + *   *  So we cheat, by actually looking at the existing indentation   *  levels for each line, and just echoing it back.  Like Python.   *  Then if we get better at it, we'll take braces into consideration, @@ -1587,29 +1592,29 @@ static bool keywordDoStartsLoop(int pos,   *  How the keywords should work:   *  No effect: - *  __FILE__ __LINE__ BEGIN END alias and  + *  __FILE__ __LINE__ BEGIN END alias and   *  defined? false in nil not or self super then   *  true undef   *  Always increment:   *  begin  class def do for module when { - *  + *   *  Always decrement:   *  end } - *  + *   *  Increment if these start a statement   *  if unless until while -- do nothing if they're modifiers   *  These end a block if there's no modifier, but don't bother   *  break next redo retry return yield - *  + *   *  These temporarily de-indent, but re-indent   *  case else elsif ensure rescue - *  + *   *  This means that the folder reflects indentation rather   *  than setting it.  The language-service updates indentation   *  when users type return and finishes entering de-denters. - *  + *   *  Later offer to fold POD, here-docs, strings, and blocks of comments   */ @@ -1617,7 +1622,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,                        WordList *[], Accessor &styler) {  	const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;  	bool foldComment = styler.GetPropertyInt("fold.comment") != 0; -     +      synchronizeDocStart(startPos, length, initStyle, styler, // ref args                          false);  	unsigned int endPos = startPos + length; diff --git a/lexers/LexSML.cxx b/lexers/LexSML.cxx index a41b4c10d..63eac3aee 100644 --- a/lexers/LexSML.cxx +++ b/lexers/LexSML.cxx @@ -6,21 +6,24 @@  // Modified from LexCaml.cxx by Robert Roessler <robertr@rftp.com> Copyright 2005  // The License.txt file describes the conditions under which this software may be distributed. -  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  inline int  issml(int c) {return isalnum(c) || c == '_';}  inline int issmlf(int c) {return isalpha(c) || c == '_';} @@ -67,7 +70,7 @@ void ColouriseSMLDoc(  			else if (sc.Match('#','\"')){  					state2 = SCE_SML_CHAR,chLit = 0;  					sc.Forward(); -					 +  				}  			else if (isdigit(sc.ch)) {  				state2 = SCE_SML_NUMBER, chBase = 10; @@ -218,4 +221,4 @@ static const char * const SMLWordListDesc[] = {  };  LexerModule lmSML(SCLEX_SML, ColouriseSMLDoc, "SML", FoldSMLDoc, SMLWordListDesc); - 	  	  + diff --git a/lexers/LexSQL.cxx b/lexers/LexSQL.cxx index 7a4335bd2..6ec32d04d 100644 --- a/lexers/LexSQL.cxx +++ b/lexers/LexSQL.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -61,8 +65,8 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo  	StyleContext sc(startPos, length, initStyle, styler); -	// property sql.backslash.escapes  -	//	Enables backslash as an escape character in SQL.  +	// property sql.backslash.escapes +	//	Enables backslash as an escape character in SQL.  	bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;  	bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0; @@ -231,8 +235,8 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,  	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;  	bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0; -	// property fold.sql.exists  -	//	Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".  +	// property fold.sql.exists +	//	Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".  	bool foldSqlExists = styler.GetPropertyInt("fold.sql.exists", 1) != 0;  	unsigned int endPos = startPos + length; @@ -311,7 +315,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,  //						// DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS  						(foldSqlExists && (strcmp(s, "exists") == 0)) ||  //						//  SQL Anywhere permits IF ... ELSE ... ENDIF -//						//      will only be active if "endif" appears in the  +//						//      will only be active if "endif" appears in the  //						//		keyword list.  						(strcmp(s, "endif") == 0)) {  				endFound = true; diff --git a/lexers/LexScriptol.cxx b/lexers/LexScriptol.cxx index 76c38e6b6..756efb67f 100644 --- a/lexers/LexScriptol.cxx +++ b/lexers/LexScriptol.cxx @@ -5,18 +5,23 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +  #ifdef SCI_NAMESPACE  using namespace Scintilla;  #endif @@ -48,10 +53,9 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw  static bool IsSolComment(Accessor &styler, int pos, int len)  { -   char c;     if(len > 0)     { -     c = styler[pos]; +     char c = styler[pos];       if(c == '`') return true;       if(len > 1)       { @@ -328,7 +332,7 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,                      state = SCE_SCRIPTOL_DEFAULT;                   }               } -             +             }            chPrev2 = chPrev;            chPrev = ch; diff --git a/lexers/LexSmalltalk.cxx b/lexers/LexSmalltalk.cxx index 265de3803..f7a754b0b 100644 --- a/lexers/LexSmalltalk.cxx +++ b/lexers/LexSmalltalk.cxx @@ -8,16 +8,22 @@  #include <stdlib.h>  #include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h>  #include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -39,7 +45,7 @@ classificationBlock      value: #BinSel value: '~@%&*-+=|\/,<>?!';      value: #Upper value: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. -((String new: 500) streamContents: [ :stream |             +((String new: 500) streamContents: [ :stream |      stream crLf; nextPutAll: 'static int ClassificationTable[256] = {'.      lexTable keysAndValuesDo: [ :index :value |          ((index - 1) rem: 16) == 0 ifTrue: [ @@ -50,7 +56,7 @@ classificationBlock          index ~= 256 ifTrue: [              stream nextPut: $,]].      stream crLf; nextPutAll: '};'; crLf. -     +      charClasses keysAndValuesDo: [ :index :name |          stream              crLf; @@ -95,7 +101,7 @@ static inline bool isDigitOfRadix(int ch, int radix)  }  static inline void skipComment(StyleContext& sc) -{     +{      while (sc.More() && sc.ch != '\"')          sc.Forward();  } @@ -118,7 +124,7 @@ static void handleHash(StyleContext& sc)          sc.SetState(SCE_ST_SPECIAL);          return;      } -     +      sc.SetState(SCE_ST_SYMBOL);      sc.Forward();      if (sc.ch == '\'') { @@ -162,7 +168,7 @@ static void handleNumeric(StyleContext& sc)      char num[256];      int nl;      int radix; -     +      sc.SetState(SCE_ST_NUMBER);      num[0] = static_cast<char>(sc.ch);      nl = 1; @@ -217,7 +223,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList)      int il;      int state;      bool doubleColonPresent; -     +      sc.SetState(SCE_ST_DEFAULT);      ident[0] = static_cast<char>(sc.ch); @@ -237,7 +243,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList)      else          doubleColonPresent = false;      ident[il] = 0; -     +      if (specialSelectorList->InList(ident))              state = SCE_ST_SPEC_SEL;      else if (doubleColonPresent) @@ -256,7 +262,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList)          else              state = SCE_ST_DEFAULT;      } -     +      sc.ChangeState(state);  } @@ -277,7 +283,7 @@ static void colorizeSmalltalkDoc(unsigned int startPos, int length, int initStyl      for (; sc.More(); sc.Forward()) {          int ch; -         +          ch = sc.ch;          if (ch == '\"') {              sc.SetState(SCE_ST_COMMENT); diff --git a/lexers/LexSorcus.cxx b/lexers/LexSorcus.cxx index 1d8ba277a..8e7fb991b 100644 --- a/lexers/LexSorcus.cxx +++ b/lexers/LexSorcus.cxx @@ -9,18 +9,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -29,7 +33,7 @@ using namespace Scintilla;  //each character a..z and A..Z + '_' can be part of a keyword  //additionally numbers that follow 'M' can be contained in a keyword -static inline bool IsSWordStart(const int ch, const int prev_ch)            +static inline bool IsSWordStart(const int ch, const int prev_ch)  {      if (isalpha(ch) || (ch == '_') || ((isdigit(ch)) && (prev_ch == 'M')))          return true; @@ -39,7 +43,7 @@ static inline bool IsSWordStart(const int ch, const int prev_ch)  //only digits that are not preceded by 'M' count as a number -static inline bool IsSorcusNumber(const int ch, const int prev_ch)          +static inline bool IsSorcusNumber(const int ch, const int prev_ch)  {      if ((isdigit(ch)) && (prev_ch != 'M'))          return true; @@ -49,46 +53,46 @@ static inline bool IsSorcusNumber(const int ch, const int prev_ch)  //only = is a valid operator -static inline bool IsSorcusOperator(const int ch)            +static inline bool IsSorcusOperator(const int ch)  {      if (ch == '=')          return true; -     +      return false;  }  static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], -                               Accessor &styler)                                         +                               Accessor &styler)  { -     +      WordList &Command = *keywordlists[0];      WordList &Parameter = *keywordlists[1];      WordList &Constant = *keywordlists[2]; -     +      // Do not leak onto next line -    if (initStyle == SCE_SORCUS_STRINGEOL)               +    if (initStyle == SCE_SORCUS_STRINGEOL)          initStyle = SCE_SORCUS_DEFAULT; -     +      StyleContext sc(startPos, length, initStyle, styler); -     +      for (; sc.More(); sc.Forward())      { -         +          // Prevent SCE_SORCUS_STRINGEOL from leaking back to previous line          if (sc.atLineStart && (sc.state == SCE_SORCUS_STRING))          { -            sc.SetState(SCE_SORCUS_STRING);          -        }        -         +            sc.SetState(SCE_SORCUS_STRING); +        } +          // Determine if the current state should terminate.          if (sc.state == SCE_SORCUS_OPERATOR)          { -            if (!IsSorcusOperator(sc.ch))  +            if (!IsSorcusOperator(sc.ch))              {                  sc.SetState(SCE_SORCUS_DEFAULT);              } -        }        +        }          else if(sc.state == SCE_SORCUS_NUMBER)          {              if(!IsSorcusNumber(sc.ch, sc.chPrev)) @@ -101,25 +105,25 @@ static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle,              if (!IsSWordStart(sc.ch, sc.chPrev))              {                  char s[100]; -                 +                  sc.GetCurrent(s, sizeof(s)); -                 +                  if (Command.InList(s)) -                {  -                    sc.ChangeState(SCE_SORCUS_COMMAND);  +                { +                    sc.ChangeState(SCE_SORCUS_COMMAND);                  }                  else if (Parameter.InList(s)) -                {  +                {                      sc.ChangeState(SCE_SORCUS_PARAMETER);                  }                  else if (Constant.InList(s)) -                {  +                {                      sc.ChangeState(SCE_SORCUS_CONSTANT);                  } -                 +                  sc.SetState(SCE_SORCUS_DEFAULT);              } -        }        +        }          else if (sc.state == SCE_SORCUS_COMMENTLINE )          {              if (sc.atLineEnd) @@ -133,24 +137,24 @@ static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle,              {                  sc.ForwardSetState(SCE_SORCUS_DEFAULT);              } -            else if (sc.atLineEnd)  +            else if (sc.atLineEnd)              {                  sc.ChangeState(SCE_SORCUS_STRINGEOL);                  sc.ForwardSetState(SCE_SORCUS_DEFAULT);              }          } -         +          // Determine if a new state should be entered.          if (sc.state == SCE_SORCUS_DEFAULT)          {              if ((sc.ch == ';') || (sc.ch == '\''))              {                  sc.SetState(SCE_SORCUS_COMMENTLINE); -            }    +            }              else if (IsSWordStart(sc.ch, sc.chPrev))              {                  sc.SetState(SCE_SORCUS_IDENTIFIER); -            }    +            }              else if (sc.ch == '\"')              {                  sc.SetState(SCE_SORCUS_STRING); @@ -164,42 +168,42 @@ static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle,                  sc.SetState(SCE_SORCUS_NUMBER);              }          } -         +      }      sc.Complete();  }  static const char* const SorcusWordListDesc[] = {"Command","Parameter", "Constant", 0}; -   +  LexerModule lmSorc(SCLEX_SORCUS, ColouriseSorcusDoc, "sorcins", 0, SorcusWordListDesc); -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lexers/LexSpecman.cxx b/lexers/LexSpecman.cxx index 093efae75..064df273e 100644 --- a/lexers/LexSpecman.cxx +++ b/lexers/LexSpecman.cxx @@ -11,15 +11,19 @@  #include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexSpice.cxx b/lexers/LexSpice.cxx index 6aa2e8fdc..7c7b77c77 100644 --- a/lexers/LexSpice.cxx +++ b/lexers/LexSpice.cxx @@ -6,19 +6,24 @@  // The License.txt file describes the conditions under which this software may be distributed.  #include <stdlib.h> -#include <ctype.h>  #include <string.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h>  #include <string> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "PropSet.h" -#include "KeyWords.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexTACL.cxx b/lexers/LexTACL.cxx index b0c12440d..314282e93 100644 --- a/lexers/LexTACL.cxx +++ b/lexers/LexTACL.cxx @@ -10,18 +10,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexTADS3.cxx b/lexers/LexTADS3.cxx index ee16a0ac0..75232e2c4 100644 --- a/lexers/LexTADS3.cxx +++ b/lexers/LexTADS3.cxx @@ -33,18 +33,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -70,7 +74,7 @@ static inline bool IsEOL(const int ch, const int chNext) {   *   - it doesn't want to admit that there's a newline until reaching the END   *   of the sequence.  We meet both needs by saying that there's a newline   *   when we see the CR in a CR-LF, but skipping the CR before returning so - *   that the caller's caller will see that we've stopped at the LF.   + *   that the caller's caller will see that we've stopped at the LF.   */  static inline bool IsEOLSkip(StyleContext &sc)  { @@ -82,17 +86,13 @@ static inline bool IsEOLSkip(StyleContext &sc)          return true;      } -    /*  +    /*       *   in other cases, we have at most a 1-character newline, so do the -     *   normal IsEOL test  +     *   normal IsEOL test       */      return IsEOL(sc.ch, sc.chNext);  } -static inline bool IsASpaceOrTab(const int ch) { -        return ch == ' ' || ch == '\t'; -} -  static inline bool IsATADS3Operator(const int ch) {          return ch == '=' || ch == '{' || ch == '}' || ch == '(' || ch == ')'                  || ch == '[' || ch == ']' || ch == ',' || ch == ':' || ch == ';' @@ -156,7 +156,7 @@ static void ColouriseTADSHTMLString(StyleContext &sc, int &lineState) {                  sc.Forward();          }          if (chQuote == '"') -                lineState &= ~T3_HTML_SQUOTE;  +                lineState &= ~T3_HTML_SQUOTE;          else                  lineState |= T3_HTML_SQUOTE; diff --git a/lexers/LexTAL.cxx b/lexers/LexTAL.cxx index a76a296d6..8219018e5 100644 --- a/lexers/LexTAL.cxx +++ b/lexers/LexTAL.cxx @@ -10,18 +10,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -94,7 +98,7 @@ static int classifyWordTAL(unsigned int start, unsigned int end, /*WordList &key  			else if (strcmp(s, "end") == 0) {  				ret = -1;  			} -		}  +		}  		else if (s[0] == '$' || builtins.InList(s)) {  			chAttr = SCE_C_WORD2;  		} diff --git a/lexers/LexTCL.cxx b/lexers/LexTCL.cxx index 3c175de2a..0e196cb7f 100644 --- a/lexers/LexTCL.cxx +++ b/lexers/LexTCL.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h> -#include <stdarg.h>  #include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -47,7 +51,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k  	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;  	bool commentLevel = false;      bool subBrace = false; // substitution begin with a brace ${.....} -	enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,  +	enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,          LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT;  	bool prevSlash = false;  	int currentLevel = 0; @@ -86,7 +90,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k      StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);  	for (; ; sc.Forward()) {  next: -        if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac  +        if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac              continue;          bool atEnd = !sc.More();  // make sure we coloured the last word          if (lineState != LS_DEFAULT) { @@ -170,7 +174,7 @@ next:                          sc.ChangeState(SCE_TCL_WORD7);                      } else if (keywords9.InList(s)) {                          sc.ChangeState(SCE_TCL_WORD8); -                    }  +                    }                  }                  expected = false;                  sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT); @@ -212,7 +216,7 @@ next:                  } else if (sc.state == SCE_TCL_COMMENT_BOX)                      lineState = LS_COMMENT_BOX;  			} -            styler.SetLineState(currentLine,  +            styler.SetLineState(currentLine,                  (subBrace ? LS_BRACE_ONLY : 0) |                  (expected ? LS_COMMAND_EXPECTED : 0)  | lineState);              if (lineState == LS_COMMENT_BOX) @@ -285,7 +289,7 @@ next:  		if (sc.ch == '\\') {  			prevSlash = true; -			continue;		 +			continue;  		}  		// Determine if a new state should be entered. @@ -322,7 +326,7 @@ next:                      subParen = 0;                      if (sc.chNext != '{') {                          sc.SetState(SCE_TCL_SUBSTITUTION); -                    }  +                    }                      else {                          sc.SetState(SCE_TCL_OPERATOR);  // $                          sc.Forward();  // { diff --git a/lexers/LexTeX.cxx b/lexers/LexTeX.cxx index 62ade1d75..0b391b6bd 100644 --- a/lexers/LexTeX.cxx +++ b/lexers/LexTeX.cxx @@ -18,18 +18,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h"  #include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -285,8 +289,8 @@ static void ColouriseTeXDoc(  static inline bool isNumber(int ch) {  	return -      (ch == '0') || (ch == '1') || (ch == '2') ||  -      (ch == '3') || (ch == '4') || (ch == '5') ||  +      (ch == '0') || (ch == '1') || (ch == '2') || +      (ch == '3') || (ch == '4') || (ch == '5') ||        (ch == '6') || (ch == '7') || (ch == '8') || (ch == '9');  } @@ -298,7 +302,7 @@ static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command)  {    int length=0;    char ch=styler.SafeGetCharAt(pos+1); -   +    if(ch==',' || ch==':' || ch==';' || ch=='%'){        command[0]=ch;        command[1]=0; @@ -311,14 +315,14 @@ static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command)            length++;            ch=styler.SafeGetCharAt(pos+length+1);       } -      -  command[length]='\0';    + +  command[length]='\0';    if(!length) return 0;    return length+1;  }  static int classifyFoldPointTeXPaired(const char* s) { -	int lev=0;  +	int lev=0;  	if (!(isdigit(s[0]) || (s[0] == '.'))){  		if (strcmp(s, "begin")==0||strcmp(s,"FoldStart")==0||  			strcmp(s,"abstract")==0||strcmp(s,"unprotect")==0|| @@ -330,14 +334,14 @@ static int classifyFoldPointTeXPaired(const char* s) {  			strcmp(s,"maketitle")==0||strcmp(s,"protect")==0||  			strncmp(s,"stop",4)==0||strncmp(s,"Stop",4)==0||  			strcmp(s,"fi")==0 -			)  +			)  		lev=-1;  	}  	return lev;  }  static int classifyFoldPointTeXUnpaired(const char* s) { -	int lev=0;  +	int lev=0;  	if (!(isdigit(s[0]) || (s[0] == '.'))){  		if (strcmp(s,"part")==0||  			strcmp(s,"chapter")==0|| @@ -362,7 +366,7 @@ static int classifyFoldPointTeXUnpaired(const char* s) {  static bool IsTeXCommentLine(int line, Accessor &styler) {  	int pos = styler.LineStart(line);  	int eol_pos = styler.LineStart(line + 1) - 1; -	 +  	int startpos = pos;  	while (startpos<eol_pos){ @@ -370,14 +374,14 @@ static bool IsTeXCommentLine(int line, Accessor &styler) {  		if (ch!='%' && ch!=' ') return false;  		else if (ch=='%') return true;  		startpos++; -	}		 +	}  	return false;  }  // FoldTeXDoc: borrowed from VisualTeX with modifications -static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)  +static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)  {  	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;  	unsigned int endPos = startPos+length; @@ -387,7 +391,7 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc  	int levelCurrent=levelPrev;  	char chNext=styler[startPos];  	char buffer[100]=""; -	 +  	for (unsigned int i=startPos; i < endPos; i++) {  		char ch=chNext;  		chNext=styler.SafeGetCharAt(i+1); @@ -412,12 +416,12 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc  	chNext4=styler.SafeGetCharAt(i+4);  	chNext5=styler.SafeGetCharAt(i+5); -	bool atEOfold = (ch == '%') &&  -			(chNext == '%') && (chNext2=='}') &&  +	bool atEOfold = (ch == '%') && +			(chNext == '%') && (chNext2=='}') &&  				(chNext3=='}')&& (chNext4=='-')&& (chNext5=='-'); -	bool atBOfold = (ch == '%') &&  -			(chNext == '%') && (chNext2=='-') &&  +	bool atBOfold = (ch == '%') && +			(chNext == '%') && (chNext2=='-') &&  				(chNext3=='-')&& (chNext4=='{')&& (chNext5=='{');  	if(atBOfold){ @@ -427,11 +431,11 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc  	if(atEOfold){  		levelCurrent-=1;  	} -	 +  	if(ch=='\\' && chNext=='['){  		levelCurrent+=1;  	} -	 +  	if(ch=='\\' && chNext==']'){  		levelCurrent-=1;  	} @@ -452,8 +456,8 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc                  levelCurrent--;          } -//---------------------------------------------------------------------------------------------	 -		 +//--------------------------------------------------------------------------------------------- +  		if (atEOL) {  			int lev = levelPrev;  			if (visibleChars == 0 && foldCompact) diff --git a/lexers/LexVB.cxx b/lexers/LexVB.cxx index c57a9ac49..59b68c91d 100644 --- a/lexers/LexVB.cxx +++ b/lexers/LexVB.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx index c0733ab82..e6960d5a1 100644 --- a/lexers/LexVHDL.cxx +++ b/lexers/LexVHDL.cxx @@ -15,15 +15,19 @@  #include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexVerilog.cxx b/lexers/LexVerilog.cxx index 8b531bb7e..a73edfb76 100644 --- a/lexers/LexVerilog.cxx +++ b/lexers/LexVerilog.cxx @@ -8,18 +8,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/lexers/LexYAML.cxx b/lexers/LexYAML.cxx index 99f34da88..8e2ff742d 100644 --- a/lexers/LexYAML.cxx +++ b/lexers/LexYAML.cxx @@ -7,18 +7,22 @@  #include <stdlib.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <stdarg.h> +#include <assert.h> +#include <ctype.h> -#include "Platform.h" +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" -#include "PropSet.h" +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h"  #include "Accessor.h"  #include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" +#include "CharacterSet.h" +#include "LexerModule.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; @@ -270,7 +274,7 @@ static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unu  		}  		const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; -		const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments); +		const int levelBeforeComments = Maximum(indentCurrentLevel,levelAfterComments);  		// Now set all the indent levels on the lines we skipped  		// Do this from end to start.  Once we encounter one line  | 
