Minor restructuring
This commit is contained in:
parent
ce19860325
commit
6d489e457f
@ -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<foliage::VariableDeclaration>,
|
|
||||||
context: &'b C,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn display_variable_declaration<'a, 'b, C>(
|
|
||||||
variable_declaration: &'a std::rc::Rc<foliage::VariableDeclaration>, 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<i32>,
|
|
||||||
term: &'a foliage::Term,
|
|
||||||
context: &'b C,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn display_term<'a, 'b, C>(term: &'a foliage::Term, parent_precedence: Option<i32>,
|
|
||||||
context: &'b C)
|
|
||||||
-> TermDisplay<'a, 'b, C>
|
|
||||||
{
|
|
||||||
TermDisplay
|
|
||||||
{
|
|
||||||
parent_precedence,
|
|
||||||
term,
|
|
||||||
context,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) struct FormulaDisplay<'a, 'b, C>
|
|
||||||
{
|
|
||||||
parent_precedence: Option<i32>,
|
|
||||||
formula: &'a foliage::Formula,
|
|
||||||
context: &'b C,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn display_formula<'a, 'b, C>(formula: &'a foliage::Formula,
|
|
||||||
parent_precedence: Option<i32>, context: &'b C)
|
|
||||||
-> FormulaDisplay<'a, 'b, C>
|
|
||||||
where
|
|
||||||
C: crate::traits::VariableDeclarationDomain
|
|
||||||
+ crate::traits::VariableDeclarationID
|
|
||||||
{
|
|
||||||
FormulaDisplay
|
|
||||||
{
|
|
||||||
parent_precedence,
|
|
||||||
formula,
|
|
||||||
context,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Precedence
|
trait Precedence
|
||||||
{
|
{
|
||||||
fn precedence(&self) -> i32;
|
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<foliage::VariableDeclaration>,
|
||||||
|
context: &'b C,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn display_variable_declaration<'a, 'b, C>(
|
||||||
|
variable_declaration: &'a std::rc::Rc<foliage::VariableDeclaration>, 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>
|
impl<'a, 'b, C> std::fmt::Debug for VariableDeclarationDisplay<'a, 'b, C>
|
||||||
where
|
where
|
||||||
C: crate::traits::VariableDeclarationDomain
|
C: crate::traits::VariableDeclarationDomain
|
||||||
@ -156,6 +115,25 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) struct TermDisplay<'a, 'b, C>
|
||||||
|
{
|
||||||
|
parent_precedence: Option<i32>,
|
||||||
|
term: &'a foliage::Term,
|
||||||
|
context: &'b C,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn display_term<'a, 'b, C>(term: &'a foliage::Term, parent_precedence: Option<i32>,
|
||||||
|
context: &'b C)
|
||||||
|
-> TermDisplay<'a, 'b, C>
|
||||||
|
{
|
||||||
|
TermDisplay
|
||||||
|
{
|
||||||
|
parent_precedence,
|
||||||
|
term,
|
||||||
|
context,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, 'b, C> std::fmt::Debug for TermDisplay<'a, 'b, C>
|
impl<'a, 'b, C> std::fmt::Debug for TermDisplay<'a, 'b, C>
|
||||||
where
|
where
|
||||||
C: crate::traits::VariableDeclarationDomain
|
C: crate::traits::VariableDeclarationDomain
|
||||||
@ -254,6 +232,28 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) struct FormulaDisplay<'a, 'b, C>
|
||||||
|
{
|
||||||
|
parent_precedence: Option<i32>,
|
||||||
|
formula: &'a foliage::Formula,
|
||||||
|
context: &'b C,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn display_formula<'a, 'b, C>(formula: &'a foliage::Formula,
|
||||||
|
parent_precedence: Option<i32>, 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>
|
impl<'a, 'b, C> std::fmt::Debug for FormulaDisplay<'a, 'b, C>
|
||||||
where
|
where
|
||||||
C: crate::traits::VariableDeclarationDomain
|
C: crate::traits::VariableDeclarationDomain
|
||||||
|
@ -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>
|
impl<'a, 'b, C> std::fmt::Debug for VariableDeclarationDisplay<'a, 'b, C>
|
||||||
where
|
where
|
||||||
C: crate::traits::VariableDeclarationDomain
|
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>
|
impl<'a, 'b, C> std::fmt::Debug for TermDisplay<'a, 'b, C>
|
||||||
where
|
where
|
||||||
C: crate::traits::VariableDeclarationDomain
|
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>
|
impl<'a, 'b, C> std::fmt::Debug for FormulaDisplay<'a, 'b, C>
|
||||||
where
|
where
|
||||||
C: crate::traits::InputConstantDeclarationDomain
|
C: crate::traits::InputConstantDeclarationDomain
|
||||||
|
Loading…
Reference in New Issue
Block a user