Remove unnecessary array indexing operation in execDFA

This commit is contained in:
Sam Harwell 2012-10-29 11:49:40 -05:00
parent c34f0d6945
commit 0deadc688a
1 changed files with 6 additions and 4 deletions

View File

@ -229,15 +229,17 @@ public class LexerATNSimulator extends ATNSimulator {
System.out.format("state %d LA(1)==%s\n", s.stateNumber, getTokenName(t)); System.out.format("state %d LA(1)==%s\n", s.stateNumber, getTokenName(t));
} }
DFAState target = null;
if (s.edges != null && t > IntStream.EOF && t < s.edges.length) {
target = s.edges[t];
}
// if no edge, pop over to ATN interpreter, update DFA and return // if no edge, pop over to ATN interpreter, update DFA and return
if ( s.edges == null || t >= s.edges.length || t <= IntStream.EOF || if (target == null) {
s.edges[t] == null )
{
ATN_failover++; ATN_failover++;
return failOverToATN(input, s); return failOverToATN(input, s);
} }
DFAState target = s.edges[t];
if ( target == ERROR ) break; if ( target == ERROR ) break;
s = target; s = target;