antlr3-getLineBuf (3) - Linux Manuals

NAME

ANTLR3_INPUT_STREAM_struct -

Master context structure for an ANTLR3 C runtime based input stream.

SYNOPSIS


#include <antlr3input.h>

Data Fields


void *(* _LT )(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_INT32 lt)
Pointer to function to return input stream element at 1 based offset from nextChar.
ANTLR3_UINT8 charByteSize
Indicates the size, in 8 bit units, of a single character.
ANTLR3_INT32 charPositionInLine
The offset within the current line of the current character.
void(* close )(struct ANTLR3_INPUT_STREAM_struct *input)
Pointer to function that closes the input stream.
void * currentLine
Pointer into the input buffer where the current line started.
void * data
Pointer the start of the input string, characters may be taken as offsets from here and in original input format encoding.
pANTLR3_STRING fileName
File name string, set to pointer to memory if you set it manually as it will be free()d.
ANTLR3_UINT32 fileNo
File number, needs to be set manually to some file index of your devising.
void(* free )(struct ANTLR3_INPUT_STREAM_struct *input)

ANTLR3_UINT32(* getCharPositionInLine )(struct ANTLR3_INPUT_STREAM_struct *input)
Pointer to function to return the current offset in the current input stream line.
ANTLR3_UINT32(* getLine )(struct ANTLR3_INPUT_STREAM_struct *input)
Pointer to function to return the current line number in the input stream.
void *(* getLineBuf )(struct ANTLR3_INPUT_STREAM_struct *input)
Pointer to function to return the current line buffer in the input stream The pointer returned is directly into the input stream so you must copy it if you wish to manipulate it without damaging the input stream.
int isAllocated
Indicates if the data pointer was allocated by us, and so should be freed when the stream dies.
pANTLR3_INT_STREAM istream
Interfaces that provide streams must all provide a generic ANTLR3_INT_STREAM interface and an ANTLR3_INPUT_STREAM is no different.
ANTLR3_UINT32 line
The line number we are traversing in the input file.
ANTLR3_UINT32 markDepth
Tracks how deep mark() calls are nested.
pANTLR3_VECTOR markers
List of mark() points in the input stream.
ANTLR3_UCHAR newlineChar
Character that automatically causes an internal line count increment.
void * nextChar
Pointer to the next character to be consumed from the input data This is cast to point at the encoding of the original file that was read by the functions installed as pointer in this input stream context instance at file/string/whatever load time.
void(* reset )(struct ANTLR3_INPUT_STREAM_struct *input)
Pointer to function that resets the input stream.
void(* setCharPositionInLine )(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 position)
Pointer to function to set the current position in the current line.
void(* setLine )(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 line)
Pointer to function to set the current line number in the input stream.
void(* SetNewLineChar )(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 newlineChar)
Pointer to function to override the default newline character that the input stream looks for to trigger the line and offset and line buffer recording information.
void(* setUcaseLA )(pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag)
Pinter to function that installs a version of LA that always returns upper case.
ANTLR3_UINT32(* size )(struct ANTLR3_INPUT_STREAM_struct *input)
Pointer to function to return the total size of the input buffer.
ANTLR3_UINT32 sizeBuf
Number of characters that can be consumed at this point in time.
pANTLR3_STRING_FACTORY strFactory
String factory for this input stream.
pANTLR3_STRING(* substr )(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_MARKER start, ANTLR3_MARKER stop)
Pointer to function to return a substring of the input stream.
void * super
Whatever super structure is providing the INPUT stream needs a pointer to itself so that this can be passed back to it whenever the api functions are called back from this interface.

Detailed Description

Master context structure for an ANTLR3 C runtime based input stream.

Field Documentation

void*(* ANTLR3_INPUT_STREAM_struct::_LT)(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_INT32 lt)

Pointer to function to return input stream element at 1 based offset from nextChar. Same as _LA for char stream, but token streams etc. have one of these that does other stuff of course.

Referenced by antlr3GenericSetupStream().

ANTLR3_UINT8 ANTLR3_INPUT_STREAM_struct::charByteSize

Indicates the size, in 8 bit units, of a single character. Note that the C runtime does not deal with surrogates and UTF8 directly as this would be slow and complicated. Variable character width inputs are expected to be converted into fixed width formats, so that would be a UTF32 format for anything that cannot work with a UCS2 encoding, such as UTF-8. Generally you are best working internally with 32 bit characters.

Referenced by antlr3GenericSetupStream(), antlr3UCS2SetupStream(), and getText().

ANTLR3_INT32 ANTLR3_INPUT_STREAM_struct::charPositionInLine

The offset within the current line of the current character.

Referenced by antlr3AsciiConsume(), antlr3AsciiGetCharPosition(), antlr3AsciiMark(), antlr3AsciiRewind(), antlr3AsciiSetCharPosition(), antlr3InputReset(), and antlr3UCS2Consume().

