efx_core/parser/error.rs
1use std::fmt;
2use crate::parser::span_range::SpanRange;
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!(f, "{} at bytes {}..{}", self.msg, self.span.start.0, self.span.end.0)
14 }
15}