]> Repositorios git - scryer-prolog.git/commitdiff
allow characters as atoms in Machine::use_module and Machine::use_qualified_module
authorMark Thom <[email protected]>
Wed, 15 Apr 2020 16:32:23 +0000 (10:32 -0600)
committerMark Thom <[email protected]>
Sat, 18 Apr 2020 20:16:40 +0000 (14:16 -0600)
src/prolog/machine/mod.rs

index 414a6ad67f50f5877274c87914c1656f2c5e3dff..1a58482abf7783e020c56744baf6f9918e2cd3f7 100644 (file)
@@ -632,8 +632,12 @@ impl Machine {
             let addr = self.machine_st.store(self.machine_st.deref(module_spec));
 
             match self.machine_st.heap.index_addr(&addr).as_ref() {
-                HeapCellValue::Atom(name, _) => name.clone(),
-                   _ => unreachable!(),
+                HeapCellValue::Atom(name, _) =>
+                    name.clone(),
+                HeapCellValue::Addr(Addr::Char(c)) =>
+                    clause_name!(c.to_string(), self.indices.atom_tbl),
+                   _ =>
+                    unreachable!(),
             }
            };
 
@@ -679,8 +683,12 @@ impl Machine {
             let addr = self.machine_st.store(self.machine_st.deref(module_spec));
 
             match self.machine_st.heap.index_addr(&addr).as_ref() {
-                HeapCellValue::Atom(name, _) => name.clone(),
-                   _ => unreachable!(),
+                HeapCellValue::Atom(name, _) =>
+                    name.clone(),
+                HeapCellValue::Addr(Addr::Char(c)) =>
+                    clause_name!(c.to_string(), self.indices.atom_tbl),
+                   _ =>
+                    unreachable!(),
             }
            };