hacky workaround

This commit is contained in:
Mark Thom
2018-05-28 20:07:34 -06:00
parent b49c0f5d36
commit 07ec2d34c8
6 changed files with 60 additions and 35 deletions

View File

@@ -229,6 +229,27 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
})
}
fn print_constant(&mut self, c: Constant) {
match c {
Constant::Char(c) if c == '\n' =>
self.outputter.append("'\\n'"),
// Constant::Char(c) if c == '\f' =>
// self.outputter.append("\\f"),
Constant::Char(c) if c == '\r' =>
self.outputter.append("'\\r'"),
Constant::Char(c) if c == '\t' =>
self.outputter.append("'\\t'"),
// Constant::Char(c) if c == '\b' =>
// self.outputter.append("\\b"),
// Constant::Char(c) if c == '\\a' =>
// self.outputter.append("\a"),
// Constant::Char(c) if c == '\\v' =>
// self.outputter.append("\\v"),
_ =>
self.outputter.append(format!("{}", c).as_str())
}
}
fn handle_heap_term(&mut self, iter: &mut HCPreOrderIterator)
{
let heap_val = match self.check_for_seen(iter) {
@@ -246,7 +267,7 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
self.outputter.append("[]");
},
HeapCellValue::Addr(Addr::Con(c)) =>
self.outputter.append(format!("{}", c).as_str()),
self.print_constant(c),
HeapCellValue::Addr(Addr::Lis(_)) => {
let cell = Rc::new(Cell::new(true));