antlr3inputstream.c man page

src/antlr3inputstream.c — Base functions to initialize and manipulate any input stream.

Synopsis

#include <antlr3input.h>

Functions

static void antlr38BitConsume (pANTLR3_INT_STREAM is)
Consume the next character in an 8 bit input stream.
static ANTLR3_UINT32 antlr38BitGetCharPosition (pANTLR3_INPUT_STREAM input)
Return the current offset in to the current line in the input stream.
static ANTLR3_UINT32 antlr38BitGetLine (pANTLR3_INPUT_STREAM input)
Return the line number as understood by the 8 bit input stream.
static void * antlr38BitGetLineBuf (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 antlr38BitGetSourceName (pANTLR3_INT_STREAM is)

static ANTLR3_MARKER antlr38BitIndex (pANTLR3_INT_STREAM is)
Calculate the current index in the output stream.
static ANTLR3_UCHAR antlr38BitLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming an 8 bit ascii input.
static ANTLR3_UCHAR antlr38BitLA_ucase (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming an 8 bit input and always return the UPPER CASE character.
static void * antlr38BitLT (pANTLR3_INPUT_STREAM input, ANTLR3_INT32 lt)
Return the input element assuming an 8 bit ascii input.
static ANTLR3_MARKER antlr38BitMark (pANTLR3_INT_STREAM is)
Mark the current input point in an 8Bit 8 bit stream such as a file stream, where all the input is available in the buffer.
static void antlr38BitRelease (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark)
Rewind the lexer input to the state specified by the supplied mark.
static void antlr38BitReuse (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name)
Install a new source code in to a working input stream so that the input stream can be reused.
static void antlr38BitRewind (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark)
Rewind the lexer input to the state specified by the supplied mark.
static void antlr38BitRewindLast (pANTLR3_INT_STREAM is)
Rewind the lexer input to the state specified by the last produced mark.
static void antlr38BitSeek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)
Rewind the lexer input to the state specified by the supplied mark.
static void antlr38BitSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position)
Set the current offset in the current line to be a particular setting.
static void antlr38BitSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line)
Set the current line number as understood by the input stream.
static void antlr38BitSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar)
Set the newline trigger character in the input stream to the supplied parameter.
static void antlr38BitSetUcaseLA (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag)

void antlr38BitSetupStream (pANTLR3_INPUT_STREAM input)
Common function to setup function interface for an 8 bit input stream.
static ANTLR3_UINT32 antlr38BitSize (pANTLR3_INPUT_STREAM input)
Return the size of the current input stream, as an 8Bit file which in this case is the total input.
static pANTLR3_STRING antlr38BitSubstr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop)
Return a substring of the 8 bit input stream in newly allocated memory.
static ANTLR3_UCHAR antlr3EBCDICLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming an 8 bit EBCDIC input.
void antlr3EBCDICSetupStream (pANTLR3_INPUT_STREAM input)
Common function to setup function interface for a EBCDIC input stream.
void antlr3GenericSetupStream (pANTLR3_INPUT_STREAM input)

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.
static void antlr3UTF16Consume (pANTLR3_INT_STREAM is)
Consume the next character in a UTF16 input stream.
static void antlr3UTF16ConsumeBE (pANTLR3_INT_STREAM is)
Consume the next character in a UTF16 input stream when the input is Big Endian and the machine is not.
static void antlr3UTF16ConsumeLE (pANTLR3_INT_STREAM is)
Consume the next character in a UTF16 input stream when the input is Little Endian and the machine is not Note that the UTF16 routines do not do any substantial verification of the input stream as for performance sake, we assume it is validly encoded.
static ANTLR3_MARKER antlr3UTF16Index (pANTLR3_INT_STREAM is)
Calculate the current index in the output stream.
static ANTLR3_UCHAR antlr3UTF16LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming an 8 bit ascii input.
static ANTLR3_UCHAR antlr3UTF16LABE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming a UTF16 input when the input is Little Endian and the machine is not.
static ANTLR3_UCHAR antlr3UTF16LALE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming a UTF16 input when the input is Little Endian and the machine is not.
static void antlr3UTF16Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)
Rewind the lexer input to the state specified by the supplied mark.
void antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)
Common function to setup function interface for a UTF16 or UCS2 input stream.
static pANTLR3_STRING antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop)
Return a substring of the UTF16 input stream in newly allocated memory.
static void antlr3UTF32Consume (pANTLR3_INT_STREAM is)
Consume the next character in a UTF32 input stream.
static ANTLR3_MARKER antlr3UTF32Index (pANTLR3_INT_STREAM is)
Calculate the current index in the output stream.
static ANTLR3_UCHAR antlr3UTF32LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming a UTF32 input in natural machine byte order.
static ANTLR3_UCHAR antlr3UTF32LABE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming a UTF32 input in big endian byte order.
static ANTLR3_UCHAR antlr3UTF32LALE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming a UTF32 input in little endian byte order.
static void antlr3UTF32Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)
Rewind the lexer input to the state specified by the supplied mark.
void antlr3UTF32SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)
Common function to setup function interface for a UTF3 input stream.
static pANTLR3_STRING antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop)
Return a substring of the UTF16 input stream in newly allocated memory.
static void antlr3UTF8Consume (pANTLR3_INT_STREAM is)
Consume the next character in a UTF8 input stream.
static ANTLR3_UCHAR antlr3UTF8LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
Return the input element assuming a UTF8 input.
void antlr3UTF8SetupStream (pANTLR3_INPUT_STREAM input)
Common function to setup function interface for a UTF8 input stream.

