oni_comb_parser_rs/extension/parser/
repeat_parser.rs1use crate::extension::parser::OperatorParser;
2use crate::utils::RangeArgument;
3use std::fmt::Debug;
4
5pub trait RepeatParser<'a>: OperatorParser<'a> {
6 fn repeat<R>(self, range: R) -> Self::P<'a, Self::Input, Vec<Self::Output>>
7 where
8 R: RangeArgument<usize> + Debug + 'a,
9 Self::Input: Clone + 'a,
10 Self::Output: Clone + Debug + 'a,
11 Self: Sized;
12
13 fn of_many0(self) -> Self::P<'a, Self::Input, Vec<Self::Output>>
14 where
15 Self::Input: Clone + 'a,
16 Self::Output: Clone + Debug + 'a;
17
18 fn of_many1(self) -> Self::P<'a, Self::Input, Vec<Self::Output>>
19 where
20 Self::Input: Clone + 'a,
21 Self::Output: Clone + Debug + 'a;
22
23 fn of_many_n_m(self, n: usize, m: usize) -> Self::P<'a, Self::Input, Vec<Self::Output>>
24 where
25 Self::Input: Clone + 'a,
26 Self::Output: Clone + Debug + 'a;
27
28 fn of_count(self, n: usize) -> Self::P<'a, Self::Input, Vec<Self::Output>>
29 where
30 Self::Input: Clone + 'a,
31 Self::Output: Clone + Debug + 'a;
32
33 fn of_rep_sep<B, R>(
34 self,
35 range: R,
36 separator: Option<Self::P<'a, Self::Input, B>>,
37 ) -> Self::P<'a, Self::Input, Vec<Self::Output>>
38 where
39 R: RangeArgument<usize> + Debug + 'a,
40 Self::Input: Clone + 'a,
41 Self::Output: Clone + Debug + 'a,
42 B: Clone + Debug + 'a;
43
44 fn of_many0_sep<B>(self, separator: Self::P<'a, Self::Input, B>) -> Self::P<'a, Self::Input, Vec<Self::Output>>
45 where
46 Self::Input: Clone + 'a,
47 Self::Output: Clone + Debug + 'a,
48 B: Clone + Debug + 'a;
49
50 fn of_many1_sep<B>(self, separator: Self::P<'a, Self::Input, B>) -> Self::P<'a, Self::Input, Vec<Self::Output>>
51 where
52 Self::Input: Clone + 'a,
53 Self::Output: Clone + Debug + 'a,
54 B: Clone + Debug + 'a;
55
56 fn of_many_n_m_sep<B>(
57 self,
58 n: usize,
59 m: usize,
60 separator: Self::P<'a, Self::Input, B>,
61 ) -> Self::P<'a, Self::Input, Vec<Self::Output>>
62 where
63 Self::Input: Clone + 'a,
64 Self::Output: Clone + Debug + 'a,
65 B: Clone + Debug + 'a;
66
67 fn of_count_sep<B>(
68 self,
69 n: usize,
70 separator: Self::P<'a, Self::Input, B>,
71 ) -> Self::P<'a, Self::Input, Vec<Self::Output>>
72 where
73 Self::Input: Clone + 'a,
74 Self::Output: Clone + Debug + 'a,
75 B: Clone + Debug + 'a;
76}