Skip to main content

Module casefold

Module casefold 

Source
Expand description

Case-insensitive matching (FR-A10) as closure of symbol sets.

A CaseFold is a canonicalisation canon: code point -> code point (stored sparsely as the pairs where it changes a character). Two characters match case-insensitively when their canonical forms are equal, so the set matched by a class S is { c : canon(c) in canon(S) }.

Dialects differ only in the canonicalisation (RULE-10):

  • ECMAScript without u: toUpperCase when it yields one character and does not map non-ASCII into ASCII (ECMA-262 Canonicalize);
  • ECMAScript with u, Go, Rust, PCRE2: Unicode simple case folding;
  • Python re: simple lowercase plus the interpreter’s equivalence keys (e.g. i also matches dotless ı), or ASCII-only under re.ASCII.

No supported dialect defines full case folding (ß vs ss) for matching, so none is implemented.

Structs§

CaseFold
Sparse canonicalisation and the closure operations built on it.

Enums§

CaseModel
Which canonicalisation to use.