diff options
| author | bors <bors@rust-lang.org> | 2014-05-02 07:06:50 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-02 07:06:50 -0700 |
| commit | b5d6b07370b665df6b54fa20e971e61041a233b0 (patch) | |
| tree | 4a43dbe1601f640ebb8bade6d67898c74bdea0e6 /src/libsyntax/parse | |
| parent | e97d4e6c190764de1240c2e8a5ac253a60faac6b (diff) | |
| parent | 1ad0cba5e6a837fdebf5f5543d4b169929972705 (diff) | |
| download | rust-b5d6b07370b665df6b54fa20e971e61041a233b0.tar.gz rust-b5d6b07370b665df6b54fa20e971e61041a233b0.zip | |
auto merge of #13879 : huonw/rust/more-re, r=alexcrichton
Commits for details. This shouldn't change the generated code at all (except for switching to `LitBinary` from an explicit ExprVec of individual ExprLit bytes for `prefix_bytes`).
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 992d289b4e9..c1f6e21f923 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -874,7 +874,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token { "unterminated character constant".to_owned()); } bump(rdr); // advance curr past token - return token::LIT_CHAR(c2 as u32); + return token::LIT_CHAR(c2); } '"' => { let mut accum_str = StrBuf::new(); @@ -1097,17 +1097,17 @@ mod test { #[test] fn character_a() { assert_eq!(setup(&mk_sh(), "'a'".to_owned()).next_token().tok, - token::LIT_CHAR('a' as u32)); + token::LIT_CHAR('a')); } #[test] fn character_space() { assert_eq!(setup(&mk_sh(), "' '".to_owned()).next_token().tok, - token::LIT_CHAR(' ' as u32)); + token::LIT_CHAR(' ')); } #[test] fn character_escaped() { assert_eq!(setup(&mk_sh(), "'\\n'".to_owned()).next_token().tok, - token::LIT_CHAR('\n' as u32)); + token::LIT_CHAR('\n')); } #[test] fn lifetime_name() { @@ -1128,7 +1128,7 @@ mod test { #[test] fn nested_block_comments() { assert_eq!(setup(&mk_sh(), "/* /* */ */'a'".to_owned()).next_token().tok, - token::LIT_CHAR('a' as u32)); + token::LIT_CHAR('a')); } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 611ce7cc527..519a7d141d3 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -18,7 +18,6 @@ use util::interner; use serialize::{Decodable, Decoder, Encodable, Encoder}; use std::cast; -use std::char; use std::fmt; use std::local_data; use std::path::BytesContainer; @@ -81,7 +80,7 @@ pub enum Token { DOLLAR, /* Literals */ - LIT_CHAR(u32), + LIT_CHAR(char), LIT_INT(i64, ast::IntTy), LIT_UINT(u64, ast::UintTy), LIT_INT_UNSUFFIXED(i64), @@ -195,7 +194,7 @@ pub fn to_str(t: &Token) -> ~str { /* Literals */ LIT_CHAR(c) => { let mut res = StrBuf::from_str("'"); - char::from_u32(c).unwrap().escape_default(|c| { + c.escape_default(|c| { res.push_char(c); }); res.push_char('\''); |
