Table of Contents

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

Kind EmbeddedCodeKind

Embedded-code kind stored in the registry.

RuleName string

Name of the parser rule that owns the embedded source.

SourceText string

Raw embedded-code source text without ANTLR delimiters.

AlternativeIndex int?

Zero-based alternative index, or null when unavailable.

ElementIndex int?

Zero-based element index, or null when 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

EmbeddedCodeKind

RuleName

Name of the parser rule that owns the embedded source.

public string RuleName { get; init; }

Property Value

string

SourceText

Raw embedded-code source text without ANTLR delimiters.

public string SourceText { get; init; }

Property Value

string

Methods

FromParserActionContext(ParserActionExecutionContext)

Creates a parser-action key from runtime execution metadata.

public static PreparedExpressionEmbeddedCodeKey FromParserActionContext(ParserActionExecutionContext context)

Parameters

context ParserActionExecutionContext

Current 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

context SemanticPredicateEvaluationContext

Current 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

source EmbeddedCodeSource

Prepared embedded-code source metadata.

fallbackRuleName string

Optional rule name used when source does not carry one.

Returns

PreparedExpressionEmbeddedCodeKey

A deterministic lookup key for the prepared source.

Exceptions

ArgumentException

Thrown when no usable rule name is available.