Package org.antlr.v4.tool.ast
Class GrammarAST
- java.lang.Object
-
- org.antlr.runtime.tree.BaseTree
-
- org.antlr.runtime.tree.CommonTree
-
- org.antlr.v4.tool.ast.GrammarAST
-
- All Implemented Interfaces:
org.antlr.runtime.tree.Tree
- Direct Known Subclasses:
GrammarASTErrorNode,GrammarASTWithOptions,NotAST,OptionalBlockAST,PlusBlockAST,RangeAST,SetAST,StarBlockAST
public class GrammarAST extends org.antlr.runtime.tree.CommonTree
-
-
Field Summary
Fields Modifier and Type Field Description ATNStateatnStateIf we build an ATN, we make AST node point at left edge of ATN constructGrammargFor error msgs, nice to know which grammar this AST lives inStringtextOverride
-
Constructor Summary
Constructors Constructor Description GrammarAST()GrammarAST(int type)GrammarAST(int type, org.antlr.runtime.Token t)GrammarAST(int type, org.antlr.runtime.Token t, String text)GrammarAST(org.antlr.runtime.Token t)GrammarAST(GrammarAST node)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandeleteChild(org.antlr.runtime.tree.Tree t)GrammarASTdupNode()GrammarASTdupTree()List<GrammarAST>getAllChildrenWithType(int type)StringgetAltLabel()Walk ancestors of this node until we find ALT with alt!=null or leftRecursiveAltInfo!=null.GrammarAST[]getChildrenAsArray()org.antlr.runtime.tree.CommonTreegetFirstDescendantWithType(int type)org.antlr.runtime.tree.CommonTreegetFirstDescendantWithType(org.antlr.runtime.BitSet types)List<GrammarAST>getNodesWithType(int ttype)List<GrammarAST>getNodesWithType(IntervalSet types)List<GrammarAST>getNodesWithTypePreorderDFS(IntervalSet types)voidgetNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types)GrammarASTgetNodeWithTokenIndex(int index)AltASTgetOutermostAltNode()voidsetText(String text)voidsetType(int type)StringtoTokenString()Objectvisit(GrammarASTVisitor v)-
Methods inherited from class org.antlr.runtime.tree.CommonTree
getCharPositionInLine, getChildIndex, getLine, getParent, getText, getToken, getTokenStartIndex, getTokenStopIndex, getType, isNil, setChildIndex, setParent, setTokenStartIndex, setTokenStopIndex, setUnknownTokenBoundaries, toString
-
Methods inherited from class org.antlr.runtime.tree.BaseTree
addChild, addChildren, createChildrenList, deleteChild, freshenParentAndChildIndexes, freshenParentAndChildIndexes, freshenParentAndChildIndexesDeeply, freshenParentAndChildIndexesDeeply, getAncestor, getAncestors, getChild, getChildCount, getChildren, getFirstChildWithType, hasAncestor, insertChild, replaceChildren, sanityCheckParentAndChildIndexes, sanityCheckParentAndChildIndexes, setChild, toStringTree
-
-
-
-
Constructor Detail
-
GrammarAST
public GrammarAST()
-
GrammarAST
public GrammarAST(org.antlr.runtime.Token t)
-
GrammarAST
public GrammarAST(GrammarAST node)
-
GrammarAST
public GrammarAST(int type)
-
GrammarAST
public GrammarAST(int type, org.antlr.runtime.Token t)
-
GrammarAST
public GrammarAST(int type, org.antlr.runtime.Token t, String text)
-
-
Method Detail
-
getChildrenAsArray
public GrammarAST[] getChildrenAsArray()
-
getNodesWithType
public List<GrammarAST> getNodesWithType(int ttype)
-
getAllChildrenWithType
public List<GrammarAST> getAllChildrenWithType(int type)
-
getNodesWithType
public List<GrammarAST> getNodesWithType(IntervalSet types)
-
getNodesWithTypePreorderDFS
public List<GrammarAST> getNodesWithTypePreorderDFS(IntervalSet types)
-
getNodesWithTypePreorderDFS_
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types)
-
getNodeWithTokenIndex
public GrammarAST getNodeWithTokenIndex(int index)
-
getOutermostAltNode
public AltAST getOutermostAltNode()
-
getAltLabel
public String getAltLabel()
Walk ancestors of this node until we find ALT with alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. If not a rule element, just returns null.
-
deleteChild
public boolean deleteChild(org.antlr.runtime.tree.Tree t)
-
getFirstDescendantWithType
public org.antlr.runtime.tree.CommonTree getFirstDescendantWithType(int type)
-
getFirstDescendantWithType
public org.antlr.runtime.tree.CommonTree getFirstDescendantWithType(org.antlr.runtime.BitSet types)
-
setType
public void setType(int type)
-
setText
public void setText(String text)
-
dupNode
public GrammarAST dupNode()
- Specified by:
dupNodein interfaceorg.antlr.runtime.tree.Tree- Overrides:
dupNodein classorg.antlr.runtime.tree.CommonTree
-
dupTree
public GrammarAST dupTree()
-
toTokenString
public String toTokenString()
-
visit
public Object visit(GrammarASTVisitor v)
-
-