1 | //! Deprecated, see [`combinator`] |
2 | #![deprecated (since = "0.4.2" , note = "Replaced with `combinator`" )] |
3 | |
4 | use crate::binary; |
5 | use crate::combinator; |
6 | use crate::error::ParseError; |
7 | use crate::stream::Accumulate; |
8 | use crate::stream::Stream; |
9 | use crate::Parser; |
10 | |
11 | /// Deprecated, replaced by [`combinator::repeat`] |
12 | #[deprecated (since = "0.4.2" , note = "Replaced with `combinator::repeat`" )] |
13 | #[inline (always)] |
14 | pub fn many0<I, O, C, E, F>(f: F) -> impl Parser<I, C, E> |
15 | where |
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)] |
27 | pub fn many1<I, O, C, E, F>(f: F) -> impl Parser<I, C, E> |
28 | where |
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)] |
40 | pub fn many_till0<I, O, C, P, E, F, G>(f: F, g: G) -> impl Parser<I, (C, P), E> |
41 | where |
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 | |
51 | pub use combinator::separated0; |
52 | pub use combinator::separated1; |
53 | pub use combinator::separated_foldl1; |
54 | #[cfg (feature = "alloc" )] |
55 | pub 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)] |
60 | pub fn many_m_n<I, O, C, E, F>(min: usize, max: usize, parse: F) -> impl Parser<I, C, E> |
61 | where |
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)] |
71 | pub use combinator::count; |
72 | pub 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)] |
77 | pub fn fold_many0<I, O, E, F, G, H, R>(f: F, init: H, g: G) -> impl Parser<I, R, E> |
78 | where |
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)] |
91 | pub fn fold_many1<I, O, E, F, G, H, R>(f: F, init: H, g: G) -> impl Parser<I, R, E> |
92 | where |
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)] |
105 | pub 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> |
112 | where |
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 | |
122 | pub use binary::length_count; |
123 | pub use binary::length_data; |
124 | pub use binary::length_value; |
125 | |