Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on December 21, 2009, 10:54:05 am

Title: variable seperated by commas
Post by: ollydbg on December 21, 2009, 10:54:05 am
For example:
Code
int *a,b;

In the current CodeCompletion symbol browser, there are two Tokens found.

Code
a, its type is int*
b, its type is int*

I think it is wrong, because the correct Token should be

Code
a, it's type is int*
b, it's type is int

In the code:
wxString ParserThread::GetActualTokenType()

it seems the "*" is binding to the left. So, if you define a variable like below:

Code
const wxString * AAAA;

AAAA is firstly regarded as a Token name.

Then we will analysis the const wxString * .

The currently CC didn't parser the pointer list definition well.
This also happens in handling typedefs.
Also, you can see the code in:
Code
void ParserThread::HandleTypedef()
{
  

    size_t lineNr = m_Tokenizer.GetLineNumber();
    bool is_function_pointer = false;
    wxString typ;
    std::queue<wxString> components;
    // get everything on the same line

    TRACE(_T("HandleTypedef() : Typedef start"));
    wxString args;
    wxString token;
    wxString peek;
    m_ParsingTypedef = true;

    while (true)
    {
        token = m_Tokenizer.GetToken();
        peek = m_Tokenizer.PeekToken();
        TRACE(_T("HandleTypedef() : token=%s, peek=%s"), token.wx_str(), peek.wx_str());
        if (token.IsEmpty() || token == ParserConsts::semicolon)
            break;

We only take care of the "semicolon", but how can we deal with commas

Title: Re: variable seperated by commas
Post by: blueshake on December 22, 2009, 06:20:25 am
also these test codes don't work .

Code
#include <iostream>

using namespace std;
typedef class qq
{
    int x;
    int y;
}*pp;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

see the screen shot.

[attachment deleted by admin]
Title: Re: variable seperated by commas
Post by: blueshake on December 25, 2009, 11:41:58 am
not work for these codes ethier.

Code
#include <iostream>

using namespace std;
class qq
{
    int x;
    int y;
}tt,*pp;
int main()
{
    cout << "Hello world!" << endl;
    return 0;
}