Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Patch for handle preprocessor - V2 - beta 3

<< < (4/5) > >>

daniloz:
@ollydbg

--- Quote from: ollydbg on April 23, 2010, 04:01:13 pm ---Note: the comment:
/ /NOTE: it actually forces reparsing of workspace

--- End quote ---

Ok, it seems this is part of some testing or debug or ... ????


--- Quote from: ollydbg on April 23, 2010, 04:01:13 pm ---I'm grad you have interests to debug and test CC. I would like to do my best to help  :D

--- End quote ---

My pleasure! Actually, I use C::B for almost an year now and I'm very happy with it, so any help I can bring to you guys is a pleasure for me. By the way, I'm glad you see my questions and "features requests" as a help. I wish I could do more and really get into the code, but right now I really don't have time for that... maybe in the future... :-)

Loaden:
Version 2 Change Log:
1. Move condition preprocessor handle from ParserThread to Tokenizer class
2. Support parse like this demo:

--- Code: ---#define AAA

void test(int testInt1 // some comment
#ifdef AAA // test
, int testInt2)
#else
)
#endif
{
    tes|
};

--- End code ---
3. Rewrote SkipXXX functions.
4. Make argument support default value, like (int i, bool b = true)
5. Fixed some bugs.

ollydbg:

--- Quote from: Loaden on April 30, 2010, 04:43:34 pm ---Version 2 Change Log:
1. Move condition preprocessor handle from ParserThread to Tokenizer class
2. Support parse like this demo:

--- Code: ---#define AAA

void test(int testInt1 // some comment
#ifdef AAA // test
, int testInt2)
#else
)
#endif
{
    tes|
};

--- End code ---
3. Rewrote SkipXXX functions.
4. Make argument support default value, like (int i, bool b = true)
5. Fixed some bugs.

--- End quote ---

Nice! You patch is far more better than my original patch of "conditional preprocessor handling" in the Parsertest project ( I original posted in ParserTester for codecompletion plugin)

@morten,
As I have explained in this post: Re: Rewrote the DoParse function.

Loaden:
V2 - Beta 2 Change Log:
1. Fixed some bugs.
2. Add #undef handle
3. Refactoring Expression

NOTE: If need skip default value, just replace GetArgument with this.

--- Code: ---wxString Tokenizer::GetArgument()
{
    wxString arg;
    int nestLevel = 0;
    bool skipEqual = false;
    while (NotEOF())
    {
        while (SkipComment())
            ;

        wxChar ch = CurrentChar();
        if (ch == _T('('))
        {
            ++nestLevel;
            arg.Trim(true);
        }
        else if (ch == _T(')'))
        {
            skipEqual = false;
            --nestLevel;
            arg.Trim(true);
        }

        unsigned int index = m_TokenIndex;
        while (ch == _T('#'))
        {
            if (!HandleConditionPreprocessor())
                break;
            ch = CurrentChar();
        }

        if (ch == _T(','))
        {
            skipEqual = false;
            arg.Trim(true);
            arg.Append(_T(", "));
        }
        else if (ch == _T('='))
            skipEqual = true;
        else if (!skipEqual && ((ch > _T(' ')) || (ch == _T(' ') && arg.Last() != _T(' '))))
            arg.Append(ch);

        if (index == m_TokenIndex)
            MoveToNextChar();

        if (nestLevel == 0)
            break;
    }

    return arg;
}
--- End code ---

Loaden:
V2 - Beta 3 Change Log:
1. Replace from 'GetArgument' to 'ReadBlock'.
2. Fix bugs.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version