support discontiguous and multifile declarations
This commit is contained in:
18
src/write.rs
18
src/write.rs
@@ -2,6 +2,7 @@ use crate::clause_types::*;
|
||||
use crate::forms::*;
|
||||
use crate::indexing::IndexingCodePtr;
|
||||
use crate::instructions::*;
|
||||
use crate::machine::loader::CompilationTarget;
|
||||
use crate::machine::machine_errors::*;
|
||||
use crate::machine::machine_indices::*;
|
||||
|
||||
@@ -20,8 +21,12 @@ impl fmt::Display for LocalCodePtr {
|
||||
impl fmt::Display for REPLCodePtr {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
REPLCodePtr::AddDiscontiguousPredicate =>
|
||||
write!(f, "REPLCodePtr::AddDiscontiguousPredicate"),
|
||||
REPLCodePtr::AddDynamicPredicate =>
|
||||
write!(f, "REPLCodePtr::AddDynamicPredicate"),
|
||||
REPLCodePtr::AddMultifilePredicate =>
|
||||
write!(f, "REPLCodePtr::AddMultifilePredicate"),
|
||||
REPLCodePtr::AddGoalExpansionClause =>
|
||||
write!(f, "REPLCodePtr::AddGoalExpansionClause"),
|
||||
REPLCodePtr::AddTermExpansionClause =>
|
||||
@@ -88,6 +93,15 @@ impl fmt::Display for IndexPtr {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for CompilationTarget {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
CompilationTarget::User => write!(f, "user"),
|
||||
CompilationTarget::Module(ref module_name) => write!(f, "{}", module_name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for FactInstruction {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
@@ -404,6 +418,10 @@ impl fmt::Display for SessionError {
|
||||
write!(f, "modules ({}, in this case) cannot import themselves.",
|
||||
module_name)
|
||||
}
|
||||
&SessionError::PredicateNotMultifileOrDiscontiguous(ref compilation_target, ref key) => {
|
||||
write!(f, "module {} does not define {}/{} as multifile or discontiguous.",
|
||||
compilation_target.module_name(), key.0, key.1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user