Skip to content

Commit 963f371

Browse files
committed
Remove regex module from libunicode
The regex crate keeps its own tables now (rust-lang/regex#41) so we don't need them here. [breaking-change]
1 parent 6790b0e commit 963f371

File tree

3 files changed

+1
-334
lines changed

3 files changed

+1
-334
lines changed

src/etc/unicode.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -317,23 +317,6 @@ def emit_property_module(f, mod, tbl, emit_fn):
317317
f.write(" }\n\n")
318318
f.write("}\n\n")
319319

320-
def emit_regex_module(f, cats, w_data):
321-
f.write("pub mod regex {\n")
322-
regex_class = "&'static [(char, char)]"
323-
class_table = "&'static [(&'static str, %s)]" % regex_class
324-
325-
emit_table(f, "UNICODE_CLASSES", cats, class_table,
326-
pfun=lambda x: "(\"%s\",super::%s::%s_table)" % (x[0], x[1], x[0]))
327-
328-
f.write(" pub const PERLD: %s = super::general_category::Nd_table;\n\n"
329-
% regex_class)
330-
f.write(" pub const PERLS: %s = super::property::White_Space_table;\n\n"
331-
% regex_class)
332-
333-
emit_table(f, "PERLW", w_data, regex_class)
334-
335-
f.write("}\n\n")
336-
337320
def emit_conversions_module(f, lowerupper, upperlower):
338321
f.write("pub mod conversions {")
339322
f.write("""
@@ -616,27 +599,12 @@ def optimize_width_table(wtable):
616599
# bsearch_range_table is used in all the property modules below
617600
emit_bsearch_range_table(rf)
618601

619-
# all of these categories will also be available as \p{} in libregex
620-
allcats = []
602+
# category tables
621603
for (name, cat, pfuns) in ("general_category", gencats, ["N", "Cc"]), \
622604
("derived_property", derived, want_derived), \
623605
("script", scripts, []), \
624606
("property", props, ["White_Space"]):
625607
emit_property_module(rf, name, cat, pfuns)
626-
allcats.extend(map(lambda x: (x, name), cat))
627-
allcats.sort(key=lambda c: c[0])
628-
629-
# the \w regex corresponds to Alphabetic + Mark + Decimal_Number +
630-
# Connector_Punctuation + Join-Control according to UTS#18
631-
# http://www.unicode.org/reports/tr18/#Compatibility_Properties
632-
perl_words = []
633-
for cat in derived["Alphabetic"], gencats["M"], gencats["Nd"], \
634-
gencats["Pc"], props["Join_Control"]:
635-
perl_words.extend(ungroup_cat(cat))
636-
perl_words = group_cat(perl_words)
637-
638-
# emit lookup tables for \p{}, along with \d, \w, and \s for libregex
639-
emit_regex_module(rf, allcats, perl_words)
640608

641609
# normalizations and conversions module
642610
emit_norm_module(rf, canon_decomp, compat_decomp, combines, norm_props)

src/libunicode/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939

4040
extern crate core;
4141

42-
// regex module
43-
pub use tables::regex;
44-
4542
mod normalize;
4643
mod tables;
4744
mod u_str;

0 commit comments

Comments
 (0)