1//! Deprecated, see [`combinator`]
2#![deprecated(since = "0.4.2", note = "Replaced with `combinator`")]
3
4use crate::binary;
5use crate::combinator;
6use crate::error::ParseError;
7use crate::stream::Accumulate;
8use crate::stream::Stream;
9use crate::Parser;
10
11/// Deprecated, replaced by [`combinator::repeat`]
12#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat`")]
13#[inline(always)]
14pub fn many0<I, O, C, E, F>(f: F) -> impl Parser<I, C, E>
15where
16 I: Stream,
17 C: Accumulate<O>,
18 F: Parser<I, O, E>,
19 E: ParseError<I>,
20{
21 combinator::repeat(range:0.., f)
22}
23
24/// Deprecated, replaced by [`combinator::repeat`]
25#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat`")]
26#[inline(always)]
27pub fn many1<I, O, C, E, F>(f: F) -> impl Parser<I, C, E>
28where
29 I: Stream,
30 C: Accumulate<O>,
31 F: Parser<I, O, E>,
32 E: ParseError<I>,
33{
34 combinator::repeat(range:1.., f)
35}
36
37/// Deprecated, replaced by [`combinator::repeat_till0`]
38#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat_till0`")]
39#[inline(always)]
40pub fn many_till0<I, O, C, P, E, F, G>(f: F, g: G) -> impl Parser<I, (C, P), E>
41where
42 I: Stream,
43 C: Accumulate<O>,
44 F: Parser<I, O, E>,
45 G: Parser<I, P, E>,
46 E: ParseError<I>,
47{
48 combinator::repeat_till0(f, g)
49}
50
51pub use combinator::separated0;
52pub use combinator::separated1;
53pub use combinator::separated_foldl1;
54#[cfg(feature = "alloc")]
55pub use combinator::separated_foldr1;
56
57/// Deprecated, replaced by [`combinator::repeat`]
58#[deprecated(since = "0.4.2", note = "Replaced with `combinator::repeat`")]
59#[inline(always)]
60pub fn many_m_n<I, O, C, E, F>(min: usize, max: usize, parse: F) -> impl Parser<I, C, E>
61where
62 I: Stream,
63 C: Accumulate<O>,
64 F: Parser<I, O, E>,
65 E: ParseError<I>,
66{
67 combinator::repeat(range:min..=max, f:parse)
68}
69
70#[allow(deprecated)]
71pub use combinator::count;
72pub use combinator::fill;
73
74/// Deprecated, replaced by [`combinator::fold_repeat`]
75#[deprecated(since = "0.4.2", note = "Replaced with `combinator::fold_repeat`")]
76#[inline(always)]
77pub fn fold_many0<I, O, E, F, G, H, R>(f: F, init: H, g: G) -> impl Parser<I, R, E>
78where
79 I: Stream,
80 F: Parser<I, O, E>,
81 G: FnMut(R, O) -> R,
82 H: FnMut() -> R,
83 E: ParseError<I>,
84{
85 combinator::fold_repeat(range:0.., f, init, g)
86}
87
88/// Deprecated, replaced by [`combinator::fold_repeat`]
89#[deprecated(since = "0.4.2", note = "Replaced with `combinator::fold_repeat`")]
90#[inline(always)]
91pub fn fold_many1<I, O, E, F, G, H, R>(f: F, init: H, g: G) -> impl Parser<I, R, E>
92where
93 I: Stream,
94 F: Parser<I, O, E>,
95 G: FnMut(R, O) -> R,
96 H: FnMut() -> R,
97 E: ParseError<I>,
98{
99 combinator::fold_repeat(range:1.., f, init, g)
100}
101
102/// Deprecated, replaced by [`combinator::fold_repeat`]
103#[deprecated(since = "0.4.2", note = "Replaced with `combinator::fold_repeat`")]
104#[inline(always)]
105pub fn fold_many_m_n<I, O, E, F, G, H, R>(
106 min: usize,
107 max: usize,
108 parse: F,
109 init: H,
110 fold: G,
111) -> impl Parser<I, R, E>
112where
113 I: Stream,
114 F: Parser<I, O, E>,
115 G: FnMut(R, O) -> R,
116 H: FnMut() -> R,
117 E: ParseError<I>,
118{
119 combinator::fold_repeat(range:min..=max, f:parse, init, g:fold)
120}
121
122pub use binary::length_count;
123pub use binary::length_data;
124pub use binary::length_value;
125