mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 13:44:15 +00:00
Parse <<IMAGINARY_UNIT>>
This commit is contained in:
parent
51a67f7984
commit
194cb5fdf7
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue