feat: add better diagnostic rendering

This commit is contained in:
2026-04-21 22:35:37 +02:00
parent 0162d5b845
commit 42ba357302
5 changed files with 74 additions and 6 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
use std::fmt::Display;
use std::{fmt::Display, ops::Range};
/// A half-open interval `[start, end)` representing a location in the source text.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -23,6 +23,12 @@ impl Span {
}
}
impl From<Span> for Range<usize> {
fn from(value: Span) -> Self {
value.start..value.end
}
}
/// A fundamental, categorized unit of source code produced during lexical analysis.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Token<'src> {