oni_comb_parser_rs/extension/parsers/
operator_parsers.rsuse std::fmt::Debug;
use crate::core::Parsers;
pub trait OperatorParsers: Parsers {
fn exists<'a, I, A>(parser: Self::P<'a, I, A>) -> Self::P<'a, I, bool>
where
A: Debug + 'a;
fn not<'a, I, A>(parser: Self::P<'a, I, A>) -> Self::P<'a, I, ()>
where
A: Debug + 'a;
fn opt<'a, I, A>(parser: Self::P<'a, I, A>) -> Self::P<'a, I, Option<A>>
where
A: Clone + Debug + 'a, {
Self::or(Self::map(Self::attempt(parser), Some), Self::successful(None))
}
fn or<'a, I, A>(parser1: Self::P<'a, I, A>, parser2: Self::P<'a, I, A>) -> Self::P<'a, I, A>
where
A: Debug + 'a;
fn and_then<'a, I, A, B>(parser1: Self::P<'a, I, A>, parser2: Self::P<'a, I, B>) -> Self::P<'a, I, (A, B)>
where
A: Clone + Debug + 'a,
B: Clone + Debug + 'a;
fn attempt<'a, I, A>(parser: Self::P<'a, I, A>) -> Self::P<'a, I, A>
where
A: Debug + 'a;
fn scan_right1<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a;
fn chain_right0<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>, x: A) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a, {
Self::or(Self::chain_right1(p, op), Self::successful(x.clone()))
}
fn chain_left0<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>, x: A) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a, {
Self::or(Self::chain_left1(p, op), Self::successful(x.clone()))
}
fn chain_right1<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a, {
Self::scan_right1(p, op)
}
fn chain_left1<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a;
fn rest_right1<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>, x: A) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a;
fn rest_left1<'a, I, A, BOP>(p: Self::P<'a, I, A>, op: Self::P<'a, I, BOP>, x: A) -> Self::P<'a, I, A>
where
BOP: Fn(A, A) -> A + 'a,
A: Clone + Debug + 'a;
}