I found that the parser stopped parsing in the comment blocks, and only two variables( int a, int b) were recognized.
That is correct. C::B recognises the /* as beginning of a multi-line comment which never ends.
Why do we search for nested braces or other comments, while we are skipping to EndOfLine indside a comment ?.
As far as I know, there are only two things that can end a c++-style comment: a newline or EOF.
In other words, what about just "eating" all chars until EOL or EOF?
A patch can look like this:
Index: src/plugins/codecompletion/parser/tokenizer.cpp
===================================================================
--- src/plugins/codecompletion/parser/tokenizer.cpp (Revision 5482)
+++ src/plugins/codecompletion/parser/tokenizer.cpp (Arbeitskopie)
@@ -279,18 +279,21 @@
{
while (NotEOF() && CurrentChar() != '\n')
{
- if (CurrentChar() == '/' && NextChar() == '*')
+ if(!skippingComment)
{
- SkipComment(false); // don't skip whitespace after the comment
- if (skippingComment && CurrentChar() == '\n')
+ if (CurrentChar() == '/' && NextChar() == '*')
{
- continue; // early exit from the loop
+ SkipComment(false); // don't skip whitespace after the comment
+ if (skippingComment && CurrentChar() == '\n')
+ {
+ continue; // early exit from the loop
+ }
}
+ if (nestBraces && CurrentChar() == _T('{'))
+ ++m_NestLevel;
+ else if (nestBraces && CurrentChar() == _T('}'))
+ --m_NestLevel;
}
- if (nestBraces && CurrentChar() == _T('{'))
- ++m_NestLevel;
- else if (nestBraces && CurrentChar() == _T('}'))
- --m_NestLevel;
MoveToNextChar();
}
wxChar last = PreviousChar();
The patch looks a little bit "unclear", but this is how TortoiseSVN handles changed indendation, at least on my XP.
In fact I only added one if-clause with two braces.
If I have overseen or totally missing something, please correct me.