mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 13:44:15 +00:00
Fix bug where kg
got parsed as something = kg^-1
This commit is contained in:
parent
3631c19e04
commit
60380852e6
1 changed files with 5 additions and 5 deletions
10
src/eval.rs
10
src/eval.rs
|
@ -102,6 +102,11 @@ impl Context {
|
|||
}
|
||||
|
||||
pub fn lookup(&self, name: &str) -> Option<Value> {
|
||||
for (i, ref k) in self.dimensions.iter().enumerate() {
|
||||
if name == *k {
|
||||
return Some(Value::new_unit(1.0, i))
|
||||
}
|
||||
}
|
||||
self.units.get(name).cloned().or_else(|| {
|
||||
if name.ends_with("s") {
|
||||
if let Some(v) = self.lookup(&name[0..name.len()-1]) {
|
||||
|
@ -116,11 +121,6 @@ impl Context {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (i, ref k) in self.dimensions.iter().enumerate() {
|
||||
if name == *k {
|
||||
return Some(Value::new_unit(1.0, i))
|
||||
}
|
||||
}
|
||||
None
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue