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
37
38
39
40
41
42
use crate::position::Position;
use std::fmt::Debug;
pub trait PointInTime: Debug + Copy + Eq {
fn pos(&self) -> Position;
unsafe fn set_pos(&mut self, pos: Position);
#[inline]
fn record_pos(&self) -> Position {
self.pos()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ParserPointInTime {
pub(crate) pos: Position
}
impl ParserPointInTime {
pub(crate) fn new() -> Self {
Self {
pos: Position::null()
}
}
}
impl PointInTime for ParserPointInTime {
fn pos(&self) -> Position {
self.pos
}
unsafe fn set_pos(&mut self, pos: Position) {
self.pos = pos;
}
}