[antlr-interest] ANTLR 3: throws statement on rule does not work

Joerg.Werner at qimonda.com Joerg.Werner at qimonda.com
Tue Aug 22 00:43:17 PDT 2006


Hi,

I've been playing with ANTLR 3 for some time now and find it quite nice. I encountered one problem though: If I have a rule which declares that it throws an exception like:

expr returns [Symbol rs=null] throws Exception
    :
        ^(
            '+' e1=expr e2=expr { // Action code which throws Exception } )
    ;

then this exception is not declared in the Java code:

    // $ANTLR start expr
    // FlexibleBitstreamDecoderWalker.g:73:1: expr returns [Symbol rs=null] : ^( '+' e1= expr e2= expr );
    public expr_return expr() throws RecognitionException {    

Is this intended or is this a bug? In ANTLR 2 declaring exceptions was done this way, but maybe this has changed? 

Regards,

Jörg


-- 
Dr. Jörg Werner
Qimonda AG 
Memory Products Division
QAG PD PT TPE C
Am Campeon 1-12
D-85579 Neubiberg
email: joerg.werner at qimonda.com
Tel:  +49 89 234-26602
Fax: +49 89 234-9554740


More information about the antlr-interest mailing list