Careylq/spell/src/aff does not have a README file

    AffParseError

    pub(all) suberror AffParseError {
    AffParseError(line~ : Int, message~ : String)
    } derive(Eq,
    Debug
    )

    The error raised when a modelled directive cannot be parsed.

    line is the 1-based line number in the original .aff text.

    AffParseError::output

    fn AffParseError::output(self : AffParseError, logger : &Logger) -> Unit

    AffParseError::to_string

    fn AffParseError::to_string(self : AffParseError) -> String

    AffFile

    pub(all) struct AffFile {
    encoding : String
    flag_type : FlagType
    lang : String
    affix_headers : Array[AffixHeader]
    affix_rules : Array[AffixRule]
    flag_aliases : Array[String]
    morph_aliases : Array[String]
    replacements : Array[Replacement]
    map_groups : Array[String]
    phone_rules : Array[PhoneRule]
    iconv : Array[Conversion]
    oconv : Array[Conversion]
    try_chars : String
    keyboard : String
    max_ngram_sugs : Int?
    max_diff : Int?
    only_max_diff : Bool
    ignore_chars : String
    word_chars : String
    check_sharps : Bool
    complex_prefixes : Bool
    breaks_declared : Bool
    break_patterns : Array[String]
    compound_min : Int
    compound_flag : String?
    compound_begin : String?
    compound_end : String?
    compound_middle : String?
    compound_rules : Array[String]
    compound_permit : String?
    compound_forbid : String?
    forceucase : String?
    compound_word_max : Int
    compound_syllable_max : Int
    compound_syllable_vowels : String
    check_compound_dup : Bool
    check_compound_triple : Bool
    check_compound_repeat : Bool
    check_compound_simplified_triple : Bool
    check_compound_case : Bool
    check_compound_pattern : Array[String]
    special_flags : SpecialFlags
    unrecognized : Array[UnknownDirective]
    } derive(Eq,
    Debug
    )

    A parsed Hunspell .aff file.

    compound_min is 0 when the file has no COMPOUNDMIN line (Hunspell's own default of 3 is a matching-time concern for a later slice). encoding is "" when the file has no SET line.

    AffixHeader

    pub(all) struct AffixHeader {
    kind : AffixKind
    flag : String
    cross_product : Bool
    count : Int
    } derive(Eq,
    Debug
    )

    The header line of a PFX/SFX block: PFX flag cross_product count.

    AffixKind

    pub(all) enum AffixKind {
    Prefix
    Suffix
    } derive(Eq,
    Debug
    )

    Whether an affix is attached before (Prefix) or after (Suffix) the stem.

    AffixRule

    pub(all) struct AffixRule {
    kind : AffixKind
    flag : String
    cross_product : Bool
    strip : String
    add : String
    condition : String
    morph : Array[String]
    } derive(Eq,
    Debug
    )

    One PFX/SFX rule line: PFX flag strip add condition [morph...].

    Conversion

    pub(all) struct Conversion {
    from : String
    to : String
    } derive(Eq,
    Debug
    )

    One ICONV/OCONV conversion pair.

    from/to are stored verbatim. For ICONV a trailing _ in from is the Hunspell "end of word" marker (ICONV <ZWJ>_ x applies only when <ZWJ> is the last character of the word, as the manual's ICONV <200D>_ <FFF0> example describes); the consumer strips and interprets it.

    FlagType

    pub(all) enum FlagType {
    SingleChar
    Long
    Num
    Utf8
    } derive(Eq,
    Debug
    )

    How flags are encoded in the .aff and .dic files.

    Hunspell's default (no FLAG line) is one character per flag.

    PhoneRule

    pub(all) struct PhoneRule {
    pattern : String
    replacement : String
    } derive(Eq,
    Debug
    )

    One PHONE phonetic-transcription rule.

    Both fields are stored verbatim. The pattern uses the Aspell/Hunspell mini-language documented in the hunspell(5) manual ((class) character classes, leading/trailing -, <, digit priorities, ^, $); _ as a replacement means "output nothing".

    Replacement

    pub(all) struct Replacement {
    from : String
    to : String
    } derive(Eq,
    Debug
    )

    One REP replacement pair.

    from/to are stored verbatim, so the Hunspell convention of _ for a space is preserved and must be interpreted by the consumer.

    SpecialFlags

    pub(all) struct SpecialFlags {
    nosuggest : String?
    keepcase : String?
    forbiddenword : String?
    needaffix : String?
    circumfix : String?
    onlyincompound : String?
    } derive(Eq,
    Debug
    )

    The flag-valued directives that mark a word (or affix) as special.

    None means the directive was absent. Values are stored verbatim (see parse_aff for how AF aliases are handled).

    UnknownDirective

    pub(all) struct UnknownDirective {
    name : String
    args : Array[String]
    line : Int
    } derive(Eq,
    Debug
    )

    A directive this slice does not model, kept so that no input is rejected merely for being unknown.

    parse_aff

    fn parse_aff(text : String) -> AffFile raise AffParseError

    Parse the text of a Hunspell .aff file into a typed AST.

    The first malformed modelled directive stops the parse and raises AffParseError. Unknown directives are collected in AffFile::unrecognized instead of being rejected.

    AF aliases are resolved for PFX/SFX flag arguments (Hunspell replaces affix flags with alias indices when an AF table is present). Flag values in other directives are stored verbatim so that no information is lost.

    Parsing is single-pass, so an AF table must appear before the affix rules that reference it. Real .aff files place AF/AM near the top, so this matches the format in practice.