void(* ANTLR3_INPUT_STREAM_struct::close)(struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to function that closes the input stream.

Referenced by antlr3AsciiFileStreamNew(), and antlr3GenericSetupStream().

void* ANTLR3_INPUT_STREAM_struct::currentLine

Pointer into the input buffer where the current line started.

Referenced by antlr3AsciiConsume(), antlr3AsciiGetLineBuf(), antlr3AsciiMark(), antlr3AsciiRewind(), antlr3InputReset(), antlr3UCS2Consume(), and emit().

void* ANTLR3_INPUT_STREAM_struct::data

Pointer the start of the input string, characters may be taken as offsets from here and in original input format encoding.

Referenced by antlr3AsciiConsume(), antlr3AsciiLA(), antlr3AsciiLA_ucase(), antlr3InputClose(), antlr3InputReset(), antlr3NewAsciiStringCopyStream(), antlr3NewAsciiStringInPlaceStream(), antlr3NewUCS2StringInPlaceStream(), antlr3readAscii(), antlr3UCS2Consume(), antlr3UCS2LA(), displayRecognitionError(), and getStartIndex().

pANTLR3_STRING ANTLR3_INPUT_STREAM_struct::fileName

File name string, set to pointer to memory if you set it manually as it will be free()d.

Referenced by antlr3AsciiFileStreamNew(), antlr3NewAsciiStringCopyStream(), antlr3NewAsciiStringInPlaceStream(), antlr3NewUCS2StringInPlaceStream(), antlr3RecognitionExceptionNew(), and setCharStream().

ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::fileNo

File number, needs to be set manually to some file index of your devising.

void(* ANTLR3_INPUT_STREAM_struct::free)(struct ANTLR3_INPUT_STREAM_struct *input)

Referenced by antlr3GenericSetupStream().

ANTLR3_UINT32(* ANTLR3_INPUT_STREAM_struct::getCharPositionInLine)(struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to function to return the current offset in the current input stream line.

Referenced by antlr3GenericSetupStream(), antlr3RecognitionExceptionNew(), getCharPositionInLine(), and nextTokenStr().

ANTLR3_UINT32(* ANTLR3_INPUT_STREAM_struct::getLine)(struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to function to return the current line number in the input stream.

Referenced by antlr3GenericSetupStream(), antlr3RecognitionExceptionNew(), getLine(), and nextTokenStr().

void*(* ANTLR3_INPUT_STREAM_struct::getLineBuf)(struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to function to return the current line buffer in the input stream The pointer returned is directly into the input stream so you must copy it if you wish to manipulate it without damaging the input stream. Encoding is obviously in the same form as the input stream.

Remarks:

*
Note taht this function wil lbe inaccurate if setLine is called as there is no way at the moment to position the input stream at a particular line number offset.

Referenced by antlr3GenericSetupStream().

int ANTLR3_INPUT_STREAM_struct::isAllocated

Indicates if the data pointer was allocated by us, and so should be freed when the stream dies.

Referenced by antlr3InputClose(), antlr3NewAsciiStringCopyStream(), antlr3NewAsciiStringInPlaceStream(), antlr3NewUCS2StringInPlaceStream(), and antlr3readAscii().

pANTLR3_INT_STREAM ANTLR3_INPUT_STREAM_struct::istream

Interfaces that provide streams must all provide a generic ANTLR3_INT_STREAM interface and an ANTLR3_INPUT_STREAM is no different.

Referenced by alreadyParsedRule(), antlr3AsciiFileStreamNew(), antlr3AsciiLT(), antlr3AsciiRewind(), antlr3AsciiSetUcaseLA(), antlr3GenericSetupStream(), antlr3InputClose(), antlr3NewAsciiStringCopyStream(), antlr3NewAsciiStringInPlaceStream(), antlr3NewUCS2StringInPlaceStream(), antlr3RecognitionExceptionNew(), antlr3UCS2SetupStream(), getCharIndex(), matchAny(), matchc(), matchRange(), matchs(), memoize(), nextTokenStr(), popCharStream(), pushCharStream(), recover(), and reset().

ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::line

The line number we are traversing in the input file. This gets incremented by a newline() call in the lexer grammar actions.

Referenced by antlr3AsciiConsume(), antlr3AsciiGetLine(), antlr3AsciiMark(), antlr3AsciiRewind(), antlr3AsciiSetLine(), antlr3InputReset(), and antlr3UCS2Consume().

ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::markDepth

Tracks how deep mark() calls are nested.

Referenced by antlr3AsciiMark(), antlr3AsciiRelease(), and antlr3InputReset().

pANTLR3_VECTOR ANTLR3_INPUT_STREAM_struct::markers

List of mark() points in the input stream.

Referenced by antlr3AsciiMark(), antlr3AsciiRewind(), antlr3GenericSetupStream(), antlr3InputClose(), and antlr3InputReset().

ANTLR3_UCHAR ANTLR3_INPUT_STREAM_struct::newlineChar

Character that automatically causes an internal line count increment.

Referenced by antlr3AsciiConsume(), antlr3AsciiSetNewLineChar(), and antlr3UCS2Consume().

void* ANTLR3_INPUT_STREAM_struct::nextChar

Pointer to the next character to be consumed from the input data This is cast to point at the encoding of the original file that was read by the functions installed as pointer in this input stream context instance at file/string/whatever load time.

Referenced by antlr3AsciiConsume(), antlr3AsciiIndex(), antlr3AsciiLA(), antlr3AsciiLA_ucase(), antlr3AsciiMark(), antlr3AsciiRewind(), antlr3AsciiSeek(), antlr3InputReset(), antlr3UCS2Consume(), antlr3UCS2Index(), antlr3UCS2LA(), and antlr3UCS2Seek().

void(* ANTLR3_INPUT_STREAM_struct::reset)(struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to function that resets the input stream.

Referenced by antlr3GenericSetupStream().

void(* ANTLR3_INPUT_STREAM_struct::setCharPositionInLine)(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 position)

Pointer to function to set the current position in the current line.

Referenced by antlr3GenericSetupStream().

void(* ANTLR3_INPUT_STREAM_struct::setLine)(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 line)

Pointer to function to set the current line number in the input stream.

Referenced by antlr3GenericSetupStream().

void(* ANTLR3_INPUT_STREAM_struct::SetNewLineChar)(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 newlineChar)

Pointer to function to override the default newline character that the input stream looks for to trigger the line and offset and line buffer recording information. Remarks:

*
By default the chracter '
*
If for some reason you do not want teh counters and pointesr to be restee, yu can set the chracter to some impossible charater such as '' or whatever.
*
This is a single character only, so choose the last chracter in a sequence of two or more.
*
This is only a simple aid to error reporting - if you have a complicated binary inptu structure it may not be adequate, but you can always override every function in the input stream with your own of course, and can even write your own complete input stream set if you like.
*
It is your responsiblity to set a valid cahracter for the input stream type. Ther is no point setting this to 0xFFFFFFFF if the input stream is 8 bit ASCII as this will just be truncated and never trigger as the comparison will be (INT32)0xFF == (INT32)0xFFFFFFFF

Referenced by antlr3GenericSetupStream().

void(* ANTLR3_INPUT_STREAM_struct::setUcaseLA)(pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag)

Pinter to function that installs a version of LA that always returns upper case. Only valid for character streams and creates a case insensitive lexer if the lexer tokens are described in upper case. The tokens will preserve case in the token text.

Referenced by antlr3GenericSetupStream().

ANTLR3_UINT32(* ANTLR3_INPUT_STREAM_struct::size)(struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to function to return the total size of the input buffer. For streams this may be just the total we have available so far. This means of course that the input stream must be careful to accumulate enough input so that any backtracking can be satisfied.

Referenced by antlr3GenericSetupStream(), and displayRecognitionError().

ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::sizeBuf

Number of characters that can be consumed at this point in time. Mostly this is just what is left in the pre-read buffer, but if the input source is a stream such as a socket or something then we may call special read code to wait for more input.

Referenced by antlr3AsciiConsume(), antlr3AsciiLA(), antlr3AsciiLA_ucase(), antlr3AsciiSize(), antlr3NewAsciiStringCopyStream(), antlr3NewAsciiStringInPlaceStream(), antlr3NewUCS2StringInPlaceStream(), antlr3readAscii(), antlr3UCS2Consume(), and antlr3UCS2LA().

pANTLR3_STRING_FACTORY ANTLR3_INPUT_STREAM_struct::strFactory

String factory for this input stream.

Referenced by antlr3AsciiFileStreamNew(), antlr3AsciiSetupStream(), antlr3AsciiSubstr(), antlr3InputClose(), antlr3NewAsciiStringCopyStream(), antlr3NewAsciiStringInPlaceStream(), antlr3NewUCS2StringInPlaceStream(), antlr3UCS2SetupStream(), antlr3UCS2Substr(), newPoolToken(), setCharStream(), and setInputStream().

pANTLR3_STRING(* ANTLR3_INPUT_STREAM_struct::substr)(struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_MARKER start, ANTLR3_MARKER stop)

Pointer to function to return a substring of the input stream. String is returned in allocated memory and is in same encoding as the input stream itself, NOT internal ANTLR3_UCHAR form.

Referenced by antlr3GenericSetupStream(), antlr3UCS2SetupStream(), and getText().

void* ANTLR3_INPUT_STREAM_struct::super

Whatever super structure is providing the INPUT stream needs a pointer to itself so that this can be passed back to it whenever the api functions are called back from this interface.

Author

Generated automatically by Doxygen for ANTLR3C from the source code.