public class GrammarAST extends CommonTree
Modifier and Type | Field and Description |
---|---|
protected Map<String,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.
|
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.
|
Set<GrammarAST> |
rewriteRefsDeep |
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?
|
Map<String,Object> |
terminalOptions |
childIndex, parent, startIndex, stopIndex, token
INVALID_NODE
Constructor and Description |
---|
GrammarAST() |
GrammarAST(int t,
String txt) |
GrammarAST(Token token) |
Modifier and Type | Method and Description |
---|---|
void |
_findAllType(int ttype,
List<GrammarAST> nodes) |
static List<Tree> |
descendants(Tree root) |
static 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(Object ast)
Make nodes unique based upon Token so we can add them to a Set; if
not a GrammarAST, check type.
|
List<GrammarAST> |
findAllType(int ttype) |
GrammarAST |
findFirstType(int ttype) |
GrammarAST |
getBlockALT(int i) |
Object |
getBlockOption(String key) |
Map<String,Object> |
getBlockOptions() |
int |
getCharPositionInLine() |
GrammarAST[] |
getChildrenAsArray() |
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() |
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,
String s) |
void |
initialize(Token token) |
void |
initialize(Tree ast) |
String |
setBlockOption(Grammar grammar,
String key,
Object value)
Save the option key/value pair and process it; return the key
or null if invalid option.
|
void |
setBlockOptions(Map<String,Object> blockOptions) |
void |
setCharPositionInLine(int value) |
void |
setLine(int line) |
void |
setLookaheadDFA(DFA lookaheadDFA) |
void |
setNFAStartState(NFAState nfaStartState) |
String |
setOption(Map<String,Object> options,
Set<String> legalOptions,
Grammar grammar,
String key,
Object value) |
void |
setOptions(Grammar grammar,
Map<String,Object> options) |
void |
setSetValue(IntSet setValue) |
String |
setTerminalOption(Grammar grammar,
String key,
Object value) |
void |
setText(String text) |
void |
setTokenBoundaries(Token startToken,
Token stopToken)
Track start/stop token for subtree root created for a rule.
|
void |
setTreeEnclosingRuleNameDeeply(String rname) |
void |
setType(int type) |
String |
toStringList() |
getChildIndex, getParent, getToken, getTokenStartIndex, getTokenStopIndex, isNil, setChildIndex, setParent, setTokenStartIndex, setTokenStopIndex, setUnknownTokenBoundaries, toString
addChild, addChildren, createChildrenList, deleteChild, freshenParentAndChildIndexes, freshenParentAndChildIndexes, freshenParentAndChildIndexesDeeply, freshenParentAndChildIndexesDeeply, getAncestor, getAncestors, getChild, getChildCount, getChildren, getFirstChildWithType, hasAncestor, insertChild, replaceChildren, sanityCheckParentAndChildIndexes, sanityCheckParentAndChildIndexes, setChild, toStringTree
public int ID
public String enclosingRuleName
public DFA lookaheadDFA
public NFAState NFAStartState
public NFAState NFATreeDownState
public NFAState followingNFAState
protected IntSet setValue
public Set<GrammarAST> rewriteRefsShallow
public Set<GrammarAST> rewriteRefsDeep
public int outerAltNum
public org.stringtemplate.v4.ST code
public GrammarAST()
public GrammarAST(int t, String txt)
public GrammarAST(Token token)
public void setBlockOptions(Map<String,Object> blockOptions)
blockOptions
- public void initialize(int i, 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 String setBlockOption(Grammar grammar, String key, Object value)
public String setOption(Map<String,Object> options, Set<String> legalOptions, Grammar grammar, String key, Object value)
public String getText()
getText
in interface Tree
getText
in class CommonTree
public void setType(int type)
public void setText(String text)
public int getType()
Tree
getType
in interface Tree
getType
in class CommonTree
public int getLine()
Tree
getLine
in interface Tree
getLine
in class CommonTree
public int getCharPositionInLine()
getCharPositionInLine
in interface Tree
getCharPositionInLine
in class CommonTree
public 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 List<GrammarAST> findAllType(int ttype)
public void _findAllType(int ttype, List<GrammarAST> nodes)
public boolean equals(Object ast)
public int hashCode()
public boolean hasSameTreeStructure(Tree other)
public static GrammarAST dup(Tree t)
public Tree dupNode()
dupNode
in interface Tree
dupNode
in class CommonTree
public static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent)
public static GrammarAST dupTree(GrammarAST t)
public void setTreeEnclosingRuleNameDeeply(String rname)
public String toStringList()
public void setTokenBoundaries(Token startToken, Token stopToken)
public GrammarAST getBlockALT(int i)
Copyright © 1992–2015 ANTLR. All rights reserved.