Avoid calling consume() at EOF

This commit is contained in:
Sam Harwell 2012-11-03 15:16:29 -05:00
parent c9890e8305
commit fbaac8194b
1 changed files with 11 additions and 3 deletions

View File

@ -265,10 +265,16 @@ public class LexerATNSimulator extends ATNSimulator {
if (target.isAcceptState) {
captureSimState(prevAccept, input, target);
if (t == IntStream.EOF) {
break;
}
}
if (t != IntStream.EOF) {
consume(input);
t = input.LA(1);
}
s = target; // flip; current DFA target becomes new src/from state
}
@ -342,8 +348,10 @@ public class LexerATNSimulator extends ATNSimulator {
input.seek(index);
this.line = line;
this.charPositionInLine = charPos;
if (input.LA(1) != IntStream.EOF) {
consume(input);
}
}
@Nullable
public ATNState getReachableTarget(Transition trans, int t) {