diff options
Diffstat (limited to 'src/libcore/unicode.rs')
| -rw-r--r-- | src/libcore/unicode.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/libcore/unicode.rs b/src/libcore/unicode.rs index d6e2c5eee6a..3b7fdcc85be 100644 --- a/src/libcore/unicode.rs +++ b/src/libcore/unicode.rs @@ -14,6 +14,7 @@ pub mod general_category { + #[cfg(stage0)] fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use cmp::{Equal, Less, Greater}; use vec::bsearch; @@ -25,6 +26,18 @@ pub mod general_category { }) != None } + #[cfg(not(stage0))] + fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { + use cmp::{Equal, Less, Greater}; + use vec::bsearch; + use option::None; + (do bsearch(r) |&(lo,hi)| { cond!( + (lo <= c && c <= hi) { Equal } + (hi < c) { Less } + _ { Greater } + )}) != None + } + static Cc_table : &'static [(char,char)] = &[ ('\x00', '\x1f'), ('\x7f', '\x9f') @@ -1449,8 +1462,7 @@ pub mod general_category { } pub mod derived_property { - - + #[cfg(stage0)] fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use cmp::{Equal, Less, Greater}; use vec::bsearch; @@ -1462,6 +1474,18 @@ pub mod derived_property { }) != None } + #[cfg(not(stage0))] + fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { + use cmp::{Equal, Less, Greater}; + use vec::bsearch; + use option::None; + (do bsearch(r) |&(lo,hi)| { cond!( + (lo <= c && c <= hi) { Equal } + (hi < c) { Less } + _ { Greater } + )}) != None + } + static Alphabetic_table : &'static [(char,char)] = &[ ('\x41', '\x5a'), ('\x61', '\x7a'), |
