mirror of https://codeberg.org/topola/topola.git
feat(specctra-core/error): separate errors for expected leaf / end-of-list
This commit is contained in:
parent
8a724dc5d2
commit
8fb9bfc0e6
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue