From 0504c699de6efcfb4c5de19b0f524d96f880f323 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 30 Dec 2012 16:20:46 +1100 Subject: Bug #3578824. Ignore comments when evaluating preprocessor expressions. From Isiledhel. --- lexers/LexCPP.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 116d5a2b3..834c273fa 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -88,10 +88,13 @@ static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace int i =0; char ch = styler.SafeGetCharAt(start, '\n'); while ((ch != '\r') && (ch != '\n')) { + char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); + if (ch == '/' && (chNext == '/' || chNext == '*')) + break; if (allowSpace || (ch != ' ')) restOfLine += ch; i++; - ch = styler.SafeGetCharAt(start + i, '\n'); + ch = chNext; } return restOfLine; } -- cgit v1.2.3