Module icu_plurals::rules::ast [−][src]
AST
provides a set of Syntax Tree Nodes used to store
the output of parse
method that is used in test_condition
method
to evaluate whether a given PluralCategory
should be used.
Examples
use icu::plurals::rules::parse_condition; use icu::plurals::rules::ast::*; let input = "i = 1"; let ast = parse_condition(input.as_bytes()) .expect("Parsing failed."); assert_eq!(ast, Condition(Box::new([ AndCondition(Box::new([ Relation { expression: Expression { operand: Operand::I, modulus: None, }, operator: Operator::Eq, range_list: RangeList(Box::new([ RangeListItem::Value( Value(1) ) ])) } ])) ])));
Structs
AndCondition | An incomplete AST representation of a plural rule. Comprises a vector of |
Condition | A complete AST representation of a plural rule’s condition. Comprises a vector of |
DecimalValue | A decimal value used in samples. |
Expression | An incomplete AST representation of a plural rule. Comprises an |
RangeList | An incomplete AST representation of a plural rule. Comprises a vector of |
Relation | An incomplete AST representation of a plural rule. Comprises an |
Rule | A complete AST representation of a plural rule.
Comprises a vector of |
SampleList | A list of values used in samples. |
SampleRange | A value range used in samples. |
Samples | A sample of example values that match the given rule. |
Value | An incomplete AST representation of a plural rule, representing one integer. |
Enums
Operand | An incomplete AST representation of a plural rule. Comprises a |
Operator | An enum of |
RangeListItem | An enum of items that appear in a |