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
45
46
47
48
49
50
51
52
53
54
55
use std::fmt::Display;
use std::sync::Arc;

use super::rule::AfxRule;

/// A representation of what a flag represents
#[non_exhaustive]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub enum FlagValue {
    // LemmaPresent and PseudoRoot are missing as they are deprecated
    AfxCircumfix,
    AfxKeepCase,
    AfxNeeded,
    AfxPseudoRoot,
    AfxSubstandard,
    Compound,
    CompoundBegin,
    CompoundEnd,
    CompoundForbid,
    CompoundForceUp,
    CompoundMiddle,
    CompoundOnly,
    CompoundPermit,
    CompoundRoot,
    ForbiddenWord,
    NoSuggest,
    WarnRare,
    /// Special case
    Rule(Arc<AfxRule>),
}

impl Display for FlagValue {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            FlagValue::AfxCircumfix => write!(f, "AfxCircumfix"),
            FlagValue::AfxKeepCase => write!(f, "AfxKeepCase"),
            FlagValue::AfxNeeded => write!(f, "AfxNeeded"),
            FlagValue::AfxPseudoRoot => write!(f, "AfxPseudoRoot"),
            FlagValue::AfxSubstandard => write!(f, "AfxSubstandard"),
            FlagValue::Compound => write!(f, "Compound"),
            FlagValue::CompoundBegin => write!(f, "CompoundBegin"),
            FlagValue::CompoundEnd => write!(f, "CompoundEnd"),
            FlagValue::CompoundForbid => write!(f, "CompoundForbid"),
            FlagValue::CompoundForceUp => write!(f, "CompoundForceUp"),
            FlagValue::CompoundMiddle => write!(f, "CompoundMiddle"),
            FlagValue::CompoundOnly => write!(f, "CompoundOnly"),
            FlagValue::CompoundPermit => write!(f, "CompoundPermit"),
            FlagValue::CompoundRoot => write!(f, "CompoundRoot"),
            FlagValue::ForbiddenWord => write!(f, "ForbiddenWord"),
            FlagValue::NoSuggest => write!(f, "NoSuggest"),
            FlagValue::WarnRare => write!(f, "WarnRare"),
            FlagValue::Rule(_) => write!(f, "Rule"),
        }
    }
}