LP-XXX/moonmo/plural does not have a README file

    PluralError

    pub suberror PluralError {
    MalformedPluralHeader(raw~ : String, reason~ : String)
    InvalidNplurals(value~ : String)
    UnexpectedToken(expected~ : String, found~ : String, pos~ : Int)
    TrailingTokens(found~ : String, pos~ : Int)
    MaxDepthExceeded(limit~ : Int)
    DivisionByZero
    EvalLimitExceeded(limit~ : Int)
    InvalidPluralIndex(index~ : UInt64, nplurals~ : Int)
    UnexpectedChar(ch~ : Char, pos~ : Int)
    IntegerOverflow(lexeme~ : String, pos~ : Int)
    } derive(Eq,
    Debug
    )

    Syntax, count, resource-limit or arithmetic error from parsing or evaluating plural rules. Example: rule.eval_index(2) catch { _ => 0 }.
    impl Show for PluralError

    BinaryOp

    pub enum BinaryOp {
    LogicalOr
    LogicalAnd
    Eq
    NotEq
    Lt
    LtEq
    Gt
    GtEq
    Add
    Sub
    Mul
    Div
    Mod
    } derive(Eq,
    Debug
    )

    Arithmetic, comparison or short-circuit logical operator in a parsed expression. Example: @plural.parse_expr("n%10").
    impl Show for BinaryOp

    PluralExpr

    pub enum PluralExpr {
    VarN
    Literal(UInt64)
    Unary(UnaryOp, PluralExpr)
    Binary(BinaryOp, PluralExpr, PluralExpr)
    Ternary(PluralExpr, PluralExpr, PluralExpr)
    } derive(Eq,
    Debug
    )

    Syntax tree for a GNU integer plural expression over n. Example: @plural.parse_expr("n != 1").
    impl Show for PluralExpr

    PluralExpr::eval

    fn PluralExpr::eval(self : PluralExpr, n : UInt64) -> UInt64 raise PluralError

    Evaluate with UInt64 arithmetic and short-circuiting. Division or remainder by zero and evaluation limits raise PluralError. Example: expr.eval(21).

    PluralRule

    pub struct PluralRule {
    nplurals : Int
    expr : PluralExpr
    source : String
    } derive(Eq,
    Debug
    )

    Compiled expression, its source and the declared number of translation forms. Example: cat.plural_rule().nplurals.
    impl Show for PluralRule

    PluralRule::default_germanic

    fn PluralRule::default_germanic() -> PluralRule

    Create the default two-form rule with index zero for n=1 and one otherwise. Example: @plural.PluralRule::default_germanic().

    PluralRule::eval_index

    fn PluralRule::eval_index(self : PluralRule, n : UInt64) -> Int raise PluralError

    Evaluate a count and check the resulting index against nplurals. Propagates evaluation errors and raises InvalidPluralIndex for an out-of-range result. Example: rule.eval_index(21).

    PluralRule::parse

    fn PluralRule::parse(header_value : String) -> PluralRule raise PluralError

    Compile a Plural-Forms value. Raises PluralError for invalid assignments, counts outside 1..64 or expression errors. Example: @plural.PluralRule::parse("nplurals=2; plural=n!=1;").

    UnaryOp

    pub enum UnaryOp {
    LogicalNot
    } derive(Eq,
    Debug
    )

    Logical negation operator in a parsed plural expression. Example: @plural.parse_expr("!n").
    impl Show for UnaryOp

    parse_expr

    fn parse_expr(input : String) -> PluralExpr raise PluralError

    Parse an expression with GNU precedence. Invalid tokens, overflowing literals and excessive nesting raise PluralError. Example: @plural.parse_expr("n%10").