about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2014-10-13 13:51:43 +0100
committerSimon Sapin <simon.sapin@exyr.org>2014-10-13 14:07:12 +0100
commit61a8a28f9ff10aed41b1ee5c58df827db6b87d7c (patch)
tree35ae7cbbe4fa019e81e5cd2ac7f616eca1a0496a /src
parent7dbd4349c406b997b486426d2e3aa9f2cc1fbd0c (diff)
downloadrust-61a8a28f9ff10aed41b1ee5c58df827db6b87d7c.tar.gz
rust-61a8a28f9ff10aed41b1ee5c58df827db6b87d7c.zip
Include the Unicode version used to generate `src/libunicode/tables.rs`.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/etc/unicode.py9
-rw-r--r--src/libunicode/lib.rs1
-rw-r--r--src/libunicode/tables.rs4
3 files changed, 14 insertions, 0 deletions
diff --git a/src/etc/unicode.py b/src/etc/unicode.py
index 0b128686690..d3de1d2b64e 100755
--- a/src/etc/unicode.py
+++ b/src/etc/unicode.py
@@ -604,6 +604,15 @@ if __name__ == "__main__":
         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"]
diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs
index 2918bad03df..b84aec77a09 100644
--- a/src/libunicode/lib.rs
+++ b/src/libunicode/lib.rs
@@ -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};
diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs
index e359883295f..3f15abcad6d 100644
--- a/src/libunicode/tables.rs
+++ b/src/libunicode/tables.rs
@@ -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;