Table of Contents

Class EmbeddedCodePreparationResult<TArtifact>

Namespace
Utils.Parser.EmbeddedCode
Assembly
Utils.Parser.dll

Represents the result of preparing ANTLR embedded-code source for a specific execution or generation path.

public sealed record EmbeddedCodePreparationResult<TArtifact> : IEquatable<EmbeddedCodePreparationResult<TArtifact>>

Type Parameters

TArtifact

Type of the prepared artifact produced on success.

Inheritance
EmbeddedCodePreparationResult<TArtifact>
Implements
Inherited Members
Extension Methods

Constructors

EmbeddedCodePreparationResult(EmbeddedCodePreparationStatus, TArtifact?, ParserDiagnosticDescriptor?, Exception?, IReadOnlyList<object?>?)

Initializes a new instance of the EmbeddedCodePreparationResult<TArtifact> record.

public EmbeddedCodePreparationResult(EmbeddedCodePreparationStatus status, TArtifact? artifact = default, ParserDiagnosticDescriptor? diagnosticDescriptor = null, Exception? exception = null, IReadOnlyList<object?>? diagnosticArguments = null)

Parameters

status EmbeddedCodePreparationStatus

Preparation outcome category.

artifact TArtifact

Optional prepared artifact when preparation succeeded.

diagnosticDescriptor ParserDiagnosticDescriptor

Optional diagnostic descriptor associated with the outcome.

exception Exception

Optional exception associated with a failed preparation attempt.

diagnosticArguments IReadOnlyList<object>

Optional diagnostic message arguments associated with the outcome.

Properties

Artifact

Gets the optional prepared artifact when preparation succeeded.

public TArtifact? Artifact { get; }

Property Value

TArtifact

DiagnosticArguments

Gets the optional diagnostic message arguments associated with the outcome.

public IReadOnlyList<object?> DiagnosticArguments { get; }

Property Value

IReadOnlyList<object>

DiagnosticDescriptor

Gets the optional diagnostic descriptor associated with the outcome.

public ParserDiagnosticDescriptor? DiagnosticDescriptor { get; }

Property Value

ParserDiagnosticDescriptor

Exception

Gets the optional exception associated with a failed preparation attempt.

public Exception? Exception { get; }

Property Value

Exception

Status

Gets the preparation outcome category.

public EmbeddedCodePreparationStatus Status { get; }

Property Value

EmbeddedCodePreparationStatus

Methods

CompilationFailed(Exception?, IEnumerable<object?>?)

Creates a failed compilation preparation result.

public static EmbeddedCodePreparationResult<TArtifact> CompilationFailed(Exception? exception = null, IEnumerable<object?>? diagnosticArguments = null)

Parameters

exception Exception

Optional exception associated with the failed compilation.

diagnosticArguments IEnumerable<object>

Optional diagnostic message arguments associated with the outcome.

Returns

EmbeddedCodePreparationResult<TArtifact>

A failed compilation preparation result.

CompilerNotConfigured(IEnumerable<object?>?)

Creates a compiler-not-configured preparation result.

public static EmbeddedCodePreparationResult<TArtifact> CompilerNotConfigured(IEnumerable<object?>? diagnosticArguments = null)

Parameters

diagnosticArguments IEnumerable<object>

Optional diagnostic message arguments associated with the outcome.

Returns

EmbeddedCodePreparationResult<TArtifact>

A compiler-not-configured preparation result.

PreservedNotCompiled(IEnumerable<object?>?)

Creates a preserved-without-compilation preparation result.

public static EmbeddedCodePreparationResult<TArtifact> PreservedNotCompiled(IEnumerable<object?>? diagnosticArguments = null)

Parameters

diagnosticArguments IEnumerable<object>

Optional diagnostic message arguments associated with the outcome.

Returns

EmbeddedCodePreparationResult<TArtifact>

A preserved-without-compilation preparation result.

Success(TArtifact)

Creates a successful preparation result with an artifact.

public static EmbeddedCodePreparationResult<TArtifact> Success(TArtifact artifact)

Parameters

artifact TArtifact

Prepared artifact produced by the preparation path.

Returns

EmbeddedCodePreparationResult<TArtifact>

A successful preparation result.

Unsupported(IEnumerable<object?>?)

Creates an unsupported preparation result.

public static EmbeddedCodePreparationResult<TArtifact> Unsupported(IEnumerable<object?>? diagnosticArguments = null)

Parameters

diagnosticArguments IEnumerable<object>

Optional diagnostic message arguments associated with the outcome.

Returns

EmbeddedCodePreparationResult<TArtifact>

An unsupported preparation result.