pub fn canonical_repeat(
expr: GrammarExpr,
min: u64,
max: Option<u64>,
) -> Result<GrammarExpr, RepetitionBoundsError>Expand description
Lowers counted repetition to its most specific expression variant.
As the JavaScript canonicalRepeat builder does, 0.. is zero-or-more,
1.. is one-or-more, 0..1 is optional, and every other range is a
counted repeat.
ยงErrors
Returns RepetitionBoundsError when max is below min or either
bound exceeds the JavaScript safe-integer range.