At 13:34 8/02/2010, Iwud H8u wrote:
>token1 returns [ObjectA a]
> : ^(C_ID (conId=classId
>{$a=evaluateAndReturnAsObjectA($conId.text); })
>);
>
>token2 returns [ObjectA m]
> : ^(C_ID (id=classId
{$m=evaluateAndReturnAsObjectA($id.text);
>}) );
[...]
>Oddly, the Java methods generated for the methods have the
>following return types :
> --- MyTree.token1_return token1() { ... }
> --- ObjectA token2() { .. }
>
>I'm slightly at my wits end, understanding whats going on. What
am
>I missing here?
Generally, a rule will return a value directly if it only has one
return value, or a structure containing all the return values if
it has more than one. Evidently something about the token1 rule
is making it want to return multiple values; perhaps it's the
context in which it's used in another rule? If you have a look at
the contents of the structure it might give you an additional
hint.
If it does return a *_return structure, then it will have a member
matching the declared value. (ie. token1_return will contain an
ObjectA called "a".)
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.