Bug: didn't stop at end of stream during consume()

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9794]
This commit is contained in:
parrt 2012-01-03 12:40:42 -08:00
parent 1d6bbb08c3
commit 5c328c7e3f
1 changed files with 4 additions and 1 deletions

View File

@ -67,9 +67,12 @@ public class CommonTokenStream extends BufferedTokenStream<CommonToken> {
if ( p == -1 ) setup();
p++;
sync(p);
while ( tokens.get(p).getChannel()!=channel ) {
CommonToken t = tokens.get(p);
int n = size();
while ( p<n && t.getChannel()!=channel ) {
p++;
sync(p);
t = tokens.get(p);
}
}