[antlr-interest] (POST THIRD TIME) how to bail on MissingTokenException

Terence Parr parrt at cs.usfca.edu
Thu Oct 30 10:55:51 PDT 2008


Missing comes from the automatic in-line error recovery. You need to  
override

	protected Object recoverFromMismatchedToken(IntStream input, int  
ttype, BitSet follow)

just throw an exception. make sure you don't catch anything later...  
this should be in the book under how to make the parser bail on first  
exception.
Ter
On Oct 29, 2008, at 9:25 PM, Geoff hendrey wrote:

> Hi,
>
> thanks for the response, I really appreciate it. Do you mean  
> "mismatch" or "missing"? Just to be sure we are on the same page, I  
> am getting a MissingTokenException, not MismatchedTokenException. My  
> grammar file already deals with MismatchedTokenException, nd I have  
> no problem with that. I need to find out how to abort parsing on  
> MISSINGTokenException.
>
> Thanks, and sorry for using caps and bold. Just wanted to make sure  
> we are on the same page.
>
> -geoff
>
>
>
> From: Terence Parr <parrt at cs.usfca.edu>
> To: Geoff hendrey <geoff_hendrey at yahoo.com>
> Cc: antlr-interest at antlr.org
> Sent: Wednesday, October 29, 2008 12:58:28 PM
> Subject: Re: [antlr-interest] (POST THIRD TIME) how to bail on  
> MissingTokenException
>
> Hi Geoff, isn't there something in the source code that says "  
> override me if you want to turn off automatic in-line error recovery  
> for mismatch token"?
> Ter
>
> 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