moxy_token/source/location.rs
1/// 0 indexed char based location
2#[derive(Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
3pub struct Location {
4 index: usize,
5 line: usize,
6 column: usize,
7}
8
9impl Location {
10 pub const fn new(index: usize, line: usize, column: usize) -> Self {
11 Self { index, line, column }
12 }
13
14 pub const fn index(&self) -> usize {
15 self.index
16 }
17
18 pub const fn line(&self) -> usize {
19 self.line
20 }
21
22 pub const fn column(&self) -> usize {
23 self.column
24 }
25}