Only create a new ATNConfigSet for reach when no DFA edge is available

This commit is contained in:
Sam Harwell 2012-03-13 18:14:50 -05:00
parent 9d774c6543
commit 83c680850e
1 changed files with 4 additions and 3 deletions

View File

@ -253,8 +253,7 @@ public class LexerATNSimulator extends ATNSimulator {
System.out.format("start state closure=%s\n", closure);
}
@NotNull
ATNConfigSet reach = new ATNConfigSet();
ATNConfigSet reach = null;
traceLookahead1();
int t = input.LA(1);
@ -297,6 +296,8 @@ public class LexerATNSimulator extends ATNSimulator {
}
if (target == null) {
reach = new ATNConfigSet();
// if we don't find an existing DFA state
// Fill reach starting from closure, following t transitions
getReachableConfigSet(closure, reach, t);
@ -330,7 +331,7 @@ public class LexerATNSimulator extends ATNSimulator {
t = input.LA(1);
closure = reach;
reach = new ATNConfigSet();
reach = null;
s = target; // flip; current DFA target becomes new src/from state
}