public class ProfilingATNSimulator extends ParserATNSimulator
| Modifier and Type | Field and Description |
|---|---|
protected TokenStream |
_input |
protected int |
_llStopIndex |
protected int |
_sllStopIndex |
protected int |
_startIndex |
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 SimulatorState |
currentState |
protected DecisionInfo[] |
decisions |
protected int |
numDecisions |
always_try_local_context, debug, dfa_debug, enable_global_context_dfa, force_global_context, optimize_hidden_conflicted_configs, optimize_ll1, optimize_tail_calls, optimize_unique_closure, parser, reportAmbiguities, retry_debug, tail_call_preserves_sll, treat_sllk1_conflict_as_ambiguity, userWantsCtxSensitiveatn, ERROR, RULE_LF_VARIANT_MARKER, RULE_NOLF_VARIANT_MARKER, RULE_VARIANT_DELIMITER, SERIALIZED_UUID, SERIALIZED_VERSION| Constructor and Description |
|---|
ProfilingATNSimulator(Parser parser) |
| Modifier and Type | Method and Description |
|---|---|
int |
adaptivePredict(TokenStream input,
int decision,
ParserRuleContext outerContext) |
protected SimulatorState |
computeReachSet(DFA dfa,
SimulatorState previous,
int t,
PredictionContextCache contextCache) |
protected SimulatorState |
computeStartState(DFA dfa,
ParserRuleContext globalContext,
boolean useContext) |
protected Tuple2<DFAState,ParserRuleContext> |
computeTargetState(DFA dfa,
DFAState s,
ParserRuleContext remainingGlobalContext,
int t,
boolean useContext,
PredictionContextCache contextCache)
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)
Evaluate a semantic context within a specific parser context.
|
SimulatorState |
getCurrentState() |
DecisionInfo[] |
getDecisionInfo() |
protected DFAState |
getExistingTargetState(DFAState previousD,
int t)
Get an existing target state for an edge in the DFA.
|
protected SimulatorState |
getStartState(DFA dfa,
TokenStream input,
ParserRuleContext outerContext,
boolean useContext) |
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,
SimulatorState conflictState,
int startIndex,
int stopIndex) |
protected void |
reportContextSensitivity(DFA dfa,
int prediction,
SimulatorState acceptState,
int startIndex,
int stopIndex) |
actionTransition, adaptivePredict, addDFAContextState, addDFAEdge, addDFAEdge, addDFAState, applyPrecedenceFilter, closure, closure, configWithAltAtStopState, createDFAState, dumpDeadEndConfigs, evalSemanticContext, execATN, execDFA, getConflictingAltsFromConfigSet, getEpsilonTarget, getLookaheadName, getParser, getPredicatePredictions, getPredictionMode, getPredsForAmbigAlts, getReachableTarget, getReturnState, getRuleName, getTokenName, getUniqueAlt, handleNoViableAlt, isAcceptState, noViableAlt, precedenceTransition, predicateDFAState, predTransition, removeAllConfigsNotInRuleStopState, reset, ruleTransition, setPredictionMode, skipTailCallscheckCondition, checkCondition, clearDFA, deserialize, edgeFactory, stateFactory, toInt, toInt32, toLong, toUUIDprotected final DecisionInfo[] decisions
protected int numDecisions
protected TokenStream _input
protected int _startIndex
protected int _sllStopIndex
protected int _llStopIndex
protected int currentDecision
protected SimulatorState currentState
protected int conflictingAltResolvedBySLL
public ProfilingATNSimulator(Parser parser)
public int adaptivePredict(TokenStream input, int decision, ParserRuleContext outerContext)
adaptivePredict in class ParserATNSimulatorprotected SimulatorState getStartState(DFA dfa, TokenStream input, ParserRuleContext outerContext, boolean useContext)
getStartState in class ParserATNSimulatorprotected SimulatorState computeStartState(DFA dfa, ParserRuleContext globalContext, boolean useContext)
computeStartState in class ParserATNSimulatorprotected SimulatorState computeReachSet(DFA dfa, SimulatorState previous, int t, PredictionContextCache contextCache)
computeReachSet in class ParserATNSimulatorprotected DFAState getExistingTargetState(DFAState previousD, int t)
ParserATNSimulatornull.getExistingTargetState in class ParserATNSimulatorpreviousD - The current DFA statet - The next input symbolt, or null if the target state for this edge is not
already cachedprotected Tuple2<DFAState,ParserRuleContext> computeTargetState(DFA dfa, DFAState s, ParserRuleContext remainingGlobalContext, int t, boolean useContext, PredictionContextCache contextCache)
ParserATNSimulatorcomputeTargetState in class ParserATNSimulators - The current DFA statet - The next input symbolt. If t does not lead to a valid DFA state, this method
returns ATNSimulator.ERROR.protected boolean evalSemanticContext(SemanticContext pred, ParserRuleContext parserCallStack, int alt)
ParserATNSimulatorThis 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 ParserATNSimulatorpred - The semantic context to evaluateparserCallStack - The parser context in which to evaluate the
semantic contextalt - The alternative which is guarded by predprotected void reportContextSensitivity(DFA dfa, int prediction, SimulatorState acceptState, int startIndex, int stopIndex)
reportContextSensitivity in class ParserATNSimulatorprotected void reportAttemptingFullContext(DFA dfa, BitSet conflictingAlts, SimulatorState conflictState, int startIndex, int stopIndex)
reportAttemptingFullContext in class ParserATNSimulatorprotected void reportAmbiguity(@NotNull
DFA dfa,
DFAState D,
int startIndex,
int stopIndex,
boolean exact,
@NotNull
BitSet ambigAlts,
@NotNull
ATNConfigSet configs)
ParserATNSimulatorreportAmbiguity in class ParserATNSimulatorpublic DecisionInfo[] getDecisionInfo()
public SimulatorState getCurrentState()
Copyright © 1992–2024 Daniel Sun. All rights reserved.