Package | Description |
---|---|
org.antlr.analysis | |
org.antlr.codegen | |
org.antlr.tool |
Modifier and Type | Field and Description |
---|---|
protected DFAState[] |
DFA.altToAcceptState
We only want one accept state per predicted alt; track here
|
DFAState |
AnalysisRecursionOverflowException.ovfState |
DFAState |
DFA.startState
What's the start state for this DFA?
|
Modifier and Type | Field and Description |
---|---|
protected Set<DFAState> |
DecisionProbe.danglingStates
The set of states w/o emanating edges and w/o resolving sem preds.
|
protected Vector<DFAState> |
DFA.states
Maps the state number to the actual DFAState.
|
protected Set<DFAState> |
DecisionProbe.statesResolvedWithSemanticPredicatesSet
Was a syntactic ambiguity resolved with predicates? Any DFA
state that predicts more than one alternative, must be resolved
with predicates or it should be reported to the user.
|
protected Set<DFAState> |
DecisionProbe.statesWithSyntacticallyAmbiguousAltsSet
Track all DFA states with nondeterministic alternatives.
|
protected Map<DFAState,Map<Integer,SemanticContext>> |
DecisionProbe.stateToAltSetWithSemanticPredicatesMap
Track the predicates for each alt per DFA state;
more than one DFA state might have syntactically ambig alt prediction.
|
protected Map<DFAState,Map<Integer,Set<antlr.Token>>> |
DecisionProbe.stateToIncompletelyCoveredAltsMap
Tracks alts insufficiently covered.
|
protected Map<DFAState,Set<Integer>> |
DecisionProbe.stateToSyntacticallyAmbiguousTokensRuleAltsMap
Track just like stateToSyntacticallyAmbiguousAltsMap, but only
for nondeterminisms that arise in the Tokens rule such as keyword vs
ID rule.
|
protected Map<DFAState,DFAState> |
DFA.uniqueStates
A set of all uniquely-numbered DFA states.
|
protected Map<DFAState,DFAState> |
DFA.uniqueStates
A set of all uniquely-numbered DFA states.
|
Modifier and Type | Method and Description |
---|---|
protected DFAState |
NFAToDFAConverter.addDFAStateToWorkList(DFAState d)
Add a new DFA state to the DFA if not already present.
|
protected DFAState |
DFA.addState(DFAState d)
Add a new DFA state to this DFA if not already present.
|
protected DFAState |
NFAToDFAConverter.computeStartState()
From this first NFA state of a decision, create a DFA.
|
protected DFAState |
NFAToDFAConverter.convertToAcceptState(DFAState d,
int alt) |
DFAState |
DFA.getAcceptState(int alt) |
DFAState |
DFA.getState(int stateNumber) |
DFAState |
DFA.newState() |
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.
|
Modifier and Type | Method and Description |
---|---|
Map<DFAState,DFAState> |
DFA.getUniqueStates() |
Map<DFAState,DFAState> |
DFA.getUniqueStates() |
Modifier and Type | Method and Description |
---|---|
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,
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 Set |
DecisionProbe.getDFAPathStatesToTarget(DFAState targetState) |
Set |
DecisionProbe.getDisabledAlternatives(DFAState d)
Which alts were specifically turned off to resolve nondeterminisms?
This is different than the unreachable alts.
|
Map<Integer,Set<antlr.Token>> |
DecisionProbe.getIncompletelyCoveredAlts(DFAState d)
Return a list of alts whose predicate context was insufficient to
resolve a nondeterminism for state d.
|
List |
DecisionProbe.getNonDeterministicAltsForState(DFAState targetState)
Return the sorted list of alts that conflict within a single state.
|
protected Map<Integer,SemanticContext> |
NFAToDFAConverter.getPredicatesPerNonDeterministicAlt(DFAState d,
Set nondeterministicAlts)
Return a mapping from nondeterministc alt to combined list of predicates.
|
List<Label> |
DecisionProbe.getSampleNonDeterministicInputSequence(DFAState targetState)
Return a List
|
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,
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,
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,
Map<Integer,Set<antlr.Token>> altToLocationsReachableWithoutPredicate) |
void |
DecisionProbe.reportLexerRuleNondeterminism(DFAState d,
Set<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,
Set<Integer> nondeterministicAlts) |
void |
DecisionProbe.reportNondeterminismResolvedWithSemanticPredicate(DFAState d) |
void |
DecisionProbe.reportRecursionOverflow(DFAState d,
NFAConfiguration recursionNFAConfiguration) |
protected int |
NFAToDFAConverter.resolveByChoosingFirstAlt(DFAState d,
Set nondeterministicAlts) |
protected int |
NFAToDFAConverter.resolveByPickingExitAlt(DFAState d,
Set nondeterministicAlts)
Resolve state d by choosing exit alt, which is same value as the
number of alternatives.
|
protected int |
NFAToDFAConverter.resolveByPickingMinAlt(DFAState d,
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,
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,
Set<Integer> nondeterministicAlts)
turn off all states associated with alts other than the good one
(as long as they are one of the nondeterministic ones)
|
Constructor and Description |
---|
AnalysisRecursionOverflowException(DFAState ovfState,
NFAConfiguration proposedNFAConfiguration) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
CodeGenerator.canGenerateSwitch(DFAState s)
You can generate a switch rather than if-then-else for a DFA state
if there are no semantic predicates and the number of edge label
values is small enough; e.g., don't generate a switch for a state
containing an edge label such as 20..52330 (the resulting byte codes
would overflow the method 65k limit probably).
|
org.antlr.stringtemplate.StringTemplate |
CodeGenerator.generateSpecialState(DFAState s)
A special state is huge (too big for state tables) or has a predicated
edge.
|
protected org.antlr.stringtemplate.StringTemplate |
ACyclicDFACodeGenerator.walkFixedDFAGeneratingStateMachine(org.antlr.stringtemplate.StringTemplateGroup templates,
DFA dfa,
DFAState s,
int k) |
Modifier and Type | Field and Description |
---|---|
DFAState |
GrammarInsufficientPredicatesMessage.problemState |
DFAState |
GrammarDanglingStateMessage.problemState |
DFAState |
GrammarNonDeterminismMessage.problemState |
DFAState |
RecursionOverflowMessage.sampleBadState |
Modifier and Type | Method and Description |
---|---|
static void |
ErrorManager.danglingState(DecisionProbe probe,
DFAState d) |
static void |
ErrorManager.insufficientPredicates(DecisionProbe probe,
DFAState d,
Map<Integer,Set<antlr.Token>> altToUncoveredLocations) |
static void |
ErrorManager.nondeterminism(DecisionProbe probe,
DFAState d) |
static void |
ErrorManager.recursionOverflow(DecisionProbe probe,
DFAState sampleBadState,
int alt,
Collection targetRules,
Collection callSiteStates) |
protected void |
DOTGenerator.walkCreatingDFADOT(org.antlr.stringtemplate.StringTemplate dot,
DFAState s)
Do a depth-first walk of the state machine graph and
fill a DOT description template.
|
Constructor and Description |
---|
GrammarDanglingStateMessage(DecisionProbe probe,
DFAState problemState) |
GrammarInsufficientPredicatesMessage(DecisionProbe probe,
DFAState problemState,
Map<Integer,Set<antlr.Token>> altToLocations) |
GrammarNonDeterminismMessage(DecisionProbe probe,
DFAState problemState) |
RecursionOverflowMessage(DecisionProbe probe,
DFAState sampleBadState,
int alt,
Collection targetRules,
Collection callSiteStates) |
Copyright © 2020. All rights reserved.