From 2ce4f602c049370427f51514d727b7b5e9fec7fd Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sun, 12 Apr 2020 12:18:15 -0600 Subject: [PATCH] be more judicious with at_cdr in print_string (#295) --- src/prolog/heap_print.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/prolog/heap_print.rs b/src/prolog/heap_print.rs index 91757052..780eb1bd 100644 --- a/src/prolog/heap_print.rs +++ b/src/prolog/heap_print.rs @@ -1045,7 +1045,9 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { let buf = heap_pstr_iter.to_string(); let end_addr = heap_pstr_iter.focus(); - if Addr::EmptyList == end_addr { + let at_cdr = self.at_cdr(","); + + if !at_cdr && Addr::EmptyList == end_addr { if !self.machine_st.flags.double_quotes.is_codes() { self.push_char('"'); @@ -1124,7 +1126,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { iter.stack().push(end_addr); } } else { - let switch = if !self.at_cdr(",") { + let switch = if !at_cdr { self.push_char('['); true } else { -- 2.54.0