| |
|
| java.lang.Object antlr.BaseAST
All known Subclasses: antlr.ParseTree, org.netbeans.modules.cnd.modelimpl.parser.CsmAST, org.netbeans.modules.cnd.modelimpl.parser.FakeAST, antlr.CommonAST,
BaseAST | abstract public class BaseAST implements AST,Serializable(Code) | | A Child-Sibling Tree.
A tree with PLUS at the root and with two children 3 and 4 is
structured as:
PLUS
|
3 -- 4
and can be specified easily in LISP notation as
(PLUS 3 4)
where every '(' starts a new subtree.
These trees are particular useful for translators because of
the flexibility of the children lists. They are also very easy
to walk automatically, whereas trees with specific children
reference fields can't easily be walked automatically.
This class contains the basic support for an AST.
Most people will create ASTs that are subclasses of
BaseAST or of CommonAST.
IMPORTANT:
Although this class is declared to be serialized,
it's unsafe to use out.writeObject(ast) and ast = (AST)in.readObject()
use instead:
antlr.Utils.writeAST(out, ast) and ast = antlr.Utils.readAST(in)
|
addChild | public void addChild(AST node)(Code) | | Add a node to the end of the child list for this node
|
equals | public boolean equals(AST t)(Code) | | Is node t equal to this in terms of token type and text?
|
equalsList | public boolean equalsList(AST t)(Code) | | Is t an exact structural and equals() match of this tree. The
'this' reference is considered the start of a sibling list.
|
equalsListPartial | public boolean equalsListPartial(AST sub)(Code) | | Is 'sub' a subtree of this list?
The siblings of the root are NOT ignored.
|
equalsTree | public boolean equalsTree(AST t)(Code) | | Is tree rooted at 'this' equal to 't'? The siblings
of 'this' are ignored.
|
equalsTreePartial | public boolean equalsTreePartial(AST sub)(Code) | | Is 't' a subtree of the tree rooted at 'this'? The siblings
of 'this' are ignored.
|
findAll | public ASTEnumeration findAll(AST target)(Code) | | Walk the tree looking for all exact subtree matches. Return
an ASTEnumerator that lets the caller walk the list
of subtree roots found herein.
|
findAllPartial | public ASTEnumeration findAllPartial(AST sub)(Code) | | Walk the tree looking for all subtrees. Return
an ASTEnumerator that lets the caller walk the list
of subtree roots found herein.
|
getColumn | public int getColumn()(Code) | | |
getFirstChild | public AST getFirstChild()(Code) | | Get the first child of this node; null if not children
|
getLine | public int getLine()(Code) | | |
getNextSibling | public AST getNextSibling()(Code) | | Get the next sibling in line after this one
|
getNumberOfChildren | public int getNumberOfChildren()(Code) | | How many children does this node have?
|
getText | public String getText()(Code) | | Get the token text for this node
|
getTokenNames | public static String[] getTokenNames()(Code) | | Return an array of strings that maps token ID to it's text. @since 2.7.3
|
getType | public int getType()(Code) | | Get the token type for this node
|
initialize | abstract public void initialize(int t, String txt)(Code) | | |
initialize | abstract public void initialize(AST t)(Code) | | |
initialize | abstract public void initialize(Token t)(Code) | | |
removeChildren | public void removeChildren()(Code) | | Remove all children
|
setFirstChild | public void setFirstChild(AST c)(Code) | | |
setNextSibling | public void setNextSibling(AST n)(Code) | | |
setText | public void setText(String text)(Code) | | Set the token text for this node
|
setType | public void setType(int ttype)(Code) | | Set the token type for this node
|
setVerboseStringConversion | public static void setVerboseStringConversion(boolean verbose, String[] names)(Code) | | |
toStringList | public String toStringList()(Code) | | Print out a child-sibling tree in LISP notation
|
|
|
|