>> I think you override emit()
>
> That is indeed what I'm doing, good to hear I'm on the right track :)
>
> But if I refer to a token in a parser action (with $token), it's of type
> CommonToken, and not the subclass of Token that I'm emitting. I can't use
> the TokenLabelType option, since different tokens emit different types of
> token Objects.
>
> Obviously I can cast $token in the parser action to the appropriate type,
> but I hoped this would not be necessary.

To hopefully clarify it a bit further, in bison one can specify with
%union the list of possible types of the token objects, and with %token
<TYPE> x that token x is an object of type TYPE.

Is there some way to do this in antlr (specifying the type of the token
objects on a per-token basis, instead of one single type for all tokens
like TokenLabelType does)?


Stijn

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