fix #1177 (LB(k) stops at index 0) @antlr/antlr-targets might care about this

This commit is contained in:
parrt 2016-12-10 14:05:31 -08:00
parent 9ef75603ce
commit 0a7e90fe8e
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ public class CommonTokenStream extends BufferedTokenStream {
int i = p;
int n = 1;
// find k good tokens looking backwards
while ( n<=k ) {
while ( n<=k && i>0 ) {
// skip off-channel tokens
i = previousTokenOnChannel(i - 1, channel);
n++;