Class ParserRuleInvocationFrame
Represents passive per-invocation parser rule metadata state. Parameters, locals, returns, and labeled completed child calls remain untyped managed metadata; the frame does not bind ANTLR type syntax or expose implicit grammar variables.
public sealed class ParserRuleInvocationFrame
- Inheritance
-
ParserRuleInvocationFrame
- Inherited Members
- Extension Methods
Constructors
ParserRuleInvocationFrame(string, int)
Initializes an empty parser rule invocation frame.
public ParserRuleInvocationFrame(string ruleName, int inputPosition)
Parameters
ruleNamestringName of the parser rule being invoked.
inputPositionintToken-stream position at the time of rule entry.
ParserRuleInvocationFrame(string, int, IReadOnlyDictionary<string, object?>)
Initializes a parser rule invocation frame with passive parameter values.
public ParserRuleInvocationFrame(string ruleName, int inputPosition, IReadOnlyDictionary<string, object?> parameters)
Parameters
ruleNamestringName of the parser rule being invoked.
inputPositionintToken-stream position at the time of rule entry.
parametersIReadOnlyDictionary<string, object>Passive parameter values to expose through the frame.
ParserRuleInvocationFrame(string, int, IReadOnlyDictionary<string, object?>, ParserRuleInvocationDescriptor?)
Initializes a parser rule invocation frame with passive parameter values and rule metadata.
public ParserRuleInvocationFrame(string ruleName, int inputPosition, IReadOnlyDictionary<string, object?> parameters, ParserRuleInvocationDescriptor? descriptor)
Parameters
ruleNamestringName of the parser rule being invoked.
inputPositionintToken-stream position at the time of rule entry.
parametersIReadOnlyDictionary<string, object>Passive parameter values to expose through the frame.
descriptorParserRuleInvocationDescriptorPassive rule metadata descriptor to expose through the frame.
ParserRuleInvocationFrame(string, int, IReadOnlyDictionary<string, object?>, ParserRuleInvocationDescriptor?, ParserRuleInvocationFrame?)
Initializes a parser rule invocation frame with passive parameter values, rule metadata, and a parent frame.
public ParserRuleInvocationFrame(string ruleName, int inputPosition, IReadOnlyDictionary<string, object?> parameters, ParserRuleInvocationDescriptor? descriptor, ParserRuleInvocationFrame? parent)
Parameters
ruleNamestringName of the parser rule being invoked.
inputPositionintToken-stream position at the time of rule entry.
parametersIReadOnlyDictionary<string, object>Passive parameter values to expose through the frame.
descriptorParserRuleInvocationDescriptorPassive rule metadata descriptor to expose through the frame.
parentParserRuleInvocationFrameParent invocation frame in the current call stack, or
nullfor root-level rules.
Properties
Depth
Gets the zero-based call-stack depth of this invocation frame. Root-level rule frames have depth 0; each nested rule invocation increments the depth by 1.
public int Depth { get; }
Property Value
Descriptor
Gets passive rule-level metadata associated with this invocation frame, when supplied by the runtime.
public ParserRuleInvocationDescriptor? Descriptor { get; }
Property Value
InputPosition
Gets the token-stream position at the time of rule entry.
public int InputPosition { get; }
Property Value
LabeledCallResults
Gets the immutable assignment and list label results produced by successful direct child calls in this frame. Store replacement is synchronized with managed execution-state snapshots so failed parser attempts roll back changes.
public ParserLabeledRuleCallResultStore LabeledCallResults { get; }
Property Value
LastCompletedChildCall
Gets the call result from the most recently completed successful direct child rule invocation,
or null when no child rule has yet completed successfully in the current rule context.
This value is set by the invocation-frame manager on successful child exit and is synchronized
with the managed execution-state snapshot during parser backtracking restoration.
It must not be stored in static or global fields; its rollback safety relies on the
managed execution-state snapshot mechanism being active.
public ParserRuleCallResult? LastCompletedChildCall { get; }
Property Value
Locals
Gets passive local values associated with this invocation frame.
public IReadOnlyDictionary<string, object?> Locals { get; }
Property Value
Parameters
Gets passive parameter values associated with this invocation frame.
public IReadOnlyDictionary<string, object?> Parameters { get; }
Property Value
Parent
Gets the parent invocation frame in the current parser rule call stack, or null when this is a root-level rule.
public ParserRuleInvocationFrame? Parent { get; }
Property Value
Returns
Gets passive return values associated with this invocation frame.
public IReadOnlyDictionary<string, object?> Returns { get; }
Property Value
RuleName
Gets the name of the parser rule associated with this invocation frame.
public string RuleName { get; }
Property Value
Methods
ClearPendingChildParameters(string?)
Removes all pending child-parameter seeds for ruleName, or all seeds when ruleName is null.
public void ClearPendingChildParameters(string? ruleName = null)
Parameters
ruleNamestring
GetParameter(string)
Gets a parameter value by name.
public object? GetParameter(string name)
Parameters
namestringParameter metadata name.
Returns
- object
The parameter value associated with
name.
Exceptions
- KeyNotFoundException
Thrown when the parameter name is not present.
SetLocal(string, object?)
Sets a passive local value by metadata name.
public void SetLocal(string name, object? value)
Parameters
SetPendingChildParameter(string, string, object?)
Seeds an untyped parameter value for the next invocation of ruleName as a direct child of this frame.
Seeds are consumed and copied into the matching child frame when that rule is entered through the stack frame manager.
Parameters are not auto-bound; rule call arguments are not evaluated.
public void SetPendingChildParameter(string ruleName, string parameterName, object? value)
Parameters
ruleNamestringName of the child rule that will receive the seed.
parameterNamestringParameter metadata name.
valueobjectUntyped parameter value to seed.
SetPendingChildParameters(string, IReadOnlyDictionary<string, object?>)
Atomically merges untyped parameter values for the next invocation of a named child rule.
public void SetPendingChildParameters(string ruleName, IReadOnlyDictionary<string, object?> values)
Parameters
ruleNamestringName of the child rule that will receive the seeds.
valuesIReadOnlyDictionary<string, object>Parameter metadata names and untyped values to seed.
SetReturnValue(string, object?)
Sets a passive return value by metadata name.
public void SetReturnValue(string name, object? value)
Parameters
TryConsumePendingChildParameters(string, out IReadOnlyDictionary<string, object?>)
Attempts to consume and remove the pending parameter seed for ruleName.
On success, the seeds are removed from this frame and returned as a read-only snapshot.
public bool TryConsumePendingChildParameters(string ruleName, out IReadOnlyDictionary<string, object?> parameters)
Parameters
ruleNamestringName of the child rule whose seeds to consume.
parametersIReadOnlyDictionary<string, object>Receives the pending parameter snapshot when present.
Returns
- bool
truewhen seeds forruleNamewere present; otherwise,false.
TryGetLocal(string, out object?)
Attempts to get a passive local value by metadata name.
public bool TryGetLocal(string name, out object? value)
Parameters
Returns
- bool
truewhen the local name is present; otherwise,false.
TryGetParameter(string, out object?)
Attempts to get a parameter value by name.
public bool TryGetParameter(string name, out object? value)
Parameters
Returns
- bool
truewhen the parameter name is present; otherwise,false.
TryGetReturnValue(string, out object?)
Attempts to get a passive return value by metadata name.
public bool TryGetReturnValue(string name, out object? value)
Parameters
Returns
- bool
truewhen the return name is present; otherwise,false.