Documentation
¶
Overview ¶
Package charset classifies a single Unicode code point against the property names this engine recognises for the \p{…} / \P{…} construct. It is the one rune-aware piece of the otherwise byte-oriented engine: the parser uses Valid to reject unknown property names at compile time, and the VM uses Match to test a decoded rune.
Two families of names are supported, matching the slice of Onigmo/Ruby this engine implements:
- General categories: the one-letter groups L, N, P, S, Z, C and the two-letter letter/number/other subcategories Lu, Ll, Lt, Lm, Lo, Nd, Nl, No, Cf. These map directly onto Go's unicode range tables.
- Onigmo POSIX-style aliases: Alpha, Alnum, Digit, Space, Upper, Lower and Word. These follow Ruby's definitions (e.g. Space is the Unicode White_Space property, which is broader than the Z general category; Word is letter | mark | decimal-number | connector-punctuation), which do not always coincide with a single general category.
Names are matched case-sensitively, exactly as Onigmo treats them. Negation (\P{…} and \p{^…}) is handled by the caller, not here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FoldEqual ¶
FoldEqual reports whether runes a and b are equal under simple (1:1) Unicode case folding — that is, whether they belong to the same simple-case-folding orbit. The orbit is the cycle Go's unicode.SimpleFold walks (e.g. k → K → Kelvin-sign → k, or Σ → ς → σ → Σ), so FoldEqual('k', 0x212A) and FoldEqual('É', 'é') are both true. This is the engine's rune-level /i model; full/special case folding (multi-character expansions such as ß→"ss" and locale-specific rules such as Turkish dotless-i) is deliberately out of scope.
func FoldRangeContains ¶
FoldRangeContains reports whether code point r is in the inclusive range [lo,hi] under simple case folding: r matches if r, or any rune in r's simple-case-folding orbit, lies within the range. So FoldRangeContains tests "A" against the range "a".."z" (folding to lowercase) and the Kelvin sign against the same range (its orbit includes ASCII "k"). The class machinery uses this so (?i)[a-z] and (?i)[α-ω] match their opposite-case members.
Types ¶
This section is empty.