ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct - Online Linux Manual PageSection : 3
Updated : Tue Jan 26 2021
Source : Version 3.3.1
Note : ANTLR3C

NAMEANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct − A generic list of elements tracked in an alternative to be used in a -> rewrite rule​.

SYNOPSIS
#include <antlr3rewritestreams​.h>

Data Fieldsvoid *(* _next )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
pANTLR3_BASE_TREE_ADAPTOR adaptor
Pointer to the tree adaptor in use for this stream​.
void(* add )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream, void *el, void(ANTLR3_CDECL *freePtr)(void *))
Add a new pANTLR3_BASE_TREE to this stream​.
ANTLR3_UINT32 cursor
Cursor 0​.​.n-1​.
ANTLR3_BOOLEAN dirty
Once a node / subtree has been used in a stream, it must be dup'ed from then on​.
void *(* dup )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream, void *el)
When constructing trees, sometimes we need to dup a token or AST subtree​.
void * elementDescription
The element or stream description; usually has name of the token or rule reference that this list tracks​.
pANTLR3_VECTOR elements
The list of tokens or subtrees we are tracking​.
void(* free )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
ANTLR3_BOOLEAN freeElements
Indicates whether we should free the vector or it was supplied to us​.
void *(* getDescription )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
Returns the description string if there is one available (check for NULL)​.
ANTLR3_BOOLEAN(* hasNext )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
Returns ANTLR3_TRUE if there is a next element available​.
void *(* next )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
Return the next element in the stream​.
pANTLR3_BASE_TREE(* nextNode )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
Treat next element as a single node even if it's a subtree​.
void *(* nextToken )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
pANTLR3_BASE_TREE(* nextTree )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
pANTLR3_BASE_RECOGNIZER rec
void(* reset )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
Reset the condition of this stream so that it appears we have not consumed any of its elements​.
void * singleElement
Track single elements w/o creating a list​.
ANTLR3_UINT32(* size )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)
Number of elements available in the stream​.
pANTLR3_BASE_TREE(* toTree )(struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream, void *el)
Ensure stream emits trees; tokens must be converted to AST nodes​.

Detailed DescriptionA generic list of elements tracked in an alternative to be used in a -> rewrite rule​.
In the C implementation, all tree oriented streams return a pointer to the same type: pANTLR3_BASE_TREE​. Anything that has subclassed from this still passes this type, within which there is a super pointer, which points to it's own data and methods​. Hence we do not need to implement this as the equivalent of an abstract class, but just fill in the appropriate interface as usual with this model​. Once you start next()ing, do not try to add more elements​. It will break the cursor tracking I believe​. See also pANTLR3_REWRITE_RULE_NODE_STREAM pANTLR3_REWRITE_RULE_ELEMENT_STREAM pANTLR3_REWRITE_RULE_SUBTREE_STREAM TODO: add mechanism to detect/puke on modification after reading from stream

Field Documentation

void*(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::_next) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Referenced by antlr3RewriteRuleElementStreamNewAE(), next(), nextNode(), nextNodeNode(), nextNodeToken(), nextToken(), and nextTree()​.

pANTLR3_BASE_TREE_ADAPTOR ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::adaptorPointer to the tree adaptor in use for this stream​. Referenced by add(), antlr3RewriteRuleElementStreamNewAE(), dupTree(), freeNodeRS(), freeRS(), nextNode(), nextNodeToken(), and toTreeNode()​.

void(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::add) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream, void *el, void(ANTLR3_CDECL *freePtr)(void *))Add a new pANTLR3_BASE_TREE to this stream​. Referenced by antlr3RewriteRuleElementStreamNewAE(), and antlr3RewriteRuleElementStreamNewAEE()​.

ANTLR3_UINT32 ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::cursorCursor 0​.​.n-1​. If singleElement!=NULL, cursor is 0 until you next(), which bumps it to 1 meaning no more elements​. Referenced by _next(), antlr3RewriteRuleElementStreamNewAE(), hasNext(), next(), nextNode(), nextTree(), and reset()​.

ANTLR3_BOOLEAN ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dirtyOnce a node / subtree has been used in a stream, it must be dup'ed from then on​. Streams are reset after sub rules so that the streams can be reused in future sub rules​. So, reset must set a dirty bit​. If dirty, then next() always returns a dup​. Referenced by antlr3RewriteRuleElementStreamNewAE(), nextNode(), nextTree(), and reset()​.

