Fix precedence of absolute value operation

As the absolute value operation has its own type of parentheses, it
never needs to take precedence over other terms in order to be displayed
correctly. To avoid extraneous parentheses around absolute value
operations, set its precedence level to 0.
This commit is contained in:
Patrick Lühne 2020-03-30 06:42:54 +02:00
parent 551c35ed75
commit 153f77621e
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 2 additions and 3 deletions

View File

@ -15,6 +15,8 @@ impl Precedence for crate::Term
| Self::Integer(_)
| Self::String(_)
| Self::Variable(_)
| Self::UnaryOperation(
crate::UnaryOperation{operator: crate::UnaryOperator::AbsoluteValue, ..})
=> 0,
Self::UnaryOperation(
crate::UnaryOperation{operator: crate::UnaryOperator::Negative, ..})
@ -33,9 +35,6 @@ impl Precedence for crate::Term
| Self::BinaryOperation(
crate::BinaryOperation{operator: crate::BinaryOperator::Subtract, ..})
=> 4,
Self::UnaryOperation(
crate::UnaryOperation{operator: crate::UnaryOperator::AbsoluteValue, ..})
=> 5,
}
}
}