oni_comb_parser_rs/extension/parser/
operator_parser.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
use crate::core::ParserRunner;
use std::fmt::Debug;

pub trait OperatorParser<'a>: ParserRunner<'a> {
  fn and_then<B>(self, other: Self::P<'a, Self::Input, B>) -> Self::P<'a, Self::Input, (Self::Output, B)>
  where
    Self::Output: Clone + Debug + 'a,
    B: Clone + Debug + 'a;

  fn or(self, other: Self::P<'a, Self::Input, Self::Output>) -> Self::P<'a, Self::Input, Self::Output>
  where
    Self::Output: Debug + 'a;

  fn exists(self) -> Self::P<'a, Self::Input, bool>
  where
    Self::Output: Debug + 'a;

  fn not(self) -> Self::P<'a, Self::Input, ()>
  where
    Self::Output: Debug + 'a;

  fn opt(self) -> Self::P<'a, Self::Input, Option<Self::Output>>
  where
    Self::Output: Clone + Debug + 'a;

  fn attempt(self) -> Self::P<'a, Self::Input, Self::Output>
  where
    Self::Output: Debug + 'a;

  fn scan_right1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;

  fn chain_right0<BOP>(
    self,
    op: Self::P<'a, Self::Input, BOP>,
    x: Self::Output,
  ) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;

  fn chain_left0<BOP>(
    self,
    op: Self::P<'a, Self::Input, BOP>,
    x: Self::Output,
  ) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;

  fn chain_right1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;

  fn chain_left1<BOP>(self, op: Self::P<'a, Self::Input, BOP>) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;

  fn rest_right1<BOP>(
    self,
    op: Self::P<'a, Self::Input, BOP>,
    x: Self::Output,
  ) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;

  fn rest_left1<BOP>(
    self,
    op: Self::P<'a, Self::Input, BOP>,
    x: Self::Output,
  ) -> Self::P<'a, Self::Input, Self::Output>
  where
    BOP: Fn(Self::Output, Self::Output) -> Self::Output + 'a,
    Self::Output: Clone + Debug + 'a;
}