antlr3-expungeRS (3) - Linux Manuals

NAME

src/antlr3rewritestreams.c -

Implementation of token/tree streams that are used by the tree re-write rules to manipulate the tokens and trees produced by rules that are subject to rewrite directives.

SYNOPSIS


#include <antlr3rewritestreams.h>

Functions


static void * _next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Do the work of getting the next element, making sure that it's a tree node or subtree.
static void add (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void *el, void(ANTLR3_CDECL *freePtr)(void *))

static pANTLR3_REWRITE_RULE_ELEMENT_STREAM antlr3RewriteRuleElementStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

static pANTLR3_REWRITE_RULE_ELEMENT_STREAM antlr3RewriteRuleElementStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void *oneElement)

static pANTLR3_REWRITE_RULE_ELEMENT_STREAM antlr3RewriteRuleElementStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM antlr3RewriteRuleNODEStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM antlr3RewriteRuleNODEStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void *oneElement)

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM antlr3RewriteRuleNODEStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM antlr3RewriteRuleSubtreeStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM antlr3RewriteRuleSubtreeStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void *oneElement)

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM antlr3RewriteRuleSubtreeStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM antlr3RewriteRuleTOKENStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM antlr3RewriteRuleTOKENStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void *oneElement)

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM antlr3RewriteRuleTOKENStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

static void * dupTok (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void *el)
When constructing trees, sometimes we need to dup a token or AST subtree.
static void * dupTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void *element)
When constructing trees, sometimes we need to dup a token or AST subtree.
static void * dupTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void *element)
When constructing trees, sometimes we need to dup a token or AST subtree.
static void expungeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)

static void freeNodeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Do special nilNode reuse detection for node streams.
static void freeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)

static void * getDescription (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Returns the description string if there is one available (check for NULL).
static ANTLR3_BOOLEAN hasNext (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Returns ANTLR3_TRUE if there is a next element available.
static void * next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Return the next element in the stream.
static pANTLR3_BASE_TREE nextNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Treat next element as a single node even if it's a subtree.
static pANTLR3_BASE_TREE nextNodeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)

static pANTLR3_BASE_TREE nextNodeToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Get the next token from the list and create a node for it This is the implementation for token streams.
static void * nextToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Return the next element for a caller that wants just the token.
static pANTLR3_BASE_TREE nextTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Return the next element in the stream.
static void reset (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Reset the condition of this stream so that it appears we have not consumed any of its elements.
static ANTLR3_UINT32 size (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream)
Number of elements available in the stream.
static pANTLR3_BASE_TREE toTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void *element)
We don;t explicitly convert to a tree unless the call goes to nextTree, which means rewrites are heterogeneous.
static pANTLR3_BASE_TREE toTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void *element)
Ensure stream emits trees; tokens must be converted to AST nodes.

Detailed Description

Implementation of token/tree streams that are used by the tree re-write rules to manipulate the tokens and trees produced by rules that are subject to rewrite directives.

Function Documentation

static void * _next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Do the work of getting the next element, making sure that it's a tree node or subtree. Deal with the optimization of single- element list versus list of size > 1. Throw an exception (or something similar) if the stream is empty or we're out of elements and size>1. You can override in a 'subclass' if necessary.

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, ANTLR3_VECTOR_struct::get, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElement, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::size, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::toTree.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static void add (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el, void(ANTLR3_CDECL *freePtr)(void *)) [static]

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, ANTLR3_VECTOR_struct::add, ANTLR3_TRUE, ANTLR3_VECTOR_struct::count, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElements, ANTLR3_VECTOR_FACTORY_struct::newVector, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElement, and ANTLR3_BASE_TREE_ADAPTOR_struct::super.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static pANTLR3_REWRITE_RULE_ELEMENT_STREAM antlr3RewriteRuleElementStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description) [static]

