Skip to content

Commit 9228947

Browse files
committed
Avoid hitting unicode lib per char.
1 parent fdc5b53 commit 9228947

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/comp/syntax/parse/lexer.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,15 @@ fn next_token(rdr: reader) -> {tok: token::token, chpos: uint, bpos: uint} {
307307
fn next_token_inner(rdr: reader) -> token::token {
308308
let accum_str = "";
309309
let c = rdr.curr;
310-
if char::is_XID_start(c) || c == '_' {
311-
while char::is_XID_continue(c) {
310+
if (c >= 'a' && c <= 'z')
311+
|| (c >= 'A' && c <= 'Z')
312+
|| c == '_'
313+
|| (c > 'z' && char::is_XID_start(c)) {
314+
while (c >= 'a' && c <= 'z')
315+
|| (c >= 'A' && c <= 'Z')
316+
|| (c >= '0' && c <= '9')
317+
|| c == '_'
318+
|| (c > 'z' && char::is_XID_continue(c)) {
312319
str::push_char(accum_str, c);
313320
rdr.bump();
314321
c = rdr.curr;

0 commit comments

Comments
 (0)