src/antlr3inputstream.c(3)
πΈ src/antlr3inputstream.c β the ANTLR3C bestie cut πΈ
okay so hi bestie π this is the manual page for src/antlr3inputstream.c out of the ANTLR3C docs, and it is literally the origin story for every input stream you're ever gonna touch in this library. It's giving β¨infrastructureβ¨, it's giving πfoundationπ, and yes, it is long, so buckle up and hydrate. π§
β¨ NAME β¨
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 streamstatic ANTLR3_UINT32 antlr38BitGetLine (pANTLR3_INPUT_STREAM input)β return the line number as understood by the 8 bit input streamstatic 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 ('static pANTLR3_STRING antlr38BitGetSourceName (pANTLR3_INT_STREAM is)static ANTLR3_MARKER antlr38BitIndex (pANTLR3_INT_STREAM is)β calculate the current index in the output streamstatic ANTLR3_UCHAR antlr38BitLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming an 8 bit ascii inputstatic 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 inputstatic 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 bufferstatic void antlr38BitRelease (pANTLR3_INT_STREAM is, ANTLR3_MARKER mark)β rewind the lexer input to the state specified by the supplied markstatic 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 markstatic void antlr38BitRewindLast (pANTLR3_INT_STREAM is)β rewind the lexer input to the state specified by the last produced markstatic void antlr38BitSeek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)β rewind the lexer input to the state specified by the supplied markstatic void antlr38BitSetCharPosition (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 position)β set the current offset in the current line to be a particular settingstatic void antlr38BitSetLine (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 line)β set the current line number as understood by the input streamstatic void antlr38BitSetNewLineChar (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 newlineChar)β set the newline trigger character in the input stream to the supplied parameterstatic 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 streamstatic 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 inputstatic 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 memorystatic ANTLR3_UCHAR antlr3EBCDICLA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming an 8 bit EBCDIC inputvoid antlr3EBCDICSetupStream (pANTLR3_INPUT_STREAM input)β common function to setup function interface for a EBCDIC input streamvoid 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 startstatic void antlr3UTF16Consume (pANTLR3_INT_STREAM is)β consume the next character in a UTF16 input streamstatic 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 notstatic 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 encodedstatic ANTLR3_MARKER antlr3UTF16Index (pANTLR3_INT_STREAM is)β calculate the current index in the output streamstatic ANTLR3_UCHAR antlr3UTF16LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming an 8 bit ascii inputstatic 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 notstatic 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 notstatic void antlr3UTF16Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)β rewind the lexer input to the state specified by the supplied markvoid antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)β common function to setup function interface for a UTF16 or UCS2 input streamstatic pANTLR3_STRING antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop)β return a substring of the UTF16 input stream in newly allocated memorystatic void antlr3UTF32Consume (pANTLR3_INT_STREAM is)β consume the next character in a UTF32 input streamstatic ANTLR3_MARKER antlr3UTF32Index (pANTLR3_INT_STREAM is)β calculate the current index in the output streamstatic ANTLR3_UCHAR antlr3UTF32LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming a UTF32 input in natural machine byte orderstatic ANTLR3_UCHAR antlr3UTF32LABE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming a UTF32 input in big endian byte orderstatic ANTLR3_UCHAR antlr3UTF32LALE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming a UTF32 input in little endian byte orderstatic void antlr3UTF32Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)β rewind the lexer input to the state specified by the supplied markvoid antlr3UTF32SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)β common function to setup function interface for a UTF3 input streamstatic pANTLR3_STRING antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop)β return a substring of the UTF16 input stream in newly allocated memorystatic void antlr3UTF8Consume (pANTLR3_INT_STREAM is)β consume the next character in a UTF8 input streamstatic ANTLR3_UCHAR antlr3UTF8LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)β return the input element assuming a UTF8 inputvoid 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.
like, that's the whole point of this file, bestie β it's the base-layer glow-up that every input stream gets handed. π«Ά
π₯ Function Documentation π₯
π«Ά 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().
π«Ά 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().
π«Ά 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().
π«Ά 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 ('
Parameters
- input
References ANTLR3_INPUT_STREAM_struct::currentLine.
Referenced by antlr3GenericSetupStream().
bestie that description literally ends with (' and we are NOT fixing it, we are preserving it, periodt π
π«Ά pANTLR3_STRING antlr38BitGetSourceName (pANTLR3_INT_STREAM is) [static]
References ANTLR3_INT_STREAM_struct::streamName.
Referenced by antlr3GenericSetupStream().
π«Ά 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().
π«Ά 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)
π Its little friendship circle: ANTLR3_CHARSTREAM_EOF, ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.
π And it gets summoned by antlr38BitSetUcaseLA(), and antlr3GenericSetupStream().
πΈ antlr38BitLA_ucase β the LOUD version of LA, no cap
ANTLR3_UCHAR antlr38BitLA_ucase (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]
Bestie, this one hands you the input element assuming an 8 bit input, and it always returns the UPPER CASE character. Heads up though: this is 8 bit only, so we're trusting that the toupper function will use the correct locale for 8 bits. That's the whole deal. π
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().
β¨ antlr38BitLT β peek, but make it ascii
void * antlr38BitLT (pANTLR3_INPUT_STREAM input, ANTLR3_INT32 lt) [static]
Return the input element assuming an 8 bit ascii input. Simple as that, girlypop. π¦
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().
π antlr38BitMark β drop a pin π
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. Like bookmarking a spot in a fic you're absolutely devouring. π₯
Parameters
- is β Input stream context pointer
References
ANTLR3_VECTOR_struct::add, 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().
π antlr38BitRelease β let that mark go, bestie
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
mark(), ANTLR3_INPUT_STREAM_struct::markDepth, and ANTLR3_INT_STREAM_struct::super.
Referenced by
antlr3GenericSetupStream().
π antlr38BitReuse β glow-up for your stream
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. It's giving recycling, it's giving sustainable queen. π
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().
π«Ά antlr38BitRewind β take it back to the mark
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, mark(), 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().
π antlr38BitRewindLast β back to the last pin
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().
π§ antlr38BitSeek β jump to the seekPoint, periodt
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().
β antlr38BitSetCharPosition β set the vibe of your column
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(). So like, it's cosmetic, it's for the ~aesthetic~ of your error messages. π
References
ANTLR3_INPUT_STREAM_struct::charPositionInLine.
Referenced by
antlr3GenericSetupStream().
π antlr38BitSetLine β tell the stream what line it's on
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. Basically: gaslight your input stream into thinking it's somewhere else, but for a good reason. π
References
ANTLR3_INPUT_STREAM_struct::line.
Referenced by
antlr3GenericSetupStream().
π antlr38BitSetNewLineChar β pick your newline trigger
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. No pressure bestie, but like... check it. π
References
ANTLR3_INPUT_STREAM_struct::newlineChar.
Referenced by
antlr3GenericSetupStream().
π antlr38BitSetUcaseLA β flip the ucase switch
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().
π₯ antlr38BitSetupStream β the main character assembles the squad
void antlr38BitSetupStream (pANTLR3_INPUT_STREAM input)
Common function to setup function interface for an 8 bit input stream. This is the one that hooks everything up. β¨
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
consumefor instance. So like β steal the whole fit, then swap out the pieces that don't fit your body. Slay. π
References
antlr3StringFactoryNew(), ANTLR3_INPUT_STREAM_struct::encoding, and ANTLR3_INPUT_STREAM_struct::strFactory.
Referenced by
setupInputStream().
π antlr38BitSize β how big is this thing
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. This one keeps it simple, and honestly? Iconic of it.
Parameters
- input β Input stream context pointer
References
ANTLR3_INPUT_STREAM_struct::sizeBuf.
Referenced by
antlr3GenericSetupStream().
π¦ antlr38BitSubstr β gimme a slice of that stream
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. Fresh memory, fresh substring, no cap. π«Ά
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().
π antlr3EBCDICLA β LA, but it's giving mainframe energy
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().
π§ antlr3EBCDICSetupStream β EBCDIC squad, assemble
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().
antlr3GenericSetupStream β¨
void antlr3GenericSetupStream (pANTLR3_INPUT_STREAM input)
Okay bestie, this is the one that wires up everything. It's the generic setup that gets a plain character stream fully dressed, hooks and all, so all the function pointers on your input stream actually point at something real. π
References:
ANTLR3_INT_STREAM_struct::_LAANTLR3_INPUT_STREAM_struct::_LTantlr38BitConsume()antlr38BitGetCharPosition()antlr38BitGetLine()antlr38BitGetLineBuf()antlr38BitGetSourceName()antlr38BitIndex()antlr38BitLA()antlr38BitLT()antlr38BitMark()antlr38BitRelease()antlr38BitReuse()antlr38BitRewind()antlr38BitRewindLast()antlr38BitSeek()antlr38BitSetCharPosition()antlr38BitSetLine()antlr38BitSetNewLineChar()antlr38BitSetUcaseLA()antlr38BitSize()antlr38BitSubstr()ANTLR3_CHARSTREAMantlr3InputClose()antlr3InputReset()antlr3IntStreamNew()ANTLR3_INPUT_STREAM_struct::charByteSizeANTLR3_INPUT_STREAM_struct::closeANTLR3_INT_STREAM_struct::consumeANTLR3_INPUT_STREAM_struct::freeANTLR3_INPUT_STREAM_struct::getCharPositionInLineANTLR3_INPUT_STREAM_struct::getLineANTLR3_INPUT_STREAM_struct::getLineBufANTLR3_INT_STREAM_struct::getSourceNameANTLR3_INT_STREAM_struct::indexANTLR3_INPUT_STREAM_struct::istreamANTLR3_INT_STREAM_struct::markANTLR3_INPUT_STREAM_struct::markersANTLR3_INT_STREAM_struct::releaseANTLR3_INPUT_STREAM_struct::resetANTLR3_INPUT_STREAM_struct::reuseANTLR3_INT_STREAM_struct::rewindANTLR3_INT_STREAM_struct::rewindLastANTLR3_INT_STREAM_struct::seekANTLR3_INPUT_STREAM_struct::setCharPositionInLineANTLR3_INPUT_STREAM_struct::setLineANTLR3_INPUT_STREAM_struct::SetNewLineCharANTLR3_INPUT_STREAM_struct::setUcaseLAANTLR3_INPUT_STREAM_struct::sizeANTLR3_INPUT_STREAM_struct::substrANTLR3_INT_STREAM_struct::superANTLR3_INT_STREAM_struct::type
Referenced by: antlr3CreateFileStream(), and antlr3CreateStringStream().
antlr3InputClose π
void antlr3InputClose (pANTLR3_INPUT_STREAM input) [static]
Shut an input stream down and give back every last byte of memory it was hoarding. It's the goodbye hug that also cleans up, iconic behaviour fr. β¨
Parameters:
- input β input stream context pointer
References:
ANTLR3_STRING_FACTORY_struct::closeANTLR3_INPUT_STREAM_struct::dataANTLR3_INT_STREAM_struct::freeANTLR3_INPUT_STREAM_struct::isAllocatedANTLR3_INPUT_STREAM_struct::istreamANTLR3_INPUT_STREAM_struct::markersANTLR3_INPUT_STREAM_struct::strFactory
Referenced by: antlr3GenericSetupStream().
antlr3InputReset π¦
void antlr3InputReset (pANTLR3_INPUT_STREAM input) [static]
Reset a re-startable input stream back to the very start. Like rewinding the group chat to read the whole thing from the beginning, no cap. π
Parameters:
- input β input stream context pointer
References:
antlr3VectorNew()ANTLR3_INPUT_STREAM_struct::charPositionInLineANTLR3_VECTOR_struct::clearANTLR3_INPUT_STREAM_struct::currentLineANTLR3_INPUT_STREAM_struct::dataANTLR3_INPUT_STREAM_struct::lineANTLR3_INPUT_STREAM_struct::markDepthANTLR3_INPUT_STREAM_struct::markersANTLR3_INPUT_STREAM_struct::nextChar
Referenced by: antlr3GenericSetupStream().
antlr3UTF16Consume πΈ
void antlr3UTF16Consume (pANTLR3_INT_STREAM is) [static]
Eat the next character out of a UTF16 input stream. Nom. π
Parameters:
- input β input stream context pointer
References:
ANTLR3_INPUT_STREAM_struct::charPositionInLineANTLR3_INPUT_STREAM_struct::currentLineANTLR3_INPUT_STREAM_struct::dataANTLR3_INPUT_STREAM_struct::lineANTLR3_INPUT_STREAM_struct::newlineCharANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::superUNI_SUR_HIGH_ENDUNI_SUR_HIGH_STARTUNI_SUR_LOW_ENDUNI_SUR_LOW_START
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16ConsumeBE π₯
void antlr3UTF16ConsumeBE (pANTLR3_INT_STREAM is) [static]
Same energy as above, but for when the input is Big Endian and the machine you're running on is not. The endianness mismatch is the whole plot twist. π
Parameters:
- input β input stream context pointer
References:
ANTLR3_INPUT_STREAM_struct::charPositionInLineANTLR3_INPUT_STREAM_struct::currentLineANTLR3_INPUT_STREAM_struct::dataANTLR3_INPUT_STREAM_struct::lineANTLR3_INPUT_STREAM_struct::newlineCharANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::superUNI_SUR_HIGH_ENDUNI_SUR_HIGH_STARTUNI_SUR_LOW_ENDUNI_SUR_LOW_START
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16ConsumeLE π
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.
Real talk though: the UTF16 routines do not do any substantial verification of the input stream. For performance's sake, they just assume it is validly encoded. So if a low surrogate shows up at the curent input position, they just consume it. Surrogate pairs are supposed to be seen as Hi, Lo. So if you've got a Lo first, the input stream is fubar β and they just ignore that. π
Parameters:
- input β input stream context pointer
References:
ANTLR3_INPUT_STREAM_struct::charPositionInLineANTLR3_INPUT_STREAM_struct::currentLineANTLR3_INPUT_STREAM_struct::dataANTLR3_INPUT_STREAM_struct::lineANTLR3_INPUT_STREAM_struct::newlineCharANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::superUNI_SUR_HIGH_ENDUNI_SUR_HIGH_STARTUNI_SUR_LOW_ENDUNI_SUR_LOW_START
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16Index π§
ANTLR3_MARKER antlr3UTF16Index (pANTLR3_INT_STREAM is) [static]
Work out where you are right now in the output stream. Your little "you are here" map pin. π
Parameters:
- input β input stream context pointer
References:
ANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INT_STREAM_struct::super
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16LA β
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_EOFANTLR3_INPUT_STREAM_struct::datahalfBasehalfShiftANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::superUNI_SUR_HIGH_ENDUNI_SUR_HIGH_STARTUNI_SUR_LOW_ENDUNI_SUR_LOW_START
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16LABE π
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_EOFANTLR3_INPUT_STREAM_struct::datahalfBasehalfShiftANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::superUNI_SUR_HIGH_ENDUNI_SUR_HIGH_STARTUNI_SUR_LOW_ENDUNI_SUR_LOW_START
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16LALE π
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_EOFANTLR3_INPUT_STREAM_struct::datahalfBasehalfShiftANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::superUNI_SUR_HIGH_ENDUNI_SUR_HIGH_STARTUNI_SUR_LOW_ENDUNI_SUR_LOW_START
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16Seek π«Ά
void antlr3UTF16Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) [static]
Rewind the lexer input back to the exact state the supplied mark points at. Time travel, but for a stream. βͺ
Parameters:
- input β input stream context pointer
Remarks: Assumes UTF16 input stream.
References:
ANTLR3_INT_STREAM_struct::_LAANTLR3_CHARSTREAM_EOFANTLR3_INT_STREAM_struct::consumeANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INT_STREAM_struct::super
Referenced by: antlr3UTF16SetupStream().
antlr3UTF16SetupStream π
void antlr3UTF16SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN machineBigEndian, ANTLR3_BOOLEAN inputBigEndian)
The common function that sets up the whole function interface for a UTF16 or UCS2 input stream. It's giving matchmaker, honestly. π
Parameters:
- input β input stream context pointer
Remarks:
- Strictly speaking, there is no such thing as a UCS2 input stream, because 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::_LAANTLR3_FALSEANTLR3_TRUEantlr3StringFactoryNew()antlr3UTF16Consume()antlr3UTF16ConsumeBE()antlr3UTF16ConsumeLE()antlr3UTF16Index()antlr3UTF16LA()antlr3UTF16LABE()antlr3UTF16LALE()antlr3UTF16Seek()antlr3UTF16Substr()ANTLR3_INPUT_STREAM_struct::charByteSizeANTLR3_INT_STREAM_struct::consumeANTLR3_INPUT_STREAM_struct::encodingANTLR3_INT_STREAM_struct::indexANTLR3_INPUT_STREAM_struct::istreamANTLR3_INT_STREAM_struct::seekANTLR3_INPUT_STREAM_struct::strFactoryANTLR3_INPUT_STREAM_struct::substr
Referenced by: setupInputStream().
antlr3UTF16Substr π
pANTLR3_STRING antlr3UTF16Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) [static]
Hand you back a substring of the UTF16 input stream, freshly allocated in new memory. A little gift, wrapped and everything. π
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_CASTANTLR3_STRING_FACTORY_struct::newPtrANTLR3_INPUT_STREAM_struct::strFactory
Referenced by: antlr3UTF16SetupStream().
antlr3UTF32Consume π
void antlr3UTF32Consume (pANTLR3_INT_STREAM is) [static]
Consume the next character in a UTF32 input stream. Big characters, bigger vibes. π
Parameters:
- input β input stream context pointer
References:
ANTLR3_INPUT_STREAM_struct::charPositionInLineANTLR3_INPUT_STREAM_struct::currentLineANTLR3_INPUT_STREAM_struct::dataANTLR3_INPUT_STREAM_struct::lineANTLR3_INPUT_STREAM_struct::newlineCharANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INPUT_STREAM_struct::sizeBufANTLR3_INT_STREAM_struct::super
Referenced by: antlr3UTF32SetupStream().
antlr3UTF32Index π
ANTLR3_MARKER antlr3UTF32Index (pANTLR3_INT_STREAM is) [static]
Calculate the current index in the output stream. Same little map-pin energy as its UTF16 sibling. π
Parameters:
- input β input stream context pointer
References:
ANTLR3_INPUT_STREAM_struct::nextCharANTLR3_INT_STREAM_struct::super
Referenced by: antlr3UTF32SetupStream().
antlr3UTF32LA π₯
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
and the one right before this just wraps up like this π«
- 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, andANTLR3_INT_STREAM_struct::super. - Referenced by β
antlr3UTF32SetupStream().
ANTLR3_UCHAR antlr3UTF32LABE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]
okay so bestie, this one hands you back the input element while assuming a UTF32 input in big endian byte order. big-endian girlies, this is your moment π
Parameters
inputβ Input stream context pointerlaβ 1 based offset of next input stream element
Returns
Next input character in internal ANTLR3 encoding (UTF32)
Remarks
and the original literally says, quote-unquote: "This is the same code as LE version but seprated in case there are better optimisations fo rendinan swap" β yeah, typos and all, we keep it real here π«Ά
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().
ANTLR3_UCHAR antlr3UTF32LALE (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]
same energy, different endianness β¨ this one returns the input element assuming a UTF32 input in little endian byte order. the LE to the previous BE, if you will.
Parameters
inputβ Input stream context pointerlaβ 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().
void antlr3UTF32Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint) [static]
rewind the lexer input back to the state that the supplied mark is pointing at. it's giving β¨time travelβ¨ but make it lexer-core.
Parameters
inputβ Input stream context pointer
Remarks
Assumes UTF32 input stream. (no cap, it just assumes it π)
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)
the common function that sets up the whole function interface for a UTF3 input stream. lowkey the main character of this whole file, ngl π
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().
pANTLR3_STRING antlr3UTF32Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop) [static]
returns a substring of the UTF16 input stream, and it does it in newly allocated memory π (yes, the doc literally says UTF16 here β we don't ask questions, we report the facts, bestie.)
Parameters
inputβ Input stream context pointerstartβ Offset in input stream where the string startsstopβ 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().
void antlr3UTF8Consume (pANTLR3_INT_STREAM is) [static]
consume the next character in a UTF8 input stream. munch munch, next char please π
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().
ANTLR3_UCHAR antlr3UTF8LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la) [static]
returns the input element, assuming a UTF8 input. lookahead queen behavior fr fr πΈ
Parameters
inputβ Input stream context pointerlaβ 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)
the common function to set up the function interface for a UTF8 input stream. wiring up the whole vibe check for UTF8 π¦
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 that get subtracted from a buffer value during UTF8 conversion β¨ this table has as many values as there might be trailing bytes in a UTF-8 sequence. slay, math π
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 π and here's the tea: 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. historical artifact core πΊ
π Author π
Generated automatically by Doxygen for ANTLR3C from the source code. no human author, just robot magic doing its thing π€β¨
and that's the whole page bestie, we made it to the end!! π this was Version 3.3.1, dated Tue Jul 29 2025 00:00:00, and it lives at src/antlr3inputstream.c(3) π«Ά go forth and stream your inputs, you've got this ππ¦π
π¦ where this page comes from
- fedora 43: antlr3-C-devel 1:3.4-3.5.3.14.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms