Export formatting implementation functionality
This commit is contained in:
parent
1e610a77fe
commit
1e34d726e1
@ -1,5 +1,5 @@
|
||||
mod formulas;
|
||||
mod terms;
|
||||
pub mod formulas;
|
||||
pub mod terms;
|
||||
|
||||
pub trait Format
|
||||
{
|
||||
@ -19,3 +19,19 @@ impl Format for DefaultFormat
|
||||
write!(formatter, "{:?}", variable_declaration)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn display_term<'term, 'format, F>(term: &'term crate::Term, format: &'format F)
|
||||
-> terms::TermDisplay<'term, 'format, F>
|
||||
where
|
||||
F: Format,
|
||||
{
|
||||
terms::display_term(term, None, terms::TermPosition::Any, format)
|
||||
}
|
||||
|
||||
pub fn display_formula<'formula, 'format, F>(formula: &'formula crate::Formula, format: &'format F)
|
||||
-> formulas::FormulaDisplay<'formula, 'format, F>
|
||||
where
|
||||
F: Format,
|
||||
{
|
||||
formulas::display_formula(formula, None, formulas::FormulaPosition::Any, format)
|
||||
}
|
||||
|
@ -29,13 +29,13 @@ impl std::fmt::Display for crate::PredicateDeclaration
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
enum FormulaPosition
|
||||
pub(crate) enum FormulaPosition
|
||||
{
|
||||
Any,
|
||||
ImpliesAntecedent,
|
||||
}
|
||||
|
||||
struct FormulaDisplay<'formula, 'format, F>
|
||||
pub struct FormulaDisplay<'formula, 'format, F>
|
||||
where
|
||||
F: super::Format,
|
||||
{
|
||||
@ -117,7 +117,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn display_formula<'formula, 'format, F>(formula: &'formula crate::Formula,
|
||||
pub(crate) fn display_formula<'formula, 'format, F>(formula: &'formula crate::Formula,
|
||||
parent_formula: Option<&'formula crate::Formula>, position: FormulaPosition, format: &'format F)
|
||||
-> FormulaDisplay<'formula, 'format, F>
|
||||
where
|
||||
|
@ -58,7 +58,7 @@ pub(crate) enum TermPosition
|
||||
Right,
|
||||
}
|
||||
|
||||
pub(crate) struct TermDisplay<'term, 'format, F>
|
||||
pub struct TermDisplay<'term, 'format, F>
|
||||
where
|
||||
F: super::Format,
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user