protected DFAState
NFAToDFAConverter. addDFAStateToWorkList (DFAState d)
Add a new DFA state to the DFA if not already present.
protected void
NFAToDFAConverter. addPredicateTransitions (DFAState d)
for each NFA config in d, look for "predicate required" sign set
during nondeterminism resolution.
protected DFAState
DFA. addState (DFAState d)
Add a new DFA state to this DFA if not already present.
int
DFAState. addTransition (DFAState target,
Label label)
Add a transition from this state to target with label.
protected static int
NFAToDFAConverter. addTransition (DFAState d,
Label label,
DFAState targetState,
java.util.Map targetToLabelMap)
Add a transition from state d to targetState with label in normal case.
void
NFAToDFAConverter. closure (DFAState d)
For all NFA states (configurations) merged in d,
compute the epsilon closure; that is, find all NFA states reachable
from the NFA states in d via purely epsilon transitions.
void
NFAToDFAConverter. closure (NFAState p,
int alt,
NFAContext context,
SemanticContext semanticContext,
DFAState d,
boolean collectPredicates)
Where can we get from NFA state p traversing only epsilon transitions?
Add new NFA states + context to DFA state d.
static boolean
NFAToDFAConverter. closureIsBusy (DFAState d,
NFAConfiguration proposedNFAConfiguration)
A closure operation should abort if that computation has already
been done or a computation with a conflicting context has already
been done.
protected DFAState
NFAToDFAConverter. convertToAcceptState (DFAState d,
int alt)
protected void
NFAToDFAConverter. convertToEOTAcceptState (DFAState d)
Walk the configurations of this DFA state d looking for the
configuration, c, that has a transition on EOT.
protected void
DFA. createEOTAndEOFTables (DFAState s)
Set up the EOT and EOF tables; we cannot put -1 min/max values so
we need another way to test that in the DFA transition function.
protected void
DFA. createMinMaxTables (DFAState s)
protected void
DFA. createSpecialTable (DFAState s)
protected void
DFA. createTransitionTableEntryForState (DFAState s)
protected boolean
DFA. doesStateReachAcceptState (DFAState d)
figure out if this state eventually reaches an accept state and
modify the instance variable 'reduced' to indicate if we find
at least one state that cannot reach an accept state.
protected void
NFAToDFAConverter. findNewDFAStatesAndAddDFATransitions (DFAState d)
From this node, add a d--a-->t transition for all
labels 'a' where t is a DFA node created
from the set of NFA states reachable from any NFA
state in DFA state d.
protected java.util.Set
DecisionProbe. getDFAPathStatesToTarget (DFAState targetState)
java.util.Set
DecisionProbe. getDisabledAlternatives (DFAState d)
Which alts were specifically turned off to resolve nondeterminisms?
This is different than the unreachable alts.
java.util.Map<java.lang.Integer,java.util.Set<antlr.Token>>
DecisionProbe. getIncompletelyCoveredAlts (DFAState d)
Return a list of alts whose predicate context was insufficient to
resolve a nondeterminism for state d.
java.util.List
DecisionProbe. getNonDeterministicAltsForState (DFAState targetState)
Return the sorted list of alts that conflict within a single state.
protected java.util.Map<java.lang.Integer,SemanticContext >
NFAToDFAConverter. getPredicatesPerNonDeterministicAlt (DFAState d,
java.util.Set nondeterministicAlts)
Return a mapping from nondeterministc alt to combined list of predicates.
java.util.List<Label >
DecisionProbe. getSampleNonDeterministicInputSequence (DFAState targetState)
Return a List indicating an input sequence that can be matched
from the start state of the DFA to the targetState (which is known
to have a problem).
SemanticContext
DecisionProbe. getSemanticContextForAlt (DFAState d,
int alt)
Each state in the DFA represents a different input sequence for an
alt of the decision.
protected void
DFAOptimizer. optimizeEOTBranches (DFAState d)
protected void
DFAOptimizer. optimizeExitBranches (DFAState d)
DFAState
NFAToDFAConverter. reach (DFAState d,
Label label)
Given the set of NFA states in DFA state d, find all NFA states
reachable traversing label arcs.
protected boolean
DecisionProbe. reachesState (DFAState startState,
DFAState targetState,
java.util.Set states)
Given a start state and a target state, return true if start can reach
target state.
void
DecisionProbe. removeRecursiveOverflowState (DFAState d)
If a recursion overflow is resolve with predicates, then we need
to shut off the warning that would be generated.
void
DFA. removeState (DFAState d)
void
DecisionProbe. reportAltPredicateContext (DFAState d,
java.util.Map altPredicateContext)
Report the list of predicates found for each alternative; copy
the list because this set gets altered later by the method
tryToResolveWithSemanticPredicates() while flagging NFA configurations
in d as resolved.
void
DecisionProbe. reportDanglingState (DFAState d)
Report the fact that DFA state d is not a state resolved with
predicates and yet it has no emanating edges.
void
DecisionProbe. reportIncompletelyCoveredAlts (DFAState d,
java.util.Map<java.lang.Integer,java.util.Set<antlr.Token>> altToLocationsReachableWithoutPredicate)
void
DecisionProbe. reportLexerRuleNondeterminism (DFAState d,
java.util.Set<java.lang.Integer> nondeterministicAlts)
Currently the analysis reports issues between token definitions, but
we don't print out warnings in favor of just picking the first token
definition found in the grammar ala lex/flex.
void
DecisionProbe. reportNondeterminism (DFAState d,
java.util.Set<java.lang.Integer> nondeterministicAlts)
void
DecisionProbe. reportNondeterminismResolvedWithSemanticPredicate (DFAState d)
void
DecisionProbe. reportRecursionOverflow (DFAState d,
NFAConfiguration recursionNFAConfiguration)
protected int
NFAToDFAConverter. resolveByChoosingFirstAlt (DFAState d,
java.util.Set nondeterministicAlts)
protected int
NFAToDFAConverter. resolveByPickingExitAlt (DFAState d,
java.util.Set nondeterministicAlts)
Resolve state d by choosing exit alt, which is same value as the
number of alternatives.
protected int
NFAToDFAConverter. resolveByPickingMinAlt (DFAState d,
java.util.Set nondeterministicAlts)
Turn off all configurations associated with the
set of incoming nondeterministic alts except the min alt number.
void
NFAToDFAConverter. resolveNonDeterminisms (DFAState d)
If > 1 NFA configurations within this DFA state have identical
NFA state and context, but differ in their predicted
TODO update for new context suffix stuff 3-9-2005
alternative then a single input sequence predicts multiple alts.
void
DFA. setAcceptState (int alt,
DFAState acceptState)
void
DFA. setState (int stateNumber,
DFAState d)
protected boolean
NFAToDFAConverter. tryToResolveWithSemanticPredicates (DFAState d,
java.util.Set nondeterministicAlts)
See if a set of nondeterministic alternatives can be disambiguated
with the semantic predicate contexts of the alternatives.
protected static void
NFAToDFAConverter. turnOffOtherAlts (DFAState d,
int min,
java.util.Set<java.lang.Integer> nondeterministicAlts)
turn off all states associated with alts other than the good one
(as long as they are one of the nondeterministic ones)