add exception to recover()

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9287]
This commit is contained in:
parrt 2011-11-10 12:21:08 -08:00
parent b6d8ff9234
commit fbbf74bc4e
2 changed files with 5 additions and 3 deletions

View File

@ -48,9 +48,11 @@ public interface ANTLRErrorStrategy {
/** Resynchronize the parser by consuming tokens until we find one
* in the resynchronization set--loosely the set of tokens that can follow
* the current rule.
* the current rule. The exception contains info you might want to
* use to recover better.
*/
void recover(BaseRecognizer recognizer);
void recover(BaseRecognizer recognizer,
RecognitionException e);
/** Make sure that the current lookahead symbol is consistent with
* what were expecting at this point in the ATN. You can call this

View File

@ -103,7 +103,7 @@ public class DefaultANTLRErrorStrategy implements ANTLRErrorStrategy {
* token that the match() routine could not recover from.
*/
@Override
public void recover(BaseRecognizer recognizer) {
public void recover(BaseRecognizer recognizer, RecognitionException e) {
// System.out.println("recover in "+recognizer.getRuleInvocationStack()+
// " index="+recognizer.getInputStream().index()+
// ", lastErrorIndex="+