feat: recognize dedicated minus sign

> As per Unicode 17.0.0, the ASCII hyphen-minus is not a mathematical symbol. To express the minus sign in math, U+2212 − MINUS SIGN is used instead.

https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode#cite_ref-7
This commit is contained in:
electria 2026-07-21 14:23:37 -07:00
commit 431ea5b67e
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -22,7 +22,7 @@ impl TryFrom<char> for Operator {
fn try_from(value: char) -> Result<Self, Self::Error> { fn try_from(value: char) -> Result<Self, Self::Error> {
match value { match value {
'+' => Ok(Self::Plus), '+' => Ok(Self::Plus),
'-' => Ok(Self::Minus), '-' | '' => Ok(Self::Minus),
'*' | '×' => Ok(Self::Mult), '*' | '×' => Ok(Self::Mult),
'/' | '÷' => Ok(Self::Div), '/' | '÷' => Ok(Self::Div),
'^' => Ok(Self::Exp), '^' => Ok(Self::Exp),