aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexInno.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/LexInno.cxx')
-rw-r--r--src/LexInno.cxx50
1 files changed, 32 insertions, 18 deletions
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 &sectionKeywords = *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;