diff options
| -rw-r--r-- | include/SciLexer.h | 1 | ||||
| -rw-r--r-- | include/Scintilla.iface | 1 | ||||
| -rw-r--r-- | src/LexInno.cxx | 50 | 
3 files changed, 34 insertions, 18 deletions
| diff --git a/include/SciLexer.h b/include/SciLexer.h index 982b48b7b..e9101658f 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -1089,6 +1089,7 @@  #define SCE_INNO_SECTION 4  #define SCE_INNO_PREPROC 5  #define SCE_INNO_PREPROC_INLINE 6 +#define SCE_INNO_INLINE_EXPANSION 6  #define SCE_INNO_COMMENT_PASCAL 7  #define SCE_INNO_KEYWORD_PASCAL 8  #define SCE_INNO_KEYWORD_USER 9 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 35884456b..73783f6ba 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -3137,6 +3137,7 @@ val SCE_INNO_PARAMETER=3  val SCE_INNO_SECTION=4  val SCE_INNO_PREPROC=5  val SCE_INNO_PREPROC_INLINE=6 +val SCE_INNO_INLINE_EXPANSION=6  val SCE_INNO_COMMENT_PASCAL=7  val SCE_INNO_KEYWORD_PASCAL=8  val SCE_INNO_KEYWORD_USER=9 diff --git a/src/LexInno.cxx b/src/LexInno.cxx index 3af9b2f1d..fe7af1e7d 100644 --- a/src/LexInno.cxx +++ b/src/LexInno.cxx @@ -33,6 +33,8 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  	char *buffer = new char[length];  	int bufferCount = 0;  	bool isBOL, isEOL, isWS, isBOLWS = 0; +	bool isCode = false; +	bool isCStyleComment = false;  	WordList §ionKeywords = *keywordLists[0];  	WordList &standardKeywords = *keywordLists[1]; @@ -63,7 +65,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  		switch(state) {  			case SCE_INNO_DEFAULT: -				if (ch == ';' && isBOLWS) { +				if (!isCode && ch == ';' && isBOLWS) {  					// Start of a comment  					state = SCE_INNO_COMMENT;  				} else if (ch == '[' && isBOLWS) { @@ -73,13 +75,17 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  				} else if (ch == '#' && isBOLWS) {  					// Start of a preprocessor directive  					state = SCE_INNO_PREPROC; -				} else if (ch == '{' && chNext == '#') { -					// Start of a preprocessor inline directive -					state = SCE_INNO_PREPROC_INLINE; -				} else if ((ch == '{' && (chNext == ' ' || chNext == '\t')) -					   || (ch == '(' && chNext == '*')) { +				} else if (!isCode && ch == '{' && chNext != '{' && chPrev != '{') { +					// Start of an inline expansion +					state = SCE_INNO_INLINE_EXPANSION; +				} else if (isCode && (ch == '{' || (ch == '(' && chNext == '*'))) {  					// Start of a Pascal comment  					state = SCE_INNO_COMMENT_PASCAL; +					isCStyleComment = false; +				} else if (isCode && ch == '/' && chNext == '/') { +					// Apparently, C-style comments are legal, too +					state = SCE_INNO_COMMENT_PASCAL; +					isCStyleComment = true;  				} else if (ch == '"') {  					// Start of a double-quote string  					state = SCE_INNO_STRING_DOUBLE; @@ -112,13 +118,13 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  					buffer[bufferCount] = '\0';  					// Check if the buffer contains a keyword -					if (standardKeywords.InList(buffer)) { +					if (!isCode && standardKeywords.InList(buffer)) {  						styler.ColourTo(i-1,SCE_INNO_KEYWORD); -					} else if (parameterKeywords.InList(buffer)) { +					} else if (!isCode && parameterKeywords.InList(buffer)) {  						styler.ColourTo(i-1,SCE_INNO_PARAMETER); -					} else if (pascalKeywords.InList(buffer)) { +					} else if (isCode && pascalKeywords.InList(buffer)) {  						styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL); -					} else if (userKeywords.InList(buffer)) { +					} else if (!isCode && userKeywords.InList(buffer)) {  						styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);  					} else {  						styler.ColourTo(i-1,SCE_INNO_DEFAULT); @@ -138,6 +144,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  					// Check if the buffer contains a section name  					if (sectionKeywords.InList(buffer)) {  						styler.ColourTo(i,SCE_INNO_SECTION); +						isCode = !strcmpi(buffer, "code");  					} else {  						styler.ColourTo(i,SCE_INNO_DEFAULT);  					} @@ -187,10 +194,10 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  				}  				break; -			case SCE_INNO_PREPROC_INLINE: +			case SCE_INNO_INLINE_EXPANSION:  				if (ch == '}') {  					state = SCE_INNO_DEFAULT; -					styler.ColourTo(i,SCE_INNO_PREPROC_INLINE); +					styler.ColourTo(i,SCE_INNO_INLINE_EXPANSION);  				} else if (isEOL) {  					state = SCE_INNO_DEFAULT;  					styler.ColourTo(i,SCE_INNO_DEFAULT); @@ -198,12 +205,19 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k  				break;  			case SCE_INNO_COMMENT_PASCAL: -				if (ch == '}' || (ch == ')' && chPrev == '*')) { -					state = SCE_INNO_DEFAULT; -					styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL); -				} else if (isEOL) { -					state = SCE_INNO_DEFAULT; -					styler.ColourTo(i,SCE_INNO_DEFAULT); +				if (isCStyleComment) { +					if (isEOL) { +						state = SCE_INNO_DEFAULT; +						styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL); +					} +				} else { +					if (ch == '}' || (ch == ')' && chPrev == '*')) { +						state = SCE_INNO_DEFAULT; +						styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL); +					} else if (isEOL) { +						state = SCE_INNO_DEFAULT; +						styler.ColourTo(i,SCE_INNO_DEFAULT); +					}  				}  				break; | 
