Skip to content

Commit 61a8a28

Browse files
committed
Include the Unicode version used to generate src/libunicode/tables.rs.
1 parent 7dbd434 commit 61a8a28

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/etc/unicode.py

+9
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,15 @@ def optimize_width_table(wtable):
604604
rf.write(preamble)
605605

606606
# download and parse all the data
607+
fetch("ReadMe.txt")
608+
with open("ReadMe.txt") as readme:
609+
pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
610+
unicode_version = re.search(pattern, readme.read()).groups()
611+
rf.write("""
612+
/// The version of [Unicode](http://www.unicode.org/)
613+
/// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on.
614+
pub const UNICODE_VERSION: (uint, uint, uint) = (%s, %s, %s);
615+
""" % unicode_version)
607616
(canon_decomp, compat_decomp, gencats, combines,
608617
lowerupper, upperlower) = load_unicode_data("UnicodeData.txt")
609618
want_derived = ["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase"]

src/libunicode/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub mod char {
6464
pub use normalize::{decompose_canonical, decompose_compatible, compose};
6565

6666
pub use tables::normalization::canonical_combining_class;
67+
pub use tables::UNICODE_VERSION;
6768

6869
pub use u_char::{is_alphabetic, is_XID_start, is_XID_continue};
6970
pub use u_char::{is_lowercase, is_uppercase, is_whitespace};

src/libunicode/tables.rs

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
#![allow(missing_doc, non_uppercase_statics, non_snake_case)]
1414

15+
/// The version of [Unicode](http://www.unicode.org/)
16+
/// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on.
17+
pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0);
18+
1519
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
1620
use core::cmp::{Equal, Less, Greater};
1721
use core::slice::ImmutableSlice;

0 commit comments

Comments
 (0)