efx_core/ast/error.rs
1use crate::ast::span_range::SpanRange;
2use std::fmt;
3
4/// Parser error with human-readable message and range
5#[derive(Debug)]
6pub struct ParseError {
7 pub msg: String,
8 pub span: SpanRange,
9}
10
11impl fmt::Display for ParseError {
12 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13 write!(
14 f,
15 "{} at bytes {}..{}",
16 self.msg, self.span.start.0, self.span.end.0
17 )
18 }
19}