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

Terence Parr parrt at cs.usfca.edu
Mon Oct 30 13:01:35 PST 2006


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