public static class SemanticContext.Predicate extends SemanticContext
SemanticContext.AND, SemanticContext.CommutativePredicate, SemanticContext.FalsePredicate, SemanticContext.NOT, SemanticContext.OR, SemanticContext.Predicate, SemanticContext.TruePredicate| Modifier and Type | Field and Description |
|---|---|
protected int |
constantValue
sometimes predicates are known to be true or false; we need
a way to represent this without resorting to a target language
value like true or TRUE.
|
static int |
FALSE_PRED |
protected boolean |
gated
Is this a {...}?=> gating predicate or a normal disambiguating {..}?
If any predicate in expression is gated, then expression is considered
gated.
|
static int |
INVALID_PRED_VALUE |
GrammarAST |
predicateAST
The AST node in tree created from the grammar holding the predicate
|
protected boolean |
synpred
syntactic predicates are converted to semantic predicates
but synpreds are generated slightly differently.
|
static int |
TRUE_PRED |
EMPTY_SEMANTIC_CONTEXT| Constructor and Description |
|---|
SemanticContext.Predicate(GrammarAST predicate) |
SemanticContext.Predicate(int constantValue) |
SemanticContext.Predicate(SemanticContext.Predicate p) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Two predicates are the same if they are literally the same
text rather than same node in the grammar's AST.
|
org.stringtemplate.v4.ST |
genExpr(CodeGenerator generator,
org.stringtemplate.v4.STGroup templates,
DFA dfa)
Generate an expression that will evaluate the semantic context,
given a set of output templates.
|
SemanticContext |
getGatedPredicateContext()
Given a semantic context expression tree, return a tree with all
nongated predicates set to true and then reduced.
|
int |
hashCode() |
boolean |
hasUserSemanticPredicate() |
boolean |
isSyntacticPredicate() |
String |
toString() |
void |
trackUseOfSyntacticPredicates(Grammar g)
Notify the indicated grammar of any syn preds used within this context
|
and, factorAnd, factorOr, getAndOperands, getOrOperands, not, orpublic GrammarAST predicateAST
protected boolean gated
protected boolean synpred
public static final int INVALID_PRED_VALUE
public static final int FALSE_PRED
public static final int TRUE_PRED
protected int constantValue
public SemanticContext.Predicate(int constantValue)
public SemanticContext.Predicate(GrammarAST predicate)
public SemanticContext.Predicate(SemanticContext.Predicate p)
public boolean equals(Object o)
public org.stringtemplate.v4.ST genExpr(CodeGenerator generator, org.stringtemplate.v4.STGroup templates, DFA dfa)
SemanticContextgenExpr in class SemanticContextpublic SemanticContext getGatedPredicateContext()
SemanticContextgetGatedPredicateContext in class SemanticContextpublic boolean hasUserSemanticPredicate()
hasUserSemanticPredicate in class SemanticContextpublic boolean isSyntacticPredicate()
isSyntacticPredicate in class SemanticContextpublic void trackUseOfSyntacticPredicates(Grammar g)
SemanticContexttrackUseOfSyntacticPredicates in class SemanticContextCopyright © 1992–2014 ANTLR. All rights reserved.