Improved handling of (potentially) null fields
This commit is contained in:
parent
4c4f767d17
commit
2f0029a040
|
@ -126,7 +126,8 @@ public class DefaultErrorStrategy implements ANTLRErrorStrategy {
|
|||
// lastErrorIndex+
|
||||
// ", states="+lastErrorStates);
|
||||
if ( lastErrorIndex==recognizer.getInputStream().index() &&
|
||||
lastErrorStates.contains(recognizer._ctx.s) ) {
|
||||
lastErrorStates != null &&
|
||||
lastErrorStates.contains(recognizer._ctx.s) ) {
|
||||
// uh oh, another error at same token index and previously-visited
|
||||
// state in ATN; must be a case where LT(1) is in the recovery
|
||||
// token set so nothing got consumed. Consume a single token
|
||||
|
|
|
@ -130,6 +130,10 @@ public abstract class Lexer extends Recognizer<Integer, LexerATNSimulator>
|
|||
*/
|
||||
@Override
|
||||
public Token nextToken() {
|
||||
if (_input == null) {
|
||||
throw new IllegalStateException("nextToken requires a non-null input stream.");
|
||||
}
|
||||
|
||||
if (_hitEOF) {
|
||||
emitEOF();
|
||||
return _token;
|
||||
|
|
Loading…
Reference in New Issue