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:
parent
551c35ed75
commit
153f77621e
@ -15,6 +15,8 @@ impl Precedence for crate::Term
|
|||||||
| Self::Integer(_)
|
| Self::Integer(_)
|
||||||
| Self::String(_)
|
| Self::String(_)
|
||||||
| Self::Variable(_)
|
| Self::Variable(_)
|
||||||
|
| Self::UnaryOperation(
|
||||||
|
crate::UnaryOperation{operator: crate::UnaryOperator::AbsoluteValue, ..})
|
||||||
=> 0,
|
=> 0,
|
||||||
Self::UnaryOperation(
|
Self::UnaryOperation(
|
||||||
crate::UnaryOperation{operator: crate::UnaryOperator::Negative, ..})
|
crate::UnaryOperation{operator: crate::UnaryOperator::Negative, ..})
|
||||||
@ -33,9 +35,6 @@ impl Precedence for crate::Term
|
|||||||
| Self::BinaryOperation(
|
| Self::BinaryOperation(
|
||||||
crate::BinaryOperation{operator: crate::BinaryOperator::Subtract, ..})
|
crate::BinaryOperation{operator: crate::BinaryOperator::Subtract, ..})
|
||||||
=> 4,
|
=> 4,
|
||||||
Self::UnaryOperation(
|
|
||||||
crate::UnaryOperation{operator: crate::UnaryOperator::AbsoluteValue, ..})
|
|
||||||
=> 5,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user