Skip to content

Commit 3c10a94

Browse files
committed
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.
1 parent 5411cbf commit 3c10a94

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/libsyntax/parse/lexer.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,12 @@ pub fn is_whitespace(c: char) -> bool {
225225
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
226226
}
227227

228-
fn may_begin_ident(c: char) -> bool { return is_alpha(c) || c == '_'; }
229-
230228
fn in_range(c: char, lo: char, hi: char) -> bool {
231229
return lo <= c && c <= hi
232230
}
233231

234-
fn is_alpha(c: char) -> bool {
235-
return in_range(c, 'a', 'z') || in_range(c, 'A', 'Z');
236-
}
237-
238232
fn is_dec_digit(c: char) -> bool { return in_range(c, '0', '9'); }
239233

240-
fn is_alnum(c: char) -> bool { return is_alpha(c) || is_dec_digit(c); }
241-
242234
fn is_hex_digit(c: char) -> bool {
243235
return in_range(c, '0', '9') || in_range(c, 'a', 'f') ||
244236
in_range(c, 'A', 'F');
@@ -444,8 +436,7 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token {
444436
}
445437
}
446438
let mut is_float = false;
447-
if rdr.curr == '.' && !(is_alpha(nextch(rdr)) || nextch(rdr) == '_' ||
448-
nextch(rdr) == '.') {
439+
if rdr.curr == '.' && !(ident_start(nextch(rdr)) || nextch(rdr) == '.') {
449440
is_float = true;
450441
bump(rdr);
451442
let dec_part = scan_digits(rdr, 10u);

0 commit comments

Comments
 (0)