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
<[email protected]>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
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to