Start working on bnf()
This commit is contained in:
parent
a049236300
commit
73845224d5
@ -1 +1,4 @@
|
||||
pub struct Bnf {}
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Bnf {
|
||||
Production,
|
||||
}
|
||||
|
@ -147,6 +147,10 @@ impl<'a, I: ParserInput, O, E> Parser<I, O, E> for BoxedParser<'a, I, O, E> {
|
||||
fn parse(&self, input: I) -> ParseResult<I, O, E> {
|
||||
self.inner.parse(input)
|
||||
}
|
||||
|
||||
fn bnf(&self) -> Option<Bnf> {
|
||||
self.inner.bnf()
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: ParserInput, O, E, F> Parser<I, O, E> for F
|
||||
@ -158,6 +162,19 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: ParserInput, O, E, F> Parser<I, O, E> for (F, Bnf)
|
||||
where
|
||||
F: Fn(I) -> ParseResult<I, O, E>,
|
||||
{
|
||||
fn parse(&self, input: I) -> ParseResult<I, O, E> {
|
||||
self.0(input)
|
||||
}
|
||||
|
||||
fn bnf(&self) -> Option<Bnf> {
|
||||
Some(self.1.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, O, E, T> Parser<I, O, E> for Rc<T>
|
||||
where
|
||||
I: ParserInput,
|
||||
@ -166,4 +183,8 @@ where
|
||||
fn parse(&self, input: I) -> ParseResult<I, O, E> {
|
||||
self.as_ref().parse(input)
|
||||
}
|
||||
|
||||
fn bnf(&self) -> Option<Bnf> {
|
||||
self.as_ref().bnf()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user