ANTLR3_RECOGNIZER_SHARED_STATE_struct - Online Linux Manual PageSection : 3
Updated : Tue Jan 26 2021
Source : Version 3.3.1
Note : ANTLR3C

NAMEANTLR3_RECOGNIZER_SHARED_STATE_struct − All the data elements required to track the current state of any recognizer (lexer, parser, tree parser)​.

SYNOPSIS
#include <antlr3recognizersharedstate​.h>

Data FieldsANTLR3_INT32 backtracking
If 0, no backtracking is going on​.
ANTLR3_UINT32 channel
The channel number for the current token​.
void * custom
ANTLR3_BOOLEAN error
If set to ANTLR3_TRUE then the recognizer has an exception condition (this is tested by the generated code for the rules of the grammar)​.
ANTLR3_UINT32 errorCount
When the recognizer terminates, the error handling functions will have incremented this value if any error occurred (that was displayed)​.
ANTLR3_BOOLEAN errorRecovery
This is true when we see an error and before having successfully matched a token​.
pANTLR3_EXCEPTION exception
Points to the first in a possible chain of exceptions that the recognizer has discovered​.
ANTLR3_BOOLEAN failed
In lieu of a return value, this indicates that a rule or token has failed to match​.
pANTLR3_STACK following
Track the set of token types that can follow any rule invocation​.
ANTLR3_MARKER lastErrorIndex
The index into the input stream where the last error occurred​.
pANTLR3_VECTOR rStreams
A stack of token/tree rewrite streams that are available for use by a parser or tree parser that is using rewrites to generate an AST​.
pANTLR3_INT_TRIE ruleMemo
ANTLR3_VECTOR of ANTLR3_LIST for rule memoizing​.
ANTLR3_UINT32 sizeHint
Track around a hint from the creator of the recognizer as to how big this thing is going to get, as the actress said to the bishop​.
pANTLR3_STACK streams
Input stream stack, which allows the C programmer to switch input streams easily and allow the standard nextToken() implementation to deal with it as this is a common requirement​.
pANTLR3_STRING text
Text for the current token​.
pANTLR3_COMMON_TOKEN token
The goal of all lexer rules/methods is to create a token object​.
pANTLR3_UINT8 * tokenNames
Pointer to an array of token names that are generally useful in error reporting​.
ANTLR3_MARKER tokenStartCharIndex
What character index in the stream did the current token start at? Needed, for example, to get the text for current token​.
ANTLR3_INT32 tokenStartCharPositionInLine
The character position of the first character of the current token within the line specified by tokenStartLine​.
ANTLR3_INT32 tokenStartLine
The input line (where it makes sense) on which the first character of the current token resides​.
pANTLR3_TOKEN_FACTORY tokFactory
The goal of all lexer rules being to create a token, then a lexer needs to build a token factory to create them​.
pANTLR3_TOKEN_SOURCE tokSource
A lexer is a source of tokens, produced by all the generated (or hand crafted if you like) matching rules​.
ANTLR3_UINT32 type
The token type for the current token​.
ANTLR3_UINT32 user1
User controlled variables that will be installed in a newly created token​.
ANTLR3_UINT32 user2
ANTLR3_UINT32 user3
void * userp
User programmable pointer that can be used for instance as a place to store some tracking structure specific to the grammar that would not normally be available to the error handling functions​.

Detailed DescriptionAll the data elements required to track the current state of any recognizer (lexer, parser, tree parser)​. May be share between multiple recognizers such that grammar inheritance is easily supported​.

Field Documentation

ANTLR3_INT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::backtrackingIf 0, no backtracking is going on​. Safe to exec actions etc​.​.​. If >0 then it's the level of backtracking​. Referenced by antlr3BaseRecognizerNew(), match(), matchc(), matchRange(), matchs(), noViableAlt(), reset(), and synpred()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::channelThe channel number for the current token​. Referenced by emit(), nextTokenStr(), and reset()​.

void* ANTLR3_RECOGNIZER_SHARED_STATE_struct::customReferenced by emit(), and nextTokenStr()​.

