Table of Contents

Class ParserRuleReturnSnapshot

Namespace
Utils.Parser.Runtime
Assembly
Utils.Parser.dll

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

ruleName string

Name of the parser rule whose frame was captured.

inputPosition int

Token-stream position at the time of rule entry.

depth int

Call-stack depth of the captured frame.

returns IReadOnlyDictionary<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

int

InputPosition

Gets the token-stream position at the time of captured rule entry.

public int InputPosition { get; }

Property Value

int

Returns

Gets the immutable return values captured from the frame.

public IReadOnlyDictionary<string, object?> Returns { get; }

Property Value

IReadOnlyDictionary<string, object>

RuleName

Gets the parser rule name for the captured invocation frame.

public string RuleName { get; }

Property Value

string

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

frame ParserRuleInvocationFrame

Frame to compare against this snapshot identity.

Returns

bool

true when rule name, input position, and depth match.