1#[derive(Debug)]
5pub enum LexError {
6 UnclosedTag,
8 InvalidTag(String),
10 UnclosedValue,
12 InvalidArgumentCount { expected: usize, got: usize },
14 InvalidValue(String),
16}
17
18impl std::fmt::Display for LexError {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 match self {
21 LexError::UnclosedTag => write!(f, "unclosed tag"),
22 LexError::InvalidTag(tag) => write!(f, "invalid tag: {tag}"),
23 LexError::UnclosedValue => write!(f, "unclosed parantheses for color value"),
24 LexError::InvalidArgumentCount { expected, got } => {
25 write!(f, "expected {}, got {}", expected, got)
26 }
27 LexError::InvalidValue(s) => write!(f, "invalid value '{}'", s),
28 }
29 }
30}
31
32impl std::error::Error for LexError {}