diff options
author | nyamatongwe <unknown> | 2012-06-22 14:19:31 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2012-06-22 14:19:31 +1000 |
commit | 5f10d9cc3900adb0dd2cda15c2beba095028152d (patch) | |
tree | 4a87abff815473124a1dd0e0eb307d47b1ea2cd2 /lexers/LexCPP.cxx | |
parent | 17b3153f7f0124c892d1f6f174488c3eba23c950 (diff) | |
download | scintilla-mirror-5f10d9cc3900adb0dd2cda15c2beba095028152d.tar.gz |
Bug #3487406. New style SCE_C_PREPROCESSORCOMMENT for stream comments
inside preprocessor directives.
Includes code from Marko Njezic.
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r-- | lexers/LexCPP.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index c3c69b703..b8cc706e7 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -517,7 +517,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, int activitySet = preproc.IsInactive() ? activeFlag : 0; - for (; sc.More(); sc.Forward()) { + for (; sc.More();) { if (sc.atLineStart) { // Using MaskActive() is not needed in the following statement. @@ -559,6 +559,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.Forward(); } continuationLine = true; + sc.Forward(); continue; } } @@ -618,11 +619,21 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_C_DEFAULT|activitySet); } } else { - if (sc.Match('/', '*') || sc.Match('/', '/')) { + if (sc.Match('/', '*')) { + sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet); + sc.Forward(); // Eat the * + } else if (sc.Match('/', '/')) { sc.SetState(SCE_C_DEFAULT|activitySet); } } break; + case SCE_C_PREPROCESSORCOMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_C_PREPROCESSOR|activitySet); + continue; // Without advancing in case of '\'. + } + break; case SCE_C_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); @@ -924,6 +935,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, visibleChars++; } continuationLine = false; + sc.Forward(); } const bool rawStringsChanged = rawStringTerminators.Merge(rawSTNew, lineCurrent); if (definitionsChanged || rawStringsChanged) |