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

Parse enumerator assignment

(1/2) > >>

Alpha:
Testing parsing of enumerator assignments.  (Patch attached.)

oBFusCATed:
Can you give example, what doesn't work and work works with the patch.
I'm not sure I understand the term enumerator assignments.

Alpha:
Given the following from src/plugins/codecompletion/parser/tokenizer.h

--- Code: ---enum TokenizerState
{
    tsSkipEqual         = 0x0001,         /// Skip the assignment statement
    tsSkipQuestion      = 0x0002,         /// Skip the conditional evaluation statement
    tsSkipSubScrip      = 0x0004,         /// Skip the array-subscript notation statement

    tsSingleAngleBrace  = 0x0008,         /// Reserve angle braces
    tsReadRawExpression = 0x0010,         /// Reserve every chars

    tsSkipNone          = 0x1000,         /// Skip None
    // convenient masks
    tsSkipUnWanted      = tsSkipEqual    | tsSkipQuestion | tsSkipSubScrip,
    tsTemplateArgument  = tsSkipUnWanted | tsSingleAngleBrace
};

--- End code ---
The tool tip for tsSkipQuestion is currently:

--- Code: ---TokenizerState::tsSkipQuestion=
--- End code ---
With this patch, it becomes:

--- Code: ---TokenizerState::tsSkipQuestion=0x0002
--- End code ---
With this patch, the tool tip for tsTemplateArgument is:

--- Code: ---TokenizerState::tsTemplateArgument=tsSkipUnWanted|tsSingleAngleBrace
--- End code ---

Given the following code:

--- Code: ---enum HexAssignment
{
    haFirst = 0x0001,
    haSecond,
    haThird
};

enum Colors
{
    clRed,
    clBlue,
    clGreen
};

enum TestEnum
{
    teFirst,
    teSecond = 5,
    teThird
};

--- End code ---
haFirst is:

--- Code: ---HexAssignment::haFirst=0x0001
--- End code ---
haSecond is:

--- Code: ---HexAssignment::haSecond=0x0002
--- End code ---
haThird is:

--- Code: ---HexAssignment::haThird=0x0003
--- End code ---
clRed is:

--- Code: ---Colors::clRed=0
--- End code ---
clGreen is:

--- Code: ---Colors::clGreen=2
--- End code ---
teFirst is

--- Code: ---TestEnum::teFirst=0
--- End code ---
teThird is

--- Code: ---TestEnum::teThird=6
--- End code ---

Alpha:

--- Code: ---enum TokenizerState
{
    tsSkipEqual         = 0x0001,         /// Skip the assignment statement
    tsSkipQuestion      = 0x0002,         /// Skip the conditional evaluation statement
    tsSkipSubScrip      = 0x0004,         /// Skip the array-subscript notation statement

    tsSingleAngleBrace  = 0x0008,         /// Reserve angle braces
    tsReadRawExpression = 0x0010,         /// Reserve every chars

    tsSkipNone          = 0x1000,         /// Skip None
    // convenient masks
    tsSkipUnWanted      = tsSkipEqual    | tsSkipQuestion | tsSkipSubScrip,
    tsTemplateArgument  = tsSkipUnWanted | tsSingleAngleBrace,
    tsAnotherState
};

--- End code ---
What does not work is that with this patch tsAnotherState will still have the tool tip:

--- Code: ---TokenizerState::tsAnotherState=
--- End code ---

oBFusCATed:
Have tried to add a test to the test application (cctest or something like this)?

Navigation

[0] Message Index

[#] Next page

Go to full version