Move Recognizer._errHandler to Parser class

This commit is contained in:
Sam Harwell 2012-02-23 12:17:06 -06:00
parent 1c8efd6a48
commit e400f5b1a1
2 changed files with 10 additions and 6 deletions

View File

@ -53,6 +53,8 @@ public abstract class Parser extends Recognizer<Token, ParserATNSimulator<Token>
}
}
protected ANTLRErrorStrategy _errHandler = new DefaultErrorStrategy();
protected TokenStream _input;
/** The RuleContext object for the currently executing rule. This
@ -204,6 +206,14 @@ public abstract class Parser extends Recognizer<Token, ParserATNSimulator<Token>
_errHandler.setTokenFactory(factory);
}
public ANTLRErrorStrategy getErrorHandler() {
return _errHandler;
}
public void setErrorHandler(ANTLRErrorStrategy handler) {
this._errHandler = handler;
}
@Override
public TokenStream getInputStream() { return getTokenStream(); }

View File

@ -41,8 +41,6 @@ import java.util.List;
public abstract class Recognizer<Symbol, ATNInterpreter extends ATNSimulator> {
public static final int EOF=-1;
protected ANTLRErrorStrategy _errHandler = new DefaultErrorStrategy();
private List<ANTLRErrorListener<? super Symbol>> _listeners;
protected ATNInterpreter _interp;
@ -118,10 +116,6 @@ public abstract class Recognizer<Symbol, ATNInterpreter extends ATNSimulator> {
return new ArrayList<ANTLRErrorListener<? super Symbol>>(_listeners);
}
public ANTLRErrorStrategy getErrorHandler() { return _errHandler; }
public void setErrorHandler(ANTLRErrorStrategy h) { this._errHandler = h; }
// subclass needs to override these if there are sempreds or actions
// that the ATN interp needs to execute
public boolean sempred(@Nullable RuleContext _localctx, int ruleIndex, int actionIndex) {