Properly format characters with escape sequences

Ran into this just now
This commit is contained in:
Ayaz Hafiz 2022-10-02 17:10:34 -05:00
parent be2f143353
commit 3883867b5c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 31 additions and 1 deletions

View file

@ -288,8 +288,17 @@ impl<'a> Formattable for Expr<'a> {
buf.push_str(string)
}
SingleQuote(string) => {
buf.indent(indent);
buf.push('\'');
buf.push_str(string);
for c in string.chars() {
if c == '"' {
buf.push_char_literal('"')
} else {
for escaped in c.escape_default() {
buf.push_char_literal(escaped);
}
}
}
buf.push('\'');
}
&NonBase10Int {