diff --git a/crates/specctra-core/src/common.rs b/crates/specctra-core/src/common.rs index 96c070e..9a52ec4 100644 --- a/crates/specctra-core/src/common.rs +++ b/crates/specctra-core/src/common.rs @@ -31,7 +31,7 @@ impl ListToken { if let Self::Leaf { value } = self { Ok(value) } else { - Err(ParseError::Expected("leaf value")) + Err(ParseError::ExpectedLeaf) } } @@ -39,7 +39,7 @@ impl ListToken { if let Self::End = self { Ok(()) } else { - Err(ParseError::Expected("end of list")) + Err(ParseError::ExpectedEndOfList) } } diff --git a/crates/specctra-core/src/error.rs b/crates/specctra-core/src/error.rs index 849f0da..76abcbf 100644 --- a/crates/specctra-core/src/error.rs +++ b/crates/specctra-core/src/error.rs @@ -6,10 +6,16 @@ pub enum ParseError { Eof, #[error(transparent)] Io(#[from] std::io::Error), + #[error("expected {0}")] Expected(&'static str), - #[error("expected ({0}")] + #[error("expected \"({0}\"")] ExpectedStartOfList(&'static str), + #[error("expected \")\"")] + ExpectedEndOfList, + #[error("expected leaf value")] + ExpectedLeaf, + #[error("found a space inside a quoted string, but file didn't declare this possibility")] UnexpectedSpaceInQuotedStr, }