Class ParserRuleReturnSnapshot
Captures rollback-safe return values for one active parser rule invocation frame.
public sealed class ParserRuleReturnSnapshot : IParserExecutionStateHashable
- Inheritance
-
ParserRuleReturnSnapshot
- Implements
- Inherited Members
- Extension Methods
Constructors
ParserRuleReturnSnapshot(string, int, int, IReadOnlyDictionary<string, object?>)
Initializes a new active-rule return snapshot.
public ParserRuleReturnSnapshot(string ruleName, int inputPosition, int depth, IReadOnlyDictionary<string, object?> returns)
Parameters
ruleNamestringName of the parser rule whose frame was captured.
inputPositionintToken-stream position at the time of rule entry.
depthintCall-stack depth of the captured frame.
returnsIReadOnlyDictionary<string, object>Return values present on the captured frame.
Properties
Depth
Gets the zero-based call-stack depth of the captured frame.
public int Depth { get; }
Property Value
InputPosition
Gets the token-stream position at the time of captured rule entry.
public int InputPosition { get; }
Property Value
Returns
Gets the immutable return values captured from the frame.
public IReadOnlyDictionary<string, object?> Returns { get; }
Property Value
RuleName
Gets the parser rule name for the captured invocation frame.
public string RuleName { get; }
Property Value
Methods
GetParserExecutionStateHash()
Computes a managed-state hash using the completed-call result hashing policy, including volatile markers for arbitrary unsupported return objects.
public ulong GetParserExecutionStateHash()
Returns
- ulong
The parser execution-state hash.
Matches(ParserRuleInvocationFrame)
Returns whether this snapshot belongs to frame.
public bool Matches(ParserRuleInvocationFrame frame)
Parameters
frameParserRuleInvocationFrameFrame to compare against this snapshot identity.
Returns
- bool
truewhen rule name, input position, and depth match.