|
ANTLR3C 3.3.1
|
Contains the base functions that all tree adaptors start with. More...
#include <antlr3basetreeadaptor.h>
Contains the base functions that all tree adaptors start with.
this implementation can then be overridden by any higher implementation.
|
static |
Add a child to the tree t.
If child is a flat tree (a list), make all in list children of t. Warning: if t has no children, but child does and child isNilNode then it is ok to move children to t via t.children = child.children; i.e., without copying the array. This is for construction and I'm not sure it's completely general for a tree's addChild method to work this way. Make sure you differentiate between your tree's addChild and this parser tree construction addChild if it's not ok to move children to t with a simple assignment.
References addChild(), and ANTLR3_BASE_TREE_struct::addChild.

|
static |
Use the adaptor implementation to add a child node with the supplied token.
References ANTLR3_BASE_TREE_ADAPTOR_struct::addChild, addChildToken(), and ANTLR3_BASE_TREE_ADAPTOR_struct::create.
Referenced by addChildToken(), and antlr3BaseTreeAdaptorInit().


| ANTLR3_API void antlr3BaseTreeAdaptorInit | ( | pANTLR3_BASE_TREE_ADAPTOR | adaptor, |
| pANTLR3_DEBUG_EVENT_LISTENER | debugger ) |
Given a pointer to a base tree adaptor structure (which is usually embedded in the super class the implements the tree adaptor used in the parse), initialize its function pointers and so on.
References ANTLR3_DEBUG_EVENT_LISTENER_struct::adaptor, addChild(), ANTLR3_BASE_TREE_ADAPTOR_struct::addChild, addChildToken(), ANTLR3_BASE_TREE_ADAPTOR_struct::addChildToken, antlr3BaseTreeAdaptorInit(), ANTLR3_BASE_TREE_ADAPTOR_struct::becomeRoot, becomeRoot(), ANTLR3_BASE_TREE_ADAPTOR_struct::becomeRootToken, becomeRootToken(), ANTLR3_BASE_TREE_ADAPTOR_struct::createTypeText, createTypeText(), ANTLR3_BASE_TREE_ADAPTOR_struct::createTypeToken, createTypeToken(), ANTLR3_BASE_TREE_ADAPTOR_struct::createTypeTokenText, createTypeTokenText(), dbgAddChild(), dbgAddChildToken(), dbgBecomeRoot(), dbgBecomeRootToken(), dbgCreateTypeText(), dbgCreateTypeToken(), dbgCreateTypeTokenText(), dbgDupTree(), dbgNil(), ANTLR3_BASE_TREE_ADAPTOR_struct::dupTree, dupTree(), ANTLR3_BASE_TREE_ADAPTOR_struct::dupTreeTT, dupTreeTT(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, getChild(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChildCount, getChildCount(), ANTLR3_BASE_TREE_ADAPTOR_struct::getText, getText(), ANTLR3_BASE_TREE_ADAPTOR_struct::getType, getType(), ANTLR3_BASE_TREE_ADAPTOR_struct::getUniqueID, getUniqueID(), ANTLR3_BASE_TREE_ADAPTOR_struct::isNilNode, isNilNode(), ANTLR3_BASE_TREE_ADAPTOR_struct::makeDot, makeDot(), ANTLR3_BASE_TREE_ADAPTOR_struct::nilNode, nilNode(), ANTLR3_BASE_TREE_ADAPTOR_struct::rulePostProcessing, rulePostProcessing(), ANTLR3_BASE_TREE_ADAPTOR_struct::setText, setText(), ANTLR3_BASE_TREE_ADAPTOR_struct::setText8, setText8(), ANTLR3_BASE_TREE_ADAPTOR_struct::setType, and setType().
Referenced by ANTLR3_TREE_ADAPTORDebugNew(), ANTLR3_TREE_ADAPTORNew(), antlr3BaseTreeAdaptorInit(), antlr3CommonTreeNewFromTree(), and setDebugEventListener().


|
static |
If oldRoot is a nil root, just copy or move the children to newRoot.
If not a nil root, make oldRoot a child of newRoot.
If newRoot is a nil-rooted single child tree, use the single child as the new root node.
If oldRoot was null, it's ok, just return newRoot (even if isNilNode).
Return newRoot. Throw an exception if newRoot is not a simple node or nil root with a single child node–it must be a root node. If newRoot is ^(nil x)</endcode> return x as newRoot.
Be advised that it's ok for newRoot to point at oldRoot's
children; i.e., you don't have to copy the list. We are
constructing these nodes so we should have this control for
efficiency.
References ANTLR3_BASE_TREE_struct::addChild, becomeRoot(), ANTLR3_BASE_TREE_struct::getChild, ANTLR3_BASE_TREE_struct::getChildCount, ANTLR3_BASE_TREE_struct::isNilNode, and ANTLR3_BASE_TREE_struct::reuse.
Referenced by antlr3BaseTreeAdaptorInit(), antlr3DebugListenerNew(), becomeRoot(), becomeRoot(), and dbgBecomeRoot().


|
static |
Use the adaptor interface to set a new tree node with the supplied token to the root of the tree.
References ANTLR3_BASE_TREE_ADAPTOR_struct::becomeRoot, becomeRootToken(), and ANTLR3_BASE_TREE_ADAPTOR_struct::create.
Referenced by antlr3BaseTreeAdaptorInit(), and becomeRootToken().


|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::create, ANTLR3_BASE_TREE_ADAPTOR_struct::createToken, and createTypeText().
Referenced by antlr3BaseTreeAdaptorInit(), createTypeText(), and dbgCreateTypeText().


|
static |
Use the super class supplied create() method to create a new node from the supplied token.
References ANTLR3_BASE_TREE_ADAPTOR_struct::create, ANTLR3_BASE_TREE_ADAPTOR_struct::createTokenFromToken, createTypeToken(), and ANTLR3_COMMON_TOKEN_struct::setType.
Referenced by antlr3BaseTreeAdaptorInit(), createTypeToken(), and dbgCreateTypeToken().


|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::create, ANTLR3_BASE_TREE_ADAPTOR_struct::createTokenFromToken, createTypeTokenText(), ANTLR3_COMMON_TOKEN_struct::setText8, and ANTLR3_COMMON_TOKEN_struct::setType.
Referenced by antlr3BaseTreeAdaptorInit(), createTypeTokenText(), and dbgCreateTypeTokenText().


|
static |
References ANTLR3_BASE_TREE_struct::addChild, ANTLR3_DEBUG_EVENT_LISTENER_struct::addChild, dbgAddChild(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgAddChild().


|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::addChild, ANTLR3_DEBUG_EVENT_LISTENER_struct::addChild, ANTLR3_BASE_TREE_ADAPTOR_struct::create, dbgAddChildToken(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgAddChildToken().


|
static |
References ANTLR3_DEBUG_EVENT_LISTENER_struct::becomeRoot, becomeRoot(), dbgBecomeRoot(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgBecomeRoot().


|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::becomeRoot, ANTLR3_DEBUG_EVENT_LISTENER_struct::becomeRoot, ANTLR3_BASE_TREE_ADAPTOR_struct::create, dbgBecomeRootToken(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgBecomeRootToken().


|
static |
References ANTLR3_DEBUG_EVENT_LISTENER_struct::createNode, createTypeText(), dbgCreateTypeText(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgCreateTypeText().


|
static |
References ANTLR3_DEBUG_EVENT_LISTENER_struct::createNode, createTypeToken(), dbgCreateTypeToken(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgCreateTypeToken().


|
static |
References ANTLR3_DEBUG_EVENT_LISTENER_struct::createNode, createTypeTokenText(), dbgCreateTypeTokenText(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgCreateTypeTokenText().


|
static |
References dbgDupTree(), ANTLR3_BASE_TREE_ADAPTOR_struct::dupTreeTT, and simulateTreeConstruction().
Referenced by antlr3BaseTreeAdaptorInit(), and dbgDupTree().


|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::create, ANTLR3_DEBUG_EVENT_LISTENER_struct::createNode, dbgNil(), and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by antlr3BaseTreeAdaptorInit(), and dbgNil().


|
static |
References ANTLR3_STRING_struct::addc, ANTLR3_STRING_struct::append8, ANTLR3_STRING_struct::charAt, defineDotEdges(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, ANTLR3_BASE_TREE_ADAPTOR_struct::getChildCount, ANTLR3_BASE_TREE_ADAPTOR_struct::getText, and ANTLR3_STRING_struct::len.
Referenced by defineDotEdges(), and makeDot().


|
static |
References ANTLR3_STRING_struct::addc, ANTLR3_STRING_struct::append8, ANTLR3_STRING_struct::charAt, defineDotNodes(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, ANTLR3_BASE_TREE_ADAPTOR_struct::getChildCount, ANTLR3_BASE_TREE_ADAPTOR_struct::getText, and ANTLR3_STRING_struct::len.
Referenced by defineDotNodes(), and makeDot().


|
static |
Return a duplicate of the entire tree (implementation provided by the BASE_TREE interface.).
References dupTree(), and ANTLR3_BASE_TREE_ADAPTOR_struct::dupTreeTT.

|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::addChild, ANTLR3_BASE_TREE_struct::dupNode, ANTLR3_BASE_TREE_ADAPTOR_struct::dupTreeTT, dupTreeTT(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, ANTLR3_BASE_TREE_ADAPTOR_struct::getChildCount, ANTLR3_BASE_TREE_struct::getChildIndex, ANTLR3_BASE_TREE_ADAPTOR_struct::setChildIndex, and ANTLR3_BASE_TREE_ADAPTOR_struct::setParent.
Referenced by antlr3BaseTreeAdaptorInit(), and dupTreeTT().


|
static |
|
static |
|
static |
Dummy implementation - will be supplied by super class.
References getText().
Referenced by ANTLR3_TREE_ADAPTORNew(), antlr3BaseTreeAdaptorInit(), antlr3LexerNew(), antlr3SetCTAPI(), antlr3SetTokenAPI(), getText(), getText(), getText(), getText(), getText(), and getToken().


|
static |
Dummy implementation - will be supplied by super class.
References getType().
Referenced by ANTLR3_TREE_ADAPTORNew(), antlr3BaseTreeAdaptorInit(), antlr3SetCTAPI(), antlr3SetTokenAPI(), getToken(), getType(), getType(), getType(), and getType().


|
static |
Returns a uniqueID for the node.
Because this is the C implementation we can just use its address suitably converted/cast to an integer.
References ANTLR3_UINT32_CAST, and getUniqueID().
Referenced by antlr3BaseTreeAdaptorInit(), and getUniqueID().


|
static |
References ANTLR3_BASE_TREE_struct::isNilNode, and isNilNode().
Referenced by antlr3BaseTreeAdaptorInit(), antlr3SetCTAPI(), isNilNode(), and isNilNode().


|
static |
Produce a DOT specification for graphviz.
References ANTLR3_STRING_struct::addc, ANTLR3_STRING_struct::append8, ANTLR3_STRING_struct::charAt, defineDotEdges(), defineDotNodes(), ANTLR3_BASE_TREE_ADAPTOR_struct::getText, ANTLR3_STRING_struct::len, makeDot(), ANTLR3_STRING_FACTORY_struct::newStr8, and ANTLR3_BASE_TREE_ADAPTOR_struct::strFactory.
Referenced by antlr3BaseTreeAdaptorInit(), and makeDot().


|
static |
Create and return a nil tree node (no token payload).
References ANTLR3_BASE_TREE_ADAPTOR_struct::create, and nilNode().
Referenced by antlr3BaseTreeAdaptorInit(), antlr3DebugListenerNew(), fillBuffer(), nilNode(), nilNode(), and toString().


|
static |
Transform ^(nil x) to x.
References ANTLR3_BASE_TREE_struct::getChild, ANTLR3_BASE_TREE_struct::getChildCount, ANTLR3_BASE_TREE_struct::isNilNode, ANTLR3_BASE_TREE_struct::reuse, rulePostProcessing(), ANTLR3_BASE_TREE_struct::setChildIndex, and ANTLR3_BASE_TREE_struct::setParent.
Referenced by antlr3BaseTreeAdaptorInit(), and rulePostProcessing().


|
static |
Dummy implementation - will be supplied by super class.
References setText().
Referenced by antlr3BaseTreeAdaptorInit(), antlr3SetTokenAPI(), setText(), and setText().


|
static |
Dummy implementation - will be supplied by super class.
References setText8().
Referenced by antlr3BaseTreeAdaptorInit(), antlr3SetTokenAPI(), setText8(), and setText8().


|
static |
Dummy implementation - will be supplied by super class.
References setType().
Referenced by antlr3BaseTreeAdaptorInit(), antlr3SetTokenAPI(), setType(), and setType().


|
static |
Sends the required debugging events for duplicating a tree to the debugger.
References ANTLR3_DEBUG_EVENT_LISTENER_struct::addChild, ANTLR3_DEBUG_EVENT_LISTENER_struct::createNode, ANTLR3_BASE_TREE_ADAPTOR_struct::debugger, ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, ANTLR3_BASE_TREE_ADAPTOR_struct::getChildCount, and simulateTreeConstruction().
Referenced by dbgDupTree(), and simulateTreeConstruction().

