1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Bundled Unicode Character Database snapshots.
//!
//! The XSLT / XPath spec doesn't pin a Unicode version — implementations
//! report whatever they were built against. Most production code paths
//! in this crate use the latest UCD via the `unicode-properties` crate
//! dependency. Two corners of the W3C XSLT conformance suite, however,
//! pin their expected answers to specific historical Unicode versions:
//!
//! * `tests/misc/regex-classes` — Unicode 6.0 (when these tests were
//! first written, ~2012). 120 cases.
//! * `tests/misc/unicode-90` — Unicode 9.0 (deliberately added to
//! probe Unicode 9.0-only digits). ~1440 cases.
//!
//! Bundling per-version `General_Category` snapshots costs ~45 KB of
//! compiled data total and lets the regex engine answer those tests
//! against the version they were authored for instead of skipping
//! them. Production users of `fn:matches` etc. continue to get the
//! latest UCD by default.
//!
//! ## Provenance
//!
//! The static tables under `v6_0.rs` / `v9_0.rs` are generated from
//! the official `UnicodeData.txt` files at
//! `https://www.unicode.org/Public/<version>/ucd/UnicodeData.txt`
//! by parsing each line's `General_Category` (field 2), merging
//! contiguous codepoints with the same category, and emitting the
//! result as `Range` arrays sorted by `start`. Range markers
//! (`<…, First>` / `<…, Last>`) expand to the inclusive span.
/// A half-open inclusive codepoint range. `start <= end`. Used in
/// the per-version `General_Category` tables to keep the bundled data
/// compact (~8 bytes / entry on 32-bit codepoints).
/// Which Unicode snapshot the regex engine should consult when
/// resolving `\p{…}` properties. `Latest` defers to the
/// `unicode-properties` crate (production code path); the older
/// variants force lookup against the bundled snapshots.
/// Look up a General_Category short-name (`Lu`, `Nd`, `Mn`, …) in the
/// requested Unicode snapshot. Returns the sorted range list for that
/// category, or `None` if the name isn't a recognised category or the
/// snapshot doesn't carry it.