[antlr-interest] simple exception question

Terence Parr parrt at cs.usfca.edu
Tue Jun 22 13:32:26 PDT 2004


On Jun 22, 2004, at 12:48 PM, Greg Gimler wrote:

> Currently in my grammar I'd like to have any exceptions thrown to a top
> level class in order to handle any languages I pass through that don't 
> match
> my productions.  I implemented a solution but I'm not happy with it.  
> I'm
> currently appending:
>     exception // for rule
>     catch [RecognitionException ex] {
>        throw ex; // we want this to be handled at the application level
>     }
>
> after each production.  My top level class can receive any exceptions 
> and
> take appropriate action.  My question is, is there a simpler way to do 
> this?
>   Maybe some switch I'm not aware of that will automatically throw any
> exceptions to a top level class?   Thanks.

Turn off default error handling and it will jump to the top :) (or out 
if none at top level rule). :)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list