Variables

const ANTLR3_UCHAR e2a [256]

static const UTF32 offsetsFromUTF8 [6]
Magic values subtracted from a buffer value during UTF8 conversion.
static const ANTLR3_UINT32 trailingBytesForUTF8 [256]
Index into the table below with the first byte of a UTF-8 sequence to get the number of trailing bytes that are supposed to follow it.

Detailed Description

Base functions to initialize and manipulate any input stream.

Function Documentation

static void antlr38BitConsume (pANTLR3_INT_STREAM is) [static]

Consume the next character in an 8 bit input stream.

Parameters:

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.

Referenced by antlr3GenericSetupStream().

static ANTLR3_UINT32 antlr38BitGetCharPosition (pANTLR3_INPUT_STREAM input) [static]

Return the current offset in to the current line in the input stream.

Parameters:

input Input stream context pointer

Returns:

Current line offset

References ANTLR3_INPUT_STREAM_struct::charPositionInLine.

Referenced by antlr3GenericSetupStream().

static ANTLR3_UINT32 antlr38BitGetLine (pANTLR3_INPUT_STREAM input) [static]

Return the line number as understood by the 8 bit input stream.

Parameters:

input Input stream context pointer

Returns:

Line number in input stream that we believe we are working on.

References ANTLR3_INPUT_STREAM_struct::line.

Referenced by antlr3GenericSetupStream().

static void * antlr38BitGetLineBuf (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).

Parameters:

input

References ANTLR3_INPUT_STREAM_struct::currentLine.

Referenced by antlr3GenericSetupStream().

static pANTLR3_STRING antlr38BitGetSourceName (pANTLR3_INT_STREAM is) [static]

References ANTLR3_INT_STREAM_struct::streamName.

Referenced by antlr3GenericSetupStream().

static ANTLR3_MARKER antlr38BitIndex (pANTLR3_INT_STREAM is) [static]

Calculate the current index in the output stream.

Parameters:

input Input stream context pointer

References ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3GenericSetupStream().

static ANTLR3_UCHAR antlr38BitLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming an 8 bit ascii input.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr38BitSetUcaseLA(), and antlr3GenericSetupStream().

