1#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2pub enum Delimiter {
3 Parenthesis,
4 Brace,
5 Bracket,
6}
7
8impl Delimiter {
9 pub const fn as_open_char(self) -> char {
10 match self {
11 Delimiter::Parenthesis => '(',
12 Delimiter::Brace => '{',
13 Delimiter::Bracket => '[',
14 }
15 }
16 pub const fn as_close_char(self) -> char {
17 match self {
18 Delimiter::Parenthesis => ')',
19 Delimiter::Brace => '}',
20 Delimiter::Bracket => ']',
21 }
22 }
23}
24
25#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
26pub enum PunctKind {
27 Semicolon,
28 Colon,
29 ForwardSlash,
30 Comma,
31 Star,
32 Add,
33 Sub,
34 LessThan,
35 GreaterThan,
36 Equals,
37 Dot,
38 Bang,
39 Percent,
40 Ampersand,
41 Caret,
42 Pipe,
43 Underscore,
44 Sharp,
45}
46
47impl PunctKind {
48 pub fn as_char(&self) -> char {
49 match self {
50 PunctKind::Semicolon => ';',
51 PunctKind::Colon => ':',
52 PunctKind::ForwardSlash => '/',
53 PunctKind::Comma => ',',
54 PunctKind::Star => '*',
55 PunctKind::Add => '+',
56 PunctKind::Sub => '-',
57 PunctKind::LessThan => '<',
58 PunctKind::GreaterThan => '>',
59 PunctKind::Equals => '=',
60 PunctKind::Dot => '.',
61 PunctKind::Bang => '!',
62 PunctKind::Percent => '%',
63 PunctKind::Ampersand => '&',
64 PunctKind::Caret => '^',
65 PunctKind::Pipe => '|',
66 PunctKind::Underscore => '_',
67 PunctKind::Sharp => '#',
68 }
69 }
70}