Do not cache the results of a failed predicate evaluation in the DFA (fixes #398)

This commit is contained in:
Sam Harwell 2014-01-09 06:52:13 -06:00
parent bf22a0af5b
commit 9432bfb746
1 changed files with 6 additions and 3 deletions

View File

@ -290,9 +290,12 @@ public class LexerATNSimulator extends ATNSimulator {
getReachableConfigSet(input, s.configs, reach, t);
if ( reach.isEmpty() ) { // we got nowhere on t from s
// we got nowhere on t, don't throw out this knowledge; it'd
// cause a failover from DFA later.
addDFAEdge(s, t, ERROR);
if (!reach.hasSemanticContext) {
// we got nowhere on t, don't throw out this knowledge; it'd
// cause a failover from DFA later.
addDFAEdge(s, t, ERROR);
}
// stop when we can't match any more char
return ERROR;
}