]> Repositorios git - scryer-prolog.git/commitdiff
fix faulty tidy_trail
authorMark Thom <[email protected]>
Fri, 16 Nov 2018 06:04:52 +0000 (23:04 -0700)
committerMark Thom <[email protected]>
Fri, 16 Nov 2018 06:04:52 +0000 (23:04 -0700)
src/prolog/lib/dcgs.pl
src/prolog/machine/machine_state_impl.rs

index e3ac00a0fd7156669b93e79af20dd0fd54ad82c7..d92e6d2bfe80ee6ee83f110c743431a7b3dad5dd 100644 (file)
@@ -6,7 +6,7 @@
 :- op(1200, xfx, -->).
 
 phrase(G, G) :-
-    nonvar(G), G = [_|_], !. %, append(G, _, Ls0).
+    nonvar(G), G = [_|_], !.
 phrase(G, Ls0) :-
     nonvar(G), G = (G1, G2), !, phrase(G1, Ls0, Ls1), phrase(G2, Ls1, []).
 phrase(G, Ls0) :-
@@ -50,7 +50,7 @@ expand_body(Term0, (ModTerm, ModTerms), N0, N) :-
     nonvar(Term),
     expand_body_term(Term, ModTerm, N0, N1),
     expand_body(Terms, ModTerms, N1, N).
-expand_body(Term0, ModTerm, N0, N) :-    
+expand_body(Term0, ModTerm, N0, N) :-
     nonvar(Term0),
     expand_body_term(Term0, ModTerm, N0, N).
 
index 851e9800024e55982470d321e9856abcb8afe1ce..d479d2e0ab8dd63c53e1c029383ced2ab5eb109e 100644 (file)
@@ -32,7 +32,7 @@ macro_rules! try_or_fail {
 
 impl MachineState {
     pub(super) fn new() -> Self {
-        MachineState {            
+        MachineState {
             s: 0,
             p: CodePtr::default(),
             b: 0,
@@ -132,10 +132,10 @@ impl MachineState {
         output.append(" = ");
 
         let mut printer = HCPrinter::from_heap_locs(&self, output, var_dir);
-        
+
         printer.numbervars = false;
         printer.quoted = true;
-            
+
         let mut output = printer.print(addr);
 
         let bad_ending = format!("= {}", &var);
@@ -428,6 +428,7 @@ impl MachineState {
                         let tr = self.tr;
                         let val = self.trail[tr - 1];
                         self.trail[i] = val;
+                        self.trail.pop();
                         self.tr -= 1;
                     },
                 Ref::StackCell(fr, _) => {
@@ -445,6 +446,7 @@ impl MachineState {
                         let tr = self.tr;
                         let val = self.trail[tr - 1];
                         self.trail[i] = val;
+                        self.trail.pop();
                         self.tr -= 1;
                     }
                 }