evalSemanticContextOne method

bool evalSemanticContextOne(
  1. SemanticContext pred,
  2. ParserRuleContext? parserCallStack,
  3. int alt,
  4. bool fullCtx,
)

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 {@link SemanticContext.PrecedencePredicate}) are not currently evaluated through this method.
  • Operator predicates (represented by {@link SemanticContext.AND} and {@link 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.

@param pred The semantic context to evaluate @param parserCallStack The parser context in which to evaluate the semantic context @param alt The alternative which is guarded by pred @param fullCtx true if the evaluation is occurring during LL prediction; otherwise, false if the evaluation is occurring during SLL prediction

@since 4.3

Implementation

bool evalSemanticContextOne(
  SemanticContext pred,
  ParserRuleContext? parserCallStack,
  int alt,
  bool fullCtx,
) {
  return pred.eval(parser, parserCallStack);
}