diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.rs | 18 | ||||
-rw-r--r-- | src/show.rs | 14 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/parser.rs b/src/parser.rs index d21b304..7b910d3 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -305,7 +305,7 @@ impl<'a> Parser<'a> { } Some((_, '\n')) | Some((_, '\r')) if multiline => ret.push('\n'), - Some((pos, ch)) if ch < '\u001f' => { + Some((pos, ch)) if ch < '\u{1f}' => { let mut escaped = String::new(); for c in ch.escape_default() { escaped.push(c); @@ -333,14 +333,14 @@ impl<'a> Parser<'a> { fn escape(me: &mut Parser, pos: uint, multiline: bool) -> Option<char> { match me.cur.next() { - Some((_, 'b')) => Some('\u0008'), - Some((_, 't')) => Some('\u0009'), - Some((_, 'n')) => Some('\u000a'), - Some((_, 'f')) => Some('\u000c'), - Some((_, 'r')) => Some('\u000d'), - Some((_, '"')) => Some('\u0022'), - Some((_, '/')) => Some('\u002f'), - Some((_, '\\')) => Some('\u005c'), + Some((_, 'b')) => Some('\u{8}'), + Some((_, 't')) => Some('\u{9}'), + Some((_, 'n')) => Some('\u{a}'), + Some((_, 'f')) => Some('\u{c}'), + Some((_, 'r')) => Some('\u{d}'), + Some((_, '"')) => Some('\u{22}'), + Some((_, '/')) => Some('\u{2f}'), + Some((_, '\\')) => Some('\u{5c}'), Some((pos, c @ 'u')) | Some((pos, c @ 'U')) => { let len = if c == 'u' {4} else {8}; diff --git a/src/show.rs b/src/show.rs index 32485da..330b7e5 100644 --- a/src/show.rs +++ b/src/show.rs @@ -15,13 +15,13 @@ impl fmt::Show for Value { try!(write!(f, "\"")); for ch in s.as_slice().chars() { match ch { - '\u0008' => try!(write!(f, "\\b")), - '\u0009' => try!(write!(f, "\\t")), - '\u000a' => try!(write!(f, "\\n")), - '\u000c' => try!(write!(f, "\\f")), - '\u000d' => try!(write!(f, "\\r")), - '\u0022' => try!(write!(f, "\\\"")), - '\u005c' => try!(write!(f, "\\\\")), + '\u{8}' => try!(write!(f, "\\b")), + '\u{9}' => try!(write!(f, "\\t")), + '\u{a}' => try!(write!(f, "\\n")), + '\u{c}' => try!(write!(f, "\\f")), + '\u{d}' => try!(write!(f, "\\r")), + '\u{22}' => try!(write!(f, "\\\"")), + '\u{5c}' => try!(write!(f, "\\\\")), ch => try!(write!(f, "{}", ch)), } } |