#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Span {
pub start: usize,
pub end: usize,
}
impl Span {
pub const ZERO: Self = Self::new(0, 0);
pub const fn new(start: usize, end: usize) -> Self {
Self { start, end }
}
pub fn text(self, full_text: &str) -> &str {
&full_text[self.start..self.end]
}
pub fn contains(self, other: Self) -> bool {
self.start <= other.start && other.end <= self.end
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Finding {
pub span: Span,
pub node: erl_parse::NodeId,
}