Make parser input more complex

This commit is contained in:
Greg Shuflin 2022-10-23 00:41:51 -07:00
parent f0e1d2b045
commit 6ac19c8989
2 changed files with 13 additions and 5 deletions

View File

@ -1,18 +1,15 @@
mod boxed_parser;
mod named_parser;
mod parser_input;
use std::rc::Rc;
pub use boxed_parser::BoxedParser;
pub use named_parser::NamedParser;
pub use parser_input::ParserInput;
pub type ParseResult<I, O, E> = Result<(O, I), E>;
pub trait ParserInput: std::fmt::Debug {}
impl ParserInput for &str {}
impl ParserInput for String {}
pub trait Parser<I, O, E>
where
I: ParserInput,

View File

@ -0,0 +1,11 @@
pub trait ParserInput: std::fmt::Debug {
type Output;
fn next_token() -> Self::Output;
}
impl ParserInput for &str {
type Output = ();
fn next_token() -> Self::Output {
()
}
}