| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | create(Token payload)
Implements org. |
| public Token | createToken(int tokenType, String text)
Implements abstract org. |
| public Token | createToken(Token fromToken)
Implements abstract org. |
| public Object | |
| public Object | getChild(Object t, int i)
Overrides org. Implements org. |
| public int | getChildCount(Object t)
Overrides org. Implements org. |
| public int | getChildIndex(Object t)
Implements org. |
| public Object | getParent(Object t)
Implements org. |
| public String | getText(Object t)
Overrides org. Implements org. |
| public Token | getToken(Object t)
Implements org. |
| public int | getTokenStartIndex(Object t)
Implements org. |
| public int | getTokenStopIndex(Object t)
Implements org. |
| public int | getType(Object t)
Overrides org. Implements org. |
| public void | replaceChildren(Object parent, int startChildIndex, int stopChildIndex, Object t)
Implements org. |
| public void | |
| public void | |
| public void | setTokenBoundaries(Object t, Token startToken, Token stopToken)
Implements org. |
| CommonTreeAdaptor | back to summary |
|---|---|
| public CommonTreeAdaptor() | |
| create | back to summary |
|---|---|
| public Object create(Token payload) Implements org. Doc from org. Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload. This is the most common create call. Override if you want another kind of node to be built.
| |
| createToken | back to summary |
|---|---|
| public Token createToken(int tokenType, String text) Implements abstract org. 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 | back to summary |
|---|---|
| public Token createToken(Token fromToken) Implements abstract org. 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 | back to summary |
|---|---|
| public Object dupNode(Object t) Implements org. 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.
| |
| getChild | back to summary |
|---|---|
| public Object getChild(Object t, int i) Overrides org. Implements org. Doc from org. Get a child 0..n-1 node
| |
| getChildCount | back to summary |
|---|---|
| public int getChildCount(Object t) Overrides org. Implements org. Doc from org. How many children? If 0, then this is a leaf node
| |
| getChildIndex | back to summary |
|---|---|
| public int getChildIndex(Object t) Implements org. Doc from org. What index is this node in the child list? Range: 0..n-1 If your node type doesn't handle this, it's ok but the tree rewrites in tree parsers need this functionality.
| |
| getParent | back to summary |
|---|---|
| public Object getParent(Object t) Implements org. Doc from org. Who is the parent node of this node; if null, implies node is root. If your node type doesn't handle this, it's ok but the tree rewrites in tree parsers need this functionality.
| |
| getText | back to summary |
|---|---|
| public String getText(Object t) Overrides org. Implements org.
| |
| getToken | back to summary |
|---|---|
| public Token getToken(Object t) Implements org. What is the Token associated with this node? If you are not using CommonTree, then you must override this in your own adaptor.
| |
| getTokenStartIndex | back to summary |
|---|---|
| public int getTokenStartIndex(Object t) Implements org. Doc from org. Get the token start index for this subtree; return -1 if no such index
| |
| getTokenStopIndex | back to summary |
|---|---|
| public int getTokenStopIndex(Object t) Implements org. Doc from org. Get the token stop index for this subtree; return -1 if no such index
| |
| getType | back to summary |
|---|---|
| public int getType(Object t) Overrides org. Implements org. Doc from org. For tree parsing, I need to know the token type of a node
| |
| replaceChildren | back to summary |
|---|---|
| public void replaceChildren(Object parent, int startChildIndex, int stopChildIndex, Object t) Implements org. Doc from org. Replace from start to stop child index of parent with t, which might be a list. Number of children may be different after this call. If parent is null, don't do anything; must be at root of overall tree. Can't replace whatever points to the parent externally. Do nothing.
| |
| setChildIndex | back to summary |
|---|---|
| public void setChildIndex(Object t, int index) Implements org.
| |
| setParent | back to summary |
|---|---|
| public void setParent(Object t, Object parent) Implements org.
| |
| setTokenBoundaries | back to summary |
|---|---|
| public void setTokenBoundaries(Object t, Token startToken, Token stopToken) Implements org. 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.
| |