ANTLR3_INPUT_STREAM_struct(3)

πŸ“¦ version 3.4, in fedora 43

πŸ’– NAME πŸ’–

okay bestie, welcome to the ANTLR3_INPUT_STREAM_struct(3) page from the ANTLR3C manual β€” and it's giving master context structure for an ANTLR3 C runtime based input stream. periodt.


πŸ¦‹ 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.
  • ANTLR3_UINT32 encoding β€” Indicates the encoding scheme used in this input stream.
  • 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) β€” (no extra description in the field list, it just shows up with main character energy)
  • 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(* reuse )(struct ANTLR3_INPUT_STREAM_struct *input, pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name) β€” Pointer to a function that reuses and resets an input stream by supplying a new 'source'.
  • 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/offset and line buffer recording information.
  • void(* setUcaseLA )(pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag) β€” Pointer 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. That's the whole flex, bestie.


πŸ‘‘ Field Documentation πŸ‘‘

πŸ’… _LT πŸ’…

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().


πŸ’– charByteSize πŸ’–

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 as this would be slow and complicated. If this is a UTF-8 stream then this field will be set to 0. Generally you are best working internally with 32 bit characters as this is the most efficient.

Referenced by antlr3EBCDICSetupStream(), antlr3GenericSetupStream(), antlr3UTF16SetupStream(), antlr3UTF32SetupStream(), antlr3UTF8SetupStream(), and getText().


✨ charPositionInLine ✨

ANTLR3_INT32 ANTLR3_INPUT_STREAM_struct::charPositionInLine

The offset within the current line of the current character.

