core: Convert Char::escape_default, escape_unicode to iterators

[breaking-change]
This commit is contained in:
Brian Anderson
2014-10-31 16:20:41 -07:00
parent ca1820b1fc
commit aad2461604
7 changed files with 110 additions and 43 deletions

View File

@@ -193,7 +193,7 @@ impl<'a> StringReader<'a> {
fn fatal_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) -> ! {
let mut m = m.to_string();
m.push_str(": ");
char::escape_default(c, |c| m.push(c));
for c in c.escape_default() { m.push(c) }
self.fatal_span_(from_pos, to_pos, m.as_slice());
}
@@ -202,7 +202,7 @@ impl<'a> StringReader<'a> {
fn err_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) {
let mut m = m.to_string();
m.push_str(": ");
char::escape_default(c, |c| m.push(c));
for c in c.escape_default() { m.push(c) }
self.err_span_(from_pos, to_pos, m.as_slice());
}