1. Derive a class CustomizedErrorNode from your class CustomizedNode. 2. Derive a class CustomizedTreeAdaptor from CommonTreeAdaptor. In it, override create(Token) to return a CustomizedNode, and override errorNode(TokenStream,Token,Token,RecognitionException) to return a CustomizedErrorNode.
Set your parser to use this tree adaptor instead of the default one. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Marwan Ajraoui Sent: Monday, August 03, 2009 3:47 PM To: [email protected] Subject: [antlr-interest] How to extend the CommonTree without getting aclasscastexcpetion in the generated code? Hi there; I did define a customized node, extending a commonTree, defined an adaptor extending a CommonTreeAdaptor, for my semantic analysis. Nevertheless, I'm getting a classCastException, when the parser find the first sintax error. The reason is that it can not cast CommonErrorNode to my customized node, since both extend CommonTree. I'm interested on reporting all parser errores no just the first one. What is the better aproach, dealing with this expcetion so it doesn't stop the execution? Thx in advance for any help, Cheers -- Marouane 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 -~----------~----~----~----~------~----~------~--~---
