Allow out-of-bounds values for Time

This commit is contained in:
Joscha 2021-12-11 22:39:20 +01:00
parent 44bcd5712d
commit 6e6a696ca4
3 changed files with 46 additions and 21 deletions

View file

@ -84,9 +84,11 @@ fn parse_time(p: Pair<'_, Rule>) -> Result<Spanned<Time>> {
assert_eq!(p.next(), None);
match Time::new(hour, min) {
Some(time) => Ok(Spanned::new(span, time)),
None => fail(pspan, "invalid time"),
let time = Time::new(hour, min);
if time.in_normal_range() {
Ok(Spanned::new(span, time))
} else {
fail(pspan, "invalid time")
}
}