diff options
| author | Graydon Hoare <[email protected]> | 2010-08-31 12:54:24 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-08-31 12:54:24 -0700 |
| commit | 11e747fc5835680ba2a78b3cbc277f93e07362a4 (patch) | |
| tree | 1a1e4c658e351911df5224c1253d9195d924f6b3 /src | |
| parent | Reinstate commit 9f0eaa65817303b8768c80454734144c176fda43 with sufficient fix... (diff) | |
| download | rust-11e747fc5835680ba2a78b3cbc277f93e07362a4.tar.xz rust-11e747fc5835680ba2a78b3cbc277f93e07362a4.zip | |
Er, this would be the hunk that actually failed to get committed last time.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/fe/lexer.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/comp/fe/lexer.rs b/src/comp/fe/lexer.rs index 591dfd71..0deb5401 100644 --- a/src/comp/fe/lexer.rs +++ b/src/comp/fe/lexer.rs @@ -210,18 +210,18 @@ fn hex_digit_val(char c) -> int { } if (in_range(c, 'a', 'f')) { - ret (c as int) - ('a' as int); + ret ((c as int) - ('a' as int)) + 10; } if (in_range(c, 'A', 'F')) { - ret (c as int) - ('A' as int); + ret ((c as int) - ('A' as int)) + 10; } fail; } fn bin_digit_value(char c) -> int { - if (c == 0) { ret 0; } + if (c == '0') { ret 0; } ret 1; } @@ -281,7 +281,7 @@ fn next_token(reader rdr) -> token.token { c = rdr.curr(); while (is_hex_digit(c) || c == '_') { accum_int *= 16; - accum_int += hex_digit_val(v); + accum_int += hex_digit_val(c); rdr.bump(); c = rdr.curr(); } @@ -291,9 +291,9 @@ fn next_token(reader rdr) -> token.token { rdr.bump(); rdr.bump(); c = rdr.curr(); - while (is_hex_digit(c) || c == '_') { + while (is_bin_digit(c) || c == '_') { accum_int *= 2; - accum_int += bit_value(c); + accum_int += bin_digit_value(c); rdr.bump(); c = rdr.curr(); } @@ -301,7 +301,7 @@ fn next_token(reader rdr) -> token.token { while (is_dec_digit(c) || c == '_') { accum_int *= 10; - accum_int += dec_digit_val(v); + accum_int += dec_digit_val(c); rdr.bump(); c = rdr.curr(); } |