[antlr-interest] tokens in parser grammar
Jim Idle
jimi at temporal-wave.com
Wed Aug 12 11:23:09 PDT 2009
Юрушкин Михаил wrote:
> And additional question:
>
> "
> constant[BlockStatement *stmntBlock]
> returns [ExpressionBase *resultConstant]
> : resultConstant = literal_constant // this line is wrong. Name
> conflict with result value //
> | T_IDENT { resultConstant = action.constant($T_IDENT, stmntBlock); }
> ;
> " - isn't parded :(
>
> : resultConstant = literal_constant <-- this line is wrong. Name
> conflict with result value
>
> what i do wrong?
>
>
Change the name:
: rC=literal_constant { $resultConstant = $rC.whateverTheReturnNameIs; }
...etc
The labeled return values return a struct, from which you need to
reference the name of the return element in returns declaration of the
sub_rule.
Jim
More information about the antlr-interest
mailing list