Package | org.antlr.runtime |
Class | public class RecognizerSharedState |
Property | Defined by | ||
---|---|---|---|
backtracking : int = 0 If 0, no backtracking is going on.
| RecognizerSharedState | ||
channel : int The channel number for the current token
| RecognizerSharedState | ||
errorRecovery : Boolean = false This is true when we see an error and before having successfully
matched a token.
| RecognizerSharedState | ||
failed : Boolean = false In lieu of a return value, this indicates that a rule or token
has failed to match.
| RecognizerSharedState | ||
following : Array Track the set of token types that can follow any rule invocation.
| RecognizerSharedState | ||
_fsp : int = -1 | RecognizerSharedState | ||
lastErrorIndex : int = -1 The index into the input stream where the last error occurred.
| RecognizerSharedState | ||
ruleMemo : Array An Array[size num rules] of Arrays that tracks
the stop token index for each rule.
| RecognizerSharedState | ||
syntaxErrors : int = 0 Did the recognizer encounter a syntax error? Track how many.
| RecognizerSharedState | ||
text : String You can set the text for the current token to override what is in
the input char buffer.
| RecognizerSharedState | ||
token : Token
The goal of all lexer rules/methods is to create a token object.
| RecognizerSharedState | ||
tokenStartCharIndex : int = -1 What character index in the stream did the current token start at?
Needed, for example, to get the text for current token.
| RecognizerSharedState | ||
tokenStartCharPositionInLine : int The character position of first character within the line
| RecognizerSharedState | ||
tokenStartLine : int The line on which the first character of the token resides
| RecognizerSharedState | ||
type : int The token type for the current token
| RecognizerSharedState |
backtracking | property |
public var backtracking:int = 0
If 0, no backtracking is going on. Safe to exec actions etc... If >0 then it's the level of backtracking.
channel | property |
public var channel:int
The channel number for the current token
errorRecovery | property |
public var errorRecovery:Boolean = false
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.
failed | property |
public var failed:Boolean = false
In lieu of a return value, this indicates that a rule or token has failed to match. Reset to false upon valid token match.
following | property |
public var following:Array
Track the set of token types that can follow any rule invocation. Stack grows upwards. When it hits the max, it grows 2x in size and keeps going.
_fsp | property |
public var _fsp:int = -1
lastErrorIndex | property |
public var lastErrorIndex:int = -1
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 naseum. This is a failsafe mechanism to guarantee that at least one token/tree node is consumed for two errors.
ruleMemo | property |
public var ruleMemo:Array
An Array[size num rules] of Arrays that 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 (which it is by default).
syntaxErrors | property |
public var syntaxErrors:int = 0
Did the recognizer encounter a syntax error? Track how many.
text | property |
public var text:String
You can set the text for the current token to override what is in the input char buffer. Use setText() or can set this instance var.
token | property |
public var token:Token
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. nextToken will return this object after matching lexer rule(s). If you subclass to allow multiple token emissions, then set this to the last token to be matched or something nonnull so that the auto token emit mechanism will not emit another token.
tokenStartCharIndex | property |
public var tokenStartCharIndex:int = -1
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.
tokenStartCharPositionInLine | property |
public var tokenStartCharPositionInLine:int
The character position of first character within the line
tokenStartLine | property |
public var tokenStartLine:int
The line on which the first character of the token resides
type | property |
public var type:int
The token type for the current token