ANTLR3_INT_STREAM_struct Struct Reference

#include <antlr3intstream.h>

Collaboration diagram for ANTLR3_INT_STREAM_struct:

Collaboration graph
[legend]

Data Fields

ANTLR3_UINT32(* _LA )(struct ANTLR3_INT_STREAM_struct *intStream, ANTLR3_INT32 i)
 Get ANTLR3_UINT32 at current input pointer + i ahead where i=1 is next ANTLR3_UINT32.
ANTLR3_UINT32 cachedSize
 Because the indirect call, though small in individual cases can mount up if there are thousands of tokens (very large input streams), callers of size can optionally use this cached size field.
void(* consume )(struct ANTLR3_INT_STREAM_struct *intStream)
 Consume the next 'ANTR3_UINT32' in the stream.
void(* free )(struct ANTLR3_INT_STREAM_struct *stream)
 Frees any resources that were allocated for the implementation of this interface.
pANTLR3_STRING(* getSourceName )(struct ANTLR3_INT_STREAM_struct *intStream)
ANTLR3_MARKER(* index )(struct ANTLR3_INT_STREAM_struct *intStream)
 Return the current input symbol index 0.
ANTLR3_MARKER lastMarker
 Last marker position allocated.
ANTLR3_MARKER(* mark )(struct ANTLR3_INT_STREAM_struct *intStream)
 Tell the stream to start buffering if it hasn't already.
void(* release )(struct ANTLR3_INT_STREAM_struct *intStream, ANTLR3_MARKER mark)
 You may want to commit to a backtrack but don't want to force the stream to keep bookkeeping objects around for a marker that is no longer necessary.
void(* rewind )(struct ANTLR3_INT_STREAM_struct *intStream, ANTLR3_MARKER marker)
 Reset the stream so that next call to index would return marker.
void(* rewindLast )(struct ANTLR3_INT_STREAM_struct *intStream)
 Reset the stream to the last marker position, witouh destryoing the last marker position.
void(* seek )(struct ANTLR3_INT_STREAM_struct *intStream, ANTLR3_MARKER index)
 Set the input cursor to the position indicated by index.
ANTLR3_UINT32(* size )(struct ANTLR3_INT_STREAM_struct *intStream)
 Only makes sense for streams that buffer everything up probably, but might be useful to display the entire stream or for testing.
pANTLR3_STRING streamName
 Potentially useful in error reporting and so on, this string is an identification of the input source.
void * super
 Pointer to the super structure that contains this interface.
ANTLR3_UINT32 type
 Input stream type indicator.

Field Documentation

Because the indirect call, though small in individual cases can mount up if there are thousands of tokens (very large input streams), callers of size can optionally use this cached size field.

Referenced by tokLT().

Frees any resources that were allocated for the implementation of this interface.

Usually this is just releasing the memory allocated for the structure itself, but it may of course do anything it need to so long as it does not stamp on anything else.

Referenced by antlr3CommonTreeNodeStreamFree(), antlr3CTSFree(), antlr3InputClose(), and antlr3IntStreamNew().

Last marker position allocated.

Referenced by antlr38BitMark(), antlr38BitRewindLast(), and reset().

Tell the stream to start buffering if it hasn't already.

Return current input position, index(), or some other marker so that when passed to rewind() you get back to the same spot. rewind(mark()) should not affect the input cursor.

Referenced by antlr3CommonTokenDebugStreamSourceNew(), antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), antlr3dfapredict(), antlr3GenericSetupStream(), pushCharStream(), setDebugListener(), and synpred().

You may want to commit to a backtrack but don't want to force the stream to keep bookkeeping objects around for a marker that is no longer necessary.

This will have the same behavior as rewind() except it releases resources without the backward seek.

Referenced by antlr38BitRewind(), antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), and antlr3GenericSetupStream().

Reset the stream so that next call to index would return marker.

The marker will usually be index() but it doesn't have to be. It's just a marker to indicate what state the stream was in. This is essentially calling release() and seek(). If there are markers created after this marker argument, this routine must unroll them like a stack. Assume the state the stream was in when this marker was created.

Referenced by antlr38BitRewindLast(), antlr3CommonTokenDebugStreamSourceNew(), antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), antlr3dfapredict(), antlr3GenericSetupStream(), setDebugListener(), and synpred().

Set the input cursor to the position indicated by index.

This is normally used to seek ahead in the input stream. No buffering is required to do this unless you know your stream will use seek to move backwards such as when backtracking.

This is different from rewind in its multi-directional requirement and in that its argument is strictly an input cursor (index).

For char streams, seeking forward must update the stream state such as line number. For seeking backwards, you will be presumably backtracking using the mark/rewind mechanism that restores state and so this method does not need to update state when seeking backwards.

Currently, this method is only used for efficient backtracking, but in the future it may be used for incremental parsing.

Referenced by alreadyParsedRule(), antlr3CommonTokenDebugStreamSourceNew(), antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), antlr3GenericSetupStream(), antlr3UTF16SetupStream(), antlr3UTF32SetupStream(), and setDebugListener().

Only makes sense for streams that buffer everything up probably, but might be useful to display the entire stream or for testing.

Referenced by antlr3CommonTokenStreamNew(), antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), getTokensSet(), toString(), and toStringSS().

Potentially useful in error reporting and so on, this string is an identification of the input source.

It may be NULL, so anything attempting to access it needs to check this and substitute a sensible default.

Referenced by antlr38BitGetSourceName(), antlr38BitReuse(), antlr3FileStreamNew(), and antlr3StringStreamNew().


The documentation for this struct was generated from the following file:

Generated on Mon Nov 29 17:24:05 2010 for ANTLR3C by  doxygen 1.5.5