include/antlr3tokenstream.h(3)

πŸ“¦ version 3.4, in fedora 43

πŸ’– include/antlr3tokenstream.h(3) πŸ’–

okay bestie, so this is a page from the ANTLR3C manual (that's the manual name, we're keeping it, slay) and it's literally all about the header that defines the interface for an ANTLR3 common token stream. yes, that whole vibe. let's get into it πŸ¦‹


✨ NAME ✨

include/antlr3tokenstream.h β€” Defines the interface for an ANTLR3 common token stream. that's it, that's the whole name section, periodt πŸ’…


🌸 SYNOPSIS 🌸

so you pull in all these headers first, like a little pregame:

#include <antlr3defs.h>
#include <antlr3string.h>
#include <antlr3collections.h>
#include <antlr3input.h>
#include <antlr3commontoken.h>
#include <antlr3bitset.h>
#include <antlr3debugeventlistener.h>

πŸŽ€ Data Structures πŸŽ€

here's the struct squad, three of them, iconic behavior:

  • struct ANTLR3_COMMON_TOKEN_STREAM_struct β€” Common token stream is an implementation of ANTLR_TOKEN_STREAM for the default parsers and recognizers. she's the default, she's the blueprint, she serves πŸ’–
  • struct ANTLR3_TOKEN_SOURCE_struct β€” Definition of a token source, which has a pointer to a function that returns the next token (using a token factory if it is going to be efficient) and a pointer to an ANTLR3_INPUT_STREAM. like, it knows where tokens come from AND where the input comes from. multi-talented ngl.
  • struct ANTLR3_TOKEN_STREAM_struct β€” Definition of the ANTLR3 common token stream interface. the interface itself, the main character fr πŸ‘‘

πŸ¦‹ Typedefs πŸ¦‹

and their cute little aliases, one per struct:

  • typedef struct ANTLR3_COMMON_TOKEN_STREAM_struct ANTLR3_COMMON_TOKEN_STREAM β€” Common token stream is an implementation of ANTLR_TOKEN_STREAM for the default parsers and recognizers.
  • typedef struct ANTLR3_TOKEN_SOURCE_struct ANTLR3_TOKEN_SOURCE β€” Definition of a token source, which has a pointer to a function that returns the next token (using a token factory if it is going to be efficient) and a pointer to an ANTLR3_INPUT_STREAM.
  • typedef struct ANTLR3_TOKEN_STREAM_struct ANTLR3_TOKEN_STREAM β€” Definition of the ANTLR3 common token stream interface.

πŸ’œ Detailed Description πŸ’œ

Defines the interface for an ANTLR3 common token stream. that's the whole thesis statement bestie ✨

Custom token streams should create one of these and then override any functions by installing their own pointers to implement the various functions.

so like, if you wanna go off-script and make your own token stream, you take one of these, and you swap in your own function pointers wherever you want to change the behavior. you're the director now, the struct is just the cast 🎬

🌈 Typedef Documentation 🌈

🫢 typedef struct ANTLR3_COMMON_TOKEN_STREAM_struct ANTLR3_COMMON_TOKEN_STREAM

Common token stream is an implementation of ANTLR_TOKEN_STREAM for the default parsers and recognizers. You may of course build your own implementation if you are so inclined.

go ahead, build your own if that's your thing, no one's stopping you πŸ’…

🫢 typedef struct ANTLR3_TOKEN_SOURCE_struct ANTLR3_TOKEN_SOURCE

Definition of a token source, which has a pointer to a function that returns the next token (using a token factory if it is going to be efficient) and a pointer to an ANTLR3_INPUT_STREAM. This is slightly different to the Java interface because we have no way to implement multiple interfaces without defining them in the interface structure or casting (void *), which is too convoluted.

ngl the C version has to do a lil structural workaround here because there's no clean multiple-interface situation like in Java. casting (void *) everywhere? too convoluted, we said no thank you πŸ™ˆ

🫢 typedef struct ANTLR3_TOKEN_STREAM_struct ANTLR3_TOKEN_STREAM

Definition of the ANTLR3 common token stream interface.

⭐ Remarks ⭐

Much of the documentation for this interface is stolen from Ter's Java implementation.

we said it, not us, it's literally in the docs. Ter's Java implementation ate and we borrowed the notes. credit where it's due fr fr πŸ’–

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for ANTLR3C from the source code.


and that's the whole page bestie, you understood it, you're literally a token stream expert now 🧚

Version 3.3.1, Tue Jul 29 2025 β€” that's the version and the date, and this page? she's giving documentation excellence, no cap πŸ’…βœ¨πŸŽ€πŸ¦‹
πŸ“¦ where this page comes from