Hi, morten, I find some bugs in CC, but I'm sorry, I can't create a patch, because my local copy was changed a lot. so, here are the modified code:
1.
plugins\codecompletion\classbrowser.cpp
function:
void ClassBrowser::UpdateView()
{
m_pActiveProject = 0;
m_ActiveFilename.Clear();
if (m_pParser && !Manager::IsAppShuttingDown())
{
m_pActiveProject = Manager::Get()->GetProjectManager()->GetActiveProject();
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (ed)
{
//m_ActiveFilename = ed->GetFilename().BeforeLast(_T('.'));
// the above line is a bug (see https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1559&group_id=5358)
m_ActiveFilename = ed->GetFilename().AfterLast(wxFILE_SEP_PATH);
if( m_ActiveFilename.Find(_T('.')) != wxNOT_FOUND )
{
m_ActiveFilename = ed->GetFilename().BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + m_ActiveFilename.BeforeLast(_T('.'));
m_ActiveFilename.Append(_T('.'));
}
else
m_ActiveFilename = ed->GetFilename();
}
BuildTree();
wxSplitterWindow* splitter = XRCCTRL(*this, "splitterWin", wxSplitterWindow);
if (m_pParser->ClassBrowserOptions().treeMembers)
{
splitter->SplitHorizontally(m_Tree, m_TreeBottom);
m_TreeBottom->Show(true);
}
else
{
splitter->Unsplit();
m_TreeBottom->Show(false);
}
}
else
m_Tree->DeleteAllItems();
}
For example, I have a file:
d:\MinGW\lib\gcc\mingw32\4.4.1\include\c++\vector
So, I would like to see the tokens in this file.
2. Also, the function can give the right tokens in the right file, but it seems the Browser build thread still remove all the nodes.
For example:
d:\MinGW\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_vector.h
Loot at the symbol browser tree window, there is no node shown there.
3.
I have change the SkipComments function in tokenizer.cpp
See here
bool Tokenizer::SkipComment(bool skipEndWhite)
{
bool cstyle; // C or C++ style comments
//check the comment prompt
if(CurrentChar() == '/')
{
if(NextChar() == '*')
cstyle = true;
else if(NextChar() == '/')
cstyle = false;
else
return true; //Not the comment prompt, return true;
}
else
return true; //Not the comment prompt, return true;
MoveToNextChar(2); //skip the comment prompt
while(true)
{
if (cstyle) //c style comment
{
SkipToChar('/');
if (PreviousChar() == '*')//the end of C style comments
{
MoveToNextChar();
break;
}
if(!MoveToNextChar())
break;
}
else //c++ style comment
{
SkipToEOL(false, true);//nestBrace = false skipcomment = true
MoveToNextChar();
break;
}
}
if (IsEOF())
return false;
if (skipEndWhite)
{
if(!SkipWhiteSpace())
return false;
}
else
return true;
return SkipComment(); // handle chained comments
}
For the old code,
if skipEndWhite == false, the function will always return false, this is something wrong.
...
Bed time,,,, I will add more tomorrow.