Referenced by antlr38BitConsume(), antlr38BitGetCharPosition(), antlr38BitMark(), antlr38BitRewind(), antlr38BitSetCharPosition(), antlr3InputReset(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF32Consume(), antlr3UTF8Consume(), getCharPositionInLine(), and nextTokenStr().


πŸŽ€ close πŸŽ€

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

Pointer to function that closes the input stream.

Referenced by antlr3CreateFileStream(), and antlr3GenericSetupStream().


πŸ¦‹ currentLine πŸ¦‹

void* ANTLR3_INPUT_STREAM_struct::currentLine

Pointer into the input buffer where the current line started.

Referenced by antlr38BitConsume(), antlr38BitGetLineBuf(), antlr38BitMark(), antlr38BitRewind(), antlr3InputReset(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF32Consume(), antlr3UTF8Consume(), and emit().


🌈 data 🌈

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 antlr38BitConsume(), antlr38BitLA(), antlr38BitLA_ucase(), antlr38BitReuse(), antlr3CreateStringStream(), antlr3EBCDICLA(), antlr3InputClose(), antlr3InputReset(), antlr3read8Bit(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF16LA(), antlr3UTF16LABE(), antlr3UTF16LALE(), antlr3UTF32Consume(), antlr3UTF32LA(), antlr3UTF32LABE(), antlr3UTF32LALE(), antlr3UTF8Consume(), antlr3UTF8LA(), displayRecognitionError(), and getStartIndex().


πŸ’œ encoding πŸ’œ

ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::encoding

Indicates the encoding scheme used in this input stream.

Referenced by antlr38BitSetupStream(), antlr3EBCDICSetupStream(), antlr3FileStreamNew(), antlr3StringStreamNew(), antlr3UTF16SetupStream(), antlr3UTF32SetupStream(), antlr3UTF8SetupStream(), and setupInputStream().


πŸ“ fileName πŸ“

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 antlr38BitReuse(), antlr3FileStreamNew(), antlr3RecognitionExceptionNew(), antlr3StringStreamNew(), and setCharStream().


🧚 fileNo 🧚

ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::fileNo

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


πŸ’€ free πŸ’€

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

Referenced by antlr3GenericSetupStream().


🌟 getCharPositionInLine 🌟

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(), and antlr3RecognitionExceptionNew().


πŸ’« getLine πŸ’«

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(), and getLine().


🫢 getLineBuf 🫢

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 - Heads up bestie: this function will be inaccurate if setLine is called, because there is no way at the moment to position the input stream at a particular line number offset.

Referenced by antlr3GenericSetupStream().


πŸ’– isAllocated πŸ’–

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 antlr38BitReuse(), antlr3CreateStringStream(), antlr3InputClose(), and antlr3read8Bit().


πŸ‘‘ istream πŸ‘‘

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(), antlr38BitLT(), antlr38BitReuse(), antlr38BitRewind(), antlr38BitSetUcaseLA(), antlr3EBCDICSetupStream(), antlr3FileStreamNew(), antlr3GenericSetupStream(), antlr3InputClose(), antlr3RecognitionExceptionNew(), antlr3StringStreamNew(), antlr3UTF16SetupStream(), antlr3UTF32SetupStream(), antlr3UTF8SetupStream(), getCharIndex(), matchAny(), matchc(), matchRange(), matchs(), memoize(), nextTokenStr(), popCharStream(), pushCharStream(), and recover().


πŸ¦„ line πŸ¦„

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 antlr38BitConsume(), antlr38BitGetLine(), antlr38BitMark(), antlr38BitRewind(), antlr38BitSetLine(), antlr3InputReset(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF32Consume(), antlr3UTF8Consume(), and nextTokenStr().

πŸ’– ANTLR3_UINT32 ANTLR3_INPUT_STREAM_struct::markDepth

Keeps track of how deep your mark() calls are nested, bestie. Nesting counters, we love to see it. ✨

Referenced by antlr38BitMark(), antlr38BitRelease(), and antlr3InputReset().


🌸 pANTLR3_VECTOR ANTLR3_INPUT_STREAM_struct::markers

The list of mark() points living in the input stream. Think of it as a lil guest list of every place you said "wait, remember this spot". πŸŽ€

Referenced by antlr38BitMark(), antlr38BitRewind(), antlr3GenericSetupStream(), antlr3InputClose(), and antlr3InputReset().


πŸ¦‹ ANTLR3_UCHAR ANTLR3_INPUT_STREAM_struct::newlineChar

The character that, the moment it shows up, makes the internal line count go up by one. It's giving "new line detected, everybody move". πŸ’…

Referenced by antlr38BitConsume(), antlr38BitSetNewLineChar(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF32Consume(), and antlr3UTF8Consume().


⭐ void* ANTLR3_INPUT_STREAM_struct::nextChar

Pointer to the next character that's about to be consumed from the input data. This gets cast so it points at the encoding of the original file that was read, using whatever functions got installed as pointers in this input stream context instance at file/string/whatever load time.

Referenced by antlr38BitConsume(), antlr38BitIndex(), antlr38BitLA(), antlr38BitLA_ucase(), antlr38BitMark(), antlr38BitRewind(), antlr38BitSeek(), antlr3EBCDICLA(), antlr3InputReset(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF16Index(), antlr3UTF16LA(), antlr3UTF16LABE(), antlr3UTF16LALE(), antlr3UTF16Seek(), antlr3UTF32Consume(), antlr3UTF32Index(), antlr3UTF32LA(), antlr3UTF32LABE(), antlr3UTF32LALE(), antlr3UTF32Seek(), antlr3UTF8Consume(), antlr3UTF8LA(), nextTokenStr(), and setupInputStream().


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

Pointer to the function that resets the input stream. Hit the undo button on the whole thing, fr fr. πŸ”„

Referenced by antlr38BitReuse(), and antlr3GenericSetupStream().


πŸ’œ void(* ANTLR3_INPUT_STREAM_struct::reuse) (struct ANTLR3_INPUT_STREAM_struct *input, pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name)

Pointer to a function that reuses and resets an input stream by handing it a whole new 'source'. Same stream, new era. πŸ‘‘

Referenced by antlr3GenericSetupStream().


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

Pointer to the function that sets where you currently are in the current line. Like a little cursor bookmark. πŸ“

Referenced by antlr3GenericSetupStream().


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

Pointer to the function that sets the current line number in the input stream. Jump to whatever line you want, main character behaviour. πŸ’«

Referenced by antlr3GenericSetupStream().


πŸ”₯ void(* ANTLR3_INPUT_STREAM_struct::SetNewLineChar) (struct ANTLR3_INPUT_STREAM_struct *input, ANTLR3_UINT32 newlineChar)

Pointer to the function that overrides the default newline character β€” the one the input stream watches for to trigger the line/offset and line buffer recording info.

Remarks

  • By default the chracter ' β€” and yes, bestie, the manual page literally just cuts off right there. The source text stops mid-sentence after the quote mark. We have no more. 😭
  • If for some reason you do not want the counters and pointers to be restee, you can set the chracter to some impossible character such as '\0' or whatever.
  • This is a single character only, so choose the last character in a sequence of two or more.
  • This is only a simple aid to error reporting β€” if you have a complicated binary input 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 character for the input stream type. There 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.
⚠️ Read that last one again. Setting a nonsense value for the wrong stream type doesn't error out nicely β€” it just silently never triggers. Choose wisely. πŸ’€

Referenced by antlr3GenericSetupStream().


πŸ“ void(* ANTLR3_INPUT_STREAM_struct::setUcaseLA) (pANTLR3_INPUT_STREAM input, ANTLR3_BOOLEAN flag)

Pointer to the function that installs a version of LA that always returns upper case. Only valid for character streams, and it creates a case insensitive lexer if your lexer tokens are described in upper case. The tokens will preserve case in the token text. So the matching gets chill, but the output stays exactly as written. ✨

Referenced by antlr3GenericSetupStream().


πŸŽ€ ANTLR3_UINT32(* ANTLR3_INPUT_STREAM_struct::size) (struct ANTLR3_INPUT_STREAM_struct *input)

Pointer to the function that returns the total size of the input buffer. For streams, this may be just the total we have available so far. Which means, of course, that the input stream has to 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

How many characters can be consumed at this point in time. Mostly this is just whatever's left in the pre-read buffer, but if the input source is a stream like a socket or something, then we may call special read code to wait for more input. Patience era. ⏳

Referenced by antlr38BitConsume(), antlr38BitLA(), antlr38BitLA_ucase(), antlr38BitReuse(), antlr38BitSize(), antlr3EBCDICLA(), antlr3read8Bit(), antlr3StringStreamNew(), antlr3UTF16Consume(), antlr3UTF16ConsumeBE(), antlr3UTF16ConsumeLE(), antlr3UTF16LA(), antlr3UTF16LABE(), antlr3UTF16LALE(), antlr3UTF32Consume(), antlr3UTF32LA(), antlr3UTF32LABE(), antlr3UTF32LALE(), antlr3UTF8Consume(), and antlr3UTF8LA().


πŸ¦‹ pANTLR3_STRING_FACTORY ANTLR3_INPUT_STREAM_struct::strFactory

The string factory for this input stream. Every stream needs a lil factory to make its strings. 🏭

Referenced by antlr38BitReuse(), antlr38BitSetupStream(), antlr38BitSubstr(), antlr3EBCDICSetupStream(), antlr3FileStreamNew(), antlr3InputClose(), antlr3StringStreamNew(), antlr3UTF16SetupStream(), antlr3UTF16Substr(), antlr3UTF32SetupStream(), antlr3UTF32Substr(), antlr3UTF8SetupStream(), 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 the function that returns a substring of the input stream. The string comes back in allocated memory and is in the same encoding as the input stream itself β€” NOT in internal ANTLR3_UCHAR form. Don't get it twisted. πŸ’…

Referenced by antlr3GenericSetupStream(), antlr3UTF16SetupStream(), antlr3UTF32SetupStream(), getText(), and getText().


πŸ‘‘ void* ANTLR3_INPUT_STREAM_struct::super

Whatever super structure is providing the INPUT stream needs a pointer to itself, so that it can be passed back to it whenever the api functions get called back from this interface. It's the "call me back at this number" of structs. ☎️


✨ Author ✨

Generated automatically by Doxygen for ANTLR3C from the source code.


And that's a wrap on the whole thing, bestie! 🫢 This page is from Version 3.3.1, dated Tue Jul 29 2025 β€” so yeah, mark your calendars, this documentation ate and left no crumbs. Go forth and stream your input like the icon you are. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from