[antlr-interest] Tree Parser Rule - 'throws' my-own-exception is silently ignored
Johannes Luber
jaluber at gmx.de
Sat Dec 6 09:30:30 PST 2008
Michael Lee schrieb:
> Hi,
>
> I am troubling to throw my-own-exception during tree parsing.
>
> I have a tree rule - nothing too complicated.
>
> Here is the snippet
>
> expression returns [ Expression exp ] *throws* *ExpressionParseException*
> : ^(op='+' a=expression b=expression ) { $exp =
> NumericOperationExpression.createOperation( op.getText().charAt(0) ,
> (NumericExpression) dynamicToNumeric(a) , (NumericExpression)
> dynamicToNumeric(b)); }
>
>
> However the antlr generates
>
> /*/ src/main/antlr/Eval.g:63:1: expression returns [ Expression exp ] :
> *( ^(op= '+' a= expression b= expression ) ....
> public final Expression expression() *throws RecognitionException* {
> Expression exp = null;
>
> It looks like it is silently dropping 'throws' my-own-exception.
>
> Is it a bug? Or am I doing wrong?
>
> Thanks in advance.
It's bug. Just derive your exception from RecognitionException.
Johannes
>
> Michael Lee
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list