mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-13 06:57:07 +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,
|
RPar,
|
||||||
Plus,
|
Plus,
|
||||||
Minus,
|
Minus,
|
||||||
|
ImaginaryUnit,
|
||||||
Error(String),
|
Error(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +145,15 @@ impl<'a> Iterator for TokenIterator<'a> {
|
||||||
},
|
},
|
||||||
_ => Token::Error(format!("Unexpected \\"))
|
_ => 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 => {
|
x => {
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
buf.push(x);
|
buf.push(x);
|
||||||
|
|
Loading…
Reference in a new issue