public class GrammarAST
extends org.antlr.runtime.tree.CommonTree
Modifier and Type | Field | 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 |
Constructor | Description |
---|---|
GrammarAST() |
|
GrammarAST(int t,
String txt) |
|
GrammarAST(org.antlr.runtime.Token token) |
Modifier and Type | Method | Description |
---|---|---|
void |
_findAllType(int ttype,
List<GrammarAST> nodes) |
|
static List<org.antlr.runtime.tree.Tree> |
descendants(org.antlr.runtime.tree.Tree root) |
|
static List<org.antlr.runtime.tree.Tree> |
descendants(org.antlr.runtime.tree.Tree root,
boolean insertDownUpNodes) |
|
static GrammarAST |
dup(org.antlr.runtime.tree.Tree t) |
|
org.antlr.runtime.tree.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() |
|
DFA |
getLookaheadDFA() |
|
GrammarAST |
getNextSibling() |
|
NFAState |
getNFAStartState() |
|
IntSet |
getSetValue() |
|
String |
getText() |
|
int |
getType() |
|
int |
hashCode() |
Make nodes unique based upon Token so we can add them to a Set; if
not a GrammarAST, check type.
|
boolean |
hasSameTreeStructure(org.antlr.runtime.tree.Tree other) |
See if tree has exact token types and structure; no text
|
void |
initialize(int i,
String s) |
|
void |
initialize(org.antlr.runtime.Token token) |
|
void |
initialize(org.antlr.runtime.tree.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(org.antlr.runtime.Token startToken,
org.antlr.runtime.Token stopToken) |
Track start/stop token for subtree root created for a rule.
|
void |
setTreeEnclosingRuleNameDeeply(String rname) |
|
void |
setType(int type) |
|
String |
toStringList() |
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(org.antlr.runtime.Token token)
public void setBlockOptions(Map<String,Object> blockOptions)
blockOptions
- public void initialize(int i, String s)
public void initialize(org.antlr.runtime.tree.Tree ast)
public void initialize(org.antlr.runtime.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 class org.antlr.runtime.tree.CommonTree
public void setType(int type)
public void setText(String text)
public int getType()
getType
in class org.antlr.runtime.tree.CommonTree
public int getLine()
getLine
in class org.antlr.runtime.tree.CommonTree
public int getCharPositionInLine()
getCharPositionInLine
in class org.antlr.runtime.tree.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 static List<org.antlr.runtime.tree.Tree> descendants(org.antlr.runtime.tree.Tree root)
public static List<org.antlr.runtime.tree.Tree> descendants(org.antlr.runtime.tree.Tree root, boolean insertDownUpNodes)
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(org.antlr.runtime.tree.Tree other)
public static GrammarAST dup(org.antlr.runtime.tree.Tree t)
public org.antlr.runtime.tree.Tree dupNode()
dupNode
in class org.antlr.runtime.tree.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(org.antlr.runtime.Token startToken, org.antlr.runtime.Token stopToken)
public GrammarAST getBlockALT(int i)
Copyright © 1992–2019 ANTLR. All rights reserved.