aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-11-05 12:43:34 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-11-05 12:43:34 +0000
commitc281df4aec21eae38c5e6898fea07a751e0ac65f (patch)
tree32b3c34db61ae50756c47cee698fe29a6f0e8ba7
parent548d586410aadf9c427aa8e36adc8f890889a246 (diff)
parent7d8851e5da6f416e702b390fea1360c9b6e4e263 (diff)
downloadunicode-xid-android10-mainline-networking-release.tar.gz
Snap for 5988121 from 7d8851e5da6f416e702b390fea1360c9b6e4e263 to qt-aml-networking-releaseandroid-mainline-10.0.0_r6android10-mainline-networking-release
Change-Id: I7483dcf6e97bc333f42ceffe64cab245a72d6579
-rw-r--r--.cargo_vcs_info.json5
-rw-r--r--.travis.yml25
-rw-r--r--Android.bp14
-rw-r--r--Cargo.toml39
-rw-r--r--Cargo.toml.orig28
-rwxr-xr-xscripts/unicode.py187
6 files changed, 68 insertions, 230 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
new file mode 100644
index 0000000..fbc3313
--- /dev/null
+++ b/.cargo_vcs_info.json
@@ -0,0 +1,5 @@
+{
+ "git": {
+ "sha1": "4baae9fffb156ba229665b972a9cd5991787ceb7"
+ }
+}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index d9c5c2a..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-language: rust
-rust: 'nightly'
-sudo: false
-script:
- - cargo build --verbose --features bench
- - cargo test --verbose --features bench
- - cargo bench --verbose --features bench
- - cargo clean
- - cargo build --verbose
- - cargo test --verbose
- - rustdoc --test README.md -L target/debug -L target/debug/deps
- - cargo doc
-after_success: |
- [ $TRAVIS_BRANCH = master ] &&
- [ $TRAVIS_PULL_REQUEST = false ] &&
- echo '<meta http-equiv=refresh content=0;url=unicode_xid/index.html>' > target/doc/index.html &&
- pip install ghp-import --user $USER &&
- $HOME/.local/bin/ghp-import -n target/doc &&
- git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
-env:
- global:
- secure: gTlge+/OQlVkV0R+RThWXeN0aknmS7iUTPBMYKJyRdLz7T2vubw3w80a2CVE87JlpV87A5cVGD+LgR+AhYrhKtvqHb1brMDd99gylBBi2DfV7YapDSwSCuFgVR+FjZfJRcXBtI8po5urUZ84V0WLzRX8SyWqWgoD3oCkSL3Wp3w=
-notifications:
- email:
- on_success: never
diff --git a/Android.bp b/Android.bp
index 6e218b8..99031d1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,3 +1,5 @@
+// This file is generated by cargo2android.py.
+
rust_library_rlib {
name: "libunicode_xid",
host_supported: true,
@@ -8,3 +10,15 @@ rust_library_rlib {
"default",
],
}
+
+rust_test {
+ name: "unicode-xid_test_src_lib",
+ host_supported: true,
+ crate_name: "unicode_xid",
+ srcs: ["src/lib.rs"],
+ relative_install_path: "rust/unicode-xid",
+ edition: "2015",
+ features: [
+ "default",
+ ],
+}
diff --git a/Cargo.toml b/Cargo.toml
index e813762..ff004d5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,28 +1,31 @@
-[package]
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+[package]
name = "unicode-xid"
version = "0.2.0"
-authors = ["erick.tryzelaar <erick.tryzelaar@gmail.com>",
- "kwantam <kwantam@gmail.com>",
- ]
-
+authors = ["erick.tryzelaar <erick.tryzelaar@gmail.com>", "kwantam <kwantam@gmail.com>"]
+exclude = ["/scripts/*", "/.travis.yml"]
+description = "Determine whether characters have the XID_Start\nor XID_Continue properties according to\nUnicode Standard Annex #31.\n"
homepage = "https://github.com/unicode-rs/unicode-xid"
-repository = "https://github.com/unicode-rs/unicode-xid"
documentation = "https://unicode-rs.github.io/unicode-xid"
-license = "MIT OR Apache-2.0"
-keywords = ["text", "unicode", "xid"]
readme = "README.md"
-description = """
-Determine whether characters have the XID_Start
-or XID_Continue properties according to
-Unicode Standard Annex #31.
-"""
-exclude = ["/scripts/*", "/.travis.yml"]
-
-[badges]
-travis-ci = { repository = "unicode-rs/unicode-xid" }
+keywords = ["text", "unicode", "xid"]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/unicode-rs/unicode-xid"
[features]
+bench = []
default = []
no_std = []
-bench = []
+[badges.travis-ci]
+repository = "unicode-rs/unicode-xid"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
new file mode 100644
index 0000000..e813762
--- /dev/null
+++ b/Cargo.toml.orig
@@ -0,0 +1,28 @@
+[package]
+
+name = "unicode-xid"
+version = "0.2.0"
+authors = ["erick.tryzelaar <erick.tryzelaar@gmail.com>",
+ "kwantam <kwantam@gmail.com>",
+ ]
+
+homepage = "https://github.com/unicode-rs/unicode-xid"
+repository = "https://github.com/unicode-rs/unicode-xid"
+documentation = "https://unicode-rs.github.io/unicode-xid"
+license = "MIT OR Apache-2.0"
+keywords = ["text", "unicode", "xid"]
+readme = "README.md"
+description = """
+Determine whether characters have the XID_Start
+or XID_Continue properties according to
+Unicode Standard Annex #31.
+"""
+exclude = ["/scripts/*", "/.travis.yml"]
+
+[badges]
+travis-ci = { repository = "unicode-rs/unicode-xid" }
+
+[features]
+default = []
+no_std = []
+bench = []
diff --git a/scripts/unicode.py b/scripts/unicode.py
deleted file mode 100755
index 393f901..0000000
--- a/scripts/unicode.py
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2011-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# This script uses the following Unicode tables:
-# - DerivedCoreProperties.txt
-# - ReadMe.txt
-#
-# Since this should not require frequent updates, we just store this
-# out-of-line and check the unicode.rs file into git.
-
-import fileinput, re, os, sys
-
-preamble = '''// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly
-
-#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
-'''
-
-def fetch(f):
- if not os.path.exists(os.path.basename(f)):
- os.system("curl -O http://www.unicode.org/Public/UNIDATA/%s"
- % f)
-
- if not os.path.exists(os.path.basename(f)):
- sys.stderr.write("cannot load %s" % f)
- exit(1)
-
-def group_cat(cat):
- cat_out = []
- letters = sorted(set(cat))
- cur_start = letters.pop(0)
- cur_end = cur_start
- for letter in letters:
- assert letter > cur_end, \
- "cur_end: %s, letter: %s" % (hex(cur_end), hex(letter))
- if letter == cur_end + 1:
- cur_end = letter
- else:
- cat_out.append((cur_start, cur_end))
- cur_start = cur_end = letter
- cat_out.append((cur_start, cur_end))
- return cat_out
-
-def ungroup_cat(cat):
- cat_out = []
- for (lo, hi) in cat:
- while lo <= hi:
- cat_out.append(lo)
- lo += 1
- return cat_out
-
-def format_table_content(f, content, indent):
- line = " "*indent
- first = True
- for chunk in content.split(","):
- if len(line) + len(chunk) < 98:
- if first:
- line += chunk
- else:
- line += ", " + chunk
- first = False
- else:
- f.write(line + ",\n")
- line = " "*indent + chunk
- f.write(line)
-
-def load_properties(f, interestingprops):
- fetch(f)
- props = {}
- re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
- re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
-
- for line in fileinput.input(os.path.basename(f)):
- prop = None
- d_lo = 0
- d_hi = 0
- m = re1.match(line)
- if m:
- d_lo = m.group(1)
- d_hi = m.group(1)
- prop = m.group(2)
- else:
- m = re2.match(line)
- if m:
- d_lo = m.group(1)
- d_hi = m.group(2)
- prop = m.group(3)
- else:
- continue
- if interestingprops and prop not in interestingprops:
- continue
- d_lo = int(d_lo, 16)
- d_hi = int(d_hi, 16)
- if prop not in props:
- props[prop] = []
- props[prop].append((d_lo, d_hi))
-
- # optimize if possible
- for prop in props:
- props[prop] = group_cat(ungroup_cat(props[prop]))
-
- return props
-
-def escape_char(c):
- return "'\\u{%x}'" % c
-
-def emit_bsearch_range_table(f):
- f.write("""
-fn bsearch_range_table(c: char, r: &[(char,char)]) -> bool {
- use core::cmp::Ordering::{Equal, Less, Greater};
-
- r.binary_search_by(|&(lo,hi)| {
- if lo <= c && c <= hi { Equal }
- else if hi < c { Less }
- else { Greater }
- }).is_ok()
-}\n
-""")
-
-def emit_table(f, name, t_data, t_type = "&[(char, char)]", is_pub=True,
- pfun=lambda x: "(%s,%s)" % (escape_char(x[0]), escape_char(x[1])), is_const=True):
- pub_string = "const"
- if not is_const:
- pub_string = "let"
- if is_pub:
- pub_string = "pub " + pub_string
- f.write(" %s %s: %s = &[\n" % (pub_string, name, t_type))
- data = ""
- first = True
- for dat in t_data:
- if not first:
- data += ","
- first = False
- data += pfun(dat)
- format_table_content(f, data, 8)
- f.write("\n ];\n\n")
-
-def emit_property_module(f, mod, tbl, emit):
- f.write("pub mod %s {\n" % mod)
- for cat in sorted(emit):
- emit_table(f, "%s_table" % cat, tbl[cat])
- f.write(" pub fn %s(c: char) -> bool {\n" % cat)
- f.write(" super::bsearch_range_table(c, %s_table)\n" % cat)
- f.write(" }\n\n")
- f.write("}\n\n")
-
-if __name__ == "__main__":
- r = "tables.rs"
- if os.path.exists(r):
- os.remove(r)
- with open(r, "w") as rf:
- # write the file's preamble
- 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 this version of unicode-xid is based on.
-pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
-""" % unicode_version)
- emit_bsearch_range_table(rf)
-
- want_derived = ["XID_Start", "XID_Continue"]
- derived = load_properties("DerivedCoreProperties.txt", want_derived)
- emit_property_module(rf, "derived_property", derived, want_derived)