Table of Contents

Interface IParserRuleInvocationFrameManager

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

Manages passive parser rule invocation frames for optional runtime policies. Implementations may observe rule entry and exit, but they must not own parser control flow.

public interface IParserRuleInvocationFrameManager
Extension Methods

Properties

Current

Gets the current invocation frame when the implementation tracks one.

ParserRuleInvocationFrame? Current { get; }

Property Value

ParserRuleInvocationFrame

Methods

AnnotateLastChildCallLabel(string?, ParserRuleReferenceLabelKind)

Called by ParserEngine after a direct child parser-rule call completes successfully to annotate the current frame's last completed child call result with label metadata from the call site. This ensures parent-visible label metadata reflects the current call site rather than any stale snapshot. The default implementation performs no action.

void AnnotateLastChildCallLabel(string? labelName, ParserRuleReferenceLabelKind labelKind)

Parameters

labelName string

Label name from the current RuleRef.LabelName, or null when the call site carries no label. Metadata only: no implicit variable or automatic binding.

labelKind ParserRuleReferenceLabelKind

Label kind from the current RuleRef.LabelKind.

AnnotateLastChildCallRawArguments(string?)

Called by ParserEngine after a direct child parser-rule call completes successfully (whether from a fresh parse or a memoized hit) to annotate the current frame's last completed child call result with the raw argument text from the call site. This ensures that the parent-visible call result carries the current call site's callee[...] metadata rather than stale metadata from a memoized execution-state snapshot. The default implementation performs no action.

void AnnotateLastChildCallRawArguments(string? rawArguments)

Parameters

rawArguments string

Raw call-site argument text from the current RuleRef.RawArguments, or null when the call site carries no argument clause. Not evaluated, not bound to child parameters.

Enter(string, int, ParserRuleInvocationDescriptor?)

Enters a parser rule invocation and creates the passive invocation frame for that attempt.

ParserRuleInvocationFrame Enter(string ruleName, int inputPosition, ParserRuleInvocationDescriptor? descriptor = null)

Parameters

ruleName string

Name of the parser rule being entered.

inputPosition int

Token-stream position at the time of rule entry.

descriptor ParserRuleInvocationDescriptor

Passive rule metadata descriptor for the invocation, when available.

Returns

ParserRuleInvocationFrame

The invocation frame associated with this parser rule attempt.

Exit(ParserRuleInvocationFrame, bool)

Leaves a parser rule invocation that was previously entered.

void Exit(ParserRuleInvocationFrame frame, bool succeeded)

Parameters

frame ParserRuleInvocationFrame

Invocation frame returned by Enter(string, int, ParserRuleInvocationDescriptor?).

succeeded bool

Whether the parser rule produced a parse node before leaving.

PrepareCallResultForSnapshot(ParserRuleInvocationFrame, bool)

Called by ParserEngine just before the post-rule execution-state snapshot is captured, while the rule's invocation frame is still current. Implementations that support call results must finalize them here so that the snapshot reflects the post-rule call-result state and memoization hits can restore it correctly. The default implementation performs no action.

void PrepareCallResultForSnapshot(ParserRuleInvocationFrame frame, bool succeeded)

Parameters

frame ParserRuleInvocationFrame

The current invocation frame about to be snapshotted.

succeeded bool

Whether the parser rule produced a parse node.

TryBindLastCompletedChildCallToCurrentLabel()

Binds the current frame's final completed child call result into its current call-site label store. The default implementation reports that no active managed frame retained the result.

bool TryBindLastCompletedChildCallToCurrentLabel()

Returns

bool

true when a labeled assignment or list result was retained; otherwise, false.

TrySetPendingChildParameters(string, IReadOnlyDictionary<string, object?>)

Attempts to atomically merge rollback-managed parameter seeds for the next invocation of the named child rule. Implementations must retain either every supplied seed or none of them. The default implementation reports that managed seeding is unavailable.

bool TrySetPendingChildParameters(string ruleName, IReadOnlyDictionary<string, object?> values)

Parameters

ruleName string

Target child parser rule name.

values IReadOnlyDictionary<string, object>

Declared target parameter names and their untyped seed values.

Returns

bool

true when every seed was retained atomically; otherwise, false.