Do you have:
ASTLabelType=MyToken; ? I am thinking that you do have that and that is why you are getting the cast problems right? Jim From: [email protected] [mailto:[email protected]] On Behalf Of Bob Frankel Sent: Tuesday, November 10, 2009 8:35 AM To: [email protected] Subject: [antlr-interest] custom TokenLabelType and EOF/Error tokens following idioms i've seen posted elsewhere, i've created a MyToken class that inherits from CommonToken; my Lexer then overrides Token Lexer.emit(), at which time i create instances of MyToken.... things work fine, until the parser encounters a syntactic error.... from what i can tell, the parser inserts an "error" token of type CommonToken; this then leads to a class cast exception in the surrounding parser rule when attempting to assign a CommonToken value through a generated (MyToken) cast.... i've also noticed a similar problem when my grammar explictly includes the special EOF token; again, the token created here is of type CommonToken, which leads to a class cast exception when later assigned through a (MyToken) cast inside the generated parser class.... is there some other method i should be overriding beyond Token Lexer.emit()??? thanks.... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
