Remove unnecessary duplicate conditions

This commit is contained in:
Sam Harwell 2013-04-18 12:35:15 -05:00
parent 3defe6a2b1
commit 74f4938033
1 changed files with 23 additions and 31 deletions

View File

@ -328,8 +328,7 @@ public class ParserATNSimulator extends ATNSimulator {
// Now we are certain to have a specific decision's DFA
// But, do we still need an initial state?
if ( dfa.s0==null ) { // recheck
if ( dfa.s0==null ) { // recheck
if ( dfa.s0==null ) {
try {
return predictATN(dfa, input, outerContext);
}
@ -337,8 +336,6 @@ public class ParserATNSimulator extends ATNSimulator {
mergeCache = null; // wack cache after each prediction
}
}
// fall through; another thread set dfa.s0 while we waited for lock
}
// We can start with an existing DFA
int m = input.mark();
@ -467,9 +464,6 @@ public class ParserATNSimulator extends ATNSimulator {
" at DFA state "+s.stateNumber);
}
//TODO: recheck synchronization here. don't need if no sync
// recheck; another thread might have added edge
if ( s.edges == null || t >= s.edges.length || t < -1 || s.edges[t+1] == null ) {
alt = execATN(dfa, s, input, startIndex, outerContext);
// this adds edge even if next state is accept for
// same alt; e.g., s0-A->:s1=>2-B->:s2=>2
@ -490,8 +484,6 @@ public class ParserATNSimulator extends ATNSimulator {
" predicts "+alt);
return alt; // we've updated DFA, exec'd action, and have our deepest answer
}
// fall through; another thread gave us the edge
}
DFAState target = s.edges[t+1];
if ( target == ERROR ) {
throw noViableAlt(input, outerContext, s.configs, startIndex);