Table of Contents

Class ParserDiagnostic

Namespace
Utils.Parser.Diagnostics
Assembly
Utils.Parser.Diagnostics.dll

Represents one emitted diagnostic message instance.

public sealed class ParserDiagnostic
Inheritance
ParserDiagnostic
Inherited Members
Extension Methods

Constructors

ParserDiagnostic(DiagnosticDetails, DiagnosticSpan?, SourceCodeLocation?)

Initializes a new diagnostic instance.

public ParserDiagnostic(DiagnosticDetails details, DiagnosticSpan? span = null, SourceCodeLocation? location = null)

Parameters

details DiagnosticDetails

Diagnostic details.

span DiagnosticSpan

Optional source span.

location SourceCodeLocation

Optional source location.

ParserDiagnostic(ParserDiagnosticDescriptor, string, int?, int?, string?, Exception?)

Initializes a new diagnostic instance.

public ParserDiagnostic(ParserDiagnosticDescriptor descriptor, string message, int? spanStart = null, int? spanLength = null, string? ruleName = null, Exception? exception = null)

Parameters

descriptor ParserDiagnosticDescriptor

Diagnostic descriptor.

message string

Resolved diagnostic message.

spanStart int?

Optional source span start position.

spanLength int?

Optional source span length.

ruleName string

Optional rule name context.

exception Exception

Optional related exception.

Properties

Code

Gets the diagnostic code.

public string Code { get; }

Property Value

string

Descriptor

Gets the descriptor.

public ParserDiagnosticDescriptor Descriptor { get; }

Property Value

ParserDiagnosticDescriptor

Details

Gets the descriptor.

public DiagnosticDetails Details { get; }

Property Value

DiagnosticDetails

Exception

Gets the optional related exception.

public Exception? Exception { get; }

Property Value

Exception

Location

Gets the optional human-readable source location.

public SourceCodeLocation? Location { get; }

Property Value

SourceCodeLocation

Message

Gets the resolved message.

public string Message { get; }

Property Value

string

RuleName

Gets the optional rule name context.

public string? RuleName { get; }

Property Value

string

Severity

Gets the diagnostic severity.

public DiagnosticSeverity Severity { get; }

Property Value

DiagnosticSeverity

Span

Gets the optional source span.

public DiagnosticSpan? Span { get; }

Property Value

DiagnosticSpan

Methods

ToDisplayString()

Formats the diagnostic in file/line/column style.

public string ToDisplayString()

Returns

string