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
FieldsModifier and TypeFieldDescriptionIf we build an ATN, we make AST node point at left edge of ATN constructFor error msgs, nice to know which grammar this AST lives inFields inherited from class org.antlr.runtime.tree.CommonTree
childIndex, parent, startIndex, stopIndex, tokenFields inherited from class org.antlr.runtime.tree.BaseTree
childrenFields inherited from interface org.antlr.runtime.tree.Tree
INVALID_NODE -
Constructor Summary
ConstructorsConstructorDescriptionGrammarAST(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
Modifier and TypeMethodDescriptionbooleandeleteChild(org.antlr.runtime.tree.Tree t) dupNode()dupTree()getAllChildrenWithType(int type) Walk ancestors of this node until we find ALT with alt!=null or leftRecursiveAltInfo!=null.org.antlr.runtime.tree.CommonTreegetFirstDescendantWithType(int type) org.antlr.runtime.tree.CommonTreegetFirstDescendantWithType(org.antlr.runtime.BitSet types) getNodesWithType(int ttype) getNodesWithType(IntervalSet types) voidgetNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) getNodeWithTokenIndex(int index) voidvoidsetType(int type) Methods inherited from class org.antlr.runtime.tree.CommonTree
getCharPositionInLine, getChildIndex, getLine, getParent, getText, getToken, getTokenStartIndex, getTokenStopIndex, getType, isNil, setChildIndex, setParent, setTokenStartIndex, setTokenStopIndex, setUnknownTokenBoundaries, toStringMethods 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
-
Field Details
-
g
For error msgs, nice to know which grammar this AST lives in -
atnState
If we build an ATN, we make AST node point at left edge of ATN construct -
textOverride
-
-
Constructor Details
-
GrammarAST
public GrammarAST() -
GrammarAST
public GrammarAST(org.antlr.runtime.Token t) -
GrammarAST
-
GrammarAST
public GrammarAST(int type) -
GrammarAST
public GrammarAST(int type, org.antlr.runtime.Token t) -
GrammarAST
-
-
Method Details
-
getChildrenAsArray
-
getNodesWithType
-
getAllChildrenWithType
-
getNodesWithType
-
getNodesWithTypePreorderDFS
-
getNodesWithTypePreorderDFS_
-
getNodeWithTokenIndex
-
getOutermostAltNode
-
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
-
dupNode
- Specified by:
dupNodein interfaceorg.antlr.runtime.tree.Tree- Overrides:
dupNodein classorg.antlr.runtime.tree.CommonTree
-
dupTree
-
toTokenString
-
visit
-