Click or drag to resize

RecognizerSharedState Class

The set of fields needed by an abstract recognizer to recognize input and recover from errors etc... As a separate state object, it can be shared among multiple grammars; e.g., when one grammar imports another.
Inheritance Hierarchy
SystemObject
  Stimulsoft.Data.Expressions.Antlr.RuntimeRecognizerSharedState

Namespace:  Stimulsoft.Data.Expressions.Antlr.Runtime
Assembly:  Stimulsoft.Data (in Stimulsoft.Data.dll) Version: 2019.3.1.0
Syntax
public class RecognizerSharedState

The RecognizerSharedState type exposes the following members.

Constructors
  NameDescription
Public methodRecognizerSharedState
Initializes a new instance of the RecognizerSharedState class
Public methodRecognizerSharedState(RecognizerSharedState)
Initializes a new instance of the RecognizerSharedState class
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Public field_fsp
Public fieldbacktracking
If 0, no backtracking is going on. Safe to exec actions etc... If >0 then it's the level of backtracking.
Public fieldchannel
The channel number for the current token
Public fielderrorRecovery
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.
Public fieldfailed
In lieu of a return value, this indicates that a rule or token has failed to match. Reset to false upon valid token match.
Public fieldfollowing
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.
Public fieldlastErrorIndex
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.
Public fieldruleMemo
An array[size num rules] of dictionaries 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.
Public fieldsyntaxErrors
Did the recognizer encounter a syntax error? Track how many.
Public fieldtext
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.
Public fieldtoken
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.
Public fieldtokenStartCharIndex
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.
Public fieldtokenStartCharPositionInLine
The character position of first character within the line
Public fieldtokenStartLine
The line on which the first character of the token resides
Public fieldtype
The token type for the current token
Top
Remarks
These fields are publically visible but the actual state pointer per parser is protected.
See Also