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
//! Case folding for the built-in check prefilter.
//!
//! `build.rs` derives, for every built-in check, a set of literals of which
//! at least one must occur in any text the check's regex matches (see
//! `required_literals` there). Literals are stored folded with
//! [`fold_char`], and the text is folded the same way before the search, so
//! a case-insensitive `(?i)drop` still yields the literal `drop`.
//!
//! The prefilter only has to be *necessary*, never sufficient: a check whose
//! literals are all absent from the folded text cannot match, so its regex
//! is never compiled for that command. This file is shared with `build.rs`
//! (`#[path]` include), which keeps both sides folding identically.
/// Fold one character: ASCII and simple Unicode lowercase, plus the two
/// characters whose case folding is not their lowercase form (`ſ` → `s`,
/// Kelvin sign → `k`). Any deterministic mapping is correct here, as long as
/// build.rs and the runtime use the same one.
/// Fold a whole text with [`fold_char`].