You need to repeat some of that for the lexer. Using the @lexer::members syntax if you're going to do it as a combined lexer/parser grammar (I always separate mine to keep my mental working set smaller). If you don't do the lexer, you can have a lex error and recover from it, but this should catch all of the parse errors.
Kirby On Mon, Mar 15, 2010 at 3:32 PM, Andrew Haritonkin <[email protected]> wrote: > For Java and C# target add this in the beginning of the grammar but > after grammar statement: > > grammar grammar1; > > @members { > protected override object RecoverFromMismatchedToken(IIntStream input, > int ttype, BitSet follow) > { > throw new MismatchedTokenException(ttype, input); > } > public override object RecoverFromMismatchedSet(IIntStream input, > RecognitionException e, BitSet follow) > { > throw e; > } > } > > @rulecatch { > catch (RecognitionException e) > { > throw e; > } > } > > Hope it helps, > Andrew > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
