Lines Matching refs:context

50  * All of that is done without using the outer context because we want to create
52 * prediction. One DFA works in all contexts. We avoid using context not
56 * prediction occurs without invoking another rule's ATN, there are no context
57 * stacks in the configurations. When lack of context leads to a conflict, we
62 * retry the ATN simulation, this time using full outer context without adding
63 * to the DFA. Configuration context stacks will be the full invocation stacks
64 * from the start rule. If we get a conflict using full context, then we can
67 * context. (It is not context-sensitive in the sense of context-sensitive
71 * simulation, we will again retry the ATN simulation using full context mode.
77 * We could cache results from full context to predicted alternative easily and
80 * context, because closure can fall off the end of a rule. I tried to cache
81 * tuples (stack context, semantic context, predicted alt) but it was slower
88 * which makes it really hard to build a cache for full context. Let's say that
89 * we have input A B C that leads to an SLL conflict with full context X. That
94 * full context prediction, which would lead us to requiring more input than the
97 * X to a specific DFA for that context.
105 * We avoid doing full context retry when the outer context is empty, we did not
106 * dip into the outer context by falling off the end of the decision state rule,
109 * As an example of the not dip into outer context case, consider as super
128 * context. In the first case ctorBody in the worst case will stop at the '}'.
130 * entry rule and not dip into the outer context.
179 * locks inside the DFA lock but this time on the shared context cache when it
215 * rule out as a possibility based upon better context information. If that's
439 * - collecting predicates and adding semantic context to DFA accept states
440 * - adding rule context to context-sensitive DFA accept states
444 * - reporting a context sensitivity
493 /* If any configs in previous dipped into outer context, that
548 // context occurs with the index at the correct spot
776 /* I any configs in previous dipped into outer context, that
858 * when doing full context prediction.
904 * of the decision rule (local context) or end of the start rule (full
905 * context). Once reached, these configurations are never updated by a
909 * For full-context reach operations, separate handling is required to
922 if ($c->context !== null && !$c->context->isEmpty()) {
997 * decision rule (local context) or end of the start rule (full
998 * context). Update reach to contain only these configurations. This
1017 * configuration. For full-context reach operations, these
1112 * Context-sensitive in that they can only be properly evaluated in the context
1115 * As we cannot evaluate these predicates out of context, the resulting
1144 * we can resolve them without failing over to full LL despite their context
1169 * ATN state and predicate context, remove any configuration associated with
1209 * same ATN state with the same prediction context. This transformation is
1221 * The prediction context must be considered by this filter to address
1232 * `statement`. The prediction context associated with each of these
1267 $statesFromAlt1[$config->state->stateNumber] = $config->context;
1285 * filter the prediction context for alternatives predicting alt>1
1289 $context = $statesFromAlt1[$config->state->stateNumber] ?? null;
1291 if ($context !== null && $config->context !== null && $context->equals($config->context)) {
1427 * @param ParserRuleContext $outerContext The \gamma_0 initial parser context
1474 || ($c->state instanceof RuleStopState && $c->context !== null && $c->context->hasEmptyPath())) {
1633 // We hit rule end. If we have context info, use it run thru all possible stack tops in ctx
1635 if ($config->context !== null && !$config->context->isEmpty()) {
1636 for ($i =0; $i < $config->context->getLength(); $i++) {
1637 if ($config->context->getReturnState($i) === PredictionContext::EMPTY_RETURN_STATE) {
1644 // we have no context info, just chase follow links (if greedy)
1666 $returnState = $this->atn->states[$config->context->getReturnState($i)];
1667 $newContext = $config->context->getParent($i);// "pop" return state
1671 // While we have context to pop back from, we may have
1672 // gotten that context AFTER having falling off a rule.
1673 // Make sure we track that we are now out of context.
1698 // Else if we have no context info, just chase follow links (if greedy)
1746 // Target fell off end of rule; mark resulting c as having dipped into outer context
1747 // We can't get here if incoming config was rule stop and we had context
1748 // track how far we dip into outer context. Might
1749 // come in handy and we avoid evaluating context dependent
1783 // latch when newDepth goes negative - once we step out of the entry context we can't return
1810 * StarLoopEntryState after popping context at the rule end state
1821 * Then we check that each stack top of context is a return state
1834 * Conditions fail if any context for the current config is:
1878 * context) which means it is considering exactly one alt. Closure
1899 * the context has an empty stack case. If so, it would mean
1904 if ($config->context === null) {
1905 throw new \RuntimeException('Prediction context cannot be null.');
1910 || $config->context->isEmpty()
1911 || $config->context->hasEmptyPath()) {
1916 $numCtxs = $config->context->getLength();
1919 // For each stack context
1920 $returnState = $this->atn->states[$config->context->getReturnState($i)];
1940 // Verify that the top of each stack context leads to loop entry/exit
1943 // For each stack context
1945 $returnStateNumber = $config->context->getReturnState($i);
2081 'context surrounding pred is [%s]',
2091 /* In full context mode, we can evaluate predicates on-the-fly
2108 $c = new ATNConfig($config, $pt->target);// no pred context
2151 // In full context mode, we can evaluate predicates on-the-fly
2167 $c = new ATNConfig($config, $pt->target);// no pred context
2190 $config->context
2195 $newContext = SingletonPredictionContext::create($config->context, $returnState->stateNumber);
2477 * If context sensitive parsing, we know it's ambiguity not conflict.