Cannot call IntStream.consume after EOF is reached

This commit is contained in:
Sam Harwell 2013-01-02 08:30:25 -06:00
parent e3383ecb61
commit 2080be8a14
1 changed files with 11 additions and 5 deletions

View File

@ -510,7 +510,7 @@ public class ParserATNSimulator extends ATNSimulator {
throw noViableAlt(input, outerContext, s.configs, startIndex);
}
s = target;
if (!s.requiresFullContext && !s.isAcceptState) {
if (!s.requiresFullContext && !s.isAcceptState && t != IntStream.EOF) {
input.consume();
t = input.LA(1);
}
@ -742,8 +742,11 @@ public class ParserATNSimulator extends ATNSimulator {
previous = reach;
previousD = D;
input.consume();
t = input.LA(1);
if (t != IntStream.EOF) {
input.consume();
t = input.LA(1);
}
}
}
@ -846,9 +849,12 @@ public class ParserATNSimulator extends ATNSimulator {
// we're not sure what the ambiguity is yet.
// So, keep going.
}
previous = reach;
input.consume();
t = input.LA(1);
if (t != IntStream.EOF) {
input.consume();
t = input.LA(1);
}
}
// If the configuration set uniquely predicts an alternative,