[antlr-interest] Extending a CommonTree
David-Sarah Hopwood
david-sarah at jacaranda.org
Mon Aug 3 17:13:32 PDT 2009
Marwan Ajraoui wrote:
> 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?
Override the errorNode method in your custom TreeAdaptor to return an
instance of your node class.
<http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1tree_1_1_base_tree_adaptor.html#6794aa45ca9774822f1be82a3856e8f8>
--
David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com
More information about the antlr-interest
mailing list