Top Description Inners Fields Constructors Methods
org.antlr.analysis

public abstract Class SemanticContext

extends Object
Class Inheritance
Known Direct Subclasses
org.antlr.analysis.SemanticContext.Predicate, org.antlr.analysis.SemanticContext.CommutativePredicate, org.antlr.analysis.SemanticContext.NOT
Imports
org.antlr.codegen.CodeGenerator, org.antlr.grammar.v3.ANTLRParser, org.antlr.tool.Grammar, .GrammarAST, org.stringtemplate.v4.ST, .STGroup, java.util.*

A binary tree structure used to record the semantic context in which an NFA configuration is valid. It's either a single predicate or a tree representing an operation tree such as: p1&&p2 or p1||p2. For NFA o-p1->o-p2->o, create tree AND(p1,p2). For NFA (1)-p1->(2) | ^ | | (3)-p2---- we will have to combine p1 and p2 into DFA state as we will be adding NFA configurations for state 2 with two predicates p1,p2. So, set context for combined NFA config for state 2: OR(p1,p2). I have scoped the AND, NOT, OR, and Predicate subclasses of SemanticContext within the scope of this outer class. July 7, 2006: TJP altered OR to be set of operands. the Binary tree made it really hard to reduce complicated || sequences to their minimum. Got huge repeated || conditions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public abstract static class
public static class
public static class
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
public static final SemanticContext
EMPTY_SEMANTIC_CONTEXT

Create a default value for the semantic context shared among all NFAConfigurations that do not have an actual semantic context.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static SemanticContext
public static SemanticContext[]
public static SemanticContext[]
public abstract ST
genExpr(CodeGenerator generator, STGroup templates, DFA dfa)

Generate an expression that will evaluate the semantic context, given a set of output templates.

public static Collection<SemanticContext>
public abstract SemanticContext
getGatedPredicateContext()

Given a semantic context expression tree, return a tree with all nongated predicates set to true and then reduced.

public static Collection<SemanticContext>
public abstract boolean
public abstract boolean
public static SemanticContext
public static SemanticContext
public void
trackUseOfSyntacticPredicates(Grammar g)

Notify the indicated grammar of any syn preds used within this context

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait