public class GrammarAST extends CommonTree
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
blockOptions
If this is a BLOCK node, track options here
|
org.stringtemplate.v4.ST |
code
if this is a TOKEN_REF or RULE_REF node, this is the code ST
generated for this node.
|
(package private) static int |
count |
private static GrammarAST |
DescendantDownNode |
private static GrammarAST |
DescendantUpNode |
java.lang.String |
enclosingRuleName |
NFAState |
followingNFAState
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.
|
int |
ID |
DFA |
lookaheadDFA
If this is a decision node, what is the lookahead DFA?
|
NFAState |
NFAStartState
What NFA start state was built from this node?
|
NFAState |
NFATreeDownState
This is used for TREE_BEGIN nodes to point into
the NFA.
|
int |
outerAltNum
if this is an ACTION node, this is the outermost enclosing
alt num in rule.
|
java.util.Set<GrammarAST> |
rewriteRefsDeep |
java.util.Set<GrammarAST> |
rewriteRefsShallow
If this is a BLOCK node for a rewrite rule, track referenced
elements here.
|
protected IntSet |
setValue
If this is a SET node, what are the elements?
|
java.util.Map<java.lang.String,java.lang.Object> |
terminalOptions |
private java.lang.String |
textOverride |
childIndex, parent, startIndex, stopIndex, tokenINVALID_NODE| Constructor and Description |
|---|
GrammarAST() |
GrammarAST(int t,
java.lang.String txt) |
GrammarAST(Token token) |
| Modifier and Type | Method and Description |
|---|---|
void |
_findAllType(int ttype,
java.util.List<GrammarAST> nodes) |
static java.util.List<Tree> |
descendants(Tree root) |
static java.util.List<Tree> |
descendants(Tree root,
boolean insertDownUpNodes) |
static GrammarAST |
dup(Tree t) |
Tree |
dupNode() |
static GrammarAST |
dupTree(GrammarAST t) |
static GrammarAST |
dupTreeNoActions(GrammarAST t,
GrammarAST parent)
Duplicate a tree, assuming this is a root node of a tree--
duplicate that node and what's below; ignore siblings of root node.
|
boolean |
equals(java.lang.Object ast)
Make nodes unique based upon Token so we can add them to a Set; if
not a GrammarAST, check type.
|
java.util.List<GrammarAST> |
findAllType(int ttype) |
GrammarAST |
findFirstType(int ttype) |
GrammarAST |
getBlockALT(int i) |
java.lang.Object |
getBlockOption(java.lang.String key) |
java.util.Map<java.lang.String,java.lang.Object> |
getBlockOptions() |
int |
getCharPositionInLine() |
GrammarAST[] |
getChildrenAsArray() |
private static java.util.List<GrammarAST> |
getChildrenForDupTree(GrammarAST t) |
GrammarAST |
getLastChild() |
GrammarAST |
getLastSibling() |
int |
getLine()
In case we don't have a token payload, what is the line for errors?
|
DFA |
getLookaheadDFA() |
GrammarAST |
getNextSibling() |
NFAState |
getNFAStartState() |
IntSet |
getSetValue() |
java.lang.String |
getText() |
int |
getType()
Return a token type; needed for tree parsing
|
int |
hashCode()
Make nodes unique based upon Token so we can add them to a Set; if
not a GrammarAST, check type.
|
boolean |
hasSameTreeStructure(Tree other)
See if tree has exact token types and structure; no text
|
void |
initialize(int i,
java.lang.String s) |
void |
initialize(Token token) |
void |
initialize(Tree ast) |
java.lang.String |
setBlockOption(Grammar grammar,
java.lang.String key,
java.lang.Object value)
Save the option key/value pair and process it; return the key
or null if invalid option.
|
void |
setBlockOptions(java.util.Map<java.lang.String,java.lang.Object> blockOptions) |
void |
setCharPositionInLine(int value) |
void |
setLine(int line) |
void |
setLookaheadDFA(DFA lookaheadDFA) |
void |
setNFAStartState(NFAState nfaStartState) |
java.lang.String |
setOption(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Set<java.lang.String> legalOptions,
Grammar grammar,
java.lang.String key,
java.lang.Object value) |
void |
setOptions(Grammar grammar,
java.util.Map<java.lang.String,java.lang.Object> options) |
void |
setSetValue(IntSet setValue) |
java.lang.String |
setTerminalOption(Grammar grammar,
java.lang.String key,
java.lang.Object value) |
void |
setText(java.lang.String text) |
void |
setTokenBoundaries(Token startToken,
Token stopToken)
Track start/stop token for subtree root created for a rule.
|
void |
setTreeEnclosingRuleNameDeeply(java.lang.String rname) |
void |
setType(int type) |
java.lang.String |
toStringList() |
getChildIndex, getParent, getToken, getTokenStartIndex, getTokenStopIndex, isNil, setChildIndex, setParent, setTokenStartIndex, setTokenStopIndex, setUnknownTokenBoundaries, toStringaddChild, addChildren, createChildrenList, deleteChild, freshenParentAndChildIndexes, freshenParentAndChildIndexes, freshenParentAndChildIndexesDeeply, freshenParentAndChildIndexesDeeply, getAncestor, getAncestors, getChild, getChildCount, getChildren, getFirstChildWithType, hasAncestor, insertChild, replaceChildren, sanityCheckParentAndChildIndexes, sanityCheckParentAndChildIndexes, setChild, toStringTreestatic int count
public int ID
private java.lang.String textOverride
public java.lang.String enclosingRuleName
public DFA lookaheadDFA
public NFAState NFAStartState
public NFAState NFATreeDownState
public NFAState followingNFAState
protected IntSet setValue
protected java.util.Map<java.lang.String,java.lang.Object> blockOptions
public java.util.Set<GrammarAST> rewriteRefsShallow
public java.util.Set<GrammarAST> rewriteRefsDeep
public java.util.Map<java.lang.String,java.lang.Object> terminalOptions
public int outerAltNum
public org.stringtemplate.v4.ST code
private static final GrammarAST DescendantDownNode
private static final GrammarAST DescendantUpNode
public GrammarAST()
public GrammarAST(int t,
java.lang.String txt)
public GrammarAST(Token token)
public java.util.Map<java.lang.String,java.lang.Object> getBlockOptions()
public void setBlockOptions(java.util.Map<java.lang.String,java.lang.Object> blockOptions)
blockOptions - public void initialize(int i,
java.lang.String s)
public void initialize(Tree ast)
public void initialize(Token token)
public DFA getLookaheadDFA()
public void setLookaheadDFA(DFA lookaheadDFA)
public NFAState getNFAStartState()
public void setNFAStartState(NFAState nfaStartState)
public java.lang.String setBlockOption(Grammar grammar, java.lang.String key, java.lang.Object value)
public java.lang.String setTerminalOption(Grammar grammar, java.lang.String key, java.lang.Object value)
public java.lang.String setOption(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Set<java.lang.String> legalOptions,
Grammar grammar,
java.lang.String key,
java.lang.Object value)
public java.lang.Object getBlockOption(java.lang.String key)
public void setOptions(Grammar grammar, java.util.Map<java.lang.String,java.lang.Object> options)
public java.lang.String getText()
getText in interface TreegetText in class CommonTreepublic void setType(int type)
public void setText(java.lang.String text)
public int getType()
TreegetType in interface TreegetType in class CommonTreepublic int getLine()
TreegetLine in interface TreegetLine in class CommonTreepublic int getCharPositionInLine()
getCharPositionInLine in interface TreegetCharPositionInLine in class CommonTreepublic void setLine(int line)
public void setCharPositionInLine(int value)
public IntSet getSetValue()
public void setSetValue(IntSet setValue)
public GrammarAST getLastChild()
public GrammarAST getNextSibling()
public GrammarAST getLastSibling()
public GrammarAST[] getChildrenAsArray()
public GrammarAST findFirstType(int ttype)
public java.util.List<GrammarAST> findAllType(int ttype)
public void _findAllType(int ttype,
java.util.List<GrammarAST> nodes)
public boolean equals(java.lang.Object ast)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean hasSameTreeStructure(Tree other)
public static GrammarAST dup(Tree t)
public Tree dupNode()
dupNode in interface TreedupNode in class CommonTreepublic static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent)
private static java.util.List<GrammarAST> getChildrenForDupTree(GrammarAST t)
public static GrammarAST dupTree(GrammarAST t)
public void setTreeEnclosingRuleNameDeeply(java.lang.String rname)
public java.lang.String toStringList()
public void setTokenBoundaries(Token startToken, Token stopToken)
public GrammarAST getBlockALT(int i)