diff options
author | nyamatongwe <devnull@localhost> | 2012-09-04 17:49:31 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2012-09-04 17:49:31 +1000 |
commit | 9d9e84ef76ded5bc18a4192aa824db5df73f77e8 (patch) | |
tree | 5fac3ca4007c119f2dfc5f8094da9c298c7c97b6 | |
parent | 31d4561fef9a6858cfc9411a95ba6eee5d533fcf (diff) | |
download | scintilla-mirror-9d9e84ef76ded5bc18a4192aa824db5df73f77e8.tar.gz |
Don't treat '//' in include path as comment start. Bug #3519260.
From Sakshi Verma.
-rw-r--r-- | lexers/LexCPP.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index d6efa7ee0..f7ccfd04c 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -467,6 +467,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, int styleBeforeDCKeyword = SCE_C_DEFAULT; bool continuationLine = false; bool isIncludePreprocessor = false; + bool isStringInPreprocessor = false; int lineCurrent = styler.GetLine(startPos); if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || @@ -618,13 +619,17 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_C_DEFAULT|activitySet); } break; - case SCE_C_PREPROCESSOR: + case SCE_C_PREPROCESSOR: if (options.stylingWithinPreprocessor) { if (IsASpace(sc.ch)) { sc.SetState(SCE_C_DEFAULT|activitySet); } - } else { - if (sc.Match('/', '*')) { + } else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"'))) { + isStringInPreprocessor = false; + } else if (!isStringInPreprocessor) { + if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) { + isStringInPreprocessor = true; + } else if (sc.Match('/', '*')) { sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet); sc.Forward(); // Eat the * } else if (sc.Match('/', '/')) { |