pub enum Expr {
Conc(Box<Expr>, Box<Expr>),
Alt(Box<Expr>, Box<Expr>),
Star(Box<Expr>),
Quest(Box<Expr>),
Char(u8),
Dot
}
pub enum ParseError {
TokenError((tokenizer::TokenError, usize))
}
type Result = std::result::Result<Expr, ParseError>;
pub fn parse(input: &[u8]) -> Result {
let mut tokens = tokenizer::scan(input)
.map_err(|x| ParseError::TokenError(x))?
.into_iter()
.peekable();
parse_expr(&mut tokens)
}
fn parse_expr(tokens: &mut Peekable<IntoIter<Token>>) -> Result {
let left = parse_term(tokens)?;
parse_expr_inner(tokens, left)
}
fn parse_expr_inner(tokens: &mut Peekable<IntoIter<Token>>, left: Expr) -> Result {
}
fn parse_term(tokens: &mut Peekable<IntoIter<Token>>) -> Result {
let left = parse_factor(tokens)?;
parse_term_inner(tokens, left)
}
fn parse_term_inner(tokens: &mut Peekable<IntoIter<Token>>, left: Expr) -> Result {
}
fn parse_factor(tokens: &mut Peekable<IntoIter<Token>>) -> Result {
}