From: Mark Thom Date: Fri, 13 Mar 2020 08:48:31 +0000 (-0600) Subject: fix $VAR-names (#275) and properly print single control chars (#280) X-Git-Tag: v0.8.119~53 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d3eb31e4c36071029d596b5a177306a7e67ea62c;p=scryer-prolog.git fix $VAR-names (#275) and properly print single control chars (#280) --- diff --git a/src/prolog/heap_print.rs b/src/prolog/heap_print.rs index bdfb3bdf..17501652 100644 --- a/src/prolog/heap_print.rs +++ b/src/prolog/heap_print.rs @@ -277,7 +277,7 @@ fn numbervar(n: Integer) -> Var { let i = n.mod_u(26) as usize; let j = n.div_rem_floor(Integer::from(26)); - let j = <(Integer, Integer)>::from(j).1; + let j = <(Integer, Integer)>::from(j).0; if j == 0 { CHAR_CODES[i].to_string() @@ -843,7 +843,9 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { Constant::Char(c) => { let mut result = String::new(); - if self.quoted { + if c.is_control() { + result = c.to_string(); + } else if self.quoted { result.push('\''); result += &char_to_string(c); result.push('\'');