Fix ANTLRInputStream cannot seek to end of input

This commit is contained in:
Sam Harwell 2014-01-13 22:13:27 -06:00
parent 5c80db61ea
commit 715fe67fce
1 changed files with 3 additions and 2 deletions

View File

@ -216,8 +216,9 @@ public class ANTLRInputStream implements CharStream {
p = index; // just jump; don't update stream state (line, ...)
return;
}
// seek forward, consume until p hits index
while ( p<index && index<n ) {
// seek forward, consume until p hits index or n (whichever comes first)
index = Math.min(index, n);
while ( p<index ) {
consume();
}
}