mirror of
https://github.com/rm-dr/daisy
synced 2025-08-02 01:34:50 -07:00
Fixed mph/mpg behavior
This commit is contained in:
@ -78,6 +78,8 @@ impl PreToken {
|
||||
"π"|"pi" => { Some(Constant::Pi)},
|
||||
"e" => { Some(Constant::E) },
|
||||
"phi"|"φ" => { Some(Constant::Phi) },
|
||||
"mpg" => { Some(Constant::MPG) },
|
||||
"mph" => { Some(Constant::MPH) },
|
||||
_ => { None }
|
||||
};
|
||||
|
||||
|
@ -1,17 +1,27 @@
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone)]
|
||||
pub enum Constant {
|
||||
// Fake units
|
||||
MPG,
|
||||
MPH,
|
||||
|
||||
// Mathematics
|
||||
Pi,
|
||||
Phi,
|
||||
E
|
||||
E,
|
||||
}
|
||||
|
||||
impl Constant {
|
||||
pub fn to_string(&self) -> String {
|
||||
match self {
|
||||
// Fake units
|
||||
Constant::MPG => { String::from("mpg") },
|
||||
Constant::MPH => { String::from("mph") },
|
||||
|
||||
// Mathematics
|
||||
Constant::Pi => { String::from("π") },
|
||||
Constant::Phi => { String::from("φ") },
|
||||
Constant::E => { String::from("e") },
|
||||
Constant::E => { String::from("e") }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user