diff --git a/src/output/human_readable.rs b/src/output/human_readable.rs index cb5ab04..aff4b8d 100644 --- a/src/output/human_readable.rs +++ b/src/output/human_readable.rs @@ -1,67 +1,3 @@ -pub(crate) struct VariableDeclarationDisplay<'a, 'b, C> -where - C: crate::traits::VariableDeclarationDomain - + crate::traits::VariableDeclarationID -{ - variable_declaration: &'a std::rc::Rc, - context: &'b C, -} - -pub(crate) fn display_variable_declaration<'a, 'b, C>( - variable_declaration: &'a std::rc::Rc, context: &'b C) - -> VariableDeclarationDisplay<'a, 'b, C> -where - C: crate::traits::VariableDeclarationDomain - + crate::traits::VariableDeclarationID -{ - VariableDeclarationDisplay - { - variable_declaration, - context, - } -} - -pub(crate) struct TermDisplay<'a, 'b, C> -{ - parent_precedence: Option, - term: &'a foliage::Term, - context: &'b C, -} - -pub(crate) fn display_term<'a, 'b, C>(term: &'a foliage::Term, parent_precedence: Option, - context: &'b C) - -> TermDisplay<'a, 'b, C> -{ - TermDisplay - { - parent_precedence, - term, - context, - } -} - -pub(crate) struct FormulaDisplay<'a, 'b, C> -{ - parent_precedence: Option, - formula: &'a foliage::Formula, - context: &'b C, -} - -pub(crate) fn display_formula<'a, 'b, C>(formula: &'a foliage::Formula, - parent_precedence: Option, context: &'b C) - -> FormulaDisplay<'a, 'b, C> -where - C: crate::traits::VariableDeclarationDomain - + crate::traits::VariableDeclarationID -{ - FormulaDisplay - { - parent_precedence, - formula, - context, - } -} - trait Precedence { fn precedence(&self) -> i32; @@ -124,6 +60,29 @@ impl Precedence for foliage::Formula } } +pub(crate) struct VariableDeclarationDisplay<'a, 'b, C> +where + C: crate::traits::VariableDeclarationDomain + + crate::traits::VariableDeclarationID +{ + variable_declaration: &'a std::rc::Rc, + context: &'b C, +} + +pub(crate) fn display_variable_declaration<'a, 'b, C>( + variable_declaration: &'a std::rc::Rc, context: &'b C) + -> VariableDeclarationDisplay<'a, 'b, C> +where + C: crate::traits::VariableDeclarationDomain + + crate::traits::VariableDeclarationID +{ + VariableDeclarationDisplay + { + variable_declaration, + context, + } +} + impl<'a, 'b, C> std::fmt::Debug for VariableDeclarationDisplay<'a, 'b, C> where C: crate::traits::VariableDeclarationDomain @@ -156,6 +115,25 @@ where } } +pub(crate) struct TermDisplay<'a, 'b, C> +{ + parent_precedence: Option, + term: &'a foliage::Term, + context: &'b C, +} + +pub(crate) fn display_term<'a, 'b, C>(term: &'a foliage::Term, parent_precedence: Option, + context: &'b C) + -> TermDisplay<'a, 'b, C> +{ + TermDisplay + { + parent_precedence, + term, + context, + } +} + impl<'a, 'b, C> std::fmt::Debug for TermDisplay<'a, 'b, C> where C: crate::traits::VariableDeclarationDomain @@ -254,6 +232,28 @@ where } } +pub(crate) struct FormulaDisplay<'a, 'b, C> +{ + parent_precedence: Option, + formula: &'a foliage::Formula, + context: &'b C, +} + +pub(crate) fn display_formula<'a, 'b, C>(formula: &'a foliage::Formula, + parent_precedence: Option, context: &'b C) + -> FormulaDisplay<'a, 'b, C> +where + C: crate::traits::VariableDeclarationDomain + + crate::traits::VariableDeclarationID +{ + FormulaDisplay + { + parent_precedence, + formula, + context, + } +} + impl<'a, 'b, C> std::fmt::Debug for FormulaDisplay<'a, 'b, C> where C: crate::traits::VariableDeclarationDomain diff --git a/src/output/tptp.rs b/src/output/tptp.rs index b0306ea..7c4808f 100644 --- a/src/output/tptp.rs +++ b/src/output/tptp.rs @@ -56,44 +56,6 @@ where } } -pub(crate) struct TermDisplay<'a, 'b, C> -{ - term: &'a foliage::Term, - context: &'b C, -} - -pub(crate) fn display_term<'a, 'b, C>(term: &'a foliage::Term, context: &'b C) - -> TermDisplay<'a, 'b, C> -where - C: crate::traits::VariableDeclarationDomain - + crate::traits::VariableDeclarationID -{ - TermDisplay - { - term, - context, - } -} - -pub(crate) struct FormulaDisplay<'a, 'b, C> -{ - formula: &'a foliage::Formula, - context: &'b C, -} - -pub(crate) fn display_formula<'a, 'b, C>(formula: &'a foliage::Formula, context: &'b C) - -> FormulaDisplay<'a, 'b, C> -where - C: crate::traits::VariableDeclarationDomain - + crate::traits::VariableDeclarationID -{ - FormulaDisplay - { - formula, - context, - } -} - impl<'a, 'b, C> std::fmt::Debug for VariableDeclarationDisplay<'a, 'b, C> where C: crate::traits::VariableDeclarationDomain @@ -126,6 +88,25 @@ where } } +pub(crate) struct TermDisplay<'a, 'b, C> +{ + term: &'a foliage::Term, + context: &'b C, +} + +pub(crate) fn display_term<'a, 'b, C>(term: &'a foliage::Term, context: &'b C) + -> TermDisplay<'a, 'b, C> +where + C: crate::traits::VariableDeclarationDomain + + crate::traits::VariableDeclarationID +{ + TermDisplay + { + term, + context, + } +} + impl<'a, 'b, C> std::fmt::Debug for TermDisplay<'a, 'b, C> where C: crate::traits::VariableDeclarationDomain @@ -208,6 +189,25 @@ where } } +pub(crate) struct FormulaDisplay<'a, 'b, C> +{ + formula: &'a foliage::Formula, + context: &'b C, +} + +pub(crate) fn display_formula<'a, 'b, C>(formula: &'a foliage::Formula, context: &'b C) + -> FormulaDisplay<'a, 'b, C> +where + C: crate::traits::VariableDeclarationDomain + + crate::traits::VariableDeclarationID +{ + FormulaDisplay + { + formula, + context, + } +} + impl<'a, 'b, C> std::fmt::Debug for FormulaDisplay<'a, 'b, C> where C: crate::traits::InputConstantDeclarationDomain