properly handle character controls from ASCII to UTF-8, re: #48
This commit is contained in:
@@ -296,23 +296,16 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter>
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn print_char(&mut self, c: char) {
|
fn print_char(&mut self, c: char) {
|
||||||
if c == '\n' {
|
match c {
|
||||||
self.outputter.append("\\n");
|
'\n' => self.outputter.append("\\n"),
|
||||||
} else if c == '\r' {
|
'\r' => self.outputter.append("\\r"),
|
||||||
self.outputter.append("\\r");
|
'\t' => self.outputter.append("\\t"),
|
||||||
} else if c == '\t' {
|
'\u{0b}' => self.outputter.append("\\v"), // UTF-8 vertical tab
|
||||||
self.outputter.append("\\t");
|
'\u{0c}' => self.outputter.append("\\f"), // UTF-8 form feed
|
||||||
} else if c == '\u{0b}' { // UTF-8 vertical tab
|
'\u{08}' => self.outputter.append("\\b"), // UTF-8 backspace
|
||||||
self.outputter.append("\\v");
|
'\u{07}' => self.outputter.append("\\a"), // UTF-8 alert
|
||||||
} else if c == '\u{0c}' { // UTF-8 form feed
|
_ => self.outputter.push_char(c)
|
||||||
self.outputter.append("\\f");
|
};
|
||||||
} else if c == '\u{08}' { // UTF-8 backspace
|
|
||||||
self.outputter.append("\\b");
|
|
||||||
} else if c == '\u{07}' { // UTF-8 alert
|
|
||||||
self.outputter.append("\\a");
|
|
||||||
} else {
|
|
||||||
self.outputter.push_char(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_constant(&mut self, c: Constant) {
|
fn print_constant(&mut self, c: Constant) {
|
||||||
|
|||||||
Submodule src/prolog/parser updated: b23670b232...ba9962514a
Reference in New Issue
Block a user