Merge pull request #43 from tiffany352/unicode-minus-sign

Parse U+2212 as minus sign (Fixes #33)
This commit is contained in:
Tiffany Bennett 2019-10-30 20:39:21 -07:00 committed by GitHub
commit 87495995e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -123,6 +123,7 @@ impl<'a> Iterator for TokenIterator<'a> {
},
_ => Token::Minus
},
'\u{2212}' => Token::Minus,
'/' => match self.0.peek() {
Some(&'/') => loop {
match self.0.next() {

View file

@ -569,3 +569,8 @@ fn test_formula() {
);
test("C60", "C60: molar_mass = 0.72066 kilogram / mole");
}
#[test]
fn test_unicode_minus() {
test("\u{2212}10", "-10 (dimensionless)");
}