[antlr-interest] Capturing lexer exceptions

Terence Parr parrt at cs.usfca.edu
Tue Oct 31 07:43:05 PST 2006


On Oct 31, 2006, at 4:41 AM, Gerz, Michael wrote:

> Terence,
>
> I am sorry for bothering you again but my project team is still  
> struggling with ANTLR's clever error recovery.
>
> Our problem is that we don't want ANTLR to do any error handling at  
> all. This includes errors thrown by the lexer. My colleague didn't  
> find a way to make her ANTLR parser _not_ to catch lexer exceptions.
>
> Unfortunately, the ANTLR 3 wiki (http://www.antlr.org/wiki/display/ 
> ANTLR3/Migrating+from+ANTLR+2+to+ANTLR+3) doesn't answer the  
> question how to ignore lexer exceptions (and you can no longer set  
> "defaultErrorHandler=false").
>
> Terence, could you please speak to us?

I would subclass and override nextToken() to not catch the  
exceptions.  That said, I posted email yesterday to which no one  
responded about how to deal with the error recovery that does inline  
insert/delete of tokens/chars.  Not sure if we need an option or what.

Ter



More information about the antlr-interest mailing list