forked from jasder/antlr
let it consume EOF since we sometimes need to match that during prediction
This commit is contained in:
parent
74754d04a2
commit
643edf0263
|
@ -75,7 +75,7 @@ public class UnbufferedCharStream implements CharStream {
|
|||
/**
|
||||
* This is the {@code LA(-1)} character for the current position.
|
||||
*/
|
||||
protected int lastChar = -1;
|
||||
protected int lastChar = -2; // can't be -1 (EOF)
|
||||
|
||||
/**
|
||||
* When {@code numMarkers > 0}, this is the {@code LA(-1)} character for the
|
||||
|
@ -129,7 +129,7 @@ public class UnbufferedCharStream implements CharStream {
|
|||
|
||||
@Override
|
||||
public void consume() {
|
||||
if (LA(1) == CharStream.EOF) {
|
||||
if ( lastChar == CharStream.EOF ) {
|
||||
throw new IllegalStateException("cannot consume EOF");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue