diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/winnow-0.4.7/src/multi.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/winnow-0.4.7/src/multi.rs')
-rw-r--r-- | vendor/winnow-0.4.7/src/multi.rs | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/vendor/winnow-0.4.7/src/multi.rs b/vendor/winnow-0.4.7/src/multi.rs new file mode 100644 index 000000000..3e92f70be --- /dev/null +++ b/vendor/winnow-0.4.7/src/multi.rs @@ -0,0 +1,124 @@ +//! Deprecated, see [`combinator`] +#![deprecated(since = "0.4.2", note = "Replaced with `combinator`")] + +use crate::binary; +use crate::combinator; +use crate::error::ParseError; +use crate::stream::Accumulate; +use crate::stream::Stream; +use crate::Parser; + +/// Deprecated, replaced by [`combinator::repeat`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat`")] +#[inline(always)] +pub fn many0<I, O, C, E, F>(f: F) -> impl Parser<I, C, E> +where + I: Stream, + C: Accumulate<O>, + F: Parser<I, O, E>, + E: ParseError<I>, +{ + combinator::repeat(0.., f) +} + +/// Deprecated, replaced by [`combinator::repeat`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat`")] +#[inline(always)] +pub fn many1<I, O, C, E, F>(f: F) -> impl Parser<I, C, E> +where + I: Stream, + C: Accumulate<O>, + F: Parser<I, O, E>, + E: ParseError<I>, +{ + combinator::repeat(1.., f) +} + +/// Deprecated, replaced by [`combinator::repeat_till0`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat_till0`")] +#[inline(always)] +pub fn many_till0<I, O, C, P, E, F, G>(f: F, g: G) -> impl Parser<I, (C, P), E> +where + I: Stream, + C: Accumulate<O>, + F: Parser<I, O, E>, + G: Parser<I, P, E>, + E: ParseError<I>, +{ + combinator::repeat_till0(f, g) +} + +pub use combinator::separated0; +pub use combinator::separated1; +pub use combinator::separated_foldl1; +#[cfg(feature = "alloc")] +pub use combinator::separated_foldr1; + +/// Deprecated, replaced by [`combinator::repeat`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat`")] +#[inline(always)] +pub fn many_m_n<I, O, C, E, F>(min: usize, max: usize, parse: F) -> impl Parser<I, C, E> +where + I: Stream, + C: Accumulate<O>, + F: Parser<I, O, E>, + E: ParseError<I>, +{ + combinator::repeat(min..=max, parse) +} + +#[allow(deprecated)] +pub use combinator::count; +pub use combinator::fill; + +/// Deprecated, replaced by [`combinator::fold_repeat`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::fold_repeat`")] +#[inline(always)] +pub fn fold_many0<I, O, E, F, G, H, R>(f: F, init: H, g: G) -> impl Parser<I, R, E> +where + I: Stream, + F: Parser<I, O, E>, + G: FnMut(R, O) -> R, + H: FnMut() -> R, + E: ParseError<I>, +{ + combinator::fold_repeat(0.., f, init, g) +} + +/// Deprecated, replaced by [`combinator::fold_repeat`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::fold_repeat`")] +#[inline(always)] +pub fn fold_many1<I, O, E, F, G, H, R>(f: F, init: H, g: G) -> impl Parser<I, R, E> +where + I: Stream, + F: Parser<I, O, E>, + G: FnMut(R, O) -> R, + H: FnMut() -> R, + E: ParseError<I>, +{ + combinator::fold_repeat(1.., f, init, g) +} + +/// Deprecated, replaced by [`combinator::fold_repeat`] +#[deprecated(since = "0.4.2", note = "Replaced with `combinator::fold_repeat`")] +#[inline(always)] +pub fn fold_many_m_n<I, O, E, F, G, H, R>( + min: usize, + max: usize, + parse: F, + init: H, + fold: G, +) -> impl Parser<I, R, E> +where + I: Stream, + F: Parser<I, O, E>, + G: FnMut(R, O) -> R, + H: FnMut() -> R, + E: ParseError<I>, +{ + combinator::fold_repeat(min..=max, parse, init, fold) +} + +pub use binary::length_count; +pub use binary::length_data; +pub use binary::length_value; |