diff options
| author | bors <bors@rust-lang.org> | 2014-01-03 12:16:48 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-03 12:16:48 -0800 |
| commit | 08321f1c49d75e60a2c56320a3f1483e7bf79a91 (patch) | |
| tree | fd429cf0c3cd63379bef08c36fd9acf0f3e0d82a /src/libsyntax/parse | |
| parent | 11ce6b709ace233e473eddb26e3e23c2c4c16cdd (diff) | |
| parent | 4bea679dbe3ba98049ac700d84ad48271753ce40 (diff) | |
| download | rust-08321f1c49d75e60a2c56320a3f1483e7bf79a91.tar.gz rust-08321f1c49d75e60a2c56320a3f1483e7bf79a91.zip | |
auto merge of #11149 : alexcrichton/rust/remove-either, r=brson
Had to change some stuff in typeck to bootstrap (getting methods in fmt off of Either), but other than that not so painful. Closes #9157
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 2c3d03eefea..be93c962137 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -19,7 +19,6 @@ use parse::token::{str_to_ident}; use std::cast::transmute; use std::char; -use std::either; use std::num::from_str_radix; use std::util; @@ -475,34 +474,35 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token { c = rdr.curr; nextch(rdr); if c == 'u' || c == 'i' { + enum Result { Signed(ast::int_ty), Unsigned(ast::uint_ty) } let signed = c == 'i'; let mut tp = { - if signed { either::Left(ast::ty_i) } - else { either::Right(ast::ty_u) } + if signed { Signed(ast::ty_i) } + else { Unsigned(ast::ty_u) } }; bump(rdr); c = rdr.curr; if c == '8' { bump(rdr); - tp = if signed { either::Left(ast::ty_i8) } - else { either::Right(ast::ty_u8) }; + tp = if signed { Signed(ast::ty_i8) } + else { Unsigned(ast::ty_u8) }; } n = nextch(rdr); if c == '1' && n == '6' { bump(rdr); bump(rdr); - tp = if signed { either::Left(ast::ty_i16) } - else { either::Right(ast::ty_u16) }; + tp = if signed { Signed(ast::ty_i16) } + else { Unsigned(ast::ty_u16) }; } else if c == '3' && n == '2' { bump(rdr); bump(rdr); - tp = if signed { either::Left(ast::ty_i32) } - else { either::Right(ast::ty_u32) }; + tp = if signed { Signed(ast::ty_i32) } + else { Unsigned(ast::ty_u32) }; } else if c == '6' && n == '4' { bump(rdr); bump(rdr); - tp = if signed { either::Left(ast::ty_i64) } - else { either::Right(ast::ty_u64) }; + tp = if signed { Signed(ast::ty_i64) } + else { Unsigned(ast::ty_u64) }; } if num_str.len() == 0u { fatal_span(rdr, start_bpos, rdr.last_pos, @@ -515,8 +515,8 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token { }; match tp { - either::Left(t) => return token::LIT_INT(parsed as i64, t), - either::Right(t) => return token::LIT_UINT(parsed, t) + Signed(t) => return token::LIT_INT(parsed as i64, t), + Unsigned(t) => return token::LIT_UINT(parsed, t) } } let mut is_float = false; |
