[antlr-interest] Passing user defined exceptions through theparser.

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


I just checked and the feature is not implemented in the code generator
yet. At least in the C# port of the tool it will cause recognition
exceptions if you use it in a grammar right now.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Sam Harwell
Sent: Tuesday, January 13, 2009 10:06 AM
To: Peter C. Chapin
Cc: antlr-interest
Subject: Re: [antlr-interest] Passing user defined exceptions through
theparser.

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

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