void*(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::dup) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream, void *el)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()​. Referenced by antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), antlr3RewriteRuleNODEStreamNewAEV(), antlr3RewriteRuleSubtreeStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAEE(), antlr3RewriteRuleSubtreeStreamNewAEV(), antlr3RewriteRuleTOKENStreamNewAE(), antlr3RewriteRuleTOKENStreamNewAEE(), antlr3RewriteRuleTOKENStreamNewAEV(), next(), and nextTree()​.

void* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elementDescriptionThe element or stream description; usually has name of the token or rule reference that this list tracks​. Can include rulename too, but the exception would track that info​. Referenced by antlr3RewriteRuleElementStreamNewAE(), and getDescription()​.

pANTLR3_VECTOR ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::elementsThe list of tokens or subtrees we are tracking​. Referenced by _next(), add(), antlr3RewriteRuleElementStreamNewAE(), antlr3RewriteRuleElementStreamNewAEV(), expungeRS(), freeNodeRS(), freeRS(), hasNext(), and size()​.

void(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::free) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Referenced by antlr3RewriteRuleElementStreamNewAE(), antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), antlr3RewriteRuleNODEStreamNewAEV(), antlr3RewriteRuleSubtreeStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAEE(), and antlr3RewriteRuleSubtreeStreamNewAEV()​.

ANTLR3_BOOLEAN ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::freeElementsIndicates whether we should free the vector or it was supplied to us​. Referenced by add(), antlr3RewriteRuleElementStreamNewAE(), antlr3RewriteRuleElementStreamNewAEV(), expungeRS(), freeNodeRS(), and freeRS()​.

void*(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::getDescription) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Returns the description string if there is one available (check for NULL)​. Referenced by antlr3RewriteRuleElementStreamNewAE()​.

ANTLR3_BOOLEAN(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::hasNext) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Returns ANTLR3_TRUE if there is a next element available​. Referenced by antlr3RewriteRuleElementStreamNewAE()​.

void*(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::next) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)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]​. Referenced by antlr3RewriteRuleElementStreamNewAE()​.

pANTLR3_BASE_TREE(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextNode) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)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​. Referenced by antlr3RewriteRuleElementStreamNewAE(), antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), antlr3RewriteRuleNODEStreamNewAEV(), antlr3RewriteRuleSubtreeStreamNewAE(), antlr3RewriteRuleSubtreeStreamNewAEE(), antlr3RewriteRuleSubtreeStreamNewAEV(), antlr3RewriteRuleTOKENStreamNewAE(), antlr3RewriteRuleTOKENStreamNewAEE(), and antlr3RewriteRuleTOKENStreamNewAEV()​.

void*(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextToken) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Referenced by antlr3RewriteRuleElementStreamNewAE()​.

pANTLR3_BASE_TREE(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::nextTree) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Referenced by antlr3RewriteRuleElementStreamNewAE()​.

pANTLR3_BASE_RECOGNIZER ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::recReferenced by antlr3RewriteRuleElementStreamNewAE(), freeNodeRS(), and freeRS()​.

void(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::reset) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Reset the condition of this stream so that it appears we have not consumed any of its elements​. Elements themselves are untouched​. Referenced by antlr3RewriteRuleElementStreamNewAE()​.

void* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::singleElementTrack single elements w/o creating a list​. Upon 2nd add, alloc list Referenced by _next(), add(), antlr3RewriteRuleElementStreamNewAE(), freeNodeRS(), hasNext(), and size()​.

ANTLR3_UINT32(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::size) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream)Number of elements available in the stream​. Referenced by _next(), antlr3RewriteRuleElementStreamNewAE(), next(), nextNode(), and nextTree()​.

pANTLR3_BASE_TREE(* ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct::toTree) (struct ANTLR3_REWRITE_RULE_ELEMENT_STREAM_struct *stream, void *el)Ensure stream emits trees; tokens must be converted to AST nodes​. AST nodes can be passed through unmolested​. Referenced by _next(), antlr3RewriteRuleElementStreamNewAE(), antlr3RewriteRuleNODEStreamNewAE(), antlr3RewriteRuleNODEStreamNewAEE(), and antlr3RewriteRuleNODEStreamNewAEV()​.

AuthorGenerated automatically by Doxygen for ANTLR3C from the source code​.
0
Johanes Gumabo
Data Size   :   43,761 byte
man-antlr3-singleElement.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 227,348
Visitor ID   :     :  
Visitor IP   :   3.149.27.153   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.