oni-comb-parser-rs 1.2.123

A Rust crate for parser combinators
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::core::{Parser, ParserRunner};
use crate::extension::parsers::LazyParsers;
use crate::internal::ParsersImpl;
use std::fmt::Debug;

impl LazyParsers for ParsersImpl {
  #[inline]
  fn lazy<'a, I, A, F>(f: F) -> Self::P<'a, I, A>
  where
    F: Fn() -> Self::P<'a, I, A> + 'a + Clone,
    A: Clone + Debug + 'a, {
    Parser::new(move |parse_state| {
      let parser = f();
      parser.run(parse_state)
    })
  }
}