public class ProfilingATNSimulator extends ParserATNSimulator
Modifier and Type | Field and Description |
---|---|
protected int |
_llStopIndex |
protected int |
_sllStopIndex |
protected int |
conflictingAltResolvedBySLL
At the point of LL failover, we record how SLL would resolve the conflict so that
we can determine whether or not a decision / input pair is context-sensitive.
|
protected int |
currentDecision |
protected DFAState |
currentState |
protected DecisionInfo[] |
decisions |
protected int |
numDecisions |
_dfa, _input, _outerContext, _startIndex, debug, debug_list_atn_decisions, decisionToDFA, dfa_debug, mergeCache, parser, retry_debug, TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT
atn, ERROR, SERIALIZED_UUID, SERIALIZED_VERSION, sharedContextCache
Constructor and Description |
---|
ProfilingATNSimulator(Parser parser) |
Modifier and Type | Method and Description |
---|---|
int |
adaptivePredict(TokenStream input,
int decision,
ParserRuleContext outerContext) |
protected ATNConfigSet |
computeReachSet(ATNConfigSet closure,
int t,
boolean fullCtx) |
protected DFAState |
computeTargetState(DFA dfa,
DFAState previousD,
int t)
Compute a target state for an edge in the DFA, and attempt to add the
computed state and corresponding edge to the DFA.
|
protected boolean |
evalSemanticContext(SemanticContext pred,
ParserRuleContext parserCallStack,
int alt,
boolean fullCtx)
Evaluate a semantic context within a specific parser context.
|
DFAState |
getCurrentState() |
DecisionInfo[] |
getDecisionInfo() |
protected DFAState |
getExistingTargetState(DFAState previousD,
int t)
Get an existing target state for an edge in the DFA.
|
protected void |
reportAmbiguity(DFA dfa,
DFAState D,
int startIndex,
int stopIndex,
boolean exact,
BitSet ambigAlts,
ATNConfigSet configs)
If context sensitive parsing, we know it's ambiguity not conflict
|
protected void |
reportAttemptingFullContext(DFA dfa,
BitSet conflictingAlts,
ATNConfigSet configs,
int startIndex,
int stopIndex) |
protected void |
reportContextSensitivity(DFA dfa,
int prediction,
ATNConfigSet configs,
int startIndex,
int stopIndex) |
actionTransition, addDFAEdge, addDFAState, applyPrecedenceFilter, canDropLoopEntryEdgeInLeftRecursiveRule, clearDFA, closure_, closure, closureCheckingStopState, computeStartState, dumpDeadEndConfigs, evalSemanticContext, execATN, execATNWithFullContext, getAltThatFinishedDecisionEntryRule, getConflictingAlts, getConflictingAltsOrUniqueAlt, getEpsilonTarget, getLookaheadName, getParser, getPredicatePredictions, getPredictionMode, getPredsForAmbigAlts, getReachableTarget, getRuleName, getSafeEnv, getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule, getTokenName, getUniqueAlt, noViableAlt, precedenceTransition, predicateDFAState, predTransition, removeAllConfigsNotInRuleStopState, reset, ruleTransition, setPredictionMode, splitAccordingToSemanticValidity
checkCondition, checkCondition, deserialize, edgeFactory, getCachedContext, getSharedContextCache, stateFactory, toInt, toInt32, toLong, toUUID
protected final DecisionInfo[] decisions
protected int numDecisions
protected int _sllStopIndex
protected int _llStopIndex
protected int currentDecision
protected DFAState currentState
protected int conflictingAltResolvedBySLL
public ProfilingATNSimulator(Parser parser)
public int adaptivePredict(TokenStream input, int decision, ParserRuleContext outerContext)
adaptivePredict
in class ParserATNSimulator
protected DFAState getExistingTargetState(DFAState previousD, int t)
ParserATNSimulator
null
.getExistingTargetState
in class ParserATNSimulator
previousD
- The current DFA statet
- The next input symbolt
, or null
if the target state for this edge is not
already cachedprotected DFAState computeTargetState(DFA dfa, DFAState previousD, int t)
ParserATNSimulator
computeTargetState
in class ParserATNSimulator
dfa
- The DFApreviousD
- The current DFA statet
- The next input symbolt
. If t
does not lead to a valid DFA state, this method
returns ATNSimulator.ERROR
.protected ATNConfigSet computeReachSet(ATNConfigSet closure, int t, boolean fullCtx)
computeReachSet
in class ParserATNSimulator
protected boolean evalSemanticContext(SemanticContext pred, ParserRuleContext parserCallStack, int alt, boolean fullCtx)
ParserATNSimulator
This method might not be called for every semantic context evaluated during the prediction process. In particular, we currently do not evaluate the following but it may change in the future:
SemanticContext.PrecedencePredicate
) are not currently evaluated
through this method.SemanticContext.AND
and
SemanticContext.OR
) are evaluated as a single semantic
context, rather than evaluating the operands individually.
Implementations which require evaluation results from individual
predicates should override this method to explicitly handle evaluation of
the operands within operator predicates.evalSemanticContext
in class ParserATNSimulator
pred
- The semantic context to evaluateparserCallStack
- The parser context in which to evaluate the
semantic contextalt
- The alternative which is guarded by pred
fullCtx
- true
if the evaluation is occurring during LL
prediction; otherwise, false
if the evaluation is occurring
during SLL predictionprotected void reportAttemptingFullContext(DFA dfa, BitSet conflictingAlts, ATNConfigSet configs, int startIndex, int stopIndex)
reportAttemptingFullContext
in class ParserATNSimulator
protected void reportContextSensitivity(DFA dfa, int prediction, ATNConfigSet configs, int startIndex, int stopIndex)
reportContextSensitivity
in class ParserATNSimulator
protected void reportAmbiguity(DFA dfa, DFAState D, int startIndex, int stopIndex, boolean exact, BitSet ambigAlts, ATNConfigSet configs)
ParserATNSimulator
reportAmbiguity
in class ParserATNSimulator
public DecisionInfo[] getDecisionInfo()
public DFAState getCurrentState()
Copyright © 1992–2020 ANTLR. All rights reserved.