From: Mark Thom Date: Sun, 12 Apr 2020 18:18:15 +0000 (-0600) Subject: be more judicious with at_cdr in print_string (#295) X-Git-Tag: v0.8.119~10 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=2ce4f602c049370427f51514d727b7b5e9fec7fd;p=scryer-prolog.git be more judicious with at_cdr in print_string (#295) --- 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 {