[antlr-interest] Re: exceptions in the lexer

Paul J. Lucas pauljlucas at mac.com
Fri Dec 10 13:18:53 PST 2004



--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
> 
> On Dec 6, 2004, at 5:58 PM, Don Caton wrote:
> > What's the point of this?  TokenStreamRecognitionException simply 
> > wraps a
> > RecognitionException and does not appear to add any useful 
> > functionality.
> 
> I believe I wanted TokenStream.nextToken() to be independent of the 
> normal recognition errors etc... found in antlr's lexers; might be 
> using another tool.

I'll add to the complaint about TokenStreamRecognitionException.  The default parser 
recovery code only catches RecognitionException, so if a 
TokenStreamRecognitionException is thrown, it bypasses my nice recovery mechanism.  
This apparently means that, every place I catch a RecognitionException to recover, I must 
also now catch a TokenStreamRecognitionException.

Sigh...

Either TokenStreamRecognitionException needs to go away or the auto-generated parser 
recovery code needs to catch TokenStreamRecognitionException in addition to 
RecognitionException (and do the same recovery stuff).

- Paul





 
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