aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2012-06-22 14:19:31 +1000
committernyamatongwe <devnull@localhost>2012-06-22 14:19:31 +1000
commit51244e430368eb545726e90ae5f5a6b765d09dd3 (patch)
tree6e3692719192dfb75aca7b9c39c80d546ed17705 /lexers/LexCPP.cxx
parent9f6b99068f71f7b9f20a3758ea0fc7941eed2492 (diff)
downloadscintilla-mirror-51244e430368eb545726e90ae5f5a6b765d09dd3.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.cxx16
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)