From 3c10a9412e2b1668bfe348f4728eedc2de0c642a Mon Sep 17 00:00:00 2001 From: John Clements Date: Wed, 17 Apr 2013 12:24:49 -0700 Subject: remove unused functions, fix tiny lexing bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/libsyntax/parse/lexer.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/libsyntax/parse') 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); -- cgit 1.4.1-3-g733a5