ANTLR3C
3.3.1
|
This is the standard tree adaptor used by the C runtime unless the grammar source file says to use anything different. More...
#include <antlr3commontreeadaptor.h>
This is the standard tree adaptor used by the C runtime unless the grammar source file says to use anything different.
It embeds a BASE_TREE to which it adds its own implementation of anything that the base tree is not good for, plus a number of methods that any other adaptor type needs to implement too.
ANTLR3_API pANTLR3_BASE_TREE_ADAPTOR ANTLR3_TREE_ADAPTORDebugNew | ( | pANTLR3_STRING_FACTORY | strFactory, |
pANTLR3_DEBUG_EVENT_LISTENER | debugger | ||
) |
Debugging version of the tree adaptor (not normally called as generated code calls setDebugEventListener instead which changes a normal token stream to a debugging stream and means that a user's instantiation code does not need to be changed just to debug with AW.
References ANTLR3_TREE_ADAPTORNew(), antlr3BaseTreeAdaptorInit(), ANTLR3_BASE_TREE_ADAPTOR_struct::create, dbgCreate(), dbgSetTokenBoundaries(), and ANTLR3_BASE_TREE_ADAPTOR_struct::setTokenBoundaries.
ANTLR3_API pANTLR3_BASE_TREE_ADAPTOR ANTLR3_TREE_ADAPTORNew | ( | pANTLR3_STRING_FACTORY | strFactory | ) |
Create a new tree adaptor.
Note that despite the fact that this is creating a new COMMON_TREE adaptor, we return the address of the BASE_TREE interface, as should any other adaptor that wishes to be used as the tree element of a tree parse/build. It needs to be given the address of a valid string factory as we do not know what the originating input stream encoding type was. This way we can rely on just using the original input stream's string factory or one of the correct type which the user supplies us.
References ANTLR3_MALLOC, antlr3ArboretumNew(), antlr3BaseTreeAdaptorInit(), antlr3TokenFactoryNew(), ANTLR3_COMMON_TREE_ADAPTOR_struct::arboretum, ANTLR3_COMMON_TREE_ADAPTOR_struct::baseAdaptor, create(), ANTLR3_BASE_TREE_ADAPTOR_struct::create, createToken(), ANTLR3_BASE_TREE_ADAPTOR_struct::createToken, createTokenFromToken(), ANTLR3_BASE_TREE_ADAPTOR_struct::createTokenFromToken, ctaFree(), deleteChild(), ANTLR3_BASE_TREE_ADAPTOR_struct::deleteChild, dupNode(), ANTLR3_BASE_TREE_ADAPTOR_struct::dupNode, errorNode(), ANTLR3_BASE_TREE_ADAPTOR_struct::errorNode, ANTLR3_BASE_TREE_ADAPTOR_struct::free, getChild(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChild, getChildCount(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChildCount, getChildIndex(), ANTLR3_BASE_TREE_ADAPTOR_struct::getChildIndex, getParent(), ANTLR3_BASE_TREE_ADAPTOR_struct::getParent, getText(), ANTLR3_BASE_TREE_ADAPTOR_struct::getText, getTokenStartIndex(), ANTLR3_BASE_TREE_ADAPTOR_struct::getTokenStartIndex, getTokenStopIndex(), ANTLR3_BASE_TREE_ADAPTOR_struct::getTokenStopIndex, getType(), ANTLR3_BASE_TREE_ADAPTOR_struct::getType, replaceChildren(), ANTLR3_BASE_TREE_ADAPTOR_struct::replaceChildren, setChild(), ANTLR3_BASE_TREE_ADAPTOR_struct::setChild, setChildIndex(), ANTLR3_BASE_TREE_ADAPTOR_struct::setChildIndex, setDebugEventListener(), ANTLR3_BASE_TREE_ADAPTOR_struct::setDebugEventListener, setParent(), ANTLR3_BASE_TREE_ADAPTOR_struct::setParent, setTokenBoundaries(), ANTLR3_BASE_TREE_ADAPTOR_struct::setTokenBoundaries, ANTLR3_BASE_TREE_ADAPTOR_struct::strFactory, ANTLR3_COMMON_TOKEN_struct::strFactory, ANTLR3_BASE_TREE_ADAPTOR_struct::super, ANTLR3_BASE_TREE_ADAPTOR_struct::tokenFactory, and ANTLR3_TOKEN_FACTORY_struct::unTruc.
Referenced by ANTLR3_TREE_ADAPTORDebugNew(), and antlr3CommonTreeNodeStreamNew().
|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::super.
Referenced by ANTLR3_TREE_ADAPTORNew(), and dbgCreate().
|
static |
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.
References ANTLR3_TEXT_CHARP, ANTLR3_COMMON_TOKEN_struct::chars, ANTLR3_COMMON_TOKEN_struct::input, ANTLR3_TOKEN_FACTORY_struct::input, newToken(), ANTLR3_TOKEN_FACTORY_struct::newToken, ANTLR3_COMMON_TOKEN_struct::setType, ANTLR3_BASE_TREE_ADAPTOR_struct::strFactory, ANTLR3_COMMON_TOKEN_struct::strFactory, ANTLR3_COMMON_TOKEN_struct::textState, ANTLR3_BASE_TREE_ADAPTOR_struct::tokenFactory, and ANTLR3_COMMON_TOKEN_struct::tokText.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
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.
NB: this being C it is not so easy to extend the types of creaeteToken. We will have to see if anyone needs to do this and add any variants to this interface.
References ANTLR3_TEXT_CHARP, ANTLR3_TEXT_STRING, ANTLR3_COMMON_TOKEN_struct::chars, ANTLR3_STRING_struct::chars, ANTLR3_COMMON_TOKEN_struct::getChannel, ANTLR3_COMMON_TOKEN_struct::getCharPositionInLine, ANTLR3_COMMON_TOKEN_struct::getLine, ANTLR3_COMMON_TOKEN_struct::getText, ANTLR3_COMMON_TOKEN_struct::getTokenIndex, ANTLR3_COMMON_TOKEN_struct::getType, ANTLR3_STRING_struct::len, ANTLR3_STRING_FACTORY_struct::newPtr, newToken(), ANTLR3_TOKEN_FACTORY_struct::newToken, ANTLR3_COMMON_TOKEN_struct::setChannel, ANTLR3_COMMON_TOKEN_struct::setCharPositionInLine, ANTLR3_COMMON_TOKEN_struct::setLine, ANTLR3_COMMON_TOKEN_struct::setTokenIndex, ANTLR3_COMMON_TOKEN_struct::setType, ANTLR3_BASE_TREE_ADAPTOR_struct::strFactory, ANTLR3_COMMON_TOKEN_struct::text, ANTLR3_COMMON_TOKEN_struct::textState, ANTLR3_BASE_TREE_ADAPTOR_struct::tokenFactory, ANTLR3_COMMON_TOKEN_struct::tokText, and ANTLR3_COMMON_TOKEN_struct::toString.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_FREE, ANTLR3_COMMON_TREE_ADAPTOR_struct::arboretum, ANTLR3_ARBORETUM_struct::close, ANTLR3_TOKEN_FACTORY_struct::close, ANTLR3_BASE_TREE_ADAPTOR_struct::super, and ANTLR3_BASE_TREE_ADAPTOR_struct::tokenFactory.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References create(), ANTLR3_DEBUG_EVENT_LISTENER_struct::createNode, and ANTLR3_BASE_TREE_ADAPTOR_struct::debugger.
Referenced by ANTLR3_TREE_ADAPTORDebugNew(), and setDebugEventListener().
|
static |
References ANTLR3_BASE_TREE_ADAPTOR_struct::debugger, ANTLR3_COMMON_TOKEN_struct::getTokenIndex, setTokenBoundaries(), and ANTLR3_DEBUG_EVENT_LISTENER_struct::setTokenBoundaries.
Referenced by ANTLR3_TREE_ADAPTORDebugNew(), and setDebugEventListener().
|
static |
References ANTLR3_BASE_TREE_struct::deleteChild.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
Duplicate the supplied node.
References ANTLR3_BASE_TREE_struct::dupNode.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_TOKEN_INVALID, and ANTLR3_BASE_TREE_ADAPTOR_struct::createTypeText.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::getChild.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::getChildCount.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::getChildIndex.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::getParent.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::getText.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
|
static |
References ANTLR3_BASE_TREE_struct::super.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::super.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::getType.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::replaceChildren.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::setChild.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::setChildIndex.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
Causes an existing common tree adaptor to become a debug version.
References antlr3BaseTreeAdaptorInit(), ANTLR3_BASE_TREE_ADAPTOR_struct::create, dbgCreate(), dbgSetTokenBoundaries(), and ANTLR3_BASE_TREE_ADAPTOR_struct::setTokenBoundaries.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
References ANTLR3_BASE_TREE_struct::setParent.
Referenced by ANTLR3_TREE_ADAPTORNew().
|
static |
Track start/stop token for subtree root created for a rule.
Only works with CommonTree 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.
References ANTLR3_COMMON_TOKEN_struct::getTokenIndex, ANTLR3_COMMON_TREE_struct::startIndex, ANTLR3_COMMON_TREE_struct::stopIndex, and ANTLR3_BASE_TREE_struct::super.
Referenced by ANTLR3_TREE_ADAPTORNew(), and dbgSetTokenBoundaries().