/** * Diagnostic Types for MEL Compiler * Error and warning reporting structures */ import type { SourceLocation } from "../lexer/source-location.js"; /** * Severity level of a diagnostic */ export type DiagnosticSeverity = "error" | "warning" | "info"; /** * A diagnostic message (error, warning, or info) */ export interface Diagnostic { /** Severity level */ severity: DiagnosticSeverity; /** Error code (e.g., "MEL001", "MEL_LEXER") */ code: string; /** Human-readable message */ message: string; /** Location in source */ location: SourceLocation; /** The source line containing the error */ source?: string; /** Suggested fix */ suggestion?: string; /** Related diagnostics */ related?: RelatedDiagnostic[]; } /** * A related diagnostic (for multi-location errors) */ export interface RelatedDiagnostic { message: string; location: SourceLocation; } /** * Create an error diagnostic */ export declare function createError(code: string, message: string, location: SourceLocation, options?: { source?: string; suggestion?: string; related?: RelatedDiagnostic[]; }): Diagnostic; /** * Create a warning diagnostic */ export declare function createWarning(code: string, message: string, location: SourceLocation, options?: { source?: string; suggestion?: string; }): Diagnostic; /** * Create an info diagnostic */ export declare function createInfo(code: string, message: string, location: SourceLocation): Diagnostic; /** * Check if a diagnostic is an error */ export declare function isError(diagnostic: Diagnostic): boolean; /** * Check if any diagnostics contain errors */ export declare function hasErrors(diagnostics: Diagnostic[]): boolean; /** * Filter diagnostics by severity */ export declare function filterBySeverity(diagnostics: Diagnostic[], severity: DiagnosticSeverity): Diagnostic[];