mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
handle trailing whitespace inside group
This commit is contained in:
parent
25ff4642ec
commit
430f1ad616
1 changed files with 13 additions and 0 deletions
|
@ -162,6 +162,9 @@ fn group_inner(input: &str) -> IResult<&str, Vec<Node>> {
|
|||
if nodes.is_empty() {
|
||||
Err(nom::Err::Error((remaining, nom::error::ErrorKind::Many1)))
|
||||
} else {
|
||||
// chomp any trailing whitespace
|
||||
let (remaining, _) = whitespace0(remaining)?;
|
||||
|
||||
Ok((remaining, nodes))
|
||||
}
|
||||
}
|
||||
|
@ -428,6 +431,16 @@ mod test {
|
|||
]
|
||||
);
|
||||
|
||||
// including in groups
|
||||
assert_eq!(
|
||||
parse("( t t2 )")?,
|
||||
vec![Group(vec![
|
||||
Search(UnqualifiedText("t".into())),
|
||||
And,
|
||||
Search(UnqualifiedText("t2".into()))
|
||||
])]
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
parse(r#"hello -(world and "foo:bar baz") OR test"#)?,
|
||||
vec![
|
||||
|
|
Loading…
Reference in a new issue