Add a type def for lexer Result

This commit is contained in:
Eryn Wells 2017-06-18 16:50:14 -07:00
parent d994316392
commit 2a7626c75f

View file

@ -11,6 +11,8 @@ pub use error::Error;
use chars::Lexable;
pub type Result = std::result::Result<Token, Error>;
#[derive(Debug, Eq, PartialEq)]
pub enum Token { LeftParen, RightParen, Id(String), }
@ -44,7 +46,7 @@ impl<T> Lexer<T> where T: Iterator<Item=char> {
}
impl<T> Iterator for Lexer<T> where T: Iterator<Item=char> {
type Item = Result<Token, Error>;
type Item = Result;
fn next(&mut self) -> Option<Self::Item> {
let mut buffer = String::new();