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

New code completion remarks/issues

<< < (49/54) > >>

ollydbg:
Wait, there is a big syntax error in the if statement.


--- Code: --- if (   !SkipToOneOfChars(_T(">\r\n")), false      )
--- End code ---

look at the pair of parentheses!!!????

it is

--- Code: ---if ( XXXX, false)

--- End code ---

ollydbg:
Patch to fix the "template reading bug" , this patch contains some patch in CC comments improvement



[attachment deleted by admin]

MortenMacFly:

--- Quote from: ollydbg on December 21, 2009, 09:22:30 am ---Patch to fix the "template reading bug" ,

--- End quote ---
Wow, that was fast (I didn't even manage to run C::B today). IF this works that would be nice!

BTW: Please don't include other patches next time, if possible. This makes merging for me a little easier. ;-)

ollydbg:
hi, morten, I have an idea, I want to hear your comments.

Currently, the Tokenizer is only return a wxString as a Token.
But my idea is, Tokenizer should return a Token structure.

For example


--- Code: ---void f(XXX);
--- End code ---

In the current trunk code, the Tokenizer will return four wxString.


--- Code: ---void
f
(XXX)
;
--- End code ---

But my suggestion is to create a Token structure like

--- Code: ---struct Token{
wxString name;
Tokentype type;
}

--- End code ---

So, the Tokenizer::GetToken will return four strictures, because When Tokenizer do the "DoGetToken" function, it is already know the Token's type, so, we don't need the check the wxString in ParserThread.(mostly, we need to check the first character of the wxstring to determine this is a (XXXX)).

--- Code: ---void its type is normalText
f     its type is normalText
(XXX) its type is functionArgument
;       its type is endofStatement

--- End code ---

This will make parserThread more happier and easy to determine the syntax.


Edit

following my idea, the DoGetToken can be changed to like below:

--- Code: ---    else if (CurrentChar() == '<' && bTemplate)
    {
        MoveToNextChar();
        if (!SkipToOneOfChars(_T(">")), true)
            return wxEmptyString;

        MoveToNextChar();
        wxString tmp = m_Buffer.Mid(start+1,m_TokenIndex-start-2);
        tmp.Trim();
        str = _T("<");
        str += tmp;
        str += _T(">"); // m_Buffer.Mid(start, m_TokenIndex - start);
        type = TemplateArgument;
    }
    else if (c == '(')
    {
        m_IsOperator = false;

        // skip blocks () []
        if (!SkipBlock(CurrentChar()))
            return wxEmptyString;

        str = FixArgument(m_Buffer.Mid(start, m_TokenIndex - start));
        CompactSpaces(str);
        type = functionArgument;
    }
    else
    {
        if      (c == '{')
            ++m_NestLevel;
            type = OpenBrace
        else if (c == '}')
            --m_NestLevel;
            type = CloseBrace

        str = c;
        MoveToNextChar();
    }
--- End code ---

Take care of the "type" variable, it is a enum variable, can have the type like:


--- Code: ---enum Tokentype{

normalText;
OpenBrace;
CloseBrace;
EndOfStatement;
FunctionArgument;
TemplateArgument;
....

}

--- End code ---

So, in the parserThread void ParserThread::DoParse, we can use a switch statement



--- Code: ---switch(type){

case normaltext: XXXX
case:functionArgument: XXXX


}


--- End code ---
This will runs faster then the many "if - else if ....."

blueshake:

--- Quote ---Patch to fix the "template reading bug" , this patch contains some patch in CC comments improvement
--- End quote ---

forget to do this in patch.(will make the parser in a long work time.) :lol:

--- Code: ---#define PARSERTHREAD_DEBUG_OUTPUT 0
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version