| java.lang.Object org.antlr.runtime.tree.BaseTreeAdaptor org.antlr.runtime.tree.CommonTreeAdaptor
CommonTreeAdaptor | public class CommonTreeAdaptor extends BaseTreeAdaptor (Code) | | A TreeAdaptor that works with any Tree implementation. It provides
really just factory methods; all the work is done by BaseTreeAdaptor.
If you would like to have different tokens created than ClassicToken
objects, you need to override this and then set the parser tree adaptor to
use your subclass.
To get your parser to build nodes of a different type, override
create(Token).
|
createToken | public Token createToken(int tokenType, String text)(Code) | | Tell me how to create a token for use with imaginary token nodes.
For example, there is probably no input symbol associated with imaginary
token DECL, but you need to create it as a payload or whatever for
the DECL node as in ^(DECL type ID).
If you care what the token payload objects' type is, you should
override this method and any other createToken variant.
|
createToken | public Token createToken(Token fromToken)(Code) | | Tell me how to create a token for use with imaginary token nodes.
For example, there is probably no input symbol associated with imaginary
token DECL, but you need to create it as a payload or whatever for
the DECL node as in ^(DECL type ID).
This is a variant of createToken where the new token is derived from
an actual real input token. Typically this is for converting '{'
tokens to BLOCK etc... You'll see
r : lc='{' ID+ '}' -> ^(BLOCK[$lc] ID+) ;
If you care what the token payload objects' type is, you should
override this method and any other createToken variant.
|
dupNode | public Object dupNode(Object t)(Code) | | Duplicate a node. This is part of the factory;
override if you want another kind of node to be built.
I could use reflection to prevent having to override this
but reflection is slow.
|
getToken | public Token getToken(Object t)(Code) | | What is the Token associated with this node? If
you are not using CommonTree, then you must
override this in your own adaptor.
|
getTokenStartIndex | public int getTokenStartIndex(Object t)(Code) | | |
getTokenStopIndex | public int getTokenStopIndex(Object t)(Code) | | |
setTokenBoundaries | public void setTokenBoundaries(Object t, Token startToken, Token stopToken)(Code) | | Track start/stop token for subtree root created for a rule.
Only works with Tree nodes. For rules that match nothing,
seems like this will yield start=i and stop=i-1 in a nil node.
Might be useful info so I'll not force to be i..i.
|
Methods inherited from org.antlr.runtime.tree.BaseTreeAdaptor | public void addChild(Object t, Object child)(Code)(Java Doc) public Object becomeRoot(Object newRoot, Object oldRoot)(Code)(Java Doc) public Object becomeRoot(Token newRoot, Object oldRoot)(Code)(Java Doc) public Object create(int tokenType, Token fromToken)(Code)(Java Doc) public Object create(int tokenType, Token fromToken, String text)(Code)(Java Doc) public Object create(int tokenType, String text)(Code)(Java Doc) abstract public Token createToken(int tokenType, String text)(Code)(Java Doc) abstract public Token createToken(Token fromToken)(Code)(Java Doc) public Object dupTree(Object tree)(Code)(Java Doc) public Object getChild(Object t, int i)(Code)(Java Doc) public int getChildCount(Object t)(Code)(Java Doc) public String getText(Object t)(Code)(Java Doc) public int getType(Object t)(Code)(Java Doc) public int getUniqueID(Object node)(Code)(Java Doc) public boolean isNil(Object tree)(Code)(Java Doc) public Object nil()(Code)(Java Doc) public Object rulePostProcessing(Object root)(Code)(Java Doc) public void setText(Object t, String text)(Code)(Java Doc) public void setType(Object t, int type)(Code)(Java Doc)
|
|
|