Base functions to initialize and manipulate any input stream. More...
#include <antlr3input.h>
Functions | |
static void | antlr3AsciiConsume (pANTLR3_INT_STREAM is) |
Consume the next character in an 8 bit ASCII input stream. | |
static ANTLR3_UINT32 | antlr3AsciiGetCharPosition (pANTLR3_INPUT_STREAM input) |
Return the current offset in to the current line in the input stream. | |
static ANTLR3_UINT32 | antlr3AsciiGetLine (pANTLR3_INPUT_STREAM input) |
Return the line number as understood by the 8 bit/ASCII input stream. | |
static void * | antlr3AsciiGetLineBuf (pANTLR3_INPUT_STREAM input) |
Return a pointer into the input stream that points at the start of the current input line as triggered by the end of line character installed for the stream (' ' unless told differently). | |
static pANTLR3_STRING | antlr3AsciiGetSourceName (pANTLR3_INT_STREAM is) |
static ANTLR3_MARKER | antlr3AsciiIndex (pANTLR3_INT_STREAM is) |
Calculate the current index in the output stream. | |
static ANTLR3_UCHAR | antlr3AsciiLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) |
Return the input element assuming an 8 bit ascii input. | |
static ANTLR3_UCHAR | antlr3AsciiLA_ucase (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) |
Return the input element assuming an 8 bit ASCII input and always return the UPPER CASE character. | |
static void * | antlr3AsciiLT (pANTLR3_INPUT_STREAM input, ANTLR3_INT32 lt) |
Return the input element assuming an 8 bit ascii input. | |
static ANTLR3_MARKER | antlr3AsciiMark (pANTLR3_INT_STREAM is) |
Mark the current input point in an Ascii 8 bit stream such as a file stream, where all the input is available in the buffer. | |
static void | antlr3AsciiRelease (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark) |
Rewind the lexer input to the state specified by the supplied mark. | |
static void | antlr3AsciiRewind (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark) |
Rewind the lexer input to the state specified by the supplied mark. | |
static void | antlr3AsciiRewindLast (pANTLR3_INT_STREAM is) |
Rewind the lexer input to the state specified by the last produced mark. | |
static void | antlr3AsciiSeek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) |
Rewind the lexer input to the state specified by the supplied mark. | |
static void | antlr3AsciiSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position) |
Set the current offset in the current line to be a particular setting. | |
static void | antlr3AsciiSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line) |
Set the current line number as understood by the input stream. | |
static void | antlr3AsciiSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar) |
Set the newline trigger character in the input stream to the supplied parameter. | |
static void | antlr3AsciiSetUcaseLA (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag) |
void | antlr3AsciiSetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 type) |
Common function to setup function interface for an 8 bit ASCII input stream. | |
static ANTLR3_UINT32 | antlr3AsciiSize (pANTLR3_INPUT_STREAM input) |
Return the size of the current input stream, as an Ascii file which in this case is the total input. | |
static pANTLR3_STRING | antlr3AsciiSubstr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) |
Return a substring of the ASCII (8 bit) input stream in newly allocated memory. | |
void | antlr3GenericSetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 type) |
static void | antlr3InputClose (pANTLR3_INPUT_STREAM input) |
Close down an input stream and free any memory allocated by it. | |
static void | antlr3InputReset (pANTLR3_INPUT_STREAM input) |
Reset a re-startable input stream to the start. |
Base functions to initialize and manipulate any input stream.
static void antlr3AsciiConsume | ( | pANTLR3_INT_STREAM | is | ) | [static] |
Consume the next character in an 8 bit ASCII input stream.
input | Input stream context pointer |
References ANTLR3_INPUT_STREAM_struct::charPositionInLine, ANTLR3_INPUT_STREAM_struct::currentLine, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::line, ANTLR3_INPUT_STREAM_struct::newlineChar, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.
static ANTLR3_UINT32 antlr3AsciiGetCharPosition | ( | pANTLR3_INPUT_STREAM | input | ) | [static] |
Return the current offset in to the current line in the input stream.
input | Input stream context pointer |
References ANTLR3_INPUT_STREAM_struct::charPositionInLine.
static ANTLR3_UINT32 antlr3AsciiGetLine | ( | pANTLR3_INPUT_STREAM | input | ) | [static] |
Return the line number as understood by the 8 bit/ASCII input stream.
input | Input stream context pointer |
References ANTLR3_INPUT_STREAM_struct::line.
static void * antlr3AsciiGetLineBuf | ( | pANTLR3_INPUT_STREAM | input | ) | [static] |
Return a pointer into the input stream that points at the start of the current input line as triggered by the end of line character installed for the stream ('
' unless told differently).
[in] | input |
References ANTLR3_INPUT_STREAM_struct::currentLine.
static pANTLR3_STRING antlr3AsciiGetSourceName | ( | pANTLR3_INT_STREAM | is | ) | [static] |
References ANTLR3_INT_STREAM_struct::streamName.
static ANTLR3_MARKER antlr3AsciiIndex | ( | pANTLR3_INT_STREAM | is | ) | [static] |
Calculate the current index in the output stream.
[in] | input | Input stream context pointer |
References ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.
static ANTLR3_UCHAR antlr3AsciiLA | ( | pANTLR3_INT_STREAM | is, | |
ANTLR3_INT32 | la | |||
) | [static] |
Return the input element assuming an 8 bit ascii input.
[in] | input | Input stream context pointer |
[in] | la | 1 based offset of next input stream element |
References ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.
static ANTLR3_UCHAR antlr3AsciiLA_ucase | ( | pANTLR3_INT_STREAM | is, | |
ANTLR3_INT32 | la | |||
) | [static] |
Return the input element assuming an 8 bit ASCII input and always return the UPPER CASE character.
Note that this is 8 bit and so we assume that the toupper function will use the correct locale for 8 bits.
[in] | input | Input stream context pointer |
[in] | la | 1 based offset of next input stream element |
References ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.
static void * antlr3AsciiLT | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_INT32 | lt | |||
) | [static] |
Return the input element assuming an 8 bit ascii input.
[in] | input | Input stream context pointer |
[in] | lt | 1 based offset of next input stream element |
References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_FUNC_PTR, and ANTLR3_INPUT_STREAM_struct::istream.
static ANTLR3_MARKER antlr3AsciiMark | ( | pANTLR3_INT_STREAM | is | ) | [static] |
Mark the current input point in an Ascii 8 bit stream such as a file stream, where all the input is available in the buffer.
[in] | is | Input stream context pointer |
References ANTLR3_VECTOR_struct::add, ANTLR3_FREE_FUNC, ANTLR3_MALLOC, ANTLR3_INPUT_STREAM_struct::charPositionInLine, ANTLR3_LEX_STATE_struct::charPositionInLine, ANTLR3_VECTOR_struct::count, ANTLR3_INPUT_STREAM_struct::currentLine, ANTLR3_LEX_STATE_struct::currentLine, ANTLR3_VECTOR_struct::get, ANTLR3_INT_STREAM_struct::lastMarker, ANTLR3_INPUT_STREAM_struct::line, ANTLR3_LEX_STATE_struct::line, ANTLR3_INPUT_STREAM_struct::markDepth, ANTLR3_INPUT_STREAM_struct::markers, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_LEX_STATE_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.
static void antlr3AsciiRelease | ( | pANTLR3_INT_STREAM | is, | |
ANTLR3_MARKER | mark | |||
) | [static] |
Rewind the lexer input to the state specified by the supplied mark.
[in] | input | Input stream context pointer |
References ANTLR3_INPUT_STREAM_struct::markDepth, and ANTLR3_INT_STREAM_struct::super.
static void antlr3AsciiRewind | ( | pANTLR3_INT_STREAM | is, | |
ANTLR3_MARKER | mark | |||
) | [static] |
Rewind the lexer input to the state specified by the supplied mark.
[in] | input | Input stream context pointer |
References antlr3AsciiSeek(), ANTLR3_LEX_STATE_struct::charPositionInLine, ANTLR3_INPUT_STREAM_struct::charPositionInLine, ANTLR3_LEX_STATE_struct::currentLine, ANTLR3_INPUT_STREAM_struct::currentLine, ANTLR3_VECTOR_struct::get, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_LEX_STATE_struct::line, ANTLR3_INPUT_STREAM_struct::line, ANTLR3_INPUT_STREAM_struct::markers, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_LEX_STATE_struct::nextChar, ANTLR3_INT_STREAM_struct::release, and ANTLR3_INT_STREAM_struct::super.
static void antlr3AsciiRewindLast | ( | pANTLR3_INT_STREAM | is | ) | [static] |
Rewind the lexer input to the state specified by the last produced mark.
[in] | input | Input stream context pointer |
References ANTLR3_INT_STREAM_struct::lastMarker, and ANTLR3_INT_STREAM_struct::rewind.
static void antlr3AsciiSeek | ( | pANTLR3_INT_STREAM | is, | |
ANTLR3_MARKER | seekPoint | |||
) | [static] |
Rewind the lexer input to the state specified by the supplied mark.
[in] | input | Input stream context pointer |
References ANTLR3_FUNC_PTR, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.
Referenced by antlr3AsciiRewind().
static void antlr3AsciiSetCharPosition | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_UINT32 | position | |||
) | [static] |
Set the current offset in the current line to be a particular setting.
[in] | input | Input stream context pointer |
[in] | position | New setting for current offset. |
References ANTLR3_INPUT_STREAM_struct::charPositionInLine.
static void antlr3AsciiSetLine | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_UINT32 | line | |||
) | [static] |
Set the current line number as understood by the input stream.
input | Input stream context pointer | |
line | Line number to tell the input stream we are on |
References ANTLR3_INPUT_STREAM_struct::line.
static void antlr3AsciiSetNewLineChar | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_UINT32 | newlineChar | |||
) | [static] |
Set the newline trigger character in the input stream to the supplied parameter.
[in] | input | Input stream context pointer |
[in] | newlineChar | Character to set to be the newline trigger. |
References ANTLR3_INPUT_STREAM_struct::newlineChar.
static void antlr3AsciiSetUcaseLA | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_BOOLEAN | flag | |||
) | [static] |
References ANTLR3_INT_STREAM_struct::_LA, and ANTLR3_INPUT_STREAM_struct::istream.
void antlr3AsciiSetupStream | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_UINT32 | type | |||
) |
Common function to setup function interface for an 8 bit ASCII input stream.
input | Input stream context pointer |
References antlr3GenericSetupStream(), antlr3StringFactoryNew(), and ANTLR3_INPUT_STREAM_struct::strFactory.
Referenced by antlr3AsciiFileStreamNew(), antlr3NewAsciiStringCopyStream(), and antlr3NewAsciiStringInPlaceStream().
static ANTLR3_UINT32 antlr3AsciiSize | ( | pANTLR3_INPUT_STREAM | input | ) | [static] |
Return the size of the current input stream, as an Ascii file which in this case is the total input.
Other implementations may provide more sophisticated implementations to deal with non-recoverable streams and so on.
[in] | input | Input stream context pointer |
References ANTLR3_INPUT_STREAM_struct::sizeBuf.
static pANTLR3_STRING antlr3AsciiSubstr | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_MARKER | start, | |||
ANTLR3_MARKER | stop | |||
) | [static] |
Return a substring of the ASCII (8 bit) input stream in newly allocated memory.
input | Input stream context pointer | |
start | Offset in input stream where the string starts | |
stop | Offset in the input stream where the string ends. |
References ANTLR3_STRING_FACTORY_struct::newPtr, and ANTLR3_INPUT_STREAM_struct::strFactory.
void antlr3GenericSetupStream | ( | pANTLR3_INPUT_STREAM | input, | |
ANTLR3_UINT32 | type | |||
) |
References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_INPUT_STREAM_struct::_LT, antlr3IntStreamNew(), ANTLR3_INPUT_STREAM_struct::charByteSize, ANTLR3_INPUT_STREAM_struct::close, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::free, ANTLR3_INPUT_STREAM_struct::getCharPositionInLine, ANTLR3_INPUT_STREAM_struct::getLine, ANTLR3_INPUT_STREAM_struct::getLineBuf, ANTLR3_INT_STREAM_struct::getSourceName, ANTLR3_INT_STREAM_struct::index, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::mark, ANTLR3_INPUT_STREAM_struct::markers, ANTLR3_INT_STREAM_struct::release, ANTLR3_INPUT_STREAM_struct::reset, ANTLR3_INT_STREAM_struct::rewind, ANTLR3_INT_STREAM_struct::rewindLast, ANTLR3_INT_STREAM_struct::seek, ANTLR3_INPUT_STREAM_struct::setCharPositionInLine, ANTLR3_INPUT_STREAM_struct::setLine, ANTLR3_INPUT_STREAM_struct::SetNewLineChar, ANTLR3_INPUT_STREAM_struct::setUcaseLA, ANTLR3_INPUT_STREAM_struct::size, ANTLR3_INPUT_STREAM_struct::substr, ANTLR3_INT_STREAM_struct::super, and ANTLR3_INT_STREAM_struct::type.
Referenced by antlr3AsciiSetupStream(), and antlr3UCS2SetupStream().
static void antlr3InputClose | ( | pANTLR3_INPUT_STREAM | input | ) | [static] |
Close down an input stream and free any memory allocated by it.
input | Input stream context pointer |
References ANTLR3_FREE, ANTLR3_STRING_FACTORY_struct::close, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INT_STREAM_struct::free, ANTLR3_INPUT_STREAM_struct::isAllocated, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_INPUT_STREAM_struct::markers, and ANTLR3_INPUT_STREAM_struct::strFactory.
static void antlr3InputReset | ( | pANTLR3_INPUT_STREAM | input | ) | [static] |
Reset a re-startable input stream to the start.
input | Input stream context pointer |
References antlr3VectorNew(), ANTLR3_INPUT_STREAM_struct::charPositionInLine, ANTLR3_INPUT_STREAM_struct::currentLine, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::line, ANTLR3_INPUT_STREAM_struct::markDepth, ANTLR3_INPUT_STREAM_struct::markers, and ANTLR3_INPUT_STREAM_struct::nextChar.