[antlr-interest] how to bail on MissingTokenException

Geoff hendrey geoff_hendrey at yahoo.com
Sun Oct 26 17:02:53 PDT 2008


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/20081026/8643706b/attachment.html 


More information about the antlr-interest mailing list