Add a b'x' byte literal of type u8.

This commit is contained in:
Simon Sapin
2014-06-06 16:04:04 +01:00
parent 2fd618e77a
commit bccdba0296
16 changed files with 169 additions and 5 deletions

View File

@@ -2305,6 +2305,12 @@ impl<'a> State<'a> {
}
match lit.node {
ast::LitStr(ref st, style) => self.print_string(st.get(), style),
ast::LitByte(byte) => {
let mut res = String::from_str("b'");
(byte as char).escape_default(|c| res.push_char(c));
res.push_char('\'');
word(&mut self.s, res.as_slice())
}
ast::LitChar(ch) => {
let mut res = String::from_str("'");
ch.escape_default(|c| res.push_char(c));