Skip to content

Commit

Permalink
Make some items in core::unicode private
Browse files Browse the repository at this point in the history
They were reachable through opaque macros defined in `core`
  • Loading branch information
matthewjasper committed Aug 5, 2019
1 parent 8ae8bc2 commit 7b41fd2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions src/libcore/unicode/tables.rs
Expand Up @@ -14,8 +14,8 @@ pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
micro: 0,
_priv: (),
};
pub mod general_category {
pub const Cc_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
pub(crate) mod general_category {
const Cc_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
r1: &[
0, 1, 0
],
Expand All @@ -28,7 +28,7 @@ pub mod general_category {
Cc_table.lookup(c)
}

pub const N_table: &super::BoolTrie = &super::BoolTrie {
const N_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x03ff000000000000, 0x0000000000000000, 0x720c000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
Expand Down Expand Up @@ -141,8 +141,8 @@ pub mod general_category {

}

pub mod derived_property {
pub const Alphabetic_table: &super::BoolTrie = &super::BoolTrie {
pub(crate) mod derived_property {
const Alphabetic_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0000000000000000, 0x07fffffe07fffffe, 0x0420040000000000, 0xff7fffffff7fffff,
0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
Expand Down Expand Up @@ -327,7 +327,7 @@ pub mod derived_property {
Alphabetic_table.lookup(c)
}

pub const Case_Ignorable_table: &super::BoolTrie = &super::BoolTrie {
const Case_Ignorable_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0400408000000000, 0x0000000140000000, 0x0190a10000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
Expand Down Expand Up @@ -464,7 +464,7 @@ pub mod derived_property {
Case_Ignorable_table.lookup(c)
}

pub const Cased_table: &super::BoolTrie = &super::BoolTrie {
const Cased_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0000000000000000, 0x07fffffe07fffffe, 0x0420040000000000, 0xff7fffffff7fffff,
0xffffffffffffffff, 0xffffffffffffffff, 0xf7ffffffffffffff, 0xfffffffffffffff0,
Expand Down Expand Up @@ -565,7 +565,7 @@ pub mod derived_property {
Cased_table.lookup(c)
}

pub const Grapheme_Extend_table: &super::BoolTrie = &super::BoolTrie {
const Grapheme_Extend_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
Expand Down Expand Up @@ -689,7 +689,7 @@ pub mod derived_property {
Grapheme_Extend_table.lookup(c)
}

pub const Lowercase_table: &super::BoolTrie = &super::BoolTrie {
const Lowercase_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0000000000000000, 0x07fffffe00000000, 0x0420040000000000, 0xff7fffff80000000,
0x55aaaaaaaaaaaaaa, 0xd4aaaaaaaaaaab55, 0xe6512d2a4e243129, 0xaa29aaaab5555240,
Expand Down Expand Up @@ -789,7 +789,7 @@ pub mod derived_property {
Lowercase_table.lookup(c)
}

pub const Uppercase_table: &super::BoolTrie = &super::BoolTrie {
const Uppercase_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0000000000000000, 0x0000000007fffffe, 0x0000000000000000, 0x000000007f7fffff,
0xaa55555555555555, 0x2b555555555554aa, 0x11aed2d5b1dbced6, 0x55d255554aaaa490,
Expand Down Expand Up @@ -890,7 +890,7 @@ pub mod derived_property {
Uppercase_table.lookup(c)
}

pub const XID_Continue_table: &super::BoolTrie = &super::BoolTrie {
const XID_Continue_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x03ff000000000000, 0x07fffffe87fffffe, 0x04a0040000000000, 0xff7fffffff7fffff,
0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
Expand Down Expand Up @@ -1068,7 +1068,7 @@ pub mod derived_property {
XID_Continue_table.lookup(c)
}

pub const XID_Start_table: &super::BoolTrie = &super::BoolTrie {
const XID_Start_table: &super::BoolTrie = &super::BoolTrie {
r1: [
0x0000000000000000, 0x07fffffe07fffffe, 0x0420040000000000, 0xff7fffffff7fffff,
0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
Expand Down Expand Up @@ -1250,8 +1250,8 @@ pub mod derived_property {

}

pub mod property {
pub const Pattern_White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
pub(crate) mod property {
const Pattern_White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
r1: &[
0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Expand All @@ -1268,7 +1268,7 @@ pub mod property {
Pattern_White_Space_table.lookup(c)
}

pub const White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
const White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
r1: &[
0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Expand All @@ -1290,7 +1290,7 @@ pub mod property {

}

pub mod conversions {
pub(crate) mod conversions {
pub fn to_lower(c: char) -> [char; 3] {
match bsearch_case_table(c, to_lowercase_table) {
None => [c, '\0', '\0'],
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/unicode/unicode.py
Expand Up @@ -606,7 +606,7 @@ def compute_trie(raw_data, chunk_size):
return root, child_data


def generate_bool_trie(name, codepoint_ranges, is_pub=True):
def generate_bool_trie(name, codepoint_ranges, is_pub=False):
# type: (str, List[Tuple[int, int]], bool) -> Iterator[str]
"""
Generate Rust code for BoolTrie struct.
Expand Down Expand Up @@ -681,7 +681,7 @@ def generate_bool_trie(name, codepoint_ranges, is_pub=True):
yield " };\n\n"


def generate_small_bool_trie(name, codepoint_ranges, is_pub=True):
def generate_small_bool_trie(name, codepoint_ranges, is_pub=False):
# type: (str, List[Tuple[int, int]], bool) -> Iterator[str]
"""
Generate Rust code for `SmallBoolTrie` struct.
Expand Down Expand Up @@ -726,7 +726,7 @@ def generate_property_module(mod, grouped_categories, category_subset):
Generate Rust code for module defining properties.
"""

yield "pub mod %s {\n" % mod
yield "pub(crate) mod %s {\n" % mod
for cat in sorted(category_subset):
if cat in ("Cc", "White_Space", "Pattern_White_Space"):
generator = generate_small_bool_trie("%s_table" % cat, grouped_categories[cat])
Expand All @@ -749,7 +749,7 @@ def generate_conversions_module(unicode_data):
Generate Rust code for module defining conversions.
"""

yield "pub mod conversions {"
yield "pub(crate) mod conversions {"
yield """
pub fn to_lower(c: char) -> [char; 3] {
match bsearch_case_table(c, to_lowercase_table) {
Expand Down

0 comments on commit 7b41fd2

Please sign in to comment.