diff options
| author | John Clements <clements@racket-lang.org> | 2013-04-17 12:24:49 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-04-28 09:51:15 -0700 |
| commit | 3c10a9412e2b1668bfe348f4728eedc2de0c642a (patch) | |
| tree | 45d2a985c0b72da5348c4c0acac8aa24dd5e5be0 /src/libsyntax | |
| parent | 5411cbf656b42ef1d8a95e9de1a50bea616f7c56 (diff) | |
| download | rust-3c10a9412e2b1668bfe348f4728eedc2de0c642a.tar.gz rust-3c10a9412e2b1668bfe348f4728eedc2de0c642a.zip | |
remove unused functions, fix tiny lexing bug
before this change, the parser would parse 14.a() as a method call, but would parse 14.ΓΈ() as the floating-point number 14. followed by a function call. This is because it was checking is_alpha, rather than ident_start, and was therefore wrong with respect to unicode.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index fa425cf6285..edddac7bc7d 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -225,20 +225,12 @@ pub fn is_whitespace(c: char) -> bool { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; } -fn may_begin_ident(c: char) -> bool { return is_alpha(c) || c == '_'; } - fn in_range(c: char, lo: char, hi: char) -> bool { return lo <= c && c <= hi } -fn is_alpha(c: char) -> bool { - return in_range(c, 'a', 'z') || in_range(c, 'A', 'Z'); -} - fn is_dec_digit(c: char) -> bool { return in_range(c, '0', '9'); } -fn is_alnum(c: char) -> bool { return is_alpha(c) || is_dec_digit(c); } - fn is_hex_digit(c: char) -> bool { return in_range(c, '0', '9') || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'); @@ -444,8 +436,7 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token { } } let mut is_float = false; - if rdr.curr == '.' && !(is_alpha(nextch(rdr)) || nextch(rdr) == '_' || - nextch(rdr) == '.') { + if rdr.curr == '.' && !(ident_start(nextch(rdr)) || nextch(rdr) == '.') { is_float = true; bump(rdr); let dec_part = scan_digits(rdr, 10u); |
