diff options
| author | Patrick Walton <[email protected]> | 2010-10-13 11:02:56 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-10-13 11:02:56 -0700 |
| commit | 5c622b6ecbb47cfcef7322047217665bda5675b7 (patch) | |
| tree | af40a38c8c5aa060ef7e33dd3465cd7b18eb92a5 /src/comp/front | |
| parent | rustc: Parse vector types (diff) | |
| download | rust-5c622b6ecbb47cfcef7322047217665bda5675b7.tar.xz rust-5c622b6ecbb47cfcef7322047217665bda5675b7.zip | |
rustc: Lex identifiers that have numbers in them too
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/lexer.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs index f38f5024..9ff12f1c 100644 --- a/src/comp/front/lexer.rs +++ b/src/comp/front/lexer.rs @@ -204,6 +204,10 @@ fn is_dec_digit(char c) -> bool { ret in_range(c, '0', '9'); } +fn is_alnum(char c) -> bool { + ret is_alpha(c) || is_dec_digit(c); +} + fn is_hex_digit(char c) -> bool { ret in_range(c, '0', '9') || in_range(c, 'a', 'f') || @@ -304,8 +308,8 @@ io fn next_token(reader rdr) -> token.token { auto c = rdr.curr(); - if (is_alpha(c)) { - while (is_alpha(c) || c == '_') { + if (is_alpha(c) || c == '_') { + while (is_alnum(c) || c == '_') { accum_str += (c as u8); rdr.bump(); c = rdr.curr(); |