Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
New code completion remarks/issues
ollydbg:
--- Quote from: blueshake on September 28, 2009, 10:12:33 am ---
--- Quote ---This bug is fixed by this patch
--- End quote ---
does it work for codes like these?
--- Code: ---#include <iostream>
using namespace std;
struct qq
{
int x;
int y;
};
struct qq tt;
struct qq& xx = tt;
xx.
int main()
{
cout << "Hello world!" << endl;
return 0;
}
--- End code ---
--- End quote ---
Not yet, but the statement below are nearly the same. so, it can be easily fixed.
--- Code: ---struct qq * xx
struct qq & xx
--- End code ---
Here is my modified path, it works ok for both struct reference and pointer .
--- Code: ---Index: parserthread.cpp
===================================================================
--- parserthread.cpp (revision 5824)
+++ parserthread.cpp (working copy)
@@ -1350,8 +1350,13 @@
HandleFunction(current);
break;
}
- else if (next.GetChar(0) != '*')
+ else if (next.GetChar(0) == '*' || next.GetChar(0) == '&' )
{
+ m_Str<<current;
+ break;
+ }
+ else
+ {
// might be instantiation, see the following
/*
struct HiddenStruct {
@@ -1391,8 +1396,7 @@
}
}
}
- else
- m_Tokenizer.GetToken();
+
}
else
break;
--- End code ---
ollydbg:
--- Quote from: blueshake on September 28, 2009, 10:12:33 am ---EDIT:
And the issue in this thread seems not solved yet.http://forums.codeblocks.org/index.php/topic,10966.msg74954.html#msg74954
--- End quote ---
Yes, this issue still exist when enter
--- Code: ---while ().
--- End code ---
This is because a left search start from the "." will skip the brace pair, and find "while" as the first token.
But it is strange, it seems the right search starting from "w" give the wrong token length. I will look into it.
ollydbg:
This is the modified version of the "right search", it just solve this problem in my previous reply.
--- Code: ---wxString NativeParser::GetNextCCToken(const wxString& line, unsigned int& startAt, bool& is_function)
{
wxString res;
int nest = 0;
if ((startAt < line.Length()) && (line.GetChar(startAt) == '('))
{
while (startAt < line.Length() &&
(line.GetChar(startAt) == '*' ||
line.GetChar(startAt) == '&' ||
line.GetChar(startAt) == '('))
{
if (line.GetChar(startAt) == '(')
++nest;
++startAt;
}
}
//Manager::Get()->GetLogManager()->DebugLog(F(_T("at %d (%c): res=%s"), startAt, line.GetChar(startAt), res.c_str()));
while ((startAt < line.Length()) && (wxIsalnum(line.GetChar(startAt)) || line.GetChar(startAt) == '_'))
{
res << line.GetChar(startAt);
++startAt;
}
while ((nest > 0) && (startAt < line.Length()))
{
if (line.GetChar(startAt) == ')')
--nest;
++startAt;
}
//Manager::Get()->GetLogManager()->DebugLog(F(_T("Done nest: at %d (%c): res=%s"), startAt, line.GetChar(startAt), res.c_str()));
while (startAt < line.Length()-1&& (line.GetChar(startAt) == ' ' || line.GetChar(startAt) == '\t'))
++startAt;
if ((startAt < line.Length()) && (line.GetChar(startAt) == '(' || line.GetChar(startAt) == '['))
{
is_function = line.GetChar(startAt) == '(';
++nest;
while (startAt < line.Length()-1 && nest != 0)
{
++startAt;
#if wxCHECK_VERSION(2, 9, 0)
switch (line.GetChar(startAt).GetValue())
#else
switch (line.GetChar(startAt))
#endif
{
case ']':
case ')': --nest; ++startAt;break;
case '[':
case '(': ++nest; ++startAt;break;
}
while (startAt < line.Length()-1&& (line.GetChar(startAt) == ' ' || line.GetChar(startAt) == '\t'))
++startAt;
if (startAt < line.Length()-1 && (line.GetChar(startAt) == '(' || line.GetChar(startAt) == '['))
++nest;
}
//++startAt;
}
//Manager::Get()->GetLogManager()->DebugLog("Return at %d (%c): res=%s", startAt, line.GetChar(startAt), res.c_str());
return res;
}
--- End code ---
Note, I just add a while statement to skip the spaces between "while" and "()".
--- Code: --- while (startAt < line.Length()-1&& (line.GetChar(startAt) == ' ' || line.GetChar(startAt) == '\t'))
++startAt;
--- End code ---
MortenMacFly:
--- Quote from: ollydbg on September 29, 2009, 11:07:14 am ---This is the modified version of the "right search", it just solve this problem in my previous reply.
--- End quote ---
Committed that to trunk (including some other mods). Hence some cases still do not work, check this snippet:
--- Code: ---struct _s
{
int x;
float y;
};
typedef struct _s t_s;
int main()
{
struct _s s;
struct _s& rs = s;
struct _s* ps = &s;
t_s ts;
t_s& rts = ts;
t_s* pts = &ts;
s. // works
rs. // works
ps. // works
ps-> // does not work
ts. // works
rts. // works
pts. // works
pts-> // does not work
return 0;
}
--- End code ---
For ps and pts CC suggests... erm... ps and pts.
Probably I am missing something... it's late... ;-)
oBFusCATed:
By the way are there any plans to enable the first combo box in the CC toolbar?
If yes, what needs to be done?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version