static ANTLR3_UCHAR antlr38BitLA_ucase (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming an 8 bit 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.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr38BitSetUcaseLA().

static void * antlr38BitLT (pANTLR3_INPUT_STREAM input, ANTLR3_INT32 lt) [static]

Return the input element assuming an 8 bit ascii input.

Parameters:

input Input stream context pointer
lt 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_FUNC_PTR, and ANTLR3_INPUT_STREAM_struct::istream.

Referenced by antlr3GenericSetupStream().

static ANTLR3_MARKER antlr38BitMark (pANTLR3_INT_STREAM is) [static]

Mark the current input point in an 8Bit 8 bit stream such as a file stream, where all the input is available in the buffer.

Parameters:

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.

Referenced by antlr3GenericSetupStream().

static void antlr38BitRelease (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark) [static]

Rewind the lexer input to the state specified by the supplied mark.

Parameters:

input Input stream context pointer

Remarks:

Assumes 8 Bit input stream.

References ANTLR3_INPUT_STREAM_struct::markDepth, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3GenericSetupStream().

static void antlr38BitReuse (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name) [static]

Install a new source code in to a working input stream so that the input stream can be reused.

References ANTLR3_FALSE, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::fileName, ANTLR3_INPUT_STREAM_struct::isAllocated, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_STRING_FACTORY_struct::newStr, ANTLR3_INPUT_STREAM_struct::reset, ANTLR3_STRING_struct::set, size(), ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::streamName, and ANTLR3_INPUT_STREAM_struct::strFactory.

Referenced by antlr3GenericSetupStream().

static void antlr38BitRewind (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark) [static]

Rewind the lexer input to the state specified by the supplied mark.

Parameters:

input Input stream context pointer

Remarks:

Assumes 8 Bit input stream.

References antlr38BitSeek(), ANTLR3_INPUT_STREAM_struct::charPositionInLine, ANTLR3_LEX_STATE_struct::charPositionInLine, ANTLR3_INPUT_STREAM_struct::currentLine, ANTLR3_LEX_STATE_struct::currentLine, ANTLR3_VECTOR_struct::get, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_INPUT_STREAM_struct::line, ANTLR3_LEX_STATE_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.

Referenced by antlr3GenericSetupStream().

static void antlr38BitRewindLast (pANTLR3_INT_STREAM is) [static]

Rewind the lexer input to the state specified by the last produced mark.

Parameters:

input Input stream context pointer

Remarks:

Assumes 8 Bit input stream.

References ANTLR3_INT_STREAM_struct::lastMarker, and ANTLR3_INT_STREAM_struct::rewind.

Referenced by antlr3GenericSetupStream().

static void antlr38BitSeek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) [static]

Rewind the lexer input to the state specified by the supplied mark.

Parameters:

input Input stream context pointer

Remarks:

Assumes 8 Bit input stream.

References ANTLR3_FUNC_PTR, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr38BitRewind(), and antlr3GenericSetupStream().

static void antlr38BitSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position) [static]

Set the current offset in the current line to be a particular setting.

Parameters:

input Input stream context pointer
position New setting for current offset.

Remarks:

This does not set the actual pointers in the input stream, it is purely for reporting purposes and so on as per antlr38BitSetLine();

References ANTLR3_INPUT_STREAM_struct::charPositionInLine.

Referenced by antlr3GenericSetupStream().

static void antlr38BitSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line) [static]

Set the current line number as understood by the input stream.

Parameters:

input Input stream context pointer
line Line number to tell the input stream we are on

Remarks:

This function does not change any pointers, it just allows the programmer to set the line number according to some external criterion, such as finding a lexed directive like: #nnn 'file.c' for instance, such that error reporting and so on in is in sync with some original source format.

References ANTLR3_INPUT_STREAM_struct::line.

Referenced by antlr3GenericSetupStream().

static void antlr38BitSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar) [static]

Set the newline trigger character in the input stream to the supplied parameter.

Parameters:

input Input stream context pointer
newlineChar Character to set to be the newline trigger.

Remarks:

·
The supplied newLineChar is in UTF32 encoding (which means ASCII and latin1 etc are the same encodings), but the input stream catered to by this function is 8 bit only, so it is up to the programmer to ensure that the character supplied is valid.

References ANTLR3_INPUT_STREAM_struct::newlineChar.

Referenced by antlr3GenericSetupStream().

static void antlr38BitSetUcaseLA (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag) [static]

References ANTLR3_INT_STREAM_struct::_LA, antlr38BitLA(), antlr38BitLA_ucase(), and ANTLR3_INPUT_STREAM_struct::istream.

Referenced by antlr3GenericSetupStream().

void antlr38BitSetupStream (pANTLR3_INPUT_STREAM input)

Common function to setup function interface for an 8 bit input stream.

Parameters:

input Input stream context pointer

Remarks:

·
Many of the 8 bit oriented file stream handling functions will be usable by any or at least some, other input streams. Therefore it is perfectly acceptable to call this function to install the 8Bit handler then override just those functions that would not work for the particular input encoding, such as consume for instance.

