ANTLR3_BASE_RECOGNIZER_struct(3)
๐ ANTLR3_BASE_RECOGNIZER_struct ๐
okay bestie, welcome to the ANTLR3C section 3 manual โ this is ANTLR3_BASE_RECOGNIZER_struct(3), and it's a big one, so we're doing it in three parts. This is part one. Buckle up, hydrate, let's go ๐
โจ NAME โจ
ANTLR3_BASE_RECOGNIZER_struct โ the base tracking context structure for all types of recognizers. yes, all of them. every single one. it's giving foundation. it's giving load-bearing ๐
๐ธ SYNOPSIS ๐ธ
#include <antlr3baserecognizer.h>
๐ฆ Data Fields ๐ฆ
so many fields. like, so many. here they all are, in order, no skips, no cuts ๐
ANTLR3_BOOLEAN (*alreadyParsedRule)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_MARKER ruleIndex)โ pointer to the function that determines whether the rule has parsed input at the current index in the input stream.void (*beginBacktrack)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 level)โ pointer to a function that's a hook for listening to token consumption during error recovery.void (*beginResync)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that's a hook for listening to token consumption during error recovery.pANTLR3_BITSET (*combineFollows)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_BOOLEAN exact)โ pointer to a function that combines follow bitsets.pANTLR3_BITSET (*computeCSRuleFollow)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that computes the context-sensitive FOLLOW set for the current rule.pANTLR3_BITSET (*computeErrorRecoverySet)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that computes the error recovery set for the current rule.void (*consumeUntil)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 tokenType)โ pointer to a function that consumes input until the next token matches the given token.void (*consumeUntilSet)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_BITSET set)โ pointer to a function that consumes input until the next token matches one in the given set.pANTLR3_DEBUG_EVENT_LISTENER debuggerโ if this is set to anything other thanNULL, then this structure points to an instance of the debugger interface.void (*displayRecognitionError)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_UINT8 *tokenNames)โ pointer to a function that gets called to display a recognition error message.void (*endBacktrack)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 level, ANTLR3_BOOLEAN successful)โ pointer to a function that's a hook for listening to token consumption during error recovery.void (*endResync)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that's a hook for listening to token consumption during error recovery.void (*exConstruct)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that can construct a generic exception structure using whatever info the input stream can give it.struct ANTLR3_BASE_RECOGNIZER_struct pANTLR3_BITSET_LIST followโ that's the whole entry, bestie. no extra description, it just is.void (*free)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that knows how to free the resources of a base recognizer. the cleanup crew ๐งนvoid *(*getCurrentInputSymbol)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM istream)โ pointer to a function that returns the current input symbol.void *(*getMissingSymbol)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM istream, pANTLR3_EXCEPTION e, ANTLR3_UINT32 expectedTokenType, pANTLR3_BITSET_LIST follow)โ conjures up a missing token during error recovery. literally manifesting โจANTLR3_UINT32 (*getNumberOfSyntaxErrors)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ get the number of recognition errors (lexer, parser, tree parser).pANTLR3_STACK (*getRuleInvocationStack)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that returns anANTLR3_LISTof the strings identifying the rules in the parser that got you to this point. your receipts ๐pANTLR3_STACK (*getRuleInvocationStackNamed)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_UINT8 name)โ that's the entry, no description attached.ANTLR3_MARKER (*getRuleMemoization)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_INTKEY ruleIndex, ANTLR3_MARKER ruleParseStart)โ pointer to a function that returns whether the rule has parsed input starting at the supplied start index before.void *(*match)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow)โ pointer to a function that matches the current input symbol against the supplied type.void (*matchAny)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that matches the next token/char in the input stream regardless of what it actually is. no thoughts, just vibes.void (*memoize)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_MARKER ruleIndex, ANTLR3_MARKER ruleParseStart)โ pointer to a function that records whether the rule has parsed the input at a current position successfully or not.void (*mismatch)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow)โ pointer to a function that works out what to do when a token mismatch happens, so Tree parsers can behave differently from other recognizers.ANTLR3_BOOLEAN (*mismatchIsMissingToken)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM input, pANTLR3_BITSET_LIST follow)โ pointer to a function that decides if the current token is one that can logically follow the one we were looking for โ in which case the one we were looking for is probably just missing from the input.ANTLR3_BOOLEAN (*mismatchIsUnwantedToken)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM input, ANTLR3_UINT32 ttype)โ pointer to a function that decides if the token ahead of the current one is the one we were looking for โ in which case the current one is very likely extraneous and can be reported that way.struct ANTLR3_BASE_RECOGNIZER_struct * recognizerโ pointer to the common routine that handles single token insertion for recovery functions.void (*recover)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function that recovers from an error found in the input stream.void *(*recoverFromMismatchedSet)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_BITSET_LIST follow)โ pointer to a function that recovers from a mismatched set in the token stream, in a similar manner to(*recoverFromMismatchedToken).void *(*recoverFromMismatchedToken)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow)โ pointer to a function that recovers from a mismatched token in the input stream.void (*reportError)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ pointer to a function to call to report a recognition problem.void (*reset)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)โ resets the recognizer. fresh start, clean slate, new me ๐ฆpANTLR3_RECOGNIZER_SHARED_STATE stateโ a pointer to the shared recognizer state, so multiple recognizers can use the same input streams and so on (in the case of grammar inheritance, for instance).void * superโ whatever super structure is providing this interface needs a pointer to itself, so this can be passed back to it whenever the api functions are called back from here.ANTLR3_BOOLEAN (*synpred)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, void *ctx, void (*predicate)(void *ctx))โ pointer to a function that returns whether the supplied grammar function will parse the current input stream or not.pANTLR3_HASH_TABLE (*toStrings)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_HASH_TABLE)โ pointer to a function that converts anANLR3_LISTof tokens to anANTLR3_LISTof string token names.ANTLR3_UINT32 typeโ indicates the type of recognizer that we are an instance of.
๐ Detailed Description ๐
Base tracking context structure for all types of recognizers. that's the whole thing. it's the blueprint, the mothership, the main character ๐
๐ซถ Field Documentation ๐ซถ
๐ alreadyParsedRule ๐
ANTLR3_BOOLEAN (*ANTLR3_BASE_RECOGNIZER_struct::alreadyParsedRule)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_MARKER ruleIndex)
Pointer to a function that determines whether the rule has parsed input at the current index in the input stream.
Referenced by: antlr3BaseRecognizerNew().
๐ beginBacktrack ๐
void (*ANTLR3_BASE_RECOGNIZER_struct::beginBacktrack)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 level)
Pointer to a function that is a hook to listen to token consumption during error recovery. This is mainly used by the debug parser to send events to the listener.
Referenced by: antlr3BaseRecognizerNew().
๐ beginResync ๐
void (*ANTLR3_BASE_RECOGNIZER_struct::beginResync)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that is a hook to listen to token consumption during error recovery. This is mainly used by the debug parser to send events to the listener.
Referenced by:antlr3BaseRecognizerNew(),recover(), andrecoverFromMismatchedToken().
๐ combineFollows ๐
pANTLR3_BITSET (*ANTLR3_BASE_RECOGNIZER_struct::combineFollows)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_BOOLEAN exact)
Pointer to a function to combine follow bitsets.
See also: antlr3CombineFollows() for details.
Referenced by:antlr3BaseRecognizerNew(),computeCSRuleFollow(), andcomputeErrorRecoverySet().
๐ computeCSRuleFollow ๐
pANTLR3_BITSET (*ANTLR3_BASE_RECOGNIZER_struct::computeCSRuleFollow)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that computes the context-sensitive FOLLOW set for the current rule.
See also: antlr3ComputeCSRuleFollow() for details.
Referenced by:antlr3BaseRecognizerNew(),mismatchIsMissingToken(), andrecoverFromMismatchedElement().
๐ computeErrorRecoverySet ๐
pANTLR3_BITSET (*ANTLR3_BASE_RECOGNIZER_struct::computeErrorRecoverySet)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function to compute the error recovery set for the current rule.
See also: antlr3ComputeErrorRecoverySet() for details.
Referenced by:antlr3BaseRecognizerNew(), andrecover().
๐ consumeUntil ๐
void (*ANTLR3_BASE_RECOGNIZER_struct::consumeUntil)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 tokenType)
Pointer to function that consumes input until the next token matches the given token.
Referenced by: antlr3BaseRecognizerNew().
๐ consumeUntilSet ๐
void (*ANTLR3_BASE_RECOGNIZER_struct::consumeUntilSet)(struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_BITSET set)
Pointer to function that consumes input until the next token matches one in the given set.
Referenced by:antlr3BaseRecognizerNew(), andrecover().
okay that's part one bestie, we're not done yet โ more fields are coming in part two, don't go anywhere ๐
๐ธ debugger ๐ธ
type: pANTLR3_DEBUG_EVENT_LISTENER
So if this is set to literally anything other than NULL, it's pointing at an actual instance of the debugger interface. And here's the tea: the debugger is only ever referenced internally, inside recovery/error operations โ that's lowkey on purpose, so nobody pays the overhead of checking this pointer in every single function/method. Efficiency, we love her. ๐
Referenced by antlr3BaseRecognizerNew(), beginBacktrack(), beginResync(), endBacktrack(), endResync(), recoverFromMismatchedToken(), reportError(), and setDebugListener().
๐ displayRecognitionError ๐
void(* ANTLR3_BASE_RECOGNIZER_struct::displayRecognitionError) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_UINT8 *tokenNames)
Pointer to a function that gets called to display a recognition error message. And bestie, you can override this one independently of (*reportError)() up there โ๏ธ โ because reportError calls this one to do the actual exception printing. So the "yikes there's an error" decision and the "here's the error, printed" action are two separate gigs. Very demure, very mindful.
Referenced by antlr3BaseRecognizerNew(), antlr3LexerNew(), reportError(), and reportError().
๐ฆ endBacktrack ๐ฆ
void(* ANTLR3_BASE_RECOGNIZER_struct::endBacktrack) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 level, ANTLR3_BOOLEAN successful)
Pointer to a function that's a lil hook for listening in on token consumption during error recovery. It's mostly the debug parser using this to yeet events over to the listener. ๐ฃ
Referenced by antlr3BaseRecognizerNew().
๐ endResync ๐
void(* ANTLR3_BASE_RECOGNIZER_struct::endResync) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that's a hook for listening to token consumption during error recovery. Same vibe as above โ mostly the debug parser sending events to the listener.
Referenced by antlr3BaseRecognizerNew(), recover(), and recoverFromMismatchedToken().
โจ exConstruct โจ
void(* ANTLR3_BASE_RECOGNIZER_struct::exConstruct) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that can construct a generic exception structure, stuffed with whatever info the input stream is able to hand over. Like a little exception starter kit. ๐งฐ
Referenced by antlr3BaseRecognizerNew(), antlr3ParserNew(), antlr3TreeParserNewStream(), matchc(), matchRange(), matchs(), mismatch(), noViableAlt(), and setCharStream().
๐ follow ๐
struct ANTLR3_BASE_RECOGNIZER_struct pANTLR3_BITSET_LIST
ANTLR3_BASE_RECOGNIZER_struct::follow
That's genuinely the whole thing the docs give us for this one โ no description, no commentary, just the type declaration doing its little dance. We respect it and we move on. ๐
๐ซถ free ๐ซถ
void(* ANTLR3_BASE_RECOGNIZER_struct::free) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that knows how to free the resources of a base recognizer. Cleanup queen, taking out the trash so nothing leaks. ๐งน
Referenced by antlr3BaseRecognizerNew(), antlr3LexerNew(), freeLexer(), freeParser(), and freeParser().
๐ธ getCurrentInputSymbol ๐ธ
void *(* ANTLR3_BASE_RECOGNIZER_struct::getCurrentInputSymbol) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM istream)
Pointer to a function that returns the current input symbol. It gets placed into any label for the associated token ref โ like, x=ID. Token parsers and tree parsers need to hand back different objects, and instead of testing for the input stream type or messing with the IntStream interface, this just asks the recognizer directly: "hey, what's the current input symbol?" Simple, iconic, no drama.
Heads up: this is ignored for lexers, and the lexer's implementation of this function should return NULL. ๐ซ
Referenced by antlr3BaseRecognizerNew(), antlr3LexerNew(), antlr3TreeParserNewStream(), match(), and recoverFromMismatchedToken().
๐ getMissingSymbol ๐
void *(* ANTLR3_BASE_RECOGNIZER_struct::getMissingSymbol) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM istream, pANTLR3_EXCEPTION e, ANTLR3_UINT32 expectedTokenType, pANTLR3_BITSET_LIST follow)
Conjure up a missing token during error recovery. ๐ฎ And no, "conjure" is doing real work here โ the recognizer tries to recover from single missing symbols, but actions might go and reference that missing symbol. Example: x=ID {f($x);}. That action is clearly assuming an identifier was matched before it and that $x points at that token. If the token is missing but the next token in the stream is exactly what we wanted, we assume the token is missing and keep it moving. But because we have to return something to replace the missing token, we have to conjure one up. This method gives the user control over the tokens returned for missing tokens. Mostly you'll want to create something special for identifier tokens. For literals like '{' and ',', the default action in the parser or tree parser just works โ it simply creates a CommonToken of the appropriate type, and the text will be the token. If you change what tokens must be created by the lexer, override this method to create the appropriate tokens.
Referenced by antlr3BaseRecognizerNew(), antlr3LexerNew(), antlr3TreeParserNewStream(), recoverFromMismatchedSet(), and recoverFromMismatchedToken().
๐ฆ getNumberOfSyntaxErrors ๐ฆ
ANTLR3_UINT32(* ANTLR3_BASE_RECOGNIZER_struct::getNumberOfSyntaxErrors) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Get the number of recognition errors (lexer, parser, tree parser). Every recognizer tracks its own number, so the parser and the lexer each keep a separate count. Also, it does not count the spurious errors found between an error and the next valid token match.
See also: reportError()
Referenced by antlr3BaseRecognizerNew().
๐ getRuleInvocationStack ๐
pANTLR3_STACK(* ANTLR3_BASE_RECOGNIZER_struct::getRuleInvocationStack) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that returns an ANTLR3_LIST of the strings identifying the rules in the parser that got you to this point. Can be overridden by installing your own function set.
Todo: Document how to override invocation stack functions. (yes bestie, the docs themselves said it, not me ๐)
Referenced by antlr3BaseRecognizerNew().
โจ getRuleInvocationStackNamed โจ
pANTLR3_STACK(* ANTLR3_BASE_RECOGNIZER_struct::getRuleInvocationStackNamed) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_UINT8 name)
Referenced by antlr3BaseRecognizerNew().
๐ getRuleMemoization ๐
ANTLR3_MARKER(* ANTLR3_BASE_RECOGNIZER_struct::getRuleMemoization) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_INTKEY ruleIndex, ANTLR3_MARKER ruleParseStart)
Pointer to a function that returns whether the rule has parsed input starting at the supplied start index before. If the rule has not parsed input from that start index, it returns ANTLR3_MEMO_RULE_UNKNOWN. If it has parsed from the supplied start point, it returns the point where it last stopped parsing after that start point. Memory queen โ she remembers. ๐ง
Referenced by alreadyParsedRule(), and antlr3BaseRecognizerNew().
๐ซถ match ๐ซถ
void *(* ANTLR3_BASE_RECOGNIZER_struct::match) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow)
Pointer to a function that matches the current input symbol against the supplied type. It causes an error if a match isn't found, and the default implementation will also attempt to do one token insertion or deletion if that's possible with the input stream. You can override the default implementation by installing a pointer to your own function in this interface after the recognizer has initialized โ so you can do different recovery options, or not recover at all, whatever. To ignore recovery altogether, see the comments in the default implementation of this function in antlr3baserecognizer.c.
Note that errors are signalled by setting the error flag below and creating a new exception structure and installing it in the exception pointer below (you can chain these if you like and handle them in some customized way).
Referenced by antlr3BaseRecognizerNew().
๐ธ matchAny ๐ธ
void(* ANTLR3_BASE_RECOGNIZER_struct::matchAny) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that matches the next token/char in the input stream regardless of what it actually is. Zero standards, all vibes. ๐
Referenced by antlr3BaseRecognizerNew().
๐ memoize ๐
void(* ANTLR3_BASE_RECOGNIZER_struct::memoize) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_MARKER ruleIndex, ANTLR3_MARKER ruleParseStart)
Pointer to a function that records whether the rule has parsed the input at the current position successfully or not. Receipts. ๐
Referenced by antlr3BaseRecognizerNew().
๐ฆ mismatch ๐ฆ
void(* ANTLR3_BASE_RECOGNIZER_struct::mismatch) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow)
Pointer to a function that works out what to do when a token mismatch happens, so that Tree parsers can behave differently from other recognizers.
Referenced by antlr3BaseRecognizerNew(), and antlr3TreeParserNewStream().
๐ mismatchIsMissingToken ๐
ANTLR3_BOOLEAN(* ANTLR3_BASE_RECOGNIZER_struct::mismatchIsMissingToken) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM input, pANTLR3_BITSET_LIST follow)
Pointer to a function that decides if the current token is one that can logically follow the one we were looking for โ in which case the one we were looking for is probably missing from the input. Detective work, honestly. ๐
Referenced by antlr3BaseRecognizerNew(), and recoverFromMismatchedSet().
โจ mismatchIsUnwantedToken โจ
ANTLR3_BOOLEAN(* ANTLR3_BASE_RECOGNIZER_struct::mismatchIsUnwantedToken) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_INT_STREAM input, ANTLR3_UINT32 ttype)
Pointer to a function that decides if the token sitting ahead of the current one is the one we were looking for โ in which case the current one is very likely just extraneous and can be reported that way. Not me being the unwanted token ๐ญ
Referenced by antlr3BaseRecognizerNew(), and recoverFromMismatchedToken().
๐ recognizer ๐
type: struct ANTLR3_BASE_RECOGNIZER_struct*
Pointer to a common routine that handles single token insertion for the recovery functions.
๐ซถ recover ๐ซถ
void(* ANTLR3_BASE_RECOGNIZER_struct::recover) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function that recovers from an error found in the input stream. Generally this is going to be a #ANTLR3_EXCEPTION_NOVIABLE_ALT, but it could also come from a mismatched token that (*match)() couldn't recover from.
Referenced by antlr3BaseRecognizerNew().
๐ธ recoverFromMismatchedSet ๐ธ
void *(* ANTLR3_BASE_RECOGNIZER_struct::recoverFromMismatchedSet) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_BITSET_LIST follow)
Pointer to a function that recovers from a mismatched set in the token stream, in a similar manner to (*recoverFromMismatchedToken).
Referenced by antlr3BaseRecognizerNew().
๐ recoverFromMismatchedToken ๐
void *(* ANTLR3_BASE_RECOGNIZER_struct::recoverFromMismatchedToken) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, ANTLR3_UINT32 ttype, pANTLR3_BITSET_LIST follow)
Pointer to a function that recovers from a mismatched token in the input stream.
See also: antlr3RecoverMismatch() for details.
Referenced by antlr3BaseRecognizerNew(), match(), and mismatch().
๐ฆ reportError ๐ฆ
void(* ANTLR3_BASE_RECOGNIZER_struct::reportError) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Pointer to a function you call to report a recognition problem. You may override this with your own function, but go read the standard implementation in antlr3baserecognizer.c for guidance first, bestie. The function should recognize whether error recovery is in force, so that it doesn't print out more than one error message for the same error. From the java comments in BaseRecognizer.java:
okay so this method sets errorRecovery to flag that the parser is recovering, not parsing. Once you're in recovery mode, no errors are generated โ like, the error faucet is OFF, zero drama reported ๐ฑ. To get back out of recovery mode, the parser has to successfully match a token (after a resync). So the whole lil journey goes:
- error occurs ๐ญ
- enter recovery mode, report error ๐ข
- consume until token found in resynch set ๐ฝ๏ธ
- try to resume parsing ๐ซถ
- next
match()will reseterrorRecoverymode โจ
Referenced by: antlr3BaseRecognizerNew(), antlr3LexerNew(), nextTokenStr(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), and recoverFromMismatchedToken().
๐ reset ๐
void(* ANTLR3_BASE_RECOGNIZER_struct::reset) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer)
Reset the recognizer. That's literally the entire job description bestie, it hits the reset button ๐.
Referenced by: antlr3BaseRecognizerNew(), antlr3LexerNew(), setTokenStream(), and setTreeNodeStream().
๐ฆ state ๐ฆ
pANTLR3_RECOGNIZER_SHARED_STATE ANTLR3_BASE_RECOGNIZER_struct::state
A pointer to the shared recognizer state, so that multiple recognizers can all use the same input streams and so on (this is the grammar-inheritance situation, for instance.
Referenced by: alreadyParsedRule(), antlr3BaseRecognizerNew(), antlr3dfapredict(), antlr3LexerNew(), antlr3MTExceptionNew(), antlr3MTNExceptionNew(), antlr3RecognitionExceptionNew(), antlr3RewriteRuleElementStreamNewAE(), combineFollows(), displayRecognitionError(), displayRecognitionError(), emit(), emitNew(), freeBR(), freeLexer(), freeNodeRS(), freeParser(), freeParser(), freeRS(), getMissingSymbol(), getMissingSymbol(), getNumberOfSyntaxErrors(), getRuleMemoization(), getText(), match(), matchAny(), matchc(), matchRange(), matchs(), memoize(), mismatch(), mismatchIsUnwantedToken(), nextToken(), nextTokenStr(), noViableAlt(), popCharStream(), pushCharStream(), recover(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), recoverFromMismatchedToken(), reportError(), reportError(), reset(), reset(), setCharStream(), and synpred().
๐ super ๐
void* ANTLR3_BASE_RECOGNIZER_struct::super
Whatever super structure is out here providing this interface needs a pointer to itself, so that this can get passed back to it every single time the api functions get called back from here. It's giving self-referential main character energy, and honestly? Respect ๐ .
Referenced by: alreadyParsedRule(), antlr3LexerNew(), antlr3ParserNew(), antlr3RecognitionExceptionNew(), antlr3TreeParserNewStream(), consumeUntil(), consumeUntilSet(), displayRecognitionError(), displayRecognitionError(), match(), matchAny(), memoize(), mismatch(), recover(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), recoverFromMismatchedToken(), reset(), and synpred().
โญ synpred โญ
ANTLR3_BOOLEAN(* ANTLR3_BASE_RECOGNIZER_struct::synpred) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, void *ctx, void(*predicate)(void *ctx))
A pointer to a function that returns whether the supplied grammar function will parse the current input stream or not. This is the way syntactic predicates get evaluated. Unlike java, C is perfectly happy to invoke code via a pointer to a function (hence that's what all the ANTLR3 C interfaces do.
Referenced by: antlr3BaseRecognizerNew().
๐ toStrings ๐
pANTLR3_HASH_TABLE(* ANTLR3_BASE_RECOGNIZER_struct::toStrings) (struct ANTLR3_BASE_RECOGNIZER_struct *recognizer, pANTLR3_HASH_TABLE)
A pointer to a function that converts an ANLR3_LIST of tokens into an ANTLR3_LIST of string token names. Since this is mostly used in string template processing, it may not be useful in the C runtime ๐.
Referenced by: antlr3BaseRecognizerNew().
๐ type ๐
ANTLR3_UINT32 ANTLR3_BASE_RECOGNIZER_struct::type
Indicates the type of recognizer that we are an instance of. The programmer may set this to anything of course, but the default implementations of the interface only really understand the built in types, so new error handlers etc would probably be required to as well. No cap, that's just how it is.
Valid types are:
ANTLR3_TYPE_LEXERANTLR3_TYPE_PARSERANTLR3_TYPE_TREE_PARSER
Referenced by: alreadyParsedRule(), antlr3BaseRecognizerNew(), antlr3RecognitionExceptionNew(), antlr3TreeParserNewStream(), consumeUntil(), consumeUntilSet(), displayRecognitionError(), match(), matchAny(), memoize(), mismatch(), recover(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), recoverFromMismatchedToken(), and synpred().
โ๏ธ Author โ๏ธ
Generated automatically by Doxygen for ANTLR3C from the source code. Like, it wrote itself, slay ๐คโจ
and that's a wrap on the whole page, bestie!! ๐ซถ This one's Version 3.3.1, dated Tue Jul 29 2025 โ go forth and recognise some tokens, you absolute icon ๐๐ธ๐ฆ
๐ฆ 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