#include <antlr3recognizersharedstate.h>
May be share between multiple recognizers such that grammar inheritance is easily supported.
Data Fields | |
ANTLR3_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. |
If 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().
Referenced by emit(), and nextTokenStr().
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).
Referenced by antlr3dfapredict(), antlr3RecognitionExceptionNew(), nextTokenStr(), recover(), recoverFromMismatchedElement(), recoverFromMismatchedSet(), and recoverFromMismatchedToken().
When 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().
This 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().
Points 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(), and reportError().
In 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().
Track the set of token types that can follow any rule invocation.
Stack structure, to support: List<BitSet>.
Referenced by antlr3BaseRecognizerNew(), combineFollows(), freeParser(), mismatchIsMissingToken(), and reset().
The 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().
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.
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().
ANTLR3_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().
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.
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().
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.
Referenced by freeLexer(), nextToken(), popCharStream(), and pushCharStream().
Text 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().
The 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().
Pointer 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().
What 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().
The character position of the first character of the current token within the line specified by tokenStartLine.
Referenced by displayRecognitionError(), emit(), nextTokenStr(), and reset().
The input line (where it makes sense) on which the first character of the current token resides.
Referenced by displayRecognitionError(), emit(), nextTokenStr(), and reset().
The 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().
A 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().
User controlled variables that will be installed in a newly created token.
Referenced by emit(), and nextTokenStr().
Referenced by emit(), and nextTokenStr().
Referenced by emit(), and nextTokenStr().
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.