Skip to content

Commit

Permalink
Include the Unicode version used to generate src/libunicode/tables.rs.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Oct 13, 2014
1 parent 7dbd434 commit 61a8a28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/etc/unicode.py
Expand Up @@ -604,6 +604,15 @@ def optimize_width_table(wtable):
rf.write(preamble)

# download and parse all the data
fetch("ReadMe.txt")
with open("ReadMe.txt") as readme:
pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
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.
pub const UNICODE_VERSION: (uint, uint, uint) = (%s, %s, %s);
""" % unicode_version)
(canon_decomp, compat_decomp, gencats, combines,
lowerupper, upperlower) = load_unicode_data("UnicodeData.txt")
want_derived = ["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase"]
Expand Down
1 change: 1 addition & 0 deletions src/libunicode/lib.rs
Expand Up @@ -64,6 +64,7 @@ pub mod char {
pub use normalize::{decompose_canonical, decompose_compatible, compose};

pub use tables::normalization::canonical_combining_class;
pub use tables::UNICODE_VERSION;

pub use u_char::{is_alphabetic, is_XID_start, is_XID_continue};
pub use u_char::{is_lowercase, is_uppercase, is_whitespace};
Expand Down
4 changes: 4 additions & 0 deletions src/libunicode/tables.rs
Expand Up @@ -12,6 +12,10 @@

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

/// The version of [Unicode](http://www.unicode.org/)
/// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on.
pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0);

fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
use core::cmp::{Equal, Less, Greater};
use core::slice::ImmutableSlice;
Expand Down

0 comments on commit 61a8a28

Please sign in to comment.