oni_comb_parser_rs::prelude

Trait ParserRunner

Source
pub trait ParserRunner<'a> {
    type Input;
    type Output;
    type P<'m, X, Y>: ParserMonad<'m, Input = X, Output = Y>
       where X: 'm;

    // Required methods
    fn parse(
        &self,
        input: &'a [Self::Input],
    ) -> ParseResult<'a, Self::Input, Self::Output>;
    fn run(
        &self,
        param: &ParseState<'a, Self::Input>,
    ) -> ParseResult<'a, Self::Input, Self::Output>;

    // Provided method
    fn parse_as_result(
        &self,
        input: &'a [Self::Input],
    ) -> Result<Self::Output, ParseError<'a, Self::Input>> { ... }
}

Required Associated Types§

Source

type Input

Source

type Output

Source

type P<'m, X, Y>: ParserMonad<'m, Input = X, Output = Y> where X: 'm

Required Methods§

Source

fn parse( &self, input: &'a [Self::Input], ) -> ParseResult<'a, Self::Input, Self::Output>

Analyze input value(for ParseResult).
入力を解析する。

Source

fn run( &self, param: &ParseState<'a, Self::Input>, ) -> ParseResult<'a, Self::Input, Self::Output>

Analyze input value(for ParseResult).
入力を解析する。

Requires ParseState argument.
引数にParseStateが必要です。

Provided Methods§

Source

fn parse_as_result( &self, input: &'a [Self::Input], ) -> Result<Self::Output, ParseError<'a, Self::Input>>

Analyze input value(for Result).
入力を解析する。

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, I, A> ParserRunner<'a> for Parser<'a, I, A>

Source§

type Input = I

Source§

type Output = A

Source§

type P<'m, X, Y> = Parser<'m, X, Y> where X: 'm