mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-11 08:23:44 +00:00
The affix engine read one-character flags only, at most 128 of them, as bits of a u128. It now reads `FLAG num` (comma-separated numbers 1-65535, leading digits as in Hunspell) and `FLAG long` (two characters), with up to 65,536 distinct flags (storytold/wordcraft#4966): - One reader (`FlagMode`) parses and writes every flag field: .dic flags, PFX/SFX flags and continuation classes, FORBIDDENWORD and NOSUGGEST. - Each flag gets a dense u16 id; a stem's flags and a rule's continuation classes are sorted id sets interned in one flat table (set 0 is empty). - Hostile input: at most 1,024 flags per entry (Belarusian uses 264), a bad .aff flag is an error, a .dic entry whose flags don't read is skipped, and a FLAG line after flags were read is refused. - Lookups skip the continuation walk for groups and flags no continuation class can reach, so checks are as fast or faster with the Polish, Portuguese, Czech, Italian and Russian dictionaries (same answers). - The compact format writes a `FLAG num`/`FLAG long` line only for those modes, so one-character data is byte-for-byte unchanged and old data still loads. LibreOffice's Serbian (Cyrillic and Latin), Belarusian, Sinhala, Kannada and Nepali dictionaries now load; Danish, Galician, Icelandic and Korean still stop at COMPOUNDMIN, NEEDAFFIX, FULLSTRIP and ICONV. Ported from storytold/wordcraft#5142 (f5778bb76) onto craft-proof. craft-proof already had storytold/wordcraft#735 (AF aliases, SUBSTANDARD, KEEPCASE, ICONV, IGNORE, 256 one-character flags as a bitmask), which this commit predates; conflicts resolved by carrying those through the flag ids: AF aliases resolve to flag text read in the FLAG mode, SUBSTANDARD and KEEPCASE are flag ids like FORBIDDENWORD and NOSUGGEST, and lookups exclude up to four flags (Excluded). The FLAG long test lines in the language modules and slot.rs now use an unknown mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FypgCX8LsYYE8fsj4byBm2