1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Error and diagnostic system for the Orrery parser.
//!
//! This module provides an error handling system with:
//! - Error codes for documentation and searchability
//! - Multiple labeled spans for rich error context
//! - Severity levels
//! - Diagnostic collector for accumulating multiple errors
//!
//! # Overview
//!
//! The error system is built around the [`Diagnostic`] type, which represents
//! a single error or warning message with optional error code, multiple source
//! locations, and help text. Multiple diagnostics are wrapped in [`ParseError`]
//! for returning from the parsing lifecycle.
//!
//! # Example
//!
//! ```
//! # use orrery_parser::error::{Diagnostic, ErrorCode};
//! # use orrery_parser::Span;
//!
//! let span = Span::new(100..120);
//! let original_span = Span::new(50..70);
//!
//! let diag = Diagnostic::error("type `User` is defined multiple times")
//! .with_code(ErrorCode::E301)
//! .with_label(span, "duplicate definition")
//! .with_secondary_label(original_span, "first defined here")
//! .with_help("remove the duplicate or use a different name");
//! ```
pub use DiagnosticCollector;
pub use Result;
pub use Diagnostic;
pub use ErrorCode;
pub use Label;
pub use ParseError;
pub use Severity;