]> Repositorios git - scryer-prolog.git/commitdiff
Completed read/1, ctrl-d is end_of_file
authornotoria <[email protected]>
Sun, 3 May 2020 17:54:17 +0000 (19:54 +0200)
committernotoria <[email protected]>
Sun, 3 May 2020 17:54:17 +0000 (19:54 +0200)
src/prolog/machine/machine_state.rs

index 8def9185ca9b92286f5d8c80af2a5031840d2a6a..06fc94179d933ae15e628452fac709a03cfb870e 100644 (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);