char_lex/
utils.rs

1/// Context type for a `Token`.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub struct Context {
4    /// The corresponding `char` in this `Context`.
5    pub character: char,
6
7    /// The corresponding `position` in this `Context`.
8    ///
9    /// It is meant to represent as `(line, character)` position.
10    pub position: (usize, usize),
11}
12
13impl Context {
14    pub(super) fn new(character: char, position: (usize, usize)) -> Self {
15        Self {
16            character,
17            position,
18        }
19    }
20}