Add a type def for lexer Result
This commit is contained in:
parent
d994316392
commit
2a7626c75f
1 changed files with 3 additions and 1 deletions
|
@ -11,6 +11,8 @@ pub use error::Error;
|
||||||
|
|
||||||
use chars::Lexable;
|
use chars::Lexable;
|
||||||
|
|
||||||
|
pub type Result = std::result::Result<Token, Error>;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub enum Token { LeftParen, RightParen, Id(String), }
|
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> {
|
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> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
let mut buffer = String::new();
|
let mut buffer = String::new();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue