Fix implication parser and output
This commit is contained in:
@@ -66,6 +66,18 @@ impl Precedence for crate::Formula
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for crate::ImplicationDirection
|
||||
{
|
||||
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
|
||||
{
|
||||
match &self
|
||||
{
|
||||
crate::ImplicationDirection::LeftToRight => write!(format, "left to right"),
|
||||
crate::ImplicationDirection::RightToLeft => write!(format, "right to left"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for crate::SpecialInteger
|
||||
{
|
||||
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
|
||||
@@ -391,14 +403,15 @@ impl<'formula> std::fmt::Debug for FormulaDisplay<'formula>
|
||||
},
|
||||
crate::Formula::Implies(crate::Implies{direction, antecedent, implication}) =>
|
||||
{
|
||||
let operator_symbol = match direction
|
||||
match direction
|
||||
{
|
||||
crate::ImplicationDirection::LeftToRight => "->",
|
||||
crate::ImplicationDirection::RightToLeft => "<-",
|
||||
crate::ImplicationDirection::LeftToRight =>
|
||||
write!(format, "{:?} -> {:?}", display_formula(antecedent, precedence),
|
||||
display_formula(implication, precedence))?,
|
||||
crate::ImplicationDirection::RightToLeft =>
|
||||
write!(format, "{:?} <- {:?}", display_formula(implication, precedence),
|
||||
display_formula(antecedent, precedence))?,
|
||||
};
|
||||
|
||||
write!(format, "{:?} {} {:?}", display_formula(antecedent, precedence),
|
||||
operator_symbol, display_formula(implication, precedence))?;
|
||||
},
|
||||
crate::Formula::IfAndOnlyIf(arguments) =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user