From 804c688f4c8351c672a2d1a386e276d5bc8c16e2 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 4 Feb 2025 14:26:37 +0100 Subject: [PATCH] pretty: output escape character for \0 and \n --- src/pretty.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pretty.rs b/src/pretty.rs index 1a4aa60..c5edf3d 100644 --- a/src/pretty.rs +++ b/src/pretty.rs @@ -17,7 +17,11 @@ impl SugaredTypeTerm { } SugaredTypeTerm::Char(c) => { - format!("'{}'", c) + match c { + '\0' => format!("'\\0'"), + '\n' => format!("'\\n'"), + _ => format!("'{}'", c) + } } SugaredTypeTerm::Univ(t) => { @@ -116,7 +120,7 @@ impl SugaredTypeTerm { s.push('\n'); for x in 0..(indent*indent_width) { s.push(' '); - } + } s.push_str(&"--> ".bright_yellow()); } else { // s.push_str(" "); @@ -144,5 +148,3 @@ impl SugaredTypeTerm { } } } - -