include/antlr3tokenstream.h(3)
π 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 anANTLR3_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 anANTLR3_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
- 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