Merge pull request #716 from epage/update

chore: Upgrade winnow to 0.4.3
This commit is contained in:
Ed Page 2023-04-28 15:10:34 -05:00 committed by GitHub
commit d399e2ea33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 29 deletions

4
Cargo.lock generated
View file

@ -2057,9 +2057,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.4.1" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" checksum = "6dd168d560b787538a8ab920d47c030a5c0d488b515dd20798d59ea279a5b1df"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View file

@ -14,7 +14,7 @@ include.workspace = true
[dependencies] [dependencies]
anyhow = "1.0" anyhow = "1.0"
thiserror = "1.0" thiserror = "1.0"
winnow = "0.4.1" winnow = "0.4.3"
unicode-xid = "0.2.4" unicode-xid = "0.2.4"
once_cell = "1.17.1" once_cell = "1.17.1"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -125,16 +125,14 @@ impl<'s> Iterator for Utf8Chunks<'s> {
} }
mod parser { mod parser {
use winnow::branch::*;
use winnow::bytes::*;
use winnow::combinator::*; use winnow::combinator::*;
use winnow::prelude::*; use winnow::prelude::*;
use winnow::sequence::*;
use winnow::stream::AsBStr; use winnow::stream::AsBStr;
use winnow::stream::AsChar; use winnow::stream::AsChar;
use winnow::stream::SliceLen; use winnow::stream::SliceLen;
use winnow::stream::Stream; use winnow::stream::Stream;
use winnow::stream::StreamIsPartial; use winnow::stream::StreamIsPartial;
use winnow::token::*;
pub(crate) fn next_identifier<T>(input: T) -> IResult<T, <T as Stream>::Slice> pub(crate) fn next_identifier<T>(input: T) -> IResult<T, <T as Stream>::Slice>
where where
@ -257,8 +255,8 @@ mod parser {
preceded( preceded(
'#', '#',
alt(( alt((
terminated(take_while_m_n(3, 8, is_lower_hex_digit), peek(sep1)), terminated(take_while(3..=8, is_lower_hex_digit), peek(sep1)),
terminated(take_while_m_n(3, 8, is_upper_hex_digit), peek(sep1)), terminated(take_while(3..=8, is_upper_hex_digit), peek(sep1)),
)), )),
) )
.parse_next(input) .parse_next(input)
@ -272,26 +270,26 @@ mod parser {
{ {
alt(( alt((
( (
take_while_m_n(8, 8, is_lower_hex_digit), take_while(8, is_lower_hex_digit),
'-', '-',
take_while_m_n(4, 4, is_lower_hex_digit), take_while(4, is_lower_hex_digit),
'-', '-',
take_while_m_n(4, 4, is_lower_hex_digit), take_while(4, is_lower_hex_digit),
'-', '-',
take_while_m_n(4, 4, is_lower_hex_digit), take_while(4, is_lower_hex_digit),
'-', '-',
take_while_m_n(12, 12, is_lower_hex_digit), take_while(12, is_lower_hex_digit),
), ),
( (
take_while_m_n(8, 8, is_upper_hex_digit), take_while(8, is_upper_hex_digit),
'-', '-',
take_while_m_n(4, 4, is_upper_hex_digit), take_while(4, is_upper_hex_digit),
'-', '-',
take_while_m_n(4, 4, is_upper_hex_digit), take_while(4, is_upper_hex_digit),
'-', '-',
take_while_m_n(4, 4, is_upper_hex_digit), take_while(4, is_upper_hex_digit),
'-', '-',
take_while_m_n(12, 12, is_upper_hex_digit), take_while(12, is_upper_hex_digit),
), ),
)) ))
.recognize() .recognize()
@ -314,10 +312,9 @@ mod parser {
// or more. // or more.
const IGNORE_HEX_MIN: usize = 32; const IGNORE_HEX_MIN: usize = 32;
const IGNORE_HEX_MAX: usize = usize::MAX;
alt(( alt((
take_while_m_n(IGNORE_HEX_MIN, IGNORE_HEX_MAX, is_lower_hex_digit), take_while(IGNORE_HEX_MIN.., is_lower_hex_digit),
take_while_m_n(IGNORE_HEX_MIN, IGNORE_HEX_MAX, is_upper_hex_digit), take_while(IGNORE_HEX_MIN.., is_upper_hex_digit),
)) ))
.parse_next(input) .parse_next(input)
} }
@ -350,7 +347,7 @@ mod parser {
} }
let (after, _) = let (after, _) =
take_while_m_n(padding_len, padding_len, is_base64_padding).parse_next(padding)?; take_while(padding_len..=padding_len, is_base64_padding).parse_next(padding)?;
let after_offset = input.offset_to(&after); let after_offset = input.offset_to(&after);
Ok(input.next_slice(after_offset)) Ok(input.next_slice(after_offset))
@ -439,12 +436,7 @@ mod parser {
F: winnow::Parser<I, <I as Stream>::Slice, E>, F: winnow::Parser<I, <I as Stream>::Slice, E>,
E: winnow::error::ParseError<I>, E: winnow::error::ParseError<I>,
{ {
move |i: I| { move |i: I| repeat0(f.by_ref()).map(|()| ()).recognize().parse_next(i)
winnow::multi::many0(f.by_ref())
.map(|()| ())
.recognize()
.parse_next(i)
}
} }
#[inline] #[inline]

View file

@ -16,7 +16,7 @@ parser = ["winnow"]
flags = ["enumflags2"] flags = ["enumflags2"]
[dependencies] [dependencies]
winnow = { version = "0.4.1", optional = true } winnow = { version = "0.4.3", optional = true }
enumflags2 = { version = "0.7", optional = true } enumflags2 = { version = "0.7", optional = true }
[package.metadata.docs.rs] [package.metadata.docs.rs]