auto merge of #5945 : graydon/rust/fix-unicode-tables, r=pcwalton
This switches the unicode functions in core to use static character-range tables and a binary search helper rather than open-coded switch statements. It adds about 50k of read only data to the libcore binary but cuts out a similar amount of compiled IR. Would have done it this way in the first place but we didn't have structured statics for a long time.
This commit is contained in:
commit
ce4f73a243
4 changed files with 2666 additions and 4585 deletions
|
|
@ -535,7 +535,7 @@ fn ident_start(c: char) -> bool {
|
|||
(c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| c == '_'
|
||||
|| (c > 'z' && char::is_XID_start(c))
|
||||
|| (c > '\x7f' && char::is_XID_start(c))
|
||||
}
|
||||
|
||||
fn ident_continue(c: char) -> bool {
|
||||
|
|
@ -543,7 +543,7 @@ fn ident_continue(c: char) -> bool {
|
|||
|| (c >= 'A' && c <= 'Z')
|
||||
|| (c >= '0' && c <= '9')
|
||||
|| c == '_'
|
||||
|| (c > 'z' && char::is_XID_continue(c))
|
||||
|| (c > '\x7f' && char::is_XID_continue(c))
|
||||
}
|
||||
|
||||
// return the next token from the string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue