[antlr-interest] Throwing a exception in a rule

Alexandre Hamez alexandre.hamez at lip6.fr
Wed Aug 29 05:30:11 PDT 2007


Hi everybody,

	I try to declare a rule that throws an exception, but when I look at  
the generated code, the corresponding method doesn't throws this  
exception. The code is the following:

> check_version
> 	returns [AuthenticationAck message]
> 	throws VersionFailure
> 	:
> 	  ack_open_connection
> 	  {
> 	  	message = new AuthenticationAck();
> 	  }
> 	| close_connection_panic
> 	  {
> 	  	throw new VersionFailure($close_connection_panic.s);
> 	  }
> 	;

It is clearly stated in the doc that a rule is written like this:

	access-modifier rule-name[«arguments»] returns [«return-values»]  
throws name1, name2, ...

So, am I missing something?

Thanks for your advices!

------------------------------------------------------------------------ 
---
Alexandre Hamez   LIP6 - MoVe / EPITA - LRDE
LIP6: tel: +33 1 44 27 31 92  / Bureau 818
104 Avenue du Président Kennedy 75016 Paris
http://www-src.lip6.fr/~Alexandre.Hamez


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2429 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070829/08a33438/attachment.bin 


More information about the antlr-interest mailing list