Interface IParserRuleInvocationFrameManager
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
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
labelNamestringLabel name from the current
RuleRef.LabelName, ornullwhen the call site carries no label. Metadata only: no implicit variable or automatic binding.labelKindParserRuleReferenceLabelKindLabel 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
rawArgumentsstringRaw call-site argument text from the current
RuleRef.RawArguments, ornullwhen 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
ruleNamestringName of the parser rule being entered.
inputPositionintToken-stream position at the time of rule entry.
descriptorParserRuleInvocationDescriptorPassive 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
frameParserRuleInvocationFrameInvocation frame returned by Enter(string, int, ParserRuleInvocationDescriptor?).
succeededboolWhether 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
frameParserRuleInvocationFrameThe current invocation frame about to be snapshotted.
succeededboolWhether 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
truewhen 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
ruleNamestringTarget child parser rule name.
valuesIReadOnlyDictionary<string, object>Declared target parameter names and their untyped seed values.
Returns
- bool
truewhen every seed was retained atomically; otherwise,false.