Top Fields Constructors Methods
org.antlr.v4.tool.ast

public Class GrammarAST

extends CommonTree
Class Inheritance
Known Direct Subclasses
org.antlr.v4.tool.ast.GrammarASTErrorNode, org.antlr.v4.tool.ast.GrammarASTWithOptions, org.antlr.v4.tool.ast.NotAST, org.antlr.v4.tool.ast.OptionalBlockAST, org.antlr.v4.tool.ast.PlusBlockAST, org.antlr.v4.tool.ast.RangeAST, org.antlr.v4.tool.ast.SetAST, org.antlr.v4.tool.ast.StarBlockAST
Imports
org.antlr.runtime.CharStream, .CommonToken, .Token, org.antlr.runtime.tree.CommonTree, .CommonTreeNodeStream, .Tree, org.antlr.v4.parse.ANTLRParser, .GrammarASTAdaptor, org.antlr.v4.runtime.atn.ATNState, org.antlr.v4.runtime.misc.IntervalSet, org.antlr.v4.tool.Grammar, java.util.ArrayList, .Arrays, .LinkedList, .List

Field Summary

Modifier and TypeField and Description
public ATNState
atnState

If we build an ATN, we make AST node point at left edge of ATN construct

public Grammar
g

For error msgs, nice to know which grammar this AST lives in

public String
Inherited from org.antlr.runtime.tree.CommonTree:
childIndexparentstartIndexstopIndextoken

Constructor Summary

AccessConstructor and Description
public
public
public
public
GrammarAST(int type)

public
GrammarAST(int type, Token t)

public
GrammarAST(int type, Token t, String text)

Method Summary

Modifier and TypeMethod and Description
public boolean
public GrammarAST
public GrammarAST
public List<GrammarAST>
public String
getAltLabel()

Walk ancestors of this node until we find ALT with alt!=null or leftRecursiveAltInfo!=null.

public GrammarAST[]
public CommonTree
public CommonTree
public List<GrammarAST>
getNodesWithType(int ttype)

public List<GrammarAST>
public List<GrammarAST>
public void
public GrammarAST
public AltAST
public void
public void
setType(int type)

public String
public Object
Inherited from org.antlr.runtime.tree.CommonTree:
getCharPositionInLinegetChildIndexgetLinegetParentgetTextgetTokengetTokenStartIndexgetTokenStopIndexgetTypeisNilsetChildIndexsetParentsetTokenStartIndexsetTokenStopIndexsetUnknownTokenBoundariestoString

Field Detail

atnStateback to summary
public ATNState atnState

If we build an ATN, we make AST node point at left edge of ATN construct

gback to summary
public Grammar g

For error msgs, nice to know which grammar this AST lives in

textOverrideback to summary
public String textOverride

Constructor Detail

GrammarASTback to summary
public GrammarAST()
GrammarASTback to summary
public GrammarAST(Token t)
GrammarASTback to summary
public GrammarAST(GrammarAST node)
GrammarASTback to summary
public GrammarAST(int type)
GrammarASTback to summary
public GrammarAST(int type, Token t)
GrammarASTback to summary
public GrammarAST(int type, Token t, String text)

Method Detail

deleteChildback to summary
public boolean deleteChild(Tree t)
dupNodeback to summary
public GrammarAST dupNode()

Overrides org.antlr.runtime.tree.CommonTree.dupNode.

Implements org.antlr.runtime.tree.Tree.dupNode.

Annotations
@Override
dupTreeback to summary
public GrammarAST dupTree()
getAllChildrenWithTypeback to summary
public List<GrammarAST> getAllChildrenWithType(int type)
getAltLabelback to summary
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.

getChildrenAsArrayback to summary
public GrammarAST[] getChildrenAsArray()
getFirstDescendantWithTypeback to summary
public CommonTree getFirstDescendantWithType(int type)
getFirstDescendantWithTypeback to summary
public CommonTree getFirstDescendantWithType(BitSet types)
getNodesWithTypeback to summary
public List<GrammarAST> getNodesWithType(int ttype)
getNodesWithTypeback to summary
public List<GrammarAST> getNodesWithType(IntervalSet types)
getNodesWithTypePreorderDFSback to summary
public List<GrammarAST> getNodesWithTypePreorderDFS(IntervalSet types)
getNodesWithTypePreorderDFS_back to summary
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types)
getNodeWithTokenIndexback to summary
public GrammarAST getNodeWithTokenIndex(int index)
getOutermostAltNodeback to summary
public AltAST getOutermostAltNode()
setTextback to summary
public void setText(String text)
setTypeback to summary
public void setType(int type)
toTokenStringback to summary
public String toTokenString()
visitback to summary
public Object visit(GrammarASTVisitor v)