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

Geoff hendrey geoff_hendrey at yahoo.com
Wed Oct 29 12:53:27 PDT 2008


Can someone on the list at least "ack" this question. Is it a really stupid question or something? I have searched as many available forms of documentation as I can find, including the Antlr printed book, and I can't find the answer. Please, pretty please with sugar on top, can someone point me to the answer? (original posts below)



----- Forwarded Message ----
From: Geoff hendrey <geoff_hendrey at yahoo.com>
To: antlr-interest at antlr.org
Sent: Monday, October 27, 2008 6:16:10 PM
Subject: how to bail on MissingTokenException


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/20081029/8d3098a0/attachment.html 


More information about the antlr-interest mailing list