1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Pos {
pub line: u32,
pub column: u32,
}
impl Pos {
#[inline]
pub fn new(line: u32, column: u32) -> Self {
Self { line, column }
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct ReprPosValue(pub u32);
impl std::fmt::Display for ReprPosValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.0.checked_add(1) {
Some(value) => std::fmt::Display::fmt(&value, f),
None => f.write_str("4294967296"),
}
}
}