Class PreparedExpressionEmbeddedCodeKey
- Namespace
- Utils.Parser.Expressions
- Assembly
- Utils.Parser.Expressions.dll
Identifies a prepared expression embedded-code artifact using the stable runtime metadata available to parser policies.
public sealed record PreparedExpressionEmbeddedCodeKey : IEquatable<PreparedExpressionEmbeddedCodeKey>
- Inheritance
-
PreparedExpressionEmbeddedCodeKey
- Implements
- Inherited Members
- Extension Methods
Constructors
PreparedExpressionEmbeddedCodeKey(EmbeddedCodeKind, string, string, int?, int?)
Identifies a prepared expression embedded-code artifact using the stable runtime metadata available to parser policies.
public PreparedExpressionEmbeddedCodeKey(EmbeddedCodeKind Kind, string RuleName, string SourceText, int? AlternativeIndex, int? ElementIndex)
Parameters
KindEmbeddedCodeKindEmbedded-code kind stored in the registry.
RuleNamestringName of the parser rule that owns the embedded source.
SourceTextstringRaw embedded-code source text without ANTLR delimiters.
AlternativeIndexint?Zero-based alternative index, or
nullwhen unavailable.ElementIndexint?Zero-based element index, or
nullwhen unavailable.
Properties
AlternativeIndex
Zero-based alternative index, or null when unavailable.
public int? AlternativeIndex { get; init; }
Property Value
- int?
ElementIndex
Zero-based element index, or null when unavailable.
public int? ElementIndex { get; init; }
Property Value
- int?
Kind
Embedded-code kind stored in the registry.
public EmbeddedCodeKind Kind { get; init; }
Property Value
RuleName
Name of the parser rule that owns the embedded source.
public string RuleName { get; init; }
Property Value
SourceText
Raw embedded-code source text without ANTLR delimiters.
public string SourceText { get; init; }
Property Value
Methods
FromParserActionContext(ParserActionExecutionContext)
Creates a parser-action key from runtime execution metadata.
public static PreparedExpressionEmbeddedCodeKey FromParserActionContext(ParserActionExecutionContext context)
Parameters
contextParserActionExecutionContextCurrent parser-action execution context.
Returns
- PreparedExpressionEmbeddedCodeKey
A deterministic lookup key for the current action invocation.
FromSemanticPredicateContext(SemanticPredicateEvaluationContext)
Creates a semantic-predicate key from runtime evaluation metadata.
public static PreparedExpressionEmbeddedCodeKey FromSemanticPredicateContext(SemanticPredicateEvaluationContext context)
Parameters
contextSemanticPredicateEvaluationContextCurrent semantic-predicate evaluation context.
Returns
- PreparedExpressionEmbeddedCodeKey
A deterministic lookup key for the current predicate invocation.
FromSource(EmbeddedCodeSource, string?)
Creates a key from prepared-source metadata.
public static PreparedExpressionEmbeddedCodeKey FromSource(EmbeddedCodeSource source, string? fallbackRuleName = null)
Parameters
sourceEmbeddedCodeSourcePrepared embedded-code source metadata.
fallbackRuleNamestringOptional rule name used when
sourcedoes not carry one.
Returns
- PreparedExpressionEmbeddedCodeKey
A deterministic lookup key for the prepared source.
Exceptions
- ArgumentException
Thrown when no usable rule name is available.