Parse <<IMAGINARY_UNIT>>

This commit is contained in:
Tiffany Bennett 2016-08-02 22:50:26 -04:00
parent 51a67f7984
commit 194cb5fdf7

View file

@ -25,6 +25,7 @@ pub enum Token {
RPar,
Plus,
Minus,
ImaginaryUnit,
Error(String),
}
@ -144,6 +145,15 @@ impl<'a> Iterator for TokenIterator<'a> {
},
_ => Token::Error(format!("Unexpected \\"))
},
'<' => {
let mut string = "<IMAGINARY_UNIT>>".chars();
while self.0.next() == string.next() {}
if string.next() == None {
Token::ImaginaryUnit
} else {
Token::Error(format!("Unexpected <"))
}
},
x => {
let mut buf = String::new();
buf.push(x);