mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
commit
22ba24ad21
5 changed files with 22 additions and 11 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -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",
|
||||
]
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -169,6 +171,7 @@ mod parser {
|
|||
|
||||
fn ignore<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -228,6 +231,7 @@ mod parser {
|
|||
|
||||
fn ordinal_literal<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -262,6 +266,7 @@ mod parser {
|
|||
|
||||
fn hex_literal<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -275,6 +280,7 @@ mod parser {
|
|||
|
||||
fn css_color<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -294,6 +300,7 @@ mod parser {
|
|||
|
||||
fn uuid_literal<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -396,6 +403,7 @@ mod parser {
|
|||
|
||||
fn email_literal<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -414,6 +422,7 @@ mod parser {
|
|||
|
||||
fn url_literal<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -443,6 +452,7 @@ mod parser {
|
|||
|
||||
fn url_userinfo<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
@ -477,6 +487,7 @@ mod parser {
|
|||
|
||||
fn printf<T>(input: &mut T) -> PResult<<T as Stream>::Slice, ()>
|
||||
where
|
||||
T: Compare<char>,
|
||||
T: Stream + StreamIsPartial + PartialEq,
|
||||
<T as Stream>::Slice: AsBStr + SliceLen + Default,
|
||||
<T as Stream>::Token: AsChar + Copy,
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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<String, ()> {
|
||||
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)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue