[][src]Trait parser_fuck::Parser

pub trait Parser<I: TimeTravel> {
    type Output;
    fn parse(&self, input: I) -> Option<Self::Output>;

    fn map<U, F>(self, f: F) -> Map<Self, I, F>
    where
        Self: Sized,
        F: FnMut(Self::Output) -> U
, { ... }
fn and<B>(self, b: B) -> And<Self, B, I>
    where
        Self: Sized,
        B: Parser<I>
, { ... }
fn or<B>(self, b: B) -> Or<Self, B, I>
    where
        Self: Sized,
        B: Parser<I, Output = Self::Output>
, { ... }
fn not(self) -> Not<Self, I>
    where
        Self: Sized
, { ... }
fn many(self) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn many1(self) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn many_min(self, min: usize) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn many_max(self, max: usize) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn many1_max(self, max: usize) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn many_min_max(self, min: usize, max: usize) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn some(self, count: usize) -> Many<Self, I>
    where
        Self: Sized
, { ... }
fn may(self) -> May<Self, I>
    where
        Self: Sized
, { ... }
fn iter(self) -> Iter<Self, I>
    where
        Self: Sized
, { ... }
fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>
    where
        Self: Sized,
        U: Parser<I>,
        F: FnMut(Self::Output) -> U
, { ... }
fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>
    where
        Self: Sized,
        U: Parser<I, Output = Self::Output>,
        F: FnMut() -> U
, { ... }
fn or_trans<F>(self, f: F) -> OrTrans<Self, I, F>
    where
        Self: Sized,
        F: FnMut(I, Range<usize>) -> Self::Output
, { ... }
fn dyns(self) -> Dyn<I, Self::Output>
    where
        Self: Sized + 'static
, { ... } }

Abstract Parser with chain call

Associated Types

type Output

Loading content...

Required methods

fn parse(&self, input: I) -> Option<Self::Output>

do parse

Loading content...

Provided methods

fn map<U, F>(self, f: F) -> Map<Self, I, F> where
    Self: Sized,
    F: FnMut(Self::Output) -> U, 

Map a Parser<Output = T> to Parser<Output = U> by applying a function to a contained value

fn and<B>(self, b: B) -> And<Self, B, I> where
    Self: Sized,
    B: Parser<I>, 

Only pass if both subparsers pass

fn or<B>(self, b: B) -> Or<Self, B, I> where
    Self: Sized,
    B: Parser<I, Output = Self::Output>, 

Pass when any subparser passes

fn not(self) -> Not<Self, I> where
    Self: Sized

Pass if the subparser fail

fn many(self) -> Many<Self, I> where
    Self: Sized

*, >= 0

fn many1(self) -> Many<Self, I> where
    Self: Sized

+, >= 1

fn many_min(self, min: usize) -> Many<Self, I> where
    Self: Sized

{n,}, >= n

fn many_max(self, max: usize) -> Many<Self, I> where
    Self: Sized

{,m}, <= m

fn many1_max(self, max: usize) -> Many<Self, I> where
    Self: Sized

{1,m}, >= 1 && <= m

fn many_min_max(self, min: usize, max: usize) -> Many<Self, I> where
    Self: Sized

{n,m}, >= n && <= m

fn some(self, count: usize) -> Many<Self, I> where
    Self: Sized

{n}, == n

fn may(self) -> May<Self, I> where
    Self: Sized

?, 0 or 1

fn iter(self) -> Iter<Self, I> where
    Self: Sized

Continuously parse into iterators

fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F> where
    Self: Sized,
    U: Parser<I>,
    F: FnMut(Self::Output) -> U, 

Fail if the subparser fail, otherwise calls f with the new Parser and parse the Parser

fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F> where
    Self: Sized,
    U: Parser<I, Output = Self::Output>,
    F: FnMut() -> U, 

Pass if subparser pass, otherwise calls f and parse the result Parser

fn or_trans<F>(self, f: F) -> OrTrans<Self, I, F> where
    Self: Sized,
    F: FnMut(I, Range<usize>) -> Self::Output

Pass if subparser pass, otherwise calls f with error point

fn dyns(self) -> Dyn<I, Self::Output> where
    Self: Sized + 'static, 

Wrap to dynamic

Loading content...

Implementors

impl<B: Parser<I>, I: TimeTravel, F> Parser<I> for OrTrans<B, I, F> where
    F: FnMut(I, Range<usize>) -> B::Output
[src]

type Output = B::Output

impl<B: Parser<I>, I: TimeTravel, U, F> Parser<I> for AndThen<B, I, F> where
    U: Parser<I>,
    F: FnMut(B::Output) -> U, 
[src]

type Output = U::Output

impl<B: Parser<I>, I: TimeTravel, U, F> Parser<I> for Map<B, I, F> where
    F: FnMut(B::Output) -> U, 
[src]

type Output = U

impl<B: Parser<I>, I: TimeTravel, U, F> Parser<I> for OrElse<B, I, F> where
    U: Parser<I, Output = B::Output>,
    F: FnMut() -> U, 
[src]

type Output = B::Output

impl<I, F> Parser<I> for Satisfy<F, I> where
    I: TimeTravel,
    F: FnMut(I::Item) -> bool
[src]

type Output = Range<usize>

impl<I, U, F> Parser<I> for F where
    I: TimeTravel,
    F: Fn(I) -> Option<U>, 
[src]

type Output = U

impl<I: TimeTravel, A> Parser<I> for Many<A, I> where
    A: Parser<I>, 
[src]

type Output = Vec<A::Output>

impl<I: TimeTravel, A> Parser<I> for May<A, I> where
    A: Parser<I>, 
[src]

type Output = Option<A::Output>

impl<I: TimeTravel, A> Parser<I> for Not<A, I> where
    A: Parser<I>, 
[src]

type Output = ()

impl<I: TimeTravel, A, B> Parser<I> for And<A, B, I> where
    A: Parser<I>,
    B: Parser<I>, 
[src]

type Output = (A::Output, B::Output)

impl<I: TimeTravel, A, B> Parser<I> for Or<A, B, I> where
    A: Parser<I>,
    B: Parser<I, Output = A::Output>, 
[src]

type Output = A::Output

impl<I: TimeTravel, A: Clone> Parser<I> for Iter<A, I> where
    A: Parser<I>, 
[src]

type Output = ParserIter<A, I>

impl<I: TimeTravel, O> Parser<I> for Dyn<I, O>[src]

type Output = O

impl<I: TimeTravel, T> Parser<I> for One<T> where
    I::Item: PartialEq<T>, 
[src]

type Output = Range<usize>

impl<I: TimeTravel, T> Parser<I> for Sub<T> where
    I::Item: PartialEq<T>, 
[src]

type Output = Range<usize>

Loading content...