Add Machine::run_input_once() which reads one goal from user input and runs it
This commit is contained in:
@@ -307,6 +307,10 @@ impl Machine {
|
|||||||
self.run_module_predicate(atom!("$toplevel"), (atom!("$repl"), 1));
|
self.run_module_predicate(atom!("$toplevel"), (atom!("$repl"), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn run_input_once(&mut self) {
|
||||||
|
self.run_module_predicate(atom!("$toplevel"), (atom!("run_input_once"), 0));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_user_input(&mut self, input: String) {
|
pub fn set_user_input(&mut self, input: String) {
|
||||||
self.user_input = Stream::from_owned_string(input, &mut self.machine_st.arena);
|
self.user_input = Stream::from_owned_string(input, &mut self.machine_st.arena);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,3 +430,6 @@ print_exception_with_check(E) :-
|
|||||||
% is expected to be printed instead.
|
% is expected to be printed instead.
|
||||||
; print_exception(E)
|
; print_exception(E)
|
||||||
).
|
).
|
||||||
|
|
||||||
|
run_input_once :-
|
||||||
|
catch(read_and_match, E, print_exception(E)).
|
||||||
|
|||||||
Reference in New Issue
Block a user