oni_comb_parser_rs/internal/parser_impl/
operator_parser_impl.rs

1use std::fmt::Debug;
2
3use crate::core::Parser;
4use crate::extension::parser::OperatorParser;
5use crate::extension::parsers::OperatorParsers;
6use crate::internal::ParsersImpl;
7
8impl<'a, I, A> OperatorParser<'a> for Parser<'a, I, A> {
9  fn and_then<B>(self, pb: Self::P<'a, Self::Input, B>) -> Self::P<'a, Self::Input, (Self::Output, B)>
10  where
11    Self::Output: Clone + Debug + 'a,
12    B: Clone + Debug + 'a, {
13    ParsersImpl::and_then(self, pb)
14  }
15
16  fn or(self, pb: Self::P<'a, Self::Input, Self::Output>) -> Self::P<'a, Self::Input, Self::Output>
17  where
18    Self::Output: Debug + 'a, {
19    ParsersImpl::or(self, pb)
20  }
21
22  fn exists(self) -> Self::P<'a, Self::Input, bool>
23  where
24    Self::Output: Debug + 'a, {
25    ParsersImpl::exists(self)
26  }
27
28  fn not(self) -> Self::P<'a, Self::Input, ()>
29  where
30    Self::Output: Debug + 'a, {
31    ParsersImpl::not(self)
32  }
33
34  fn opt(self) -> Self::P<'a, Self::Input, Option<Self::Output>>
35  where
36    Self::Output: Clone + Debug + 'a, {
37    ParsersImpl::opt(self)
38  }
39
40  fn attempt(self) -> Self::P<'a, Self::Input, Self::Output>
41  where
42    Self::Output: Debug + 'a, {
43    ParsersImpl::attempt(self)
44  }
45
46  fn scan_right1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
47  where
48    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
49    Self::Output: Clone + Debug + 'a, {
50    ParsersImpl::chain_right1(self, op)
51  }
52
53  fn chain_right0<BOP>(
54    self,
55    op: Self::P<'a, Self::Input, BOP>,
56    x: Self::Output,
57  ) -> Self::P<'a, Self::Input, Self::Output>
58  where
59    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
60    Self::Output: Clone + Debug + 'a, {
61    ParsersImpl::chain_right0(self, op, x)
62  }
63
64  fn chain_left0<BOP>(
65    self,
66    op: Self::P<'a, Self::Input, BOP>,
67    x: Self::Output,
68  ) -> Self::P<'a, Self::Input, Self::Output>
69  where
70    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
71    Self::Output: Clone + Debug + 'a, {
72    ParsersImpl::chain_left0(self, op, x)
73  }
74
75  fn chain_right1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
76  where
77    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
78    Self::Output: Clone + Debug + 'a, {
79    ParsersImpl::chain_right1(self, op)
80  }
81
82  fn chain_left1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
83  where
84    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
85    Self::Output: Clone + Debug + 'a, {
86    ParsersImpl::chain_left1(self, op)
87  }
88
89  fn rest_right1<BOP>(
90    self,
91    op: Self::P<'a, Self::Input, BOP>,
92    x: Self::Output,
93  ) -> Self::P<'a, Self::Input, Self::Output>
94  where
95    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
96    Self::Output: Clone + Debug + 'a, {
97    ParsersImpl::rest_right1(self, op, x)
98  }
99
100  fn rest_left1<BOP>(
101    self,
102    op: Self::P<'a, Self::Input, BOP>,
103    x: Self::Output,
104  ) -> Self::P<'a, Self::Input, Self::Output>
105  where
106    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a + Clone,
107    Self::Output: Clone + Debug + 'a, {
108    ParsersImpl::rest_left1(self, op, x)
109  }
110}