ANTLR3_BOOLEAN ANTLR3_RECOGNIZER_SHARED_STATE_struct::errorIf set to ANTLR3_TRUE then the recognizer has an exception condition (this is tested by the generated code for the rules of the grammar)​. Referenced by antlr3dfapredict(), antlr3RecognitionExceptionNew(), nextTokenStr(), recover(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), and recoverFromMismatchedToken()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::errorCountWhen the recognizer terminates, the error handling functions will have incremented this value if any error occurred (that was displayed)​. It can then be used by the grammar programmer without having to use static globals​. Referenced by antlr3BaseRecognizerNew(), getNumberOfSyntaxErrors(), reportError(), and reset()​.

ANTLR3_BOOLEAN ANTLR3_RECOGNIZER_SHARED_STATE_struct::errorRecoveryThis is true when we see an error and before having successfully matched a token​. Prevents generation of more than one error message per error​. Referenced by antlr3BaseRecognizerNew(), match(), matchAny(), reportError(), and reset()​.

pANTLR3_EXCEPTION ANTLR3_RECOGNIZER_SHARED_STATE_struct::exceptionPoints to the first in a possible chain of exceptions that the recognizer has discovered​. Referenced by antlr3MTExceptionNew(), antlr3MTNExceptionNew(), antlr3RecognitionExceptionNew(), displayRecognitionError(), freeBR(), mismatch(), mismatchIsUnwantedToken(), noViableAlt(), recoverFromMismatchedSet(), recoverFromMismatchedToken(), reportError(), and reset()​.

ANTLR3_BOOLEAN ANTLR3_RECOGNIZER_SHARED_STATE_struct::failedIn lieu of a return value, this indicates that a rule or token has failed to match​. Reset to false upon valid token match​. Referenced by alreadyParsedRule(), antlr3BaseRecognizerNew(), match(), matchAny(), matchc(), matchRange(), matchs(), memoize(), nextTokenStr(), noViableAlt(), recover(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), reset(), and synpred()​.

pANTLR3_STACK ANTLR3_RECOGNIZER_SHARED_STATE_struct::followingTrack the set of token types that can follow any rule invocation​. Stack structure, to support: List<BitSet>​. Referenced by antlr3BaseRecognizerNew(), combineFollows(), freeParser(), and reset()​.

ANTLR3_MARKER ANTLR3_RECOGNIZER_SHARED_STATE_struct::lastErrorIndexThe index into the input stream where the last error occurred​. This is used to prevent infinite loops where an error is found but no token is consumed during recovery​.​.​.another error is found, ad nauseam​. This is a failsafe mechanism to guarantee that at least one token/tree node is consumed for two errors​. Referenced by antlr3BaseRecognizerNew(), recover(), and reset()​.

pANTLR3_VECTOR ANTLR3_RECOGNIZER_SHARED_STATE_struct::rStreamsA stack of token/tree rewrite streams that are available for use by a parser or tree parser that is using rewrites to generate an AST​. This saves each rule in the recongizer from having to allocate and deallocate rewtire streams on entry and exit​. As the parser recurses throgh the rules it will reach a steady state of the maximum number of allocated streams, which instead of deallocating them at rule exit, it will place on this stack for reuse​. The streams are then all finally freed when this stack is freed​. Referenced by antlr3BaseRecognizerNew(), antlr3RewriteRuleElementStreamNewAE(), freeBR(), freeNodeRS(), and freeRS()​.

pANTLR3_INT_TRIE ANTLR3_RECOGNIZER_SHARED_STATE_struct::ruleMemoANTLR3_VECTOR of ANTLR3_LIST for rule memoizing​. Tracks the stop token index for each rule​. ruleMemo[ruleIndex] is the memoization table for ruleIndex​. For key ruleStartIndex, you get back the stop token for associated rule or MEMO_RULE_FAILED​. This is only used if rule memoization is on​. Referenced by antlr3BaseRecognizerNew(), freeBR(), getRuleMemoization(), memoize(), and reset()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::sizeHintTrack around a hint from the creator of the recognizer as to how big this thing is going to get, as the actress said to the bishop​. This allows us to tune hash tables accordingly​. This might not be the best place for this in the end but we will see​. Referenced by antlr3BaseRecognizerNew()​.

