handle the case of empty input

This commit is contained in:
Tamo 2021-10-22 17:49:08 +02:00
parent e25ca9776f
commit 4e113bbf1b
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -91,6 +91,9 @@ impl<'a> FilterCondition<'a> {
}
pub fn parse<E: FPError<'a>>(input: &'a str) -> Result<Self, E> {
if input.trim().is_empty() {
return Ok(Self::Empty);
}
let span = Span::new(input);
parse_expression::<'a, E>(span).finish().map(|(_rem, output)| output)
}