Home | History | Annotate | Download | only in src

Lines Matching full:stream

2 /// Defines the implementation of the common node stream the default
3 /// tree node stream used by ANTLR.
41 // COMMON TREE STREAM API
52 // TREE NODE STREAM API
64 // INT STREAM API
90 pANTLR3_TREE_NODE_STREAM stream;
94 stream = (pANTLR3_TREE_NODE_STREAM) ANTLR3_CALLOC(1, sizeof(ANTLR3_TREE_NODE_STREAM));
96 if (stream == NULL)
103 stream->replaceChildren = replaceChildren;
104 stream->free = antlr3TreeNodeStreamFree;
106 return stream;
110 antlr3TreeNodeStreamFree(pANTLR3_TREE_NODE_STREAM stream)
112 ANTLR3_FREE(stream);
118 pANTLR3_COMMON_TREE_NODE_STREAM stream;
120 stream = antlr3CommonTreeNodeStreamNew(tree->strFactory, hint);
122 if (stream == NULL)
126 stream->root = tree;
128 return stream;
134 pANTLR3_COMMON_TREE_NODE_STREAM stream;
138 stream = (pANTLR3_COMMON_TREE_NODE_STREAM) ANTLR3_CALLOC(1, sizeof(ANTLR3_COMMON_TREE_NODE_STREAM));
140 if (stream == NULL)
145 // Copy in all the reusable parts of the originating stream and create new
151 stream->stringFactory = inStream->stringFactory;
153 // Create an adaptor for the common tree node stream
155 stream->adaptor = inStream->adaptor;
157 // Create space for the tree node stream interface
159 stream->tnstream = antlr3TreeNodeStreamNew();
161 if (stream->tnstream == NULL)
163 stream->free (stream);
170 stream->tnstream->istream = antlr3IntStreamNew();
172 if (stream->tnstream->istream == NULL)
174 stream->tnstream->free (stream->tnstream);
175 stream->free (stream);
180 // Install the common tree node stream API
182 stream->addNavigationNode = addNavigationNode;
183 stream->hasUniqueNavigationNodes = hasUniqueNavigationNodes;
184 stream->newDownNode = newDownNode;
185 stream->newUpNode = newUpNode;
186 stream->reset = reset;
187 stream->push = push;
188 stream->pop = pop;
189 stream->getLookaheadSize = getLookaheadSize;
191 stream->free = antlr3CommonTreeNodeStreamFree;
193 // Install the tree node stream API
195 stream->tnstream->getTreeAdaptor = getTreeAdaptor;
196 stream->tnstream->getTreeSource = getTreeSource;
197 stream->tnstream->_LT = _LT;
198 stream->tnstream->setUniqueNavigationNodes = setUniqueNavigationNodes;
199 stream->tnstream->toString = toString;
200 stream->tnstream->toStringSS = toStringSS;
201 stream->tnstream->toStringWork = toStringWork;
202 stream->tnstream->get = get;
206 stream->tnstream->istream->consume = consume;
207 stream->tnstream->istream->index = tindex;
208 stream->tnstream->istream->_LA = _LA;
209 stream->tnstream->istream->mark = mark;
210 stream->tnstream->istream->release = release;
211 stream->tnstream->istream->rewind = rewindMark;
212 stream->tnstream->istream->rewindLast = rewindLast;
213 stream->tnstream->istream->seek = seek;
214 stream->tnstream->istream->size = size;
216 // Initialize data elements of INT stream
218 stream->tnstream->istream->type = ANTLR3_COMMONTREENODE;
219 stream->tnstream->istream->super = (stream->tnstream);
221 // Initialize data elements of TREE stream
223 stream->tnstream->ctns = stream;
225 // Initialize data elements of the COMMON TREE NODE stream
227 stream->super = NULL;
228 stream->uniqueNavigationNodes = ANTLR3_FALSE;
229 stream->markers = NULL;
230 stream->nodeStack = inStream->nodeStack;
234 stream->nodes = antlr3VectorNew(DEFAULT_INITIAL_BUFFER_SIZE);
235 stream->p = -1;
242 antlr3SetCTAPI(&(stream->UP));
243 antlr3SetCTAPI(&(stream->DOWN));
244 antlr3SetCTAPI(&(stream->EOF_NODE));
245 antlr3SetCTAPI(&(stream->INVALID_NODE));
247 stream->UP.token = inStream->UP.token;
248 inStream->UP.token->strFactory = stream->stringFactory;
249 stream->DOWN.token = inStream->DOWN.token;
250 inStream->DOWN.token->strFactory = stream->stringFactory;
251 stream->EOF_NODE.token = inStream->EOF_NODE.token;
252 inStream->EOF_NODE.token->strFactory = stream->stringFactory;
253 stream->INVALID_NODE.token = inStream->INVALID_NODE.token;
254 inStream->INVALID_NODE.token->strFactory= stream->stringFactory;
256 // Reuse the root tree of the originating stream
258 stream->root = inStream->root;
260 // Signal that this is a rewriting stream so we don't
265 stream->isRewriter = ANTLR3_TRUE;
266 return stream;
272 pANTLR3_COMMON_TREE_NODE_STREAM stream;
277 stream = (pANTLR3_COMMON_TREE_NODE_STREAM) ANTLR3_CALLOC(1, sizeof(ANTLR3_COMMON_TREE_NODE_STREAM));
279 if (stream == NULL)
286 stream->stringFactory = strFactory;
288 // Create an adaptor for the common tree node stream
290 stream->adaptor = ANTLR3_TREE_ADAPTORNew(strFactory);
292 if (stream->adaptor == NULL)
294 stream->free(stream);
298 // Create space for the tree node stream interface
300 stream->tnstream = antlr3TreeNodeStreamNew();
302 if (stream->tnstream == NULL)
304 stream->adaptor->free (stream->adaptor);
305 stream->free (stream);
312 stream->tnstream->istream = antlr3IntStreamNew();
314 if (stream->tnstream->istream == NULL)
316 stream->adaptor->free (stream->adaptor);
317 stream->tnstream->free (stream->tnstream);
318 stream->free (stream);
323 // Install the common tree node stream API
325 stream->addNavigationNode = addNavigationNode;
326 stream->hasUniqueNavigationNodes = hasUniqueNavigationNodes;
327 stream->newDownNode = newDownNode;
328 stream->newUpNode = newUpNode;
329 stream->reset = reset;
330 stream->push = push;
331 stream->pop = pop;
333 stream->free = antlr3CommonTreeNodeStreamFree;
335 // Install the tree node stream API
337 stream->tnstream->getTreeAdaptor = getTreeAdaptor;
338 stream->tnstream->getTreeSource = getTreeSource;
339 stream->tnstream->_LT = _LT;
340 stream->tnstream->setUniqueNavigationNodes = setUniqueNavigationNodes;
341 stream->tnstream->toString = toString;
342 stream->tnstream->toStringSS = toStringSS;
343 stream->tnstream->toStringWork = toStringWork;
344 stream->tnstream->get = get;
348 stream->tnstream->istream->consume = consume;
349 stream->tnstream->istream->index = tindex;
350 stream->tnstream->istream->_LA = _LA;
351 stream->tnstream->istream->mark = mark;
352 stream->tnstream->istream->release = release;
353 stream->tnstream->istream->rewind = rewindMark;
354 stream->tnstream->istream->rewindLast = rewindLast;
355 stream->tnstream->istream->seek = seek;
356 stream->tnstream->istream->size = size;
358 // Initialize data elements of INT stream
360 stream->tnstream->istream->type = ANTLR3_COMMONTREENODE;
361 stream->tnstream->istream->super = (stream->tnstream);
363 // Initialize data elements of TREE stream
365 stream->tnstream->ctns = stream;
367 // Initialize data elements of the COMMON TREE NODE stream
369 stream->super = NULL;
370 stream->uniqueNavigationNodes = ANTLR3_FALSE;
371 stream->markers = NULL;
372 stream->nodeStack = antlr3StackNew(INITIAL_CALL_STACK_SIZE);
380 stream->nodes = antlr3VectorNew(hint);
381 stream->p = -1;
385 antlr3SetCTAPI(&(stream->UP));
386 antlr3SetCTAPI(&(stream->DOWN));
387 antlr3SetCTAPI(&(stream->EOF_NODE));
388 antlr3SetCTAPI(&(stream->INVALID_NODE));
394 stream->UP.token = token;
400 stream->DOWN.token = token;
406 stream->EOF_NODE.token = token;
412 stream->INVALID_NODE.token = token;
415 return stream;
418 /// Free up any resources that belong to this common tree node stream.
423 // If this is a rewrting stream, then certain resources
424 // belong to the originating node stream and we do not
523 /// Reset the input stream to the start of the input nodes.
603 /// Where is this stream pulling nodes from? This is not the name, but
612 /// Consume the next node from the input stream
652 /// Mark the state of the input stream so that we can come back to it
919 /// after this call. The stream is notified because it is walking the
921 /// tree. Also, it might be able to modify the node stream to avoid