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