[antlr-interest] Passing user defined exceptions through the parser.

Sam Harwell sharwell at pixelminegames.com
Tue Jan 13 08:05:34 PST 2009


There is a throwsSpec in the ANTLR tool grammar that *should* be able to
be used like this:

my_rule /*returns [Object o]*/ throws RecognitionException,
OperationCanceledException
 : ...
 ;

It doesn't apply to C# so it's not implemented in my CSharp3 target.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Peter C. Chapin
Sent: Tuesday, January 13, 2009 6:13 AM
Cc: antlr-interest
Subject: Re: [antlr-interest] Passing user defined exceptions through
the parser.

Laurent Caillette wrote:

> This should work if you make OperationCanceledException a subclass of
> RecognitionException, which is a checked exception thrown by parser's
> methods. Then the catch clause does its job.
>   

Okay, thanks. That's a little unsatisfying because the exception in
question really isn't a problem with recognition. Still, I can live with
that. I guess that's life with Java.

Peter


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