diff --git a/Cargo.lock b/Cargo.lock index 1d48c86..dbc605b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1719,9 +1719,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.36" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] diff --git a/crates/typos/Cargo.toml b/crates/typos/Cargo.toml index 52faa81..ea2b433 100644 --- a/crates/typos/Cargo.toml +++ b/crates/typos/Cargo.toml @@ -14,7 +14,7 @@ include.workspace = true [dependencies] anyhow = "1.0" thiserror = "1.0" -winnow = "0.5.36" +winnow = "0.5.40" unicode-xid = "0.2.4" once_cell = "1.19.0" serde = { version = "1.0", features = ["derive"] } diff --git a/crates/typos/src/tokens.rs b/crates/typos/src/tokens.rs index 8b3332e..4beabdc 100644 --- a/crates/typos/src/tokens.rs +++ b/crates/typos/src/tokens.rs @@ -129,19 +129,21 @@ impl<'s> Iterator for Utf8Chunks<'s> { } mod parser { + use winnow::combinator::trace; use winnow::combinator::*; use winnow::error::ParserError; use winnow::prelude::*; use winnow::stream::AsBStr; use winnow::stream::AsChar; + use winnow::stream::Compare; use winnow::stream::SliceLen; use winnow::stream::Stream; use winnow::stream::StreamIsPartial; use winnow::token::*; - use winnow::trace::trace; pub(crate) fn next_identifier(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -169,6 +171,7 @@ mod parser { fn ignore(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -228,6 +231,7 @@ mod parser { fn ordinal_literal(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -262,6 +266,7 @@ mod parser { fn hex_literal(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -275,6 +280,7 @@ mod parser { fn css_color(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -294,6 +300,7 @@ mod parser { fn uuid_literal(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -396,6 +403,7 @@ mod parser { fn email_literal(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -414,6 +422,7 @@ mod parser { fn url_literal(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -443,6 +452,7 @@ mod parser { fn url_userinfo(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, @@ -477,6 +487,7 @@ mod parser { fn printf(input: &mut T) -> PResult<::Slice, ()> where + T: Compare, T: Stream + StreamIsPartial + PartialEq, ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, diff --git a/crates/varcon-core/Cargo.toml b/crates/varcon-core/Cargo.toml index 6ea6845..a8f01f9 100644 --- a/crates/varcon-core/Cargo.toml +++ b/crates/varcon-core/Cargo.toml @@ -16,7 +16,7 @@ parser = ["dep:winnow"] flags = ["dep:enumflags2"] [dependencies] -winnow = { version = "0.5.36", optional = true } +winnow = { version = "0.5.40", optional = true } enumflags2 = { version = "0.7", optional = true } [package.metadata.docs.rs] diff --git a/crates/varcon-core/src/parser.rs b/crates/varcon-core/src/parser.rs index cfa238c..8f1eb09 100644 --- a/crates/varcon-core/src/parser.rs +++ b/crates/varcon-core/src/parser.rs @@ -1,5 +1,5 @@ +use winnow::combinator::trace; use winnow::prelude::*; -use winnow::trace::trace; use crate::*; @@ -69,13 +69,13 @@ impl Cluster { let header = ( "#", winnow::ascii::space0, - winnow::ascii::not_line_ending, + winnow::ascii::till_line_ending, winnow::ascii::line_ending, ); let note = winnow::combinator::preceded( ("##", winnow::ascii::space0), winnow::combinator::terminated( - winnow::ascii::not_line_ending, + winnow::ascii::till_line_ending, winnow::ascii::line_ending, ), ); @@ -170,7 +170,7 @@ impl Entry { let comment = winnow::combinator::opt(( comment_sep, winnow::ascii::space1, - winnow::ascii::not_line_ending, + winnow::ascii::till_line_ending, )) .parse_next(input)?; @@ -200,7 +200,7 @@ impl Entry { winnow::combinator::opt((winnow::ascii::space1, "--")), winnow::combinator::opt(( winnow::ascii::space1, - winnow::token::take_till0(('\n', '\r', '#')), + winnow::token::take_till(0.., ('\n', '\r', '#')), )), ) .parse_next(input)?; @@ -343,7 +343,7 @@ impl Variant { fn word(input: &mut &str) -> PResult { trace("word", move |input: &mut &str| { - winnow::token::take_till1(|item: char| item.is_ascii_whitespace()) + winnow::token::take_till(1.., |item: char| item.is_ascii_whitespace()) .map(|s: &str| s.to_owned().replace('_', " ")) .parse_next(input) })