[antlr-interest] What if you want errors to exit the parser? (v3)

Robert Hill rob.hill at blueyonder.co.uk
Mon Oct 30 13:24:59 PST 2006


Thanks Ter, that's sorted it, I added a specific clause for the failed
predicate exception, although the recognition exception catch also caught
that too.. I assume its derived.
Anyhoo, its sorted :)

Cheers!

Rob


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Terence Parr
> Sent: 30 October 2006 21:02
> To: ANTLR Interest
> Subject: [antlr-interest] What if you want errors to exit the parser? (v3)
> 
> currently, you can specify what to do upon exception.
> 
> @rulecatch {
> catch (RecognitionException e) {
>          throw e;
> }
> }
> will change the default code generated at the end of each rule's
> method that reports and recovers:
> 
> catch (RecognitionException re) {
>          reportError(re);
>          recover(input,re);
> }
> 
> but, it tries to recover from token mismatches by insertion/
> deletion....do we need an option afterall to tell ANTLR to let errors
> cause exceptions in middle of alts?
> 
> Ter




More information about the antlr-interest mailing list