aldrin_parser/
span.rs

1use crate::grammar::Rule;
2use pest::iterators::Pair;
3
4#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub struct Span {
6    pub start: usize,
7    pub end: usize,
8}
9
10impl Span {
11    pub(crate) fn from_pair(pair: &Pair<Rule>) -> Self {
12        let span = pair.as_span();
13
14        Self {
15            start: span.start(),
16            end: span.end(),
17        }
18    }
19
20    pub(crate) fn dummy() -> Self {
21        Self { start: 0, end: 0 }
22    }
23}