forked from jasder/antlr
Throw IllegalStateException if the user tries to consume EOF
This commit is contained in:
parent
cf5bf7c384
commit
c9890e8305
|
@ -144,6 +144,11 @@ public class ANTLRInputStream implements CharStream {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void consume() {
|
public void consume() {
|
||||||
|
if (p >= n) {
|
||||||
|
assert LA(1) == CharStream.EOF;
|
||||||
|
throw new IllegalStateException("cannot consume EOF");
|
||||||
|
}
|
||||||
|
|
||||||
//System.out.println("prev p="+p+", c="+(char)data[p]);
|
//System.out.println("prev p="+p+", c="+(char)data[p]);
|
||||||
if ( p < n ) {
|
if ( p < n ) {
|
||||||
p++;
|
p++;
|
||||||
|
|
Loading…
Reference in New Issue