[antlr-interest] How to extend the CommonTree without getting a classcastexcpetion in the generated code?

Marwan Ajraoui marwan.alephn at gmail.com
Mon Aug 3 15:59:37 PDT 2009


I think that altering code generation so catch-clauses get replace
with the action specified is the best aproach in my case:

@rulecatch {
catch (RecognitionException e) {
    ...
    throw e;
}
}

Cheers,


Marouane


2009/8/3 Marwan Ajraoui <marwan.alephn at gmail.com>:
> 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
>



-- 
Marouane


More information about the antlr-interest mailing list