diff options
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) |