split into lib and bin

* makes most pub things in src/ pub(crate) as not to expose things accidentally
  * only those things needed by src/bin/scryer-prolog.rs and tests/scryer.rs
    should be pub
* split src/main.rs into src/lib.rs and src/bin/scryer-prolog.rs
* add tests folder and run most of the files in src/tests with cargo test
  added bytes method to Stream in src/machine/streams.rs to check if stdout is as expected
This commit is contained in:
Skgland
2021-02-25 23:24:20 +01:00
parent f935060b2b
commit 2f428b7261
35 changed files with 981 additions and 964 deletions

View File

@@ -61,7 +61,7 @@ impl MachineState {
}
#[inline]
pub fn machine_flags(&self) -> MachineFlags {
pub(crate) fn machine_flags(&self) -> MachineFlags {
self.flags
}
@@ -590,8 +590,7 @@ impl MachineState {
}
}
pub(super)
fn trail(&mut self, r: TrailRef) {
pub(super) fn trail(&mut self, r: TrailRef) {
match r {
TrailRef::Ref(Ref::HeapCell(h)) => {
if h < self.hb {
@@ -3460,14 +3459,20 @@ impl MachineState {
}
&ChoiceInstruction::DefaultRetryMeElse(offset) => {
let mut call_policy = DefaultCallPolicy {};
try_or_fail!(self, call_policy.retry_me_else(self, offset, global_variables))
try_or_fail!(
self,
call_policy.retry_me_else(self, offset, global_variables)
)
}
&ChoiceInstruction::DefaultTrustMe(_) => {
let mut call_policy = DefaultCallPolicy {};
try_or_fail!(self, call_policy.trust_me(self, global_variables))
}
&ChoiceInstruction::RetryMeElse(offset) => {
try_or_fail!(self, call_policy.retry_me_else(self, offset, global_variables))
try_or_fail!(
self,
call_policy.retry_me_else(self, offset, global_variables)
)
}
&ChoiceInstruction::TrustMe(_) => {
try_or_fail!(self, call_policy.trust_me(self, global_variables))