public static class SemanticContext.OR extends SemanticContext
SemanticContext.AND, SemanticContext.OR, SemanticContext.PrecedencePredicate, SemanticContext.Predicate
Modifier and Type | Field and Description |
---|---|
SemanticContext[] |
opnds |
NONE
Constructor and Description |
---|
SemanticContext.OR(SemanticContext a,
SemanticContext b) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
boolean |
eval(Recognizer<?,?> parser,
RuleContext outerContext)
For context independent predicates, we evaluate them without a local
context (i.e., null context).
|
SemanticContext |
evalPrecedence(Recognizer<?,?> parser,
RuleContext outerContext)
Evaluate the precedence predicates for the context and reduce the result.
|
int |
hashCode() |
String |
toString() |
and, or
@NotNull public final SemanticContext[] opnds
public SemanticContext.OR(@NotNull SemanticContext a, @NotNull SemanticContext b)
public boolean eval(Recognizer<?,?> parser, RuleContext outerContext)
For context dependent predicates, we must pass in a local context so that references such as $arg evaluate properly as _localctx.arg. We only capture context dependent predicates in the context in which we begin prediction, so we passed in the outer context here in case of context dependent predicate evaluation.
The evaluation of predicates by this context is short-circuiting, but unordered.
eval
in class SemanticContext
public SemanticContext evalPrecedence(Recognizer<?,?> parser, RuleContext outerContext)
SemanticContext
evalPrecedence
in class SemanticContext
parser
- The parser instance.outerContext
- The current parser context object.SemanticContext.NONE
: if the predicate simplifies to true
after
precedence predicates are evaluated.null
: if the predicate simplifies to false
after
precedence predicates are evaluated.this
: if the semantic context is not changed as a result of
precedence predicate evaluation.null
SemanticContext
: the new simplified
semantic context after precedence predicates are evaluated.Copyright © 1992–2014 ANTLR. All rights reserved.