Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
New code completion remarks/issues
MortenMacFly:
I personally believe it's related to the handling of the const keyword in a function signature. For the classes where it works not here *always* the previous method has a const.
I've extarcted all the patches I applied from the beginning of the refactoring meanwhile and try to reproduce by which step this behaviour was introduced. So far I am at step 2... so this may take a while... (taking Murphy into account it'll be the last step).
ollydbg:
hello all.
I just enabled the parser_thread_output guard, and try to exam the parser_thread log. It seems when parsing codecompletion.cpp, the parser exits after parsing function: GetIncludeDirs.
Here is the log:
--- Code: ---......
DoParse() : Loop:m_Str='int ', token='SortCCList'
HandleFunction() : Adding function 'SortCCList': m_Str='int '
HandleFunction() : name='SortCCList', args='(const wxString& first, const wxString& second)', peek='{'
HandleFunction() : Skipped function SortCCList impl. from 440 to 470
HandleFunction() : Add token name='SortCCList', args='(const wxString& first, const wxString& second)', return type='int '
DoParse() : Loop:m_Str='', token='int'
DoParse() : Loop:m_Str='int ', token='CodeCompletion'
DoParse() : Loop:m_Str='int ', token='CodeComplete'
HandleFunction() : Adding function 'CodeComplete': m_Str='int '
HandleFunction() : name='CodeComplete', args='()', peek='{'
HandleFunction() : Skipped function CodeComplete impl. from 473 to 645
HandleFunction() : Add token name='CodeComplete', args='()', return type='int '
DoParse() : Loop:m_Str='', token='bool'
DoParse() : Loop:m_Str='bool ', token='TestIncludeLine'
HandleFunction() : Adding function 'TestIncludeLine': m_Str='bool '
HandleFunction() : name='TestIncludeLine', args='(wxString const &line)', peek='{'
HandleFunction() : Skipped function TestIncludeLine impl. from 648 to 664
HandleFunction() : Add token name='TestIncludeLine', args='(wxString const &line)', return type='bool '
DoParse() : Loop:m_Str='', token='wxArrayString'
DoParse() : Loop:m_Str='wxArrayString ', token='GetIncludeDirs'
HandleFunction() : Adding function 'GetIncludeDirs': m_Str='wxArrayString '
HandleFunction() : name='GetIncludeDirs', args='(cbProject &project)', peek='{'
HandleFunction() : Skipped function GetIncludeDirs impl. from 667 to 2060
HandleFunction() : Add token name='GetIncludeDirs', args='(cbProject &project)', return type='wxArrayString '
************it seems the parser stops here!!!!!!!********************
Reparsing saved files...
Starting batch parsing
--- End code ---
Note:
Skipped function GetIncludeDirs impl. from 667 to 2060
Edit:
So, I still believe it is something related to parsing such statement:
--- Code: ---....
fullname.Replace(_T("\\"), _T("/"), true);
...
--- End code ---
"\\" and "/" should carefully be tokenized.
Edit2
If you would like to do such test, you'd better delete all the include statement from the codecompletion.cpp, and copy these code to an empty console project. otherwise, too many logs will be outputs when parsing these header files. :D
blueshake:
But what about cbeditor.cpp.
It seems there is no statement fullname.Replace(_T("\\"), _T("/"), true); in the file.
ollydbg:
--- Quote from: blueshake on September 25, 2009, 07:06:32 am ---But what about cbeditor.cpp.
It seems there is no statement fullname.Replace(_T("\\"), _T("/"), true); in the file.
--- End quote ---
The same thing happens if you try to parse the cbEditor.cpp, here is the log:
--- Code: ---HandleFunction() : Adding function 'IsPreprocessor': m_Str='bool '
HandleFunction() : name='IsPreprocessor', args='(int style)', peek='{'
HandleFunction() : Skipped function IsPreprocessor impl. from 269 to 274
HandleFunction() : Add token name='IsPreprocessor', args='(int style)', return type='bool '
DoParse() : Loop:m_Str='', token='bool'
DoParse() : Loop:m_Str='bool ', token='IsCharacterOrString'
HandleFunction() : Adding function 'IsCharacterOrString': m_Str='bool '
HandleFunction() : name='IsCharacterOrString', args='(int style)', peek='{'
HandleFunction() : Skipped function IsCharacterOrString impl. from 277 to 289
HandleFunction() : Add token name='IsCharacterOrString', args='(int style)', return type='bool '
DoParse() : Loop:m_Str='', token='bool'
DoParse() : Loop:m_Str='bool ', token='IsCharacter'
HandleFunction() : Adding function 'IsCharacter': m_Str='bool '
HandleFunction() : name='IsCharacter', args='(int style)', peek='{'
HandleFunction() : Skipped function IsCharacter impl. from 292 to 304
HandleFunction() : Add token name='IsCharacter', args='(int style)', return type='bool '
DoParse() : Loop:m_Str='', token='void'
DoParse() : Loop:m_Str='void ', token='DoBraceCompletion'
HandleFunction() : Adding function 'DoBraceCompletion': m_Str='void '
HandleFunction() : name='DoBraceCompletion', args='(const wxChar& ch)', peek='{'
HandleFunction() : Skipped function DoBraceCompletion impl. from 307 to 3240
HandleFunction() : Add token name='DoBraceCompletion', args='(const wxChar& ch)', return type='void '
Reparsing saved files...
Starting batch parsing
--- End code ---
It seem the parser stops after parsing DoBraceCompletion. note:HandleFunction() : Skipped function DoBraceCompletion impl. from 307 to 3240
It's implementation is list below:
--- Code: ---void DoBraceCompletion(const wxChar& ch)
{
cbStyledTextCtrl* control = m_pOwner->GetControl();
int pos = control->GetCurrentPos();
int style = control->GetStyleAt(pos);
if ( IsComment(style) || IsPreprocessor(style) )
return;
if ( ch == _T('\'') )
{
if ( (control->GetCharAt(pos) == ch) && (pos > 1) && (control->GetCharAt(pos-2) != _T('\\')) )
{
control->DeleteBack();
control->GotoPos(pos);
}
else
{
if ( (control->GetCharAt(pos-2) == _T('\\')) || IsCharacterOrString(style) )
return;
control->AddText(ch);
control->GotoPos(pos);
}
return;
}
if ( ch == _T('"') )
{
if ( (control->GetCharAt(pos) == ch) && (pos > 1) && (control->GetCharAt(pos-2) != _T('\\')) )
{
control->DeleteBack();
control->GotoPos(pos);
}
else
{
if ( (control->GetCharAt(pos-2) == _T('\\')) || IsCharacter(style) )
return;
control->AddText(ch);
control->GotoPos(pos);
}
return;
}
if ( IsCharacterOrString(style) )
return;
const wxString leftBrace(_T("([{"));
const wxString rightBrace(_T(")]}"));
int index = leftBrace.find(ch);
const wxString unWant(_T(");\n\r\t\b "));
#if wxCHECK_VERSION(2, 9, 0)
if ((index != wxNOT_FOUND) && (unWant.find(wxUniChar(control->GetCharAt(pos))) != wxNOT_FOUND))
#else
if ((index != wxNOT_FOUND) && (unWant.find(control->GetCharAt(pos)) != wxNOT_FOUND))
#endif
{
control->AddText(rightBrace.GetChar(index));
control->GotoPos(pos);
if (ch == _T('{'))
{
const wxRegEx reg(_T("^[ \t]*{}[ \t]*"));
if (reg.Matches(control->GetCurLine()))
{
control->NewLine();
control->GotoPos(pos);
control->NewLine();
return;
}
}
}
else
{
index = rightBrace.find(ch);
if (index != wxNOT_FOUND)
{
if (control->GetCharAt(pos) == ch)
{
control->DeleteBack();
control->GotoPos(pos);
return;
}
}
}
}
--- End code ---
blueshake:
@ollydbg
I comment wxArrayString GetIncludeDirs(cbProject &project)
and void CodeCompletion::CodeCompleteIncludes() function implementation.Then the cc works in the latest cc.
And I test the codes in codecompletion.cpp without any comment in svn 5731.Everything work perfectly.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version