fix how decision numbers set in lexer nfas

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6819]
This commit is contained in:
parrt 2010-04-20 16:13:38 -08:00
parent 55899d032c
commit 41c0225adf
2 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package org.antlr.v4.analysis;
import org.antlr.v4.automata.DFA;
import org.antlr.v4.automata.DecisionState;
import org.antlr.v4.automata.TokensStartState;
import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.LexerGrammar;
@ -25,12 +26,11 @@ public class AnalysisPipeline {
void processLexer() {
LexerGrammar lg = (LexerGrammar)g;
int d = 0;
for (String modeName : lg.modes.keySet()) {
LexerNFAToDFAConverter conv = new LexerNFAToDFAConverter(lg);
DFA dfa = conv.createDFA(modeName);
g.setLookaheadDFA(d, dfa);
d++;
TokensStartState startState = g.nfa.modeToStartState.get(modeName);
g.setLookaheadDFA(startState.decision, dfa);
if ( g.tool.minimizeDFA ) {
int before = dfa.stateSet.size();

View File

@ -19,6 +19,7 @@ public class LexerNFAFactory extends ParserNFAFactory {
TokensStartState startState =
(TokensStartState)newState(TokensStartState.class, null);
nfa.modeToStartState.put(modeName, startState);
nfa.defineDecisionState(startState);
}
// CREATE NFA FOR EACH RULE