| org.antlr.tool.GrammarAST
GrammarAST | public class GrammarAST extends BaseAST (Code) | | Grammars are first converted to ASTs using this class and then are
converted to NFAs via a tree walker.
The reader may notice that I have made a very non-OO decision in this
class to track variables for many different kinds of nodes. It wastes
space for nodes that don't need the values and OO principles cry out
for a new class type for each kind of node in my tree. I am doing this
on purpose for a variety of reasons. I don't like using the type
system for different node types; it yields too many damn class files
which I hate. Perhaps if I put them all in one file. Most importantly
though I hate all the type casting that would have to go on. I would
have all sorts of extra work to do. Ick. Anyway, I'm doing all this
on purpose, not out of ignorance. ;)
|
NFAStartState | public NFAState NFAStartState(Code) | | What NFA start state was built from this node?
|
NFATreeDownState | public NFAState NFATreeDownState(Code) | | This is used for TREE_BEGIN nodes to point into
the NFA. TREE_BEGINs point at left edge of DOWN for LOOK computation
purposes (Nullable tree child list needs special code gen when matching).
|
code | public StringTemplate code(Code) | | if this is a TOKEN_REF or RULE_REF node, this is the code StringTemplate
generated for this node. We need to update it later to add
a label if someone does $tokenref or $ruleref in an action.
|
defaultBlockOptions | final public static Map defaultBlockOptions(Code) | | What are the default options for a subrule?
|
followingNFAState | public NFAState followingNFAState(Code) | | Rule ref nodes, token refs, set, and NOT set refs need to track their
location in the generated NFA so that local FOLLOW sets can be
computed during code gen for automatic error recovery.
|
legalBlockOptions | final public static Set legalBlockOptions(Code) | | |
lookaheadDFA | public DFA lookaheadDFA(Code) | | If this is a decision node, what is the lookahead DFA?
|
options | protected Map options(Code) | | If this is a BLOCK node, track options here
|
outerAltNum | public int outerAltNum(Code) | | if this is an ACTION node, this is the outermost enclosing
alt num in rule. For actions, define.g sets these (used to
be codegen.g). We need these set so we can examine actions
early, before code gen, for refs to rule predefined properties
and rule labels. For most part define.g sets outerAltNum, but
codegen.g does the ones for %foo(a={$ID.text}) type refs as
the {$ID...} is not seen as an action until code gen pulls apart.
|
rewriteRefsShallow | public Set<GrammarAST> rewriteRefsShallow(Code) | | If this is a BLOCK node for a rewrite rule, track referenced
elements here. Don't track elements in nested subrules.
|
ruleStartTokenIndex | public int ruleStartTokenIndex(Code) | | If this is a RULE node then track rule's start, stop tokens' index.
|
ruleStopTokenIndex | public int ruleStopTokenIndex(Code) | | |
setValue | protected IntSet setValue(Code) | | If this is a SET node, what are the elements?
|
token | public Token token(Code) | | This AST node was created from what token?
|
GrammarAST | public GrammarAST()(Code) | | |
dupTreeNoActions | public static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent)(Code) | | Duplicate a tree, assuming this is a root node of a tree--
duplicate that node and what's below; ignore siblings of root node.
|
equals | public boolean equals(AST ast)(Code) | | Make nodes unique based upon Token so we can add them to a Set; if
not a GrammarAST, check type.
|
findFirstType | public GrammarAST findFirstType(int ttype)(Code) | | Return a reference to the first node (depth-first) that has
token type ttype. Assume 'this' is a root node; don't visit siblings
of root. Return null if no node found with ttype.
|
getColumn | public int getColumn()(Code) | | |
getLine | public int getLine()(Code) | | |
getLookaheadDFA | public DFA getLookaheadDFA()(Code) | | |
getToken | public Token getToken()(Code) | | |
getType | public int getType()(Code) | | |
hasSameListStructure | public boolean hasSameListStructure(AST t)(Code) | | |
hasSameTreeStructure | public boolean hasSameTreeStructure(AST t)(Code) | | See if tree has exact token types and structure; no text
|
initialize | public void initialize(AST ast)(Code) | | |
initialize | public void initialize(Token token)(Code) | | |
setColumn | public void setColumn(int col)(Code) | | |
setEnclosingRule | public void setEnclosingRule(String rule)(Code) | | |
setLine | public void setLine(int line)(Code) | | |
setLookaheadDFA | public void setLookaheadDFA(DFA lookaheadDFA)(Code) | | |
setNFAStartState | public void setNFAStartState(NFAState nfaStartState)(Code) | | |
setOption | public String setOption(Grammar grammar, String key, Object value)(Code) | | Save the option key/value pair and process it; return the key
or null if invalid option.
|
setType | public void setType(int type)(Code) | | |
|
|