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

ParserTester for codecompletion plugin

(1/6) > >>

ollydbg:
we(Loaden, blueshake and visualfc and ollydbg) were pleased to announce a parser tester project, this project contains some source under codecompletion/parser folder, the log message can be shown in the simple Gui. This is really convenient when you debug parser related code, since debugging the CC within codeblocks Gui is quite slow(gdb need to load the host exe file and many other dlls, it's too slow)

Here are the steps to use this project.

1, You just extract the files to the parser folder(I only change the tokenizer and parserthread source to support the ParserTester project, adding some preprocessor directive), then open the parsertest.cbp.

2, build

3, run, then, all the "TRACE" message will be shown in the ParserTester mainframe.

By default, you need to supply a "test.cpp" in the same folder for the tester to parse

A log.txt will be saved after testing.







[attachment deleted by admin]

ollydbg:
Also, I have move the "handling conditional preprocessor code to Tokenizer class".

Here, I think it is better to move the conditional preprocessor related code from parserthread to tokenizer class.

At the moment, this was done in the parserthread, so we need some specific code to check whether there is a #if, this is even worse when like


--- Code: ---void function( A a, B b
#ifdef XXXX
, C c)
#else
, C c, D d)
#endif
--- End code ---
,  then,

--- Code: ---( A a, B b #ifdef XXXX, C c)
--- End code ---
will be returned as a whole token.because In the Tokenizer, a pair of braces will be returned as a whole token, thus made conditional directive unbalanced.

for example :CC fails to parse parts of boost

for another example, in the source of parserThread.cpp, handling class, we need to check the #if statement like:


--- Code: --- // handle preprocessor directives in class definition, e.g.

class MyClass
        #ifdef FOO
             : public MyClass1
             , public MyClass2
         #endif
{}
--- End code ---

This modification will let the Tokenizer give a transparent and consistent way to feed the parserthread.

Loaden:
 :D

ollydbg:
Another improvement of the parser, I have fix two bugs in parsing VC 2008/2005 header files. (Both the STL and the window API functions can auto prompted correctly).

bug one: In the Visual C++ 's header for std::string, there are some statement:


--- Code: ---    enum
        {    // length of internal buffer, [1, 16]
        _BUF_SIZE = 16 / sizeof (_Elem) < 1 ? 1
            : 16 / sizeof(_Elem)};
--- End code ---

Note the "<", in parser will try the skip the block of "<", but badly, there's no ">" here, so, the parser just skip to the EOF.

bug two:

In the windows API heade file, there's code statement like below:

--- Code: ---__inline
BOOL
GetMessage(
    LPMSG lpMsg,
    HWND hWnd,
    UINT wMsgFilterMin,
    UINT wMsgFilterMax
    )
{
#ifdef UNICODE
    return GetMessageW(
#else
    return GetMessageA(
#endif
        lpMsg,
        hWnd,
        wMsgFilterMin,
        wMsgFilterMax
        );
}
--- End code ---
the parser failed because there are #if in the function arguments.
All the two bugs were reporteded by Loaden.

MortenMacFly:
Well I don't really get what's the state of this work... you got me confused. :(

Does this include the patches by blueshake concerning #define handling or not? And what about the other modification concerning pointer / reference?

If you want to do me a favour, please bring in new pieces step-by-step and mark what's new.

Navigation

[0] Message Index

[#] Next page

Go to full version