about summary refs log tree commit diff
path: root/src/etc/unicode.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/unicode.py')
-rwxr-xr-xsrc/etc/unicode.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/etc/unicode.py b/src/etc/unicode.py
index 20edf9418f1..c41c26a1ccb 100755
--- a/src/etc/unicode.py
+++ b/src/etc/unicode.py
@@ -283,11 +283,7 @@ def load_east_asian_width(want_widths, except_cats):
     return widths
 
 def escape_char(c):
-    if c <= 0x7f:
-        return "'\\x%2.2x'" % c
-    if c <= 0xffff:
-        return "'\\u%4.4x'" % c
-    return "'\\U%8.8x'" % c
+    return "'\\u{%x}'" % c
 
 def emit_bsearch_range_table(f):
     f.write("""
@@ -377,8 +373,8 @@ def emit_conversions_module(f, lowerupper, upperlower):
             else if key < c { Less }
             else { Greater }
         }) {
-            slice::Found(i) => Some(i),
-            slice::NotFound(_) => None,
+            slice::BinarySearchResult::Found(i) => Some(i),
+            slice::BinarySearchResult::NotFound(_) => None,
         }
     }
 
@@ -392,6 +388,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
 def emit_grapheme_module(f, grapheme_table, grapheme_cats):
     f.write("""pub mod grapheme {
     use core::slice::SlicePrelude;
+    use core::kinds::Copy;
     pub use self::GraphemeCat::*;
     use core::slice;
 
@@ -403,6 +400,8 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
         f.write("        GC_" + cat + ",\n")
     f.write("""    }
 
+    impl Copy for GraphemeCat {}
+
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
         use core::cmp::Ordering::{Equal, Less, Greater};
         match r.binary_search(|&(lo, hi, _)| {
@@ -410,11 +409,11 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::Found(idx) => {
+            slice::BinarySearchResult::Found(idx) => {
                 let (_, _, cat) = r[idx];
                 cat
             }
-            slice::NotFound(_) => GC_Any
+            slice::BinarySearchResult::NotFound(_) => GC_Any
         }
     }
 
@@ -443,11 +442,11 @@ def emit_charwidth_module(f, width_table):
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::Found(idx) => {
+            slice::BinarySearchResult::Found(idx) => {
                 let (_, _, r_ncjk, r_cjk) = r[idx];
                 if is_cjk { r_cjk } else { r_ncjk }
             }
-            slice::NotFound(_) => 1
+            slice::BinarySearchResult::NotFound(_) => 1
         }
     }
 """)
@@ -540,11 +539,11 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::Found(idx) => {
+            slice::BinarySearchResult::Found(idx) => {
                 let (_, _, result) = r[idx];
                 result
             }
-            slice::NotFound(_) => 0
+            slice::BinarySearchResult::NotFound(_) => 0
         }
     }\n
 """)
@@ -613,7 +612,7 @@ if __name__ == "__main__":
             unicode_version = re.search(pattern, readme.read()).groups()
         rf.write("""
 /// The version of [Unicode](http://www.unicode.org/)
-/// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on.
+/// that the `UnicodeChar` and `UnicodeStrPrelude` traits are based on.
 pub const UNICODE_VERSION: (uint, uint, uint) = (%s, %s, %s);
 """ % unicode_version)
         (canon_decomp, compat_decomp, gencats, combines,