[antlr-interest] throws does not work

Vaclav Barta vbar at comp.cz
Mon Aug 6 09:00:40 PDT 2007


Kay Roepke wrote:
> 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.
Would it be possible to change the template to generate
throws Exception
on every method? I suppose that isn't all that clean either, but well, 
whatever works...

	Bye
		Vasek



More information about the antlr-interest mailing list