ANTLR (ANTLR3) 2 cases or anything else pattern

33 views Asked by At

I need C++ code generation that's why I'm using ANTLR3. I would like parse: Identifier ( TOKEN_A ( LEX_A | LEX_B | ANYTHING ) TOK_B ) I implement it like that:

enum_default_value_coma
:
EQUAL
(   valI0=SIGNED_INTEGER    { m_oCurrentEnumValue.AddDefaultValue( static_cast< Int64 >( atoll( $valI0.text.c_str() ) ) ); }
|   valU0=UNSIGNED_INTEGER  { m_oCurrentEnumValue.AddDefaultValue( static_cast< UInt64 >( atoll( $valU0.text.c_str() ) ) ); }
|   valS0=XXXXXX            { m_oCurrentEnumValue.AddDefaultValue( $valS0.text ); }
)?
COMA { m_oCurrentEnum.AddValue( m_oCurrentEnumValue ); }
;

I don't know how can I detect the "anything else", XXXXXX. Have we a "Else" pattern?

Thanks

0

There are 0 answers