Crate cldr_pluralrules_parser[−][src]
A crate for parsing CLDR plural rules.
This crate parses plural rules and returns an AST representation of the rule. Plural rules must be written according to the specifications outlined at Unicode's website.
Plural rules, compatible with this crate, can be found at this GitHub repository.
Examples
let condition = Condition(vec![ AndCondition(vec![Relation { expression: Expression { operand: Operand('i'), modulus: None, }, operator: Operator::Is, range_list: RangeList(vec![RangeListItem::Value(Value(5))]), }]), AndCondition(vec![Relation { expression: Expression { operand: Operand('v'), modulus: None, }, operator: Operator::Within, range_list: RangeList(vec![RangeListItem::Value(Value(2))]), }]), ]) assert_eq!(condition, parse_plural_rule("i is 5 or v within 2"))
Modules
ast |
A public AST module for plural rule representations. |
Functions
parse_plural_rule |
Given a string reference of a plural rule, will return the AST representation of that rule. |