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
43
/// Represents a lexical token with a name/type and its raw value from the source code.
///
/// Used to represent the output of the [`Tokenizer`][crate::Tokenizer] struct.
///
/// # Examples
/// ```
/// # use crossandra::Token;
/// let num = Token { name: "int".into(), value: "23".into(), position: 3 };
/// let kw = Token::from(("keyword", "if", 0));
/// assert_eq!(num, Token::from(("int", "23", 3)));
/// # assert_eq!(kw, Token { name: "keyword".into(), value: "if".into(), position: 0 });
/// # assert_eq!(format!("{num:?}"), "Token { name: \"int\", value: \"23\", position: 3 }");
/// ```