oni_comb_parser_rs/extension/parser/
operator_parser.rs1use crate::core::ParserRunner;
2use std::fmt::Debug;
3
4pub trait OperatorParser<'a>: ParserRunner<'a> {
5 fn and_then<B>(self, other: Self::P<'a, Self::Input, B>) -> Self::P<'a, Self::Input, (Self::Output, B)>
6 where
7 Self::Output: Clone + Debug + 'a,
8 B: Clone + Debug + 'a;
9
10 fn or(self, other: Self::P<'a, Self::Input, Self::Output>) -> Self::P<'a, Self::Input, Self::Output>
11 where
12 Self::Output: Debug + 'a;
13
14 fn exists(self) -> Self::P<'a, Self::Input, bool>
15 where
16 Self::Output: Debug + 'a;
17
18 fn not(self) -> Self::P<'a, Self::Input, ()>
19 where
20 Self::Output: Debug + 'a;
21
22 fn opt(self) -> Self::P<'a, Self::Input, Option<Self::Output>>
23 where
24 Self::Output: Clone + Debug + 'a;
25
26 fn attempt(self) -> Self::P<'a, Self::Input, Self::Output>
27 where
28 Self::Output: Debug + 'a;
29
30 fn scan_right1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
31 where
32 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
33 Self::Output: Clone + Debug + 'a;
34
35 fn chain_right0<BOP>(
36 self,
37 op: Self::P<'a, Self::Input, BOP>,
38 x: Self::Output,
39 ) -> Self::P<'a, Self::Input, Self::Output>
40 where
41 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
42 Self::Output: Clone + Debug + 'a;
43
44 fn chain_left0<BOP>(
45 self,
46 op: Self::P<'a, Self::Input, BOP>,
47 x: Self::Output,
48 ) -> Self::P<'a, Self::Input, Self::Output>
49 where
50 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
51 Self::Output: Clone + Debug + 'a;
52
53 fn chain_right1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
54 where
55 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
56 Self::Output: Clone + Debug + 'a;
57
58 fn chain_left1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
59 where
60 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
61 Self::Output: Clone + Debug + 'a;
62
63 fn rest_right1<BOP>(
64 self,
65 op: Self::P<'a, Self::Input, BOP>,
66 x: Self::Output,
67 ) -> Self::P<'a, Self::Input, Self::Output>
68 where
69 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
70 Self::Output: Clone + Debug + 'a;
71
72 fn rest_left1<BOP>(
73 self,
74 op: Self::P<'a, Self::Input, BOP>,
75 x: Self::Output,
76 ) -> Self::P<'a, Self::Input, Self::Output>
77 where
78 BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
79 Self::Output: Clone + Debug + 'a;
80}