diff options
| author | bors <bors@rust-lang.org> | 2013-05-18 00:34:24 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-18 00:34:24 -0700 |
| commit | e91daaa8a9390ccf760b3ba7f965b2863103d993 (patch) | |
| tree | 20d6c2af3206bfa8347c175624aea75d47aa078a /src/libcore/unicode.rs | |
| parent | ac74bbec9327ef393041feb544d2468131e1759e (diff) | |
| parent | ad6ee5f4e5f779d987ac7a35ce6f149039a45b15 (diff) | |
| download | rust-e91daaa8a9390ccf760b3ba7f965b2863103d993.tar.gz rust-e91daaa8a9390ccf760b3ba7f965b2863103d993.zip | |
auto merge of #6586 : bjz/rust/formatting-and-conditionals, r=thestinger
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'), |