pANTLR3_STACK ANTLR3_RECOGNIZER_SHARED_STATE_struct::streamsInput stream stack, which allows the C programmer to switch input streams easily and allow the standard nextToken() implementation to deal with it as this is a common requirement​. Referenced by freeLexer(), nextToken(), popCharStream(), and pushCharStream()​.

pANTLR3_STRING ANTLR3_RECOGNIZER_SHARED_STATE_struct::textText for the current token​. This can be overridden by setting this variable directly or by using the SETTEXT() macro (preferred) in your lexer rules​. Referenced by emit(), getText(), nextTokenStr(), reset(), and setCharStream()​.

pANTLR3_COMMON_TOKEN ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokenThe goal of all lexer rules/methods is to create a token object​. This is an instance variable as multiple rules may collaborate to create a single token​. For example, NUM : INT | FLOAT ; In this case, you want the INT or FLOAT rule to set token and not have it reset to a NUM token in rule NUM​. Referenced by emit(), emitNew(), nextTokenStr(), reset(), and setCharStream()​.

pANTLR3_UINT8* ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokenNamesPointer to an array of token names that are generally useful in error reporting​. The generated parsers install this pointer​. The table it points to is statically allocated as 8 bit ascii at parser compile time - grammar token names are thus restricted in character sets, which does not seem to terrible​. Referenced by antlr3BaseRecognizerNew(), getMissingSymbol(), and reportError()​.

ANTLR3_MARKER ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokenStartCharIndexWhat character index in the stream did the current token start at? Needed, for example, to get the text for current token​. Set at the start of nextToken​. Referenced by displayRecognitionError(), emit(), getText(), nextTokenStr(), reset(), and setCharStream()​.

ANTLR3_INT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokenStartCharPositionInLineThe character position of the first character of the current token within the line specified by tokenStartLine​. Referenced by displayRecognitionError(), emit(), nextTokenStr(), and reset()​.

ANTLR3_INT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokenStartLineThe input line (where it makes sense) on which the first character of the current token resides​. Referenced by displayRecognitionError(), emit(), nextTokenStr(), and reset()​.

pANTLR3_TOKEN_FACTORY ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokFactoryThe goal of all lexer rules being to create a token, then a lexer needs to build a token factory to create them​. Referenced by antlr3BaseRecognizerNew(), antlr3LexerNew(), emit(), freeBR(), freeLexer(), getMissingSymbol(), reset(), and setCharStream()​.

pANTLR3_TOKEN_SOURCE ANTLR3_RECOGNIZER_SHARED_STATE_struct::tokSourceA lexer is a source of tokens, produced by all the generated (or hand crafted if you like) matching rules​. As such it needs to provide a token source interface implementation​. Referenced by antlr3BaseRecognizerNew(), antlr3LexerNew(), freeLexer(), and setCharStream()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::typeThe token type for the current token​. Referenced by emit(), and reset()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::user1User controlled variables that will be installed in a newly created token​. Referenced by emit(), and nextTokenStr()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::user2Referenced by emit(), and nextTokenStr()​.

ANTLR3_UINT32 ANTLR3_RECOGNIZER_SHARED_STATE_struct::user3Referenced by emit(), and nextTokenStr()​.

void* ANTLR3_RECOGNIZER_SHARED_STATE_struct::userpUser programmable pointer that can be used for instance as a place to store some tracking structure specific to the grammar that would not normally be available to the error handling functions​.

AuthorGenerated automatically by Doxygen for ANTLR3C from the source code​.
0
Johanes Gumabo
Data Size   :   45,056 byte
man-antlr3-ruleMemo.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 236,202
Visitor ID   :     :  
Visitor IP   :   18.223.159.143   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.