Package org.antlr.v4.runtime.atn
Class SemanticContext.Predicate
- java.lang.Object
-
- org.antlr.v4.runtime.atn.SemanticContext
-
- org.antlr.v4.runtime.atn.SemanticContext.Predicate
-
- Enclosing class:
- SemanticContext
public static class SemanticContext.Predicate extends SemanticContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.antlr.v4.runtime.atn.SemanticContext
SemanticContext.AND, SemanticContext.Empty, SemanticContext.Operator, SemanticContext.OR, SemanticContext.PrecedencePredicate, SemanticContext.Predicate
-
-
Field Summary
Fields Modifier and Type Field Description booleanisCtxDependentintpredIndexintruleIndex
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)booleaneval(Recognizer<?,?> parser, RuleContext parserCallStack)For context independent predicates, we evaluate them without a local context (i.e., null context).inthashCode()java.lang.StringtoString()-
Methods inherited from class org.antlr.v4.runtime.atn.SemanticContext
and, evalPrecedence, or
-
-
-
-
Method Detail
-
eval
public boolean eval(Recognizer<?,?> parser, RuleContext parserCallStack)
Description copied from class:SemanticContextFor context independent predicates, we evaluate them without a local context (i.e., null context). That way, we can evaluate them without having to create proper rule-specific context during prediction (as opposed to the parser, which creates them naturally). In a practical sense, this avoids a cast exception from RuleContext to myruleContext.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.
- Specified by:
evalin classSemanticContext
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-