[antlr-interest] how to bail on MissingTokenException
Geoff hendrey
geoff_hendrey at yahoo.com
Mon Oct 27 18:16:10 PDT 2008
Sorry to repost my question, but I'm very eager to get a response on how to make the parser bail out (abort) on MissingTokenException.
Any advice?
----- Forwarded Message ----
From: Geoff hendrey <geoff_hendrey at yahoo.com>
To: antlr-interest at antlr.org
Sent: Sunday, October 26, 2008 5:02:53 PM
Subject: how to bail on MissingTokenException
Hi,
I recently upgraded to ANTLR 3.1.1.
I want to know how to handle MissingTokenException, so that the paring throws a RecognitionException when there is a missing token.
My grammar file aready has this:
@members{
protected void mismatch(IntStream input, int ttype, BitSet follow)throws RecognitionException{
throw new MismatchedTokenException(ttype, input);
}
public Object recoverFromMismatchedSet(IntStream input, RecognitionException e, BitSet follow)throws RecognitionException{
throw e;
}
}
@rulecatch{
catch(RecognitionException e){
throw e;
}
Can you tell me what to add so that MissingTokenException will throw a RecognitionException and abort the parsing?
(also, this is a bit of a tangent, but why do you document the ANTLR runtime API's Java Classes using Doxygen? I find it much harder to read and navigate than JavaDoc. Are JavaDocs available?)
-geoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081027/ed4a2527/attachment.html
More information about the antlr-interest
mailing list