References _next(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, add(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::add, ANTLR3_FALSE, ANTLR3_MALLOC, ANTLR3_VECTOR_struct::count, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dirty, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elementDescription, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElements, freeRS(), getDescription(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::getDescription, hasNext(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::hasNext, next(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::next, nextNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, nextToken(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextToken, nextTree(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextTree, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::rec, ANTLR3_VECTOR_struct::remove, reset(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::reset, ANTLR3_RECOGNIZER_SHARED_STATE_struct::rStreams, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElement, size(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::size, ANTLR3_BASE_RECOGNIZER_struct::state, toTree(), and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::toTree.

Referenced by antlr3RewriteRuleElementStreamNewAEE(), antlr3RewriteRuleElementStreamNewAEV(), antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAE(), and antlr3RewriteRuleTOKENStreamNewAE().

static pANTLR3_REWRITE_RULE_ELEMENT_STREAM antlr3RewriteRuleElementStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement) [static]

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::add, and antlr3RewriteRuleElementStreamNewAE().

Referenced by antlr3RewriteRuleNODEStreamNewAEE(), antlr3RewriteRuleSubtreeStreamNewAEE(), and antlr3RewriteRuleTOKENStreamNewAEE().

static pANTLR3_REWRITE_RULE_ELEMENT_STREAM antlr3RewriteRuleElementStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector) [static]

References ANTLR3_FALSE, ANTLR3_TRUE, antlr3RewriteRuleElementStreamNewAE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, ANTLR3_VECTOR_struct::factoryMade, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElements.

Referenced by antlr3RewriteRuleNODEStreamNewAEV(), antlr3RewriteRuleSubtreeStreamNewAEV(), and antlr3RewriteRuleTOKENStreamNewAEV().

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM antlr3RewriteRuleNODEStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

References antlr3RewriteRuleElementStreamNewAE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTreeNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, freeNodeRS(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, nextNodeNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::toTree, and toTreeNode().

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM antlr3RewriteRuleNODEStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement)

References antlr3RewriteRuleElementStreamNewAEE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTreeNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, freeNodeRS(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, nextNodeNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::toTree, and toTreeNode().

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM antlr3RewriteRuleNODEStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

References antlr3RewriteRuleElementStreamNewAEV(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTreeNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, freeNodeRS(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, nextNodeNode(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::toTree, and toTreeNode().

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM antlr3RewriteRuleSubtreeStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

References antlr3RewriteRuleElementStreamNewAE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTree(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, freeNodeRS(), nextNode(), and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode.

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM antlr3RewriteRuleSubtreeStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement)

References antlr3RewriteRuleElementStreamNewAEE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTree(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, freeNodeRS(), nextNode(), and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode.

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM antlr3RewriteRuleSubtreeStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

References antlr3RewriteRuleElementStreamNewAEV(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTree(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free, freeNodeRS(), nextNode(), and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode.

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM antlr3RewriteRuleTOKENStreamNewAE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description)

References antlr3RewriteRuleElementStreamNewAE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTok(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, and nextNodeToken().

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM antlr3RewriteRuleTOKENStreamNewAEE (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement)

References antlr3RewriteRuleElementStreamNewAEE(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTok(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, and nextNodeToken().

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM antlr3RewriteRuleTOKENStreamNewAEV (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector)

References antlr3RewriteRuleElementStreamNewAEV(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, dupTok(), ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode, and nextNodeToken().

static void * dupTok (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * el) [static]

When constructing trees, sometimes we need to dup a token or AST subtree. Dup'ing a token means just creating another AST node around it. For trees, you must call the adaptor.dupTree().

References ANTLR3_FPRINTF.

Referenced by antlr3RewriteRuleTOKENStreamNewAE(), antlr3RewriteRuleTOKENStreamNewAEE(), and antlr3RewriteRuleTOKENStreamNewAEV().

static void * dupTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) [static]

When constructing trees, sometimes we need to dup a token or AST subtree. Dup'ing a token means just creating another AST node around it. For trees, you must call the adaptor.dupTree().

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, and ANTLR3_BASE_TREE_ADAPTOR_struct::dupNode.

Referenced by antlr3RewriteRuleSubtreeStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAEE(), and antlr3RewriteRuleSubtreeStreamNewAEV().

static void * dupTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) [static]

When constructing trees, sometimes we need to dup a token or AST subtree. Dup'ing a token means just creating another AST node around it. For trees, you must call the adaptor.dupTree().

References ANTLR3_FPRINTF.

Referenced by antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), and antlr3RewriteRuleNODEStreamNewAEV().

static void expungeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

References ANTLR3_FREE, ANTLR3_TRUE, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElements.

Referenced by freeNodeRS(), and freeRS().

static void freeNodeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Do special nilNode reuse detection for node streams.

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, ANTLR3_VECTOR_struct::add, ANTLR3_FALSE, ANTLR3_TRUE, ANTLR3_VECTOR_struct::clear, ANTLR3_VECTOR_struct::count, ANTLR3_VECTOR_ELEMENT_struct::element, ANTLR3_VECTOR_struct::elements, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, expungeRS(), ANTLR3_VECTOR_struct::factoryMade, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElements, ANTLR3_BASE_TREE_struct::isNilNode, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::rec, ANTLR3_VECTOR_FACTORY_struct::returnVector, ANTLR3_RECOGNIZER_SHARED_STATE_struct::rStreams, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElement, ANTLR3_BASE_RECOGNIZER_struct::state, and ANTLR3_BASE_TREE_ADAPTOR_struct::super.

Referenced by antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), antlr3RewriteRuleNODEStreamNewAEV(), antlr3RewriteRuleSubtreeStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAEE(), and antlr3RewriteRuleSubtreeStreamNewAEV().

static void freeRS (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, ANTLR3_VECTOR_struct::add, ANTLR3_FALSE, ANTLR3_TRUE, ANTLR3_VECTOR_struct::clear, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, expungeRS(), ANTLR3_VECTOR_struct::factoryMade, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElements, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::rec, ANTLR3_VECTOR_FACTORY_struct::returnVector, ANTLR3_RECOGNIZER_SHARED_STATE_struct::rStreams, ANTLR3_BASE_RECOGNIZER_struct::state, and ANTLR3_BASE_TREE_ADAPTOR_struct::super.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static void * getDescription (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Returns the description string if there is one available (check for NULL).

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elementDescription.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static ANTLR3_BOOLEAN hasNext (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Returns ANTLR3_TRUE if there is a next element available.

References ANTLR3_FALSE, ANTLR3_TRUE, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElement, and ANTLR3_VECTOR_struct::size.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static void * next (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Return the next element in the stream. If out of elements, throw an exception unless size()==1. If size is 1, then return elements[0].

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::size.

Referenced by antlr3ExceptionFree(), and antlr3RewriteRuleElementStreamNewAE().

static pANTLR3_BASE_TREE nextNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Treat next element as a single node even if it's a subtree. This is used instead of next() when the result has to be a tree root node. Also prevents us from duplicating recently-added children; e.g., ^(type ID)+ adds ID to type and then 2nd iteration must dup the type node, but ID has been added.

Referencing to a rule result twice is ok; dup entire tree as we can't be adding trees; e.g., expr expr.

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, ANTLR3_TRUE, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dirty, ANTLR3_BASE_TREE_ADAPTOR_struct::dupNode, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::size.

Referenced by antlr3RewriteRuleElementStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAEE(), antlr3RewriteRuleSubtreeStreamNewAEV(), intTrieAdd(), and intTrieGet().

static pANTLR3_BASE_TREE nextNodeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next.

Referenced by antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), and antlr3RewriteRuleNODEStreamNewAEV().

static pANTLR3_BASE_TREE nextNodeToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Get the next token from the list and create a node for it This is the implementation for token streams.

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, and ANTLR3_BASE_TREE_ADAPTOR_struct::create.

Referenced by antlr3RewriteRuleTOKENStreamNewAE(), antlr3RewriteRuleTOKENStreamNewAEE(), and antlr3RewriteRuleTOKENStreamNewAEV().

static void * nextToken (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Return the next element for a caller that wants just the token.

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static pANTLR3_BASE_TREE nextTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Return the next element in the stream. If out of elements, throw an exception unless size()==1. If size is 1, then return elements[0]. Return a duplicate node/subtree if stream is out of elements and size==1. If we've already used the element, dup (dirty bit set).

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dirty, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::size.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static void reset (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Reset the condition of this stream so that it appears we have not consumed any of its elements. Elements themselves are untouched.

References ANTLR3_TRUE, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursor, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dirty.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static ANTLR3_UINT32 size (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream) [static]

Number of elements available in the stream.

Should be a count of one if singleElement is set. I copied this logic from the java implementation, which I suspect is just guarding against someone setting singleElement and forgetting to NULL it out

References ANTLR3_VECTOR_struct::count, ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elements, and ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElement.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static pANTLR3_BASE_TREE toTree (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) [static]

We don;t explicitly convert to a tree unless the call goes to nextTree, which means rewrites are heterogeneous.

Referenced by antlr3RewriteRuleElementStreamNewAE().

static pANTLR3_BASE_TREE toTreeNode (pANTLR3_REWRITE_RULE_ELEMENT_STREAM stream, void * element) [static]

Ensure stream emits trees; tokens must be converted to AST nodes. AST nodes can be passed through unmolested.

References ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptor, and ANTLR3_BASE_TREE_ADAPTOR_struct::dupNode.

Referenced by antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), and antlr3RewriteRuleNODEStreamNewAEV().

Author

Generated automatically by Doxygen for ANTLR3C from the source code.