diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 00eb190..e0c8eb3 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -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 = Result<(O, I), E>; -pub trait ParserInput: std::fmt::Debug {} - -impl ParserInput for &str {} -impl ParserInput for String {} - pub trait Parser where I: ParserInput, diff --git a/src/parser/parser_input.rs b/src/parser/parser_input.rs new file mode 100644 index 0000000..0784227 --- /dev/null +++ b/src/parser/parser_input.rs @@ -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 { + () + } +}