public static class SemanticContext.PrecedencePredicate extends SemanticContext implements Comparable<SemanticContext.PrecedencePredicate>
SemanticContext.AND, SemanticContext.Operator, SemanticContext.OR, SemanticContext.PrecedencePredicate, SemanticContext.Predicate| Modifier and Type | Field and Description |
|---|---|
int |
precedence |
NONE| Modifier | Constructor and Description |
|---|---|
protected |
PrecedencePredicate() |
|
PrecedencePredicate(int precedence) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SemanticContext.PrecedencePredicate o) |
boolean |
equals(Object obj) |
<T> boolean |
eval(Recognizer<T,?> parser,
RuleContext parserCallStack)
For context independent predicates, we evaluate them without a local
context (i.e., null context).
|
SemanticContext |
evalPrecedence(Recognizer<?,?> parser,
RuleContext parserCallStack)
Evaluate the precedence predicates for the context and reduce the result.
|
int |
hashCode() |
String |
toString() |
and, orprotected PrecedencePredicate()
public PrecedencePredicate(int precedence)
public <T> boolean eval(Recognizer<T,?> parser, RuleContext parserCallStack)
SemanticContextFor 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.
eval in class SemanticContextpublic SemanticContext evalPrecedence(Recognizer<?,?> parser, RuleContext parserCallStack)
SemanticContextevalPrecedence in class SemanticContextparser - The parser instance.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.public int compareTo(SemanticContext.PrecedencePredicate o)
compareTo in interface Comparable<SemanticContext.PrecedencePredicate>Copyright © 1992–2024 Daniel Sun. All rights reserved.