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 {
|
if let Self::Leaf { value } = self {
|
||||||
Ok(value)
|
Ok(value)
|
||||||
} else {
|
} else {
|
||||||
Err(ParseError::Expected("leaf value"))
|
Err(ParseError::ExpectedLeaf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ impl ListToken {
|
||||||
if let Self::End = self {
|
if let Self::End = self {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(ParseError::Expected("end of list"))
|
Err(ParseError::ExpectedEndOfList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,16 @@ pub enum ParseError {
|
||||||
Eof,
|
Eof,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Io(#[from] std::io::Error),
|
Io(#[from] std::io::Error),
|
||||||
|
|
||||||
#[error("expected {0}")]
|
#[error("expected {0}")]
|
||||||
Expected(&'static str),
|
Expected(&'static str),
|
||||||
#[error("expected ({0}")]
|
#[error("expected \"({0}\"")]
|
||||||
ExpectedStartOfList(&'static str),
|
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")]
|
#[error("found a space inside a quoted string, but file didn't declare this possibility")]
|
||||||
UnexpectedSpaceInQuotedStr,
|
UnexpectedSpaceInQuotedStr,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue