[antlr-interest] Return Values
Bart Kiers
bkiers at gmail.com
Sun May 15 07:11:41 PDT 2011
Hi Philip,
You can't since aParserToken will be initialized as a
org.antlr.runtime.Token type.
You will have to do it (the hard way) like this:
parserRule0
: ( parserRule1
{DoSomethingWithTheReturnValue($parserRule1.returnValue);}
| parserRule2
{DoSomethingWithTheReturnValue($parserRule2.returnValue);}
| parserRule3
{DoSomethingWithTheReturnValue($parserRule3.returnValue);}
)
;
Regards,
Bart.
On Sun, May 15, 2011 at 12:09 AM, Philip Mötteli
<Philip.Moetteli at tele2.ch>wrote:
> Hi,
>
>
> I know, how to access a return value from a parser rule/token: By calling
> "$rule.returnValue". E. g:
>
> parserRule0 : parserRule1
> {
> DoSomethingWithTheReturnValue($parserRule1.returnValue); }
> ;
>
>
> But how do I access the return value, if it's one of several options
> ('or'ed together):
>
> parserRule0 : aParserToken=( parserRule1 | parserRule2 |
> parserRule3 )
> { // How do I access
> "$aParserToken.returnValue"? }
> ;
>
>
> Thanks for any help
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list