[antlr-interest] throws does not work

Kay Roepke kroepke at classdump.org
Mon Aug 6 05:53:31 PDT 2007


On Aug 6, 2007, at 1:52 PM, Fõrat K†‚†K wrote:

> ruleName throws NullPointerException
>      :  blablaRule
>      ;
>
>
> this parser rule does not generate method:
>
> public final void jdkHome() throws NullPointerException {
> }


true, ANTLR parses the throws but doesn't use them right now.

I don't know what the book says about this, but there is a bug for it
in JIRA <http://www.antlr.org:8888/browse/ANTLR-100>.

> what should i do?

I'm afraid it isn't possible right now. You might be able to do  
something fancy with
catch handlers and rethrowing Runtime exceptions, but that's probably  
not what you want.
It's a bad hack anyway.

cheers,
-k
-- 
Kay Ršpke
http://classdump.org/






More information about the antlr-interest mailing list