ParserInterpreter handles RecognitionException in the same way as the generated code

This commit is contained in:
Sam Harwell 2014-01-26 11:50:46 -06:00
parent ddbd7086b8
commit daf793b1c1
1 changed files with 10 additions and 1 deletions

View File

@ -156,7 +156,16 @@ public class ParserInterpreter extends Parser {
break; break;
default : default :
try {
visitState(p); visitState(p);
}
catch (RecognitionException e) {
setState(atn.ruleToStopState[p.ruleIndex].stateNumber);
getContext().exception = e;
getErrorHandler().reportError(this, e);
getErrorHandler().recover(this, e);
}
break; break;
} }
} }