public DFA createLL_1_LookaheadDFA(int decision) {
Decision d = getDecision(decision);
String enclosingRule = d.startState.enclosingRule.name;
Rule r = d.startState.enclosingRule;
NFAState decisionStartState = getDecisionNFAStartState(decision);
if ( composite.watchNFAConversion ) {
System.out.println("--------------------\nattempting LL(1) DFA (d="
+decisionStartState.getDecisionNumber()+") for "+
decisionStartState.getDescription());
}
if ( r.isSynPred && !synPredNamesUsedInDFA.contains(enclosingRule) ) {
return null;
}
// compute lookahead for each alt
int numAlts = getNumberOfAltsForDecisionNFA(decisionStartState);
LookaheadSet[] altLook = new LookaheadSet[numAlts+1];
for (int alt = 1; alt <= numAlts; alt++) {
int walkAlt =
decisionStartState.translateDisplayAltToWalkAlt(alt);
NFAState altLeftEdge = getNFAStateForAltOfDecision(decisionStartState, walkAlt);
NFAState altStartState = (NFAState)altLeftEdge.transition[0].target;
//System.out.println("alt "+alt+" start state = "+altStartState.stateNumber);
altLook[alt] = ll1Analyzer.LOOK(altStartState);
//System.out.println("alt "+alt+": "+altLook[alt].toString(this));
}