wip: basic completion of predicates

This commit is contained in:
Euan Lacy
2022-05-10 04:40:22 +01:00
parent 2dfa108034
commit aaa75c3ffc
5 changed files with 167 additions and 5 deletions

View File

@@ -454,6 +454,21 @@ impl MachineState {
self.b0 = self.b;
}
pub fn read_term_from_user_input(&mut self, stream: Stream, indices: &mut IndexStore) -> CallResult {
let atoms: Vec<_> = self.atom_tbl.table.iter().map(|a| a.as_str().to_string()).collect();
if let Stream::Readline(ptr) = stream {
unsafe {
let readline = ptr.as_ptr().as_mut().unwrap();
readline.set_atoms_for_completion(atoms);
let ret = self.read_term(stream, indices);
return ret
}
}
unreachable!("Stream must be a Stream::Readline(_)")
}
pub fn read_term(&mut self, stream: Stream, indices: &mut IndexStore) -> CallResult {
fn push_var_eq_functors<'a>(
heap: &mut Heap,