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