1pub type IntType = i64;
2pub type FloatType = f64;
3pub enum Number {
4 Int(IntType),
5 Float(FloatType),
6 None,
7}
8
9#[derive(Debug, Copy, Clone, PartialEq)]
10pub struct Source {
11 pub pos: usize,
12 pub length: usize,
13 pub line: usize,
14 pub col: usize,
15}
16
17impl Source {
18 pub fn new() -> Self {
19 Source {
20 pos: 0,
21 length: 0,
22 line: 0,
23 col: 0,
24 }
25 }
26}
27use std::ops;
28impl ops::Sub<Source> for Source {
29 type Output = Source;
30 fn sub(self, rhs: Source) -> Source {
31 Source {
32 pos: rhs.pos,
33 length: self.pos + self.length - rhs.pos,
34 line: rhs.line,
35 col: rhs.col,
36 }
37 }
38}