References antlr3StringFactoryNew(), ANTLR3_INPUT_STREAM_struct::encoding, and ANTLR3_INPUT_STREAM_struct::strFactory.

Referenced by setupInputStream().

static ANTLR3_UINT32 antlr38BitSize (pANTLR3_INPUT_STREAM input) [static]

Return the size of the current input stream, as an 8Bit 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.

Parameters:

input Input stream context pointer

References ANTLR3_INPUT_STREAM_struct::sizeBuf.

Referenced by antlr3GenericSetupStream().

static pANTLR3_STRING antlr38BitSubstr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) [static]

Return a substring of the 8 bit input stream in newly allocated memory.

Parameters:

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.

Referenced by antlr3GenericSetupStream().

static ANTLR3_UCHAR antlr3EBCDICLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming an 8 bit EBCDIC input.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32) after translation from EBCDIC to ASCII

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, e2a, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3EBCDICSetupStream().

void antlr3EBCDICSetupStream (pANTLR3_INPUT_STREAM input)

Common function to setup function interface for a EBCDIC input stream.

Parameters:

input Input stream context pointer

References ANTLR3_INT_STREAM_struct::_LA, antlr3EBCDICLA(), antlr3StringFactoryNew(), ANTLR3_INPUT_STREAM_struct::charByteSize, ANTLR3_INPUT_STREAM_struct::encoding, ANTLR3_INPUT_STREAM_struct::istream, and ANTLR3_INPUT_STREAM_struct::strFactory.

Referenced by setupInputStream().

void antlr3GenericSetupStream (pANTLR3_INPUT_STREAM input)

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_INPUT_STREAM_struct::_LT, antlr38BitConsume(), antlr38BitGetCharPosition(), antlr38BitGetLine(), antlr38BitGetLineBuf(), antlr38BitGetSourceName(), antlr38BitIndex(), antlr38BitLA(), antlr38BitLT(), antlr38BitMark(), antlr38BitRelease(), antlr38BitReuse(), antlr38BitRewind(), antlr38BitRewindLast(), antlr38BitSeek(), antlr38BitSetCharPosition(), antlr38BitSetLine(), antlr38BitSetNewLineChar(), antlr38BitSetUcaseLA(), antlr38BitSize(), antlr38BitSubstr(), ANTLR3_CHARSTREAM, antlr3InputClose(), antlr3InputReset(), 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_INPUT_STREAM_struct::reuse, 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 antlr3CreateFileStream(), and antlr3CreateStringStream().

static void antlr3InputClose (pANTLR3_INPUT_STREAM input) [static]

Close down an input stream and free any memory allocated by it.

Parameters:

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.

Referenced by antlr3GenericSetupStream().

static void antlr3InputReset (pANTLR3_INPUT_STREAM input) [static]

Reset a re-startable input stream to the start.

Parameters:

input Input stream context pointer

References antlr3VectorNew(), ANTLR3_INPUT_STREAM_struct::charPositionInLine, ANTLR3_VECTOR_struct::clear, 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.

Referenced by antlr3GenericSetupStream().

static void antlr3UTF16Consume (pANTLR3_INT_STREAM is) [static]

Consume the next character in a UTF16 input stream.

Parameters:

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, ANTLR3_INT_STREAM_struct::super, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.

Referenced by antlr3UTF16SetupStream().

static void antlr3UTF16ConsumeBE (pANTLR3_INT_STREAM is) [static]

Consume the next character in a UTF16 input stream when the input is Big Endian and the machine is not.

Parameters:

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, ANTLR3_INT_STREAM_struct::super, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.

Referenced by antlr3UTF16SetupStream().

static void antlr3UTF16ConsumeLE (pANTLR3_INT_STREAM is) [static]

Consume the next character in a UTF16 input stream when the input is Little Endian and the machine is not Note that the UTF16 routines do not do any substantial verification of the input stream as for performance sake, we assume it is validly encoded. So if a low surrogate is found at the curent input position then we just consume it. Surrogate pairs should be seen as Hi, Lo. So if we have a Lo first, then the input stream is fubar but we just ignore that.

Parameters:

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, ANTLR3_INT_STREAM_struct::super, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.

Referenced by antlr3UTF16SetupStream().

static ANTLR3_MARKER antlr3UTF16Index (pANTLR3_INT_STREAM is) [static]

