Merge pull request #449 from notoria/read

Completed read/1, ctrl-d is end_of_file
This commit is contained in:
Mark Thom
2020-05-03 15:27:46 -03:00
committed by GitHub

View File

@@ -1301,6 +1301,15 @@ pub(crate) trait CallPolicy: Any + fmt::Debug {
let addr = machine_st[temp_v!(1)];
machine_st.unify(addr, Addr::HeapCell(offset.heap_loc));
}
Err(ParserError::UnexpectedEOF) => {
let addr = machine_st[temp_v!(1)];
let eof = clause_name!("end_of_file".to_string(),
indices.atom_tbl);
let atom = machine_st.heap.to_unifiable(
HeapCellValue::Atom(eof, None)
);
machine_st.unify(addr, atom);
}
Err(e) => {
let h = machine_st.heap.h();
let stub = MachineError::functor_stub(clause_name!("read"), 1);