]> Repositorios git - scryer-prolog.git/commitdiff
restore previous focus upon character match failure in compare_pstr_to_string (#441)
authorMark Thom <[email protected]>
Sun, 3 May 2020 23:03:59 +0000 (17:03 -0600)
committerMark Thom <[email protected]>
Sun, 3 May 2020 23:03:59 +0000 (17:03 -0600)
src/prolog/machine/machine_state.rs
src/prolog/toplevel.pl

index 06fc94179d933ae15e628452fac709a03cfb870e..5f3557fbb80e8ed1b5df38aecbe8e4883bc2c98b 100644 (file)
@@ -45,7 +45,7 @@ impl<'a> HeapPStrIter<'a> {
 
     #[inline]
     pub(crate)
-    fn focus(&'a self) -> Addr {
+    fn focus(&self) -> Addr {
         self.machine_st.store(self.machine_st.deref(self.focus))
     }
 
@@ -303,6 +303,10 @@ fn compare_pstr_to_string<'a>(
                 }
             }
         }
+
+        if s[s_offset ..].is_empty() {
+            return Some(s_offset);
+        }
     }
 
     Some(s_offset)
index 7a0b5bf3ec4f80699c0493cf4596a6409716352b..461e71959bb57da95c3c14018480468e34279334 100644 (file)
@@ -323,21 +323,6 @@ gather_goals([Var = Value | Pairs], VarList, QueryVarList, Goals) :-
     ;  gather_goals(Pairs, VarList, QueryVarList, Goals)
     ).
 
-/*
-gather_goals([], VarList, QueryVarList, Goals) :-
-    gather_query_vars(VarList, Vars),
-    copy_term(Vars, Vars, Goals).
-%    filter_goals(Goals0, Goals, Vars).
-gather_goals([Var = Value | Pairs], VarList, QueryVarList, Goals) :-
-    (  (  nonvar(Value)
-       ;  is_a_different_variable(Pairs, Value)
-       ) ->
-       Goals = [Var = Value | Goals0],
-       gather_goals(Pairs, VarList, QueryVarList, Goals0)
-    ;  gather_goals(Pairs, VarList, QueryVarList, Goals)
-    ).
-*/
-
 print_exception(E) :-
     (  E == error('$interrupt_thrown', repl) -> nl % print the
     % exception on a