[antlr-interest] RecognitionException in antlr3 (FIXED)

Dominique.Duflos at alcatel-lucent.fr Dominique.Duflos at alcatel-lucent.fr
Mon Sep 24 02:43:28 PDT 2007


How do I get the antlr3 parser to throw an exception when something is
wrong in the input ?

Add this to the grammar:

@rulecatch {
}
@members {
protected void mismatch(IntStream input, int ttype, BitSet follow)
   throws RecognitionException
{
   throw new MismatchedTokenException(ttype, input);
}
}




More information about the antlr-interest mailing list