mbe: handle multi-character separator

This commit is contained in:
Ryo Yoshida 2022-12-28 00:59:56 +09:00
parent 767351fb87
commit a7d411425c
No known key found for this signature in database
GPG key ID: E25698A930586171
3 changed files with 26 additions and 32 deletions

View file

@ -112,10 +112,9 @@ impl<'a> TtIter<'a> {
match (first.char, second.char, third.map(|it| it.char)) {
('.', '.', Some('.' | '=')) | ('<', '<', Some('=')) | ('>', '>', Some('=')) => {
let puncts = smallvec![first, second.clone(), third.unwrap().clone()];
let _ = self.next().unwrap();
let _ = self.next().unwrap();
Ok(puncts)
Ok(smallvec![first, second.clone(), third.unwrap().clone()])
}
('-' | '!' | '*' | '/' | '&' | '%' | '^' | '+' | '<' | '=' | '>' | '|', '=', _)
| ('-' | '=' | '>', '>', _)
@ -125,9 +124,8 @@ impl<'a> TtIter<'a> {
| ('&', '&', _)
| ('<', '<', _)
| ('|', '|', _) => {
let puncts = smallvec![first, second.clone()];
let _ = self.next().unwrap();
Ok(puncts)
Ok(smallvec![first, second.clone()])
}
_ => Ok(smallvec![first]),
}