diff options
author | Chih-Hung Hsieh <chh@google.com> | 2019-10-29 11:06:47 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-10-29 11:06:47 -0700 |
commit | a6d6b306397c2d403c88b1ac3e670204ba7ac022 (patch) | |
tree | e200c780f65ca95045f9e2c013d311b0bbea2008 | |
parent | 18ee23b52a060bb0f39c819ef5e30eb224f8cb10 (diff) | |
parent | 658c7039228ffd8163a5448a37881996eefa97f8 (diff) | |
download | platform_external_rust_crates_unicode-xid-a6d6b306397c2d403c88b1ac3e670204ba7ac022.tar.gz platform_external_rust_crates_unicode-xid-a6d6b306397c2d403c88b1ac3e670204ba7ac022.tar.bz2 platform_external_rust_crates_unicode-xid-a6d6b306397c2d403c88b1ac3e670204ba7ac022.zip |
Use released unicode-xid-0.2.0 at crates.io am: 8f400219ed
am: 658c703922
Change-Id: Ia1f2f1e73e0fa6987a44d222a59e7779c238fad3
-rw-r--r-- | .cargo_vcs_info.json | 5 | ||||
-rw-r--r-- | .travis.yml | 25 | ||||
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | Cargo.toml | 39 | ||||
-rw-r--r-- | Cargo.toml.orig | 28 | ||||
-rwxr-xr-x | scripts/unicode.py | 187 |
6 files changed, 56 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 @@ -1,3 +1,5 @@ +// This file is generated by cargo2android.py. + rust_library_rlib { name: "libunicode_xid", host_supported: true, @@ -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) |