Class ProfilingATNSimulator

    • Field Detail

      • numDecisions

        protected int numDecisions
      • _sllStopIndex

        protected int _sllStopIndex
      • _llStopIndex

        protected int _llStopIndex
      • currentDecision

        protected int currentDecision
      • currentState

        protected DFAState currentState
      • conflictingAltResolvedBySLL

        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. If LL gives a different result than SLL's predicted alternative, we have a context sensitivity for sure. The converse is not necessarily true, however. It's possible that after conflict resolution chooses minimum alternatives, SLL could get the same answer as LL. Regardless of whether or not the result indicates an ambiguity, it is not treated as a context sensitivity because LL prediction was not required in order to produce a correct prediction for this decision and input sequence. It may in fact still be a context sensitivity but we don't know by looking at the minimum alternatives for the current input.
    • Constructor Detail

      • ProfilingATNSimulator

        public ProfilingATNSimulator​(Parser parser)
    • Method Detail

      • getExistingTargetState

        protected DFAState getExistingTargetState​(DFAState previousD,
                                                  int t)
        Description copied from class: ParserATNSimulator
        Get an existing target state for an edge in the DFA. If the target state for the edge has not yet been computed or is otherwise not available, this method returns null.
        getExistingTargetState in class ParserATNSimulator
        previousD - The current DFA state
        t - The next input symbol
        The existing target DFA state for the given input symbol t, or null if the target state for this edge is not already cached
      • computeTargetState

        protected DFAState computeTargetState​(DFA dfa,
                                              DFAState previousD,
                                              int t)
        Description copied from class: ParserATNSimulator
        Compute a target state for an edge in the DFA, and attempt to add the computed state and corresponding edge to the DFA.
        computeTargetState in class ParserATNSimulator
        dfa - The DFA
        previousD - The current DFA state
        t - The next input symbol
        The computed target DFA state for the given input symbol t. If t does not lead to a valid DFA state, this method returns ATNSimulator.ERROR.
      • evalSemanticContext

        protected boolean evalSemanticContext​(SemanticContext pred,
                                              ParserRuleContext parserCallStack,
                                              int alt,
                                              boolean fullCtx)
        Description copied from class: ParserATNSimulator
        Evaluate a semantic context within a specific parser context.

        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:

        • Precedence predicates (represented by SemanticContext.PrecedencePredicate) are not currently evaluated through this method.
        • Operator predicates (represented by 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 evaluate
        parserCallStack - The parser context in which to evaluate the semantic context
        alt - 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 prediction
      • getCurrentState

        public DFAState getCurrentState()