fix incorrect handling of terminal cuts.
This commit is contained in:
@@ -247,6 +247,7 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
|||||||
if let &mut Line::Control(ref mut ctrl) = body.last_mut().unwrap() {
|
if let &mut Line::Control(ref mut ctrl) = body.last_mut().unwrap() {
|
||||||
*ctrl = ControlInstruction::CatchExecute;
|
*ctrl = ControlInstruction::CatchExecute;
|
||||||
},
|
},
|
||||||
|
QueryTermRef::Cut => {},
|
||||||
QueryTermRef::Throw(_) =>
|
QueryTermRef::Throw(_) =>
|
||||||
if let &mut Line::Control(ref mut ctrl) = body.last_mut().unwrap() {
|
if let &mut Line::Control(ref mut ctrl) = body.last_mut().unwrap() {
|
||||||
*ctrl = ControlInstruction::ThrowExecute;
|
*ctrl = ControlInstruction::ThrowExecute;
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ pub fn eval<'a, 'b: 'a>(wam: &'a mut Machine, tl: &'b TopLevel) -> EvalSession<'
|
|||||||
&TopLevel::Predicate(ref clauses) => {
|
&TopLevel::Predicate(ref clauses) => {
|
||||||
let mut cg = CodeGenerator::<DebrayAllocator>::new();
|
let mut cg = CodeGenerator::<DebrayAllocator>::new();
|
||||||
|
|
||||||
let compiled_pred = cg.compile_predicate(clauses);
|
let compiled_pred = cg.compile_predicate(clauses);
|
||||||
wam.add_predicate(clauses, compiled_pred)
|
wam.add_predicate(clauses, compiled_pred)
|
||||||
},
|
},
|
||||||
&TopLevel::Fact(ref fact) => {
|
&TopLevel::Fact(ref fact) => {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ struct MachineState {
|
|||||||
tr: usize,
|
tr: usize,
|
||||||
hb: usize,
|
hb: usize,
|
||||||
block: usize, // an offset into the OR stack.
|
block: usize, // an offset into the OR stack.
|
||||||
ball: (usize, Heap) // heap boundary, and a term copy
|
ball: (usize, Heap) // heap boundary, and a term copy
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DuplicateTerm<'a> {
|
struct DuplicateTerm<'a> {
|
||||||
@@ -446,7 +446,7 @@ impl Machine {
|
|||||||
static ref ERR_STRING: String = String::from("an operator can't be both \
|
static ref ERR_STRING: String = String::from("an operator can't be both \
|
||||||
infix and postfix.");
|
infix and postfix.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_infix!(spec) {
|
if is_infix!(spec) {
|
||||||
match self.op_dir.get(&(name.clone(), Fixity::Post)) {
|
match self.op_dir.get(&(name.clone(), Fixity::Post)) {
|
||||||
Some(_) => return EvalSession::EntryFailure(ERR_STRING.clone()),
|
Some(_) => return EvalSession::EntryFailure(ERR_STRING.clone()),
|
||||||
@@ -479,7 +479,7 @@ impl Machine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn submit_query<'a>(&mut self, code: Code, alloc_locs: AllocVarDict<'a>) -> EvalSession<'a>
|
pub fn submit_query<'a>(&mut self, code: Code, alloc_locs: AllocVarDict<'a>) -> EvalSession<'a>
|
||||||
{
|
{
|
||||||
let mut heap_locs = HashMap::new();
|
let mut heap_locs = HashMap::new();
|
||||||
@@ -1658,7 +1658,7 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let &Terminal::Terminal = term {
|
if let &Terminal::Terminal = term {
|
||||||
self.p = CodePtr::default();
|
self.p = self.cp;
|
||||||
} else {
|
} else {
|
||||||
self.p += 1;
|
self.p += 1;
|
||||||
}
|
}
|
||||||
@@ -1680,7 +1680,7 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let &Terminal::Terminal = term {
|
if let &Terminal::Terminal = term {
|
||||||
self.p = CodePtr::default();
|
self.p = self.cp;
|
||||||
} else {
|
} else {
|
||||||
self.p += 1;
|
self.p += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user