Table of Contents

Class LrcParseResult

Namespace
ModernLrc
Assembly
ModernLrc.dll

Outcome of a parse operation: the document built (possibly partial under strict mode failure) and every diagnostic emitted in source order.

public sealed record LrcParseResult : IEquatable<LrcParseResult>
Inheritance
LrcParseResult
Implements
Inherited Members

Examples

var result = LrcParser.Parse(text);
if (result.HasErrors)
    foreach (var d in result.Diagnostics)
        if (d.Severity == LrcDiagnosticSeverity.Error)
            Console.WriteLine($"{d.Code} at L{d.Line}:C{d.Column} — {d.Message}");
// Document is always non-null; may be partial when strict-mode failed mid-parse.
var doc = result.Document;

Properties

Diagnostics

All diagnostics emitted, in source order.

public required ImmutableArray<LrcDiagnostic> Diagnostics { get; init; }

Property Value

ImmutableArray<LrcDiagnostic>

Document

Built document. Always non-null; may be partial when a Strict-mode parse fails on the first Error-severity diagnostic.

public required LrcDocument Document { get; init; }

Property Value

LrcDocument

HasErrors

True if any diagnostic has Error severity.

public bool HasErrors { get; }

Property Value

bool

HasWarnings

True if any diagnostic has Warning severity.

public bool HasWarnings { get; }

Property Value

bool