From 023ee688d395e37382d526958d999d12e77af728 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Wed, 15 Apr 2020 10:32:23 -0600 Subject: [PATCH] allow characters as atoms in Machine::use_module and Machine::use_qualified_module --- src/prolog/machine/mod.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/prolog/machine/mod.rs b/src/prolog/machine/mod.rs index 414a6ad6..1a58482a 100644 --- a/src/prolog/machine/mod.rs +++ b/src/prolog/machine/mod.rs @@ -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!(), } }; -- 2.54.0