Some more work
This commit is contained in:
parent
a189f34c37
commit
e6e1d14eee
@ -1,6 +1,9 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::{ParseResult, Parser, representation::Representation};
|
||||
use crate::{
|
||||
representation::{Representation, EBNF},
|
||||
ParseResult, Parser,
|
||||
};
|
||||
|
||||
pub fn repeated<P, I, O, E>(parser: P) -> Repeated<P, I, O, E>
|
||||
where
|
||||
@ -102,7 +105,8 @@ where
|
||||
fn representation(&self) -> Representation {
|
||||
let at_least = self.at_least.unwrap_or(0);
|
||||
let at_most = self.at_most.unwrap_or(u32::MAX);
|
||||
Representation::new()
|
||||
let production = EBNF::Repeated(Box::new(self.inner_parser.representation().production()));
|
||||
Representation::new().with_production(production)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ impl fmt::Display for EBNF {
|
||||
EBNF::Nonterminal(name) => write!(f, "{name}"),
|
||||
EBNF::StringTerminal(term) => write!(f, r#""{term}""#),
|
||||
EBNF::LabeledTerminal(s) => write!(f, "<{s}>"),
|
||||
EBNF::Repeated(inner) => write!(f, "[ {inner} ]")
|
||||
EBNF::Repeated(inner) => write!(f, "[ {inner} ]"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user