Calculate the current index in the output stream.

Parameters:

input Input stream context pointer

References ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF16SetupStream().

static ANTLR3_UCHAR antlr3UTF16LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming an 8 bit ascii input.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, halfBase, halfShift, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::super, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.

Referenced by antlr3UTF16SetupStream().

static ANTLR3_UCHAR antlr3UTF16LABE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming a UTF16 input when the input is Little Endian and the machine is not.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, halfBase, halfShift, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::super, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.

Referenced by antlr3UTF16SetupStream().

static ANTLR3_UCHAR antlr3UTF16LALE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming a UTF16 input when the input is Little Endian and the machine is not.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, halfBase, halfShift, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::super, UNI_SUR_HIGH_END, UNI_SUR_HIGH_START, UNI_SUR_LOW_END, and UNI_SUR_LOW_START.

Referenced by antlr3UTF16SetupStream().

static void antlr3UTF16Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) [static]

Rewind the lexer input to the state specified by the supplied mark.

Parameters:

input Input stream context pointer

Remarks:

Assumes UTF16 input stream.

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_CHARSTREAM_EOF, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF16SetupStream().

void antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)

Common function to setup function interface for a UTF16 or UCS2 input stream.

Parameters:

input Input stream context pointer

Remarks:

·
Strictly speaking, there is no such thing as a UCS2 input stream as the term tends to confuse the notions of character encoding, unicode and so on. UCS2 is essentially UTF16 without any surrogates and so the standard UTF16 input stream is able to handle it without any special code.

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_FALSE, ANTLR3_TRUE, antlr3StringFactoryNew(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF16Index(), antlr3UTF16LA(), antlr3UTF16LABE(), antlr3UTF16LALE(), antlr3UTF16Seek(), antlr3UTF16Substr(), ANTLR3_INPUT_STREAM_struct::charByteSize, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::encoding, ANTLR3_INT_STREAM_struct::index, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::seek, ANTLR3_INPUT_STREAM_struct::strFactory, and ANTLR3_INPUT_STREAM_struct::substr.

Referenced by setupInputStream().

static pANTLR3_STRING antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) [static]

Return a substring of the UTF16 input stream in newly allocated memory.

Parameters:

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_UINT32_CAST, ANTLR3_STRING_FACTORY_struct::newPtr, and ANTLR3_INPUT_STREAM_struct::strFactory.

Referenced by antlr3UTF16SetupStream().

static void antlr3UTF32Consume (pANTLR3_INT_STREAM is) [static]

Consume the next character in a UTF32 input stream.

Parameters:

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.

Referenced by antlr3UTF32SetupStream().

static ANTLR3_MARKER antlr3UTF32Index (pANTLR3_INT_STREAM is) [static]

Calculate the current index in the output stream.

Parameters:

input Input stream context pointer

References ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF32SetupStream().

static ANTLR3_UCHAR antlr3UTF32LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming a UTF32 input in natural machine byte order.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF32SetupStream().

static ANTLR3_UCHAR antlr3UTF32LABE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming a UTF32 input in big endian byte order.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

Remarks:

This is the same code as LE version but seprated in case there are better optimisations fo rendinan swap

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF32SetupStream().

static ANTLR3_UCHAR antlr3UTF32LALE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming a UTF32 input in little endian byte order.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF32SetupStream().

static void antlr3UTF32Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) [static]

Rewind the lexer input to the state specified by the supplied mark.

Parameters:

input Input stream context pointer

Remarks:

Assumes UTF32 input stream.

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_CHARSTREAM_EOF, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

Referenced by antlr3UTF32SetupStream().

void antlr3UTF32SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)

Common function to setup function interface for a UTF3 input stream.

Parameters:

input Input stream context pointer

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_FALSE, ANTLR3_TRUE, antlr3StringFactoryNew(), antlr3UTF32Consume(), antlr3UTF32Index(), antlr3UTF32LA(), antlr3UTF32LABE(), antlr3UTF32LALE(), antlr3UTF32Seek(), antlr3UTF32Substr(), ANTLR3_INPUT_STREAM_struct::charByteSize, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::encoding, ANTLR3_INT_STREAM_struct::index, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::seek, ANTLR3_INPUT_STREAM_struct::strFactory, and ANTLR3_INPUT_STREAM_struct::substr.

