Skip to content

Commit

Permalink
Auto merge of #45571 - zackmdavis:regenerate_char_private, r=alexcric…
Browse files Browse the repository at this point in the history
…hton

regenerate libcore/char_private.rs

(filed separately from the work in #45569, because of this matter of the updated Unicode data; see also #45567)

char_private.rs is generated programmatically by char_private.py, using data retrieved from the Unicode Consortium's website.

The motivation here was to make `is_printable` crate-visible (with `pub(crate)`), but it would seem that the Unicode data has changed slightly since char_private.rs was last generated.
  • Loading branch information
bors committed Nov 7, 2017
2 parents 785643a + 3c81d3d commit a17e724
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 76 deletions.
4 changes: 2 additions & 2 deletions src/etc/char_private.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def main():
normal1 = compress_normal(normal1)

print("""\
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -226,7 +226,7 @@ def main():
current
}
pub fn is_printable(x: char) -> bool {
pub(crate) fn is_printable(x: char) -> bool {
let x = x as u32;
let lower = x as u16;
if x < 0x10000 {
Expand Down
157 changes: 83 additions & 74 deletions src/libcore/char_private.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -47,7 +47,7 @@ fn check(x: u16, singletonuppers: &[(u8, u8)], singletonlowers: &[u8],
current
}

pub fn is_printable(x: char) -> bool {
pub(crate) fn is_printable(x: char) -> bool {
let x = x as u32;
let lower = x as u16;
if x < 0x10000 {
Expand All @@ -64,7 +64,10 @@ pub fn is_printable(x: char) -> bool {
if 0x2b81e <= x && x < 0x2b820 {
return false;
}
if 0x2cea2 <= x && x < 0x2f800 {
if 0x2cea2 <= x && x < 0x2ceb0 {
return false;
}
if 0x2ebe1 <= x && x < 0x2f800 {
return false;
}
if 0x2fa1e <= x && x < 0xe0100 {
Expand All @@ -83,12 +86,12 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[
(0x05, 8),
(0x06, 3),
(0x07, 4),
(0x08, 7),
(0x08, 8),
(0x09, 16),
(0x0a, 27),
(0x0b, 24),
(0x0b, 25),
(0x0c, 22),
(0x0d, 20),
(0x0d, 18),
(0x0e, 22),
(0x0f, 4),
(0x10, 3),
Expand All @@ -99,16 +102,15 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[
(0x18, 2),
(0x19, 3),
(0x1a, 7),
(0x1c, 1),
(0x1d, 1),
(0x1f, 22),
(0x20, 3),
(0x23, 1),
(0x2b, 5),
(0x2c, 2),
(0x2d, 11),
(0x2e, 1),
(0x30, 3),
(0x31, 1),
(0x31, 3),
(0x32, 2),
(0xa7, 1),
(0xa8, 2),
Expand All @@ -125,19 +127,19 @@ const SINGLETONS0L: &'static [u8] = &[
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
0x58, 0x60, 0x88, 0x8b, 0x8c, 0x90, 0x1c, 0x1d,
0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0x2e, 0x2f, 0x3f,
0x5c, 0x5d, 0xb5, 0xe2, 0x84, 0x8d, 0x8e, 0x91,
0x92, 0xa9, 0xb1, 0xba, 0xbb, 0xc5, 0xc6, 0xc9,
0xca, 0xde, 0xe4, 0xe5, 0x04, 0x11, 0x12, 0x29,
0x31, 0x34, 0x37, 0x3a, 0x3b, 0x3d, 0x49, 0x4a,
0x5d, 0x84, 0x8e, 0x92, 0xa9, 0xb1, 0xb4, 0xba,
0xbb, 0xc6, 0xca, 0xce, 0xcf, 0xe4, 0xe5, 0x04,
0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, 0x34, 0x3a,
0x3b, 0x45, 0x46, 0x49, 0x4a, 0x5e, 0x64, 0x65,
0x84, 0x91, 0x9b, 0x9d, 0xc9, 0xce, 0xcf, 0x04,
0x0d, 0x11, 0x29, 0x45, 0x49, 0x57, 0x64, 0x65,
0x84, 0x8d, 0x91, 0xa9, 0xb4, 0xba, 0xbb, 0xc5,
0xc9, 0xdf, 0xe4, 0xe5, 0xf0, 0x04, 0x0d, 0x11,
0x3b, 0x3c, 0x45, 0x49, 0x64, 0x65, 0x80, 0x81,
0x5c, 0x5d, 0x5f, 0xb5, 0xe2, 0x84, 0x8d, 0x8e,
0x91, 0x92, 0xa9, 0xb1, 0xba, 0xbb, 0xc5, 0xc6,
0xc9, 0xca, 0xde, 0xe4, 0xe5, 0x04, 0x11, 0x12,
0x29, 0x31, 0x34, 0x37, 0x3a, 0x3b, 0x3d, 0x49,
0x4a, 0x5d, 0x84, 0x8e, 0x92, 0xa9, 0xb1, 0xb4,
0xba, 0xbb, 0xc6, 0xca, 0xce, 0xcf, 0xe4, 0xe5,
0x00, 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31,
0x34, 0x3a, 0x3b, 0x45, 0x46, 0x49, 0x4a, 0x5e,
0x64, 0x65, 0x84, 0x91, 0x9b, 0x9d, 0xc9, 0xce,
0xcf, 0x04, 0x0d, 0x11, 0x29, 0x45, 0x49, 0x57,
0x64, 0x65, 0x84, 0x8d, 0x91, 0xa9, 0xb4, 0xba,
0xbb, 0xc5, 0xc9, 0xdf, 0xe4, 0xe5, 0xf0, 0x04,
0x0d, 0x11, 0x45, 0x49, 0x64, 0x65, 0x80, 0x81,
0x84, 0xb2, 0xbc, 0xbe, 0xbf, 0xd5, 0xd7, 0xf0,
0xf1, 0x83, 0x85, 0x86, 0x89, 0x8b, 0x8c, 0x98,
0xa0, 0xa4, 0xa6, 0xa8, 0xa9, 0xac, 0xba, 0xbe,
Expand All @@ -148,18 +150,18 @@ const SINGLETONS0L: &'static [u8] = &[
0x11, 0x16, 0x17, 0x5b, 0x5c, 0xf6, 0xf7, 0xfe,
0xff, 0x80, 0x0d, 0x6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xd8, 0xd9, 0xe7, 0xfe, 0xff,
];
const SINGLETONS1U: &'static [(u8, u8)] = &[
(0x00, 6),
Expand All @@ -176,7 +178,9 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[
(0x13, 18),
(0x14, 2),
(0x15, 2),
(0x1a, 3),
(0x1c, 5),
(0x1d, 4),
(0x24, 1),
(0x6a, 3),
(0x6b, 2),
Expand All @@ -192,7 +196,7 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[
(0xee, 32),
(0xf0, 4),
(0xf1, 1),
(0xf9, 4),
(0xf9, 1),
];
const SINGLETONS1L: &'static [u8] = &[
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
Expand All @@ -202,18 +206,18 @@ const SINGLETONS1L: &'static [u8] = &[
0x89, 0x8e, 0x9e, 0x04, 0x0d, 0x0e, 0x11, 0x12,
0x29, 0x31, 0x34, 0x3a, 0x3b, 0x45, 0x46, 0x49,
0x4a, 0x4e, 0x4f, 0x64, 0x65, 0x5a, 0x5c, 0xb6,
0xb7, 0x09, 0x37, 0x90, 0x91, 0xa8, 0x6f, 0x5f,
0xee, 0xef, 0x5a, 0x62, 0x9a, 0x9b, 0x27, 0x28,
0x55, 0x9d, 0xa0, 0xa1, 0xa3, 0xa4, 0xa7, 0xa8,
0xad, 0xba, 0xbc, 0xc4, 0x06, 0x0b, 0x0c, 0x15,
0x1d, 0x3a, 0x3f, 0x45, 0x51, 0xa6, 0xa7, 0xcc,
0xcd, 0xa0, 0x07, 0x19, 0x1a, 0x22, 0x25, 0xc5,
0xc6, 0x04, 0x20, 0x23, 0x25, 0x26, 0x28, 0x33,
0x38, 0x3a, 0x48, 0x4a, 0x4c, 0x50, 0x53, 0x55,
0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x63, 0x65,
0x66, 0x6b, 0x73, 0x78, 0x7d, 0x7f, 0x8a, 0xa4,
0xaa, 0xaf, 0xb0, 0xc0, 0xd0, 0x2f, 0x1f, 0x31,
0x32, 0x3f,
0xb7, 0x84, 0x85, 0x9d, 0x09, 0x37, 0x90, 0x91,
0xa8, 0x07, 0x0a, 0x3b, 0x3e, 0x6f, 0x5f, 0xee,
0xef, 0x5a, 0x62, 0x9a, 0x9b, 0x27, 0x28, 0x55,
0x9d, 0xa0, 0xa1, 0xa3, 0xa4, 0xa7, 0xa8, 0xad,
0xba, 0xbc, 0xc4, 0x06, 0x0b, 0x0c, 0x15, 0x1d,
0x3a, 0x3f, 0x45, 0x51, 0xa6, 0xa7, 0xcc, 0xcd,
0xa0, 0x07, 0x19, 0x1a, 0x22, 0x25, 0xc5, 0xc6,
0x04, 0x20, 0x23, 0x25, 0x26, 0x28, 0x33, 0x38,
0x3a, 0x48, 0x4a, 0x4c, 0x50, 0x53, 0x55, 0x56,
0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x63, 0x65, 0x66,
0x6b, 0x73, 0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa,
0xaf, 0xb0, 0xc0, 0xd0, 0x2f, 0x3f,
];
const NORMAL0: &'static [u8] = &[
0x00, 0x20,
Expand All @@ -224,12 +228,12 @@ const NORMAL0: &'static [u8] = &[
0x05, 0x11,
0x81, 0xac, 0x0e,
0x3b, 0x05,
0x5f, 0x41,
0x6b, 0x35,
0x1e, 0x16,
0x80, 0xdf, 0x03,
0x19, 0x08,
0x01, 0x04,
0x20, 0x05,
0x22, 0x03,
0x0a, 0x04,
0x34, 0x04,
0x07, 0x03,
Expand All @@ -238,8 +242,7 @@ const NORMAL0: &'static [u8] = &[
0x10, 0x0b,
0x50, 0x0f,
0x12, 0x07,
0x01, 0x07,
0x4d, 0x08,
0x55, 0x08,
0x02, 0x04,
0x1c, 0x0a,
0x09, 0x03,
Expand All @@ -258,8 +261,8 @@ const NORMAL0: &'static [u8] = &[
0x10, 0x08,
0x56, 0x07,
0x02, 0x07,
0x15, 0x0e,
0x4f, 0x04,
0x15, 0x0d,
0x50, 0x04,
0x43, 0x03,
0x2d, 0x03,
0x01, 0x04,
Expand Down Expand Up @@ -304,34 +307,32 @@ const NORMAL0: &'static [u8] = &[
0x3c, 0x37,
0x08, 0x08,
0x2a, 0x06,
0x80, 0xf6, 0x05,
0x82, 0x04, 0x11,
0x82, 0xff, 0x11,
0x18, 0x08,
0x2f, 0x11,
0x2d, 0x03,
0x1f, 0x11,
0x20, 0x10,
0x21, 0x0f,
0x80, 0x8c, 0x04,
0x82, 0x97, 0x19,
0x0b, 0x15,
0x87, 0x5a, 0x03,
0x15, 0x1a,
0x16, 0x19,
0x04, 0x10,
0x80, 0xf4, 0x05,
0x2f, 0x05,
0x3b, 0x07,
0x02, 0x0e,
0x18, 0x09,
0x80, 0xa5, 0x3b,
0x80, 0xaa, 0x36,
0x74, 0x0c,
0x80, 0xd6, 0x1a,
0x0c, 0x05,
0x80, 0xff, 0x05,
0x29, 0x03,
0x80, 0x8a, 0x05,
0x80, 0xb6, 0x05,
0x24, 0x0c,
0x9b, 0xc6, 0x0a,
0xd2, 0x16, 0x2a,
0xd2, 0x2b, 0x15,
0x84, 0x8d, 0x03,
0x37, 0x09,
0x81, 0x5c, 0x14,
Expand Down Expand Up @@ -378,8 +379,8 @@ const NORMAL1: &'static [u8] = &[
0x1d, 0x03,
0x31, 0x0f,
0x1c, 0x04,
0x24, 0x0c,
0x1b, 0x05,
0x24, 0x09,
0x1e, 0x05,
0x2b, 0x05,
0x44, 0x04,
0x0e, 0x2a,
Expand Down Expand Up @@ -447,11 +448,16 @@ const NORMAL1: &'static [u8] = &[
0x0f, 0x04,
0x10, 0x81, 0x60,
0x53, 0x0c,
0x01, 0x81, 0xc0,
0x01, 0x81, 0x00,
0x48, 0x08,
0x53, 0x1d,
0x39, 0x81, 0x07,
0x46, 0x0a,
0x1d, 0x03,
0x47, 0x83, 0x49,
0x47, 0x49,
0x37, 0x03,
0x0e, 0x08,
0x0a, 0x82, 0xa6,
0x83, 0x9a, 0x66,
0x75, 0x0b,
0x80, 0xc4, 0x8a, 0xbc,
Expand All @@ -467,10 +473,11 @@ const NORMAL1: &'static [u8] = &[
0x45, 0x0b,
0x2f, 0x10,
0x11, 0x40,
0x01, 0x1f,
0x02, 0x1e,
0x97, 0xed, 0x13,
0x82, 0xf3, 0xa5, 0x0d,
0x02, 0x8b, 0xfe,
0x81, 0x1f, 0x51,
0x81, 0x8c, 0x89, 0x04,
0x6b, 0x05,
0x0d, 0x03,
0x09, 0x07,
Expand Down Expand Up @@ -503,20 +510,22 @@ const NORMAL1: &'static [u8] = &[
0x1d, 0x0d,
0x2c, 0x04,
0x09, 0x07,
0x02, 0x80, 0xae,
0x83, 0xd3, 0x0d,
0x02, 0x0e,
0x06, 0x80, 0x9a,
0x83, 0xd5, 0x0b,
0x0d, 0x03,
0x07, 0x09,
0x09, 0x07,
0x74, 0x0c,
0x55, 0x2b,
0x0c, 0x04,
0x38, 0x08,
0x0a, 0x06,
0x28, 0x08,
0x1e, 0x62,
0x18, 0x08,
0x1c, 0x04,
0x0f, 0x21,
0x12, 0x2e,
0x01, 0x86, 0x3f,
0x1e, 0x52,
0x0c, 0x04,
0x3d, 0x03,
0x1c, 0x14,
0x18, 0x28,
0x01, 0x0f,
0x17, 0x86, 0x19,
];

0 comments on commit a17e724

Please sign in to comment.