oni_comb_parser_rs/core/
parser_runner.rs1use crate::core::ParserMonad;
2use crate::core::{ParseError, ParseResult, ParseState};
3
4pub trait ParserRunner<'a> {
5 type Input;
6 type Output;
7 type P<'m, X, Y: 'm>: ParserMonad<'m, Input = X, Output = Y>
8 where
9 X: 'm;
10
11 fn parse(&self, input: &'a [Self::Input]) -> ParseResult<'a, Self::Input, Self::Output>;
14
15 fn parse_as_result(&self, input: &'a [Self::Input]) -> Result<Self::Output, ParseError<'a, Self::Input>> {
18 self.parse(input).to_result()
19 }
20
21 fn run(&self, param: &ParseState<'a, Self::Input>) -> ParseResult<'a, Self::Input, Self::Output>;
27}