Update to rust master
This commit is contained in:
parent
f9408377c9
commit
4dce070c70
|
@ -305,7 +305,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
Some((_, '\n')) |
|
Some((_, '\n')) |
|
||||||
Some((_, '\r')) if multiline => ret.push('\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();
|
let mut escaped = String::new();
|
||||||
for c in ch.escape_default() {
|
for c in ch.escape_default() {
|
||||||
escaped.push(c);
|
escaped.push(c);
|
||||||
|
@ -333,14 +333,14 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
fn escape(me: &mut Parser, pos: uint, multiline: bool) -> Option<char> {
|
fn escape(me: &mut Parser, pos: uint, multiline: bool) -> Option<char> {
|
||||||
match me.cur.next() {
|
match me.cur.next() {
|
||||||
Some((_, 'b')) => Some('\u0008'),
|
Some((_, 'b')) => Some('\u{8}'),
|
||||||
Some((_, 't')) => Some('\u0009'),
|
Some((_, 't')) => Some('\u{9}'),
|
||||||
Some((_, 'n')) => Some('\u000a'),
|
Some((_, 'n')) => Some('\u{a}'),
|
||||||
Some((_, 'f')) => Some('\u000c'),
|
Some((_, 'f')) => Some('\u{c}'),
|
||||||
Some((_, 'r')) => Some('\u000d'),
|
Some((_, 'r')) => Some('\u{d}'),
|
||||||
Some((_, '"')) => Some('\u0022'),
|
Some((_, '"')) => Some('\u{22}'),
|
||||||
Some((_, '/')) => Some('\u002f'),
|
Some((_, '/')) => Some('\u{2f}'),
|
||||||
Some((_, '\\')) => Some('\u005c'),
|
Some((_, '\\')) => Some('\u{5c}'),
|
||||||
Some((pos, c @ 'u')) |
|
Some((pos, c @ 'u')) |
|
||||||
Some((pos, c @ 'U')) => {
|
Some((pos, c @ 'U')) => {
|
||||||
let len = if c == 'u' {4} else {8};
|
let len = if c == 'u' {4} else {8};
|
||||||
|
|
14
src/show.rs
14
src/show.rs
|
@ -15,13 +15,13 @@ impl fmt::Show for Value {
|
||||||
try!(write!(f, "\""));
|
try!(write!(f, "\""));
|
||||||
for ch in s.as_slice().chars() {
|
for ch in s.as_slice().chars() {
|
||||||
match ch {
|
match ch {
|
||||||
'\u0008' => try!(write!(f, "\\b")),
|
'\u{8}' => try!(write!(f, "\\b")),
|
||||||
'\u0009' => try!(write!(f, "\\t")),
|
'\u{9}' => try!(write!(f, "\\t")),
|
||||||
'\u000a' => try!(write!(f, "\\n")),
|
'\u{a}' => try!(write!(f, "\\n")),
|
||||||
'\u000c' => try!(write!(f, "\\f")),
|
'\u{c}' => try!(write!(f, "\\f")),
|
||||||
'\u000d' => try!(write!(f, "\\r")),
|
'\u{d}' => try!(write!(f, "\\r")),
|
||||||
'\u0022' => try!(write!(f, "\\\"")),
|
'\u{22}' => try!(write!(f, "\\\"")),
|
||||||
'\u005c' => try!(write!(f, "\\\\")),
|
'\u{5c}' => try!(write!(f, "\\\\")),
|
||||||
ch => try!(write!(f, "{}", ch)),
|
ch => try!(write!(f, "{}", ch)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue