diff options
Diffstat (limited to 'chain/src/lib.rs')
-rw-r--r-- | chain/src/lib.rs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/chain/src/lib.rs b/chain/src/lib.rs index a3d420b..916678f 100644 --- a/chain/src/lib.rs +++ b/chain/src/lib.rs @@ -10,9 +10,16 @@ pub mod atom; -use graph::{error::Error as GError, LabelExtGraph, Parent}; +pub mod item; -use forest::Error as ForestError; +// TODO: We need a module for items, that serve the role of the +// forests now. + +use graph::{error::Error as GError, LabelExtGraph}; + +use item::default::Error as ForestError; + +use item::PaSe; /// An edge in the Chain-Rule machine. #[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] @@ -20,14 +27,14 @@ pub struct Edge { /// The position in the atomic languages. label: usize, /// The source of the associated forest edge. - forest_source: Parent, + forest_source: PaSe, /// Whether or not this edge is "accepting". accepting: bool, } impl Edge { /// Construct a new edge. - pub fn new(label: usize, forest_source: Parent, accepting: bool) -> Self { + pub fn new(label: usize, forest_source: PaSe, accepting: bool) -> Self { Self { label, forest_source, @@ -46,7 +53,7 @@ impl Edge { } /// Return the associated forest edge of the edge. - pub fn forest_source(&self) -> Parent { + pub fn forest_source(&self) -> PaSe { self.forest_source } } @@ -56,12 +63,7 @@ impl core::fmt::Display for Edge { let label = self.label(); let forest_source = self.forest_source(); - write!( - f, - "edge label {label} with forest source {} and edge index {}", - forest_source.node(), - forest_source.edge() - ) + write!(f, "edge label {label} with item {}", forest_source) } } @@ -84,7 +86,7 @@ pub enum TwoLayers { /// the source of the associated forest edge of the second layer, /// and the third is a list of edges, which are the common first /// layers. - Two(usize, Parent, bool, Vec<(Edge, usize)>), + Two(usize, PaSe, bool, Vec<(Edge, usize)>), } /// The type of a collapsed iterator. |