Update filter-parser/src/value.rs

Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
Tamo 2022-01-10 15:53:44 +01:00 committed by GitHub
parent 3c7ea1d298
commit 0fcde35a20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,12 +26,10 @@ fn quoted_by(quote: char, input: Span) -> IResult<Token> {
let mut i = input.iter_indices(); let mut i = input.iter_indices();
while let Some((idx, c)) = i.next() { while let Some((idx, c)) = i.next() {
match c { if c == quote {
c if c == quote => {
let (rem, output) = input.take_split(idx); let (rem, output) = input.take_split(idx);
return Ok((rem, Token::new(output, escaped.then(|| unescape(output, quote))))); return Ok((rem, Token::new(output, escaped.then(|| unescape(output, quote)))));
} } else if c == '\\' {
'\\' => {
if let Some((_, c)) = i.next() { if let Some((_, c)) = i.next() {
escaped |= c == quote; escaped |= c == quote;
} else { } else {
@ -42,8 +40,6 @@ fn quoted_by(quote: char, input: Span) -> IResult<Token> {
} }
} }
// if it was preceeded by a `\` or if it was anything else we can continue to advance // if it was preceeded by a `\` or if it was anything else we can continue to advance
_ => (),
}
} }
Ok(( Ok((