aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2009-02-14 10:10:28 +0000
committernyamatongwe <unknown>2009-02-14 10:10:28 +0000
commit5851dfb479bdfe8fb3268b0d618acf7d35bdbb19 (patch)
tree804701a35c17a3156c5c2427092142664163e078 /src
parent6e7a57c178ee65bcf0468d4e78d9acb06a3b23d8 (diff)
downloadscintilla-mirror-5851dfb479bdfe8fb3268b0d618acf7d35bdbb19.tar.gz
Bug #2551033 fix from Kai Liu.
Diffstat (limited to 'src')
-rw-r--r--src/LexCPP.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx
index c2933f41d..d12a6e0db 100644
--- a/src/LexCPP.cxx
+++ b/src/LexCPP.cxx
@@ -77,6 +77,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool continuationLine = false;
+ bool isIncludePreprocessor = false;
if (initStyle == SCE_C_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\'
@@ -118,6 +119,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
// if different sets of lines lexed.
visibleChars = 0;
lastWordWasUUID = false;
+ isIncludePreprocessor = false;
}
// Handle line continuation generically.
@@ -230,6 +232,11 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
case SCE_C_STRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL);
+ } else if (isIncludePreprocessor) {
+ if (sc.ch == '>') {
+ sc.ForwardSetState(SCE_C_DEFAULT);
+ isIncludePreprocessor = false;
+ }
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
@@ -321,6 +328,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') {
sc.SetState(SCE_C_STRING);
+ isIncludePreprocessor = false; // ensure that '>' won't end the string
+ } else if (isIncludePreprocessor && sc.ch == '<') {
+ sc.SetState(SCE_C_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_C_CHARACTER);
} else if (sc.ch == '#' && visibleChars == 0) {
@@ -332,6 +342,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT);
+ } else if (sc.Match("include")) {
+ isIncludePreprocessor = true;
}
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_C_OPERATOR);