Referenced by setupInputStream().

static pANTLR3_STRING antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) [static]

Return a substring of the UTF16 input stream in newly allocated memory.

Parameters:

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_UINT32_CAST, ANTLR3_STRING_FACTORY_struct::newPtr, and ANTLR3_INPUT_STREAM_struct::strFactory.

Referenced by antlr3UTF32SetupStream().

static void antlr3UTF8Consume (pANTLR3_INT_STREAM is) [static]

Consume the next character in a UTF8 input stream.

Parameters:

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, offsetsFromUTF8, ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::super, and trailingBytesForUTF8.

Referenced by antlr3UTF8SetupStream().

static ANTLR3_UCHAR antlr3UTF8LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]

Return the input element assuming a UTF8 input.

Parameters:

input Input stream context pointer
la 1 based offset of next input stream element

Returns:

Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, offsetsFromUTF8, ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::super, and trailingBytesForUTF8.

Referenced by antlr3UTF8SetupStream().

void antlr3UTF8SetupStream (pANTLR3_INPUT_STREAM input)

Common function to setup function interface for a UTF8 input stream.

Parameters:

input Input stream context pointer

References ANTLR3_INT_STREAM_struct::_LA, antlr3StringFactoryNew(), antlr3UTF8Consume(), antlr3UTF8LA(), ANTLR3_INPUT_STREAM_struct::charByteSize, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::encoding, ANTLR3_INPUT_STREAM_struct::istream, and ANTLR3_INPUT_STREAM_struct::strFactory.

Referenced by setupInputStream().

Variable Documentation

const ANTLR3_UCHAR e2a[256]

Referenced by antlr3EBCDICLA().

const UTF32 offsetsFromUTF8[6] [static]

Initial value:

= 
    {   0x00000000UL, 0x00003080UL, 0x000E2080UL, 
    0x03C82080UL, 0xFA082080UL, 0x82082080UL 
    }

Magic values subtracted from a buffer value during UTF8 conversion. This table contains as many values as there might be trailing bytes in a UTF-8 sequence.

Referenced by antlr3UTF8Consume(), and antlr3UTF8LA().

const ANTLR3_UINT32 trailingBytesForUTF8[256] [static]

Initial value:

= {
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
}

Index into the table below with the first byte of a UTF-8 sequence to get the number of trailing bytes that are supposed to follow it. Note that legal UTF-8 values can't have 4 or 5-bytes. The table is left as-is for anyone who may want to do such conversion, which was allowed in earlier algorithms.

Referenced by antlr3UTF8Consume(), and antlr3UTF8LA().

Author

Generated automatically by Doxygen for ANTLR3C from the source code.

Referenced By

antlr38BitConsume(3), antlr38BitGetCharPosition(3), antlr38BitGetLine(3), antlr38BitGetLineBuf(3), antlr38BitGetSourceName(3), antlr38BitIndex(3), antlr38BitLA(3), antlr38BitLA_ucase(3), antlr38BitLT(3), antlr38BitMark(3), antlr38BitRelease(3), antlr38BitReuse(3), antlr38BitRewind(3), antlr38BitRewindLast(3), antlr38BitSeek(3), antlr38BitSetCharPosition(3), antlr38BitSetLine(3), antlr38BitSetNewLineChar(3), antlr38BitSetUcaseLA(3), antlr38BitSize(3), antlr38BitSubstr(3), antlr3-e2a(3), antlr3EBCDICLA(3), antlr3InputClose(3), antlr3InputReset(3), antlr3UTF16Consume(3), antlr3UTF16ConsumeBE(3), antlr3UTF16ConsumeLE(3), antlr3UTF16Index(3), antlr3UTF16LA(3), antlr3UTF16LABE(3), antlr3UTF16LALE(3), antlr3UTF16Seek(3), antlr3UTF16Substr(3), antlr3UTF32Consume(3), antlr3UTF32Index(3), antlr3UTF32LA(3), antlr3UTF32LABE(3), antlr3UTF32LALE(3), antlr3UTF32Seek(3), antlr3UTF32Substr(3), antlr3UTF8Consume(3) and antlr3UTF8LA(3) are aliases of antlr3inputstream.c(3).

Tue Oct 4 2016 Version 3.3.1 ANTLR3C