Minor formatting

This commit is contained in:
Patrick Lühne 2020-05-11 03:21:51 +02:00
parent 7832f18ffd
commit 6bf01db51a
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -385,9 +385,11 @@ where
Ok(()) Ok(())
}; };
use foliage::*;
match &self.formula match &self.formula
{ {
foliage::Formula::Exists(exists) => Formula::Exists(exists) =>
{ {
write!(formatter, "?[")?; write!(formatter, "?[")?;
@ -406,7 +408,7 @@ where
write!(formatter, "]: ({:?})", display_formula(&exists.argument))?; write!(formatter, "]: ({:?})", display_formula(&exists.argument))?;
}, },
foliage::Formula::ForAll(for_all) => Formula::ForAll(for_all) =>
{ {
write!(formatter, "![")?; write!(formatter, "![")?;
@ -425,9 +427,8 @@ where
write!(formatter, "]: ({:?})", display_formula(&for_all.argument))?; write!(formatter, "]: ({:?})", display_formula(&for_all.argument))?;
}, },
foliage::Formula::Not(argument) => Formula::Not(argument) => write!(formatter, "~{:?}", display_formula(argument))?,
write!(formatter, "~{:?}", display_formula(argument))?, Formula::And(arguments) =>
foliage::Formula::And(arguments) =>
{ {
write!(formatter, "(")?; write!(formatter, "(")?;
@ -444,7 +445,7 @@ where
write!(formatter, ")")?; write!(formatter, ")")?;
}, },
foliage::Formula::Or(arguments) => Formula::Or(arguments) =>
{ {
write!(formatter, "(")?; write!(formatter, "(")?;
@ -461,10 +462,10 @@ where
write!(formatter, ")")?; write!(formatter, ")")?;
}, },
foliage::Formula::Implies(foliage::Implies{antecedent, implication, ..}) Formula::Implies(Implies{antecedent, implication, ..}) =>
=> write!(formatter, "({:?} => {:?})", display_formula(antecedent), write!(formatter, "({:?} => {:?})", display_formula(antecedent),
display_formula(implication))?, display_formula(implication))?,
foliage::Formula::IfAndOnlyIf(arguments) => match arguments.len() Formula::IfAndOnlyIf(arguments) => match arguments.len()
{ {
0 => write!(formatter, "$true")?, 0 => write!(formatter, "$true")?,
_ => _ =>
@ -498,31 +499,25 @@ where
} }
}, },
}, },
foliage::Formula::Compare( Formula::Compare(Compare{operator: ComparisonOperator::Less, left, right}) =>
foliage::Compare{operator: foliage::ComparisonOperator::Less, left, right}) display_compare(left, right, crate::OperatorNotation::Prefix, "$less",
=> display_compare(left, right, crate::OperatorNotation::Prefix, "$less",
Some("p__less__"))?, Some("p__less__"))?,
foliage::Formula::Compare( Formula::Compare(Compare{operator: ComparisonOperator::LessOrEqual, left, right}) =>
foliage::Compare{operator: foliage::ComparisonOperator::LessOrEqual, left, right}) display_compare(left, right, crate::OperatorNotation::Prefix, "$lesseq",
=> display_compare(left, right, crate::OperatorNotation::Prefix, "$lesseq",
Some("p__less_equal__"))?, Some("p__less_equal__"))?,
foliage::Formula::Compare( Formula::Compare(Compare{operator: ComparisonOperator::Greater, left, right}) =>
foliage::Compare{operator: foliage::ComparisonOperator::Greater, left, right}) display_compare(left, right, crate::OperatorNotation::Prefix, "$greater",
=> display_compare(left, right, crate::OperatorNotation::Prefix, "$greater",
Some("p__greater__"))?, Some("p__greater__"))?,
foliage::Formula::Compare( Formula::Compare(Compare{operator: ComparisonOperator::GreaterOrEqual, left, right}) =>
foliage::Compare{operator: foliage::ComparisonOperator::GreaterOrEqual, left, right}) display_compare(left, right, crate::OperatorNotation::Prefix, "$greatereq",
=> display_compare(left, right, crate::OperatorNotation::Prefix, "$greatereq",
Some("p__greater_equal__"))?, Some("p__greater_equal__"))?,
foliage::Formula::Compare( Formula::Compare(Compare{operator: ComparisonOperator::Equal, left, right}) =>
foliage::Compare{operator: foliage::ComparisonOperator::Equal, left, right}) display_compare(left, right, crate::OperatorNotation::Infix, "=", None)?,
=> display_compare(left, right, crate::OperatorNotation::Infix, "=", None)?, Formula::Compare(Compare{operator: ComparisonOperator::NotEqual, left, right}) =>
foliage::Formula::Compare( display_compare(left, right, crate::OperatorNotation::Infix, "!=", None)?,
foliage::Compare{operator: foliage::ComparisonOperator::NotEqual, left, right}) Formula::Boolean(true) => write!(formatter, "$true")?,
=> display_compare(left, right, crate::OperatorNotation::Infix, "!=", None)?, Formula::Boolean(false) => write!(formatter, "$false")?,
foliage::Formula::Boolean(true) => write!(formatter, "$true")?, Formula::Predicate(predicate) =>
foliage::Formula::Boolean(false) => write!(formatter, "$false")?,
foliage::Formula::Predicate(predicate) =>
{ {
write!(formatter, "{}", predicate.declaration.name)?; write!(formatter, "{}", predicate.declaration.name)?;