Handle empty statistics cookies.
This commit is contained in:
parent
d79035e14d
commit
0105b49d0d
@ -1,5 +1,6 @@
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::recognize;
|
||||
use nom::sequence::tuple;
|
||||
|
||||
@ -27,8 +28,11 @@ pub fn percent_statistics_cookie<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
|
||||
let (remaining, _) =
|
||||
recognize(tuple((tag("["), nom::character::complete::u64, tag("%]"))))(input)?;
|
||||
let (remaining, _) = recognize(tuple((
|
||||
tag("["),
|
||||
opt(nom::character::complete::u64),
|
||||
tag("%]"),
|
||||
)))(input)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
@ -47,9 +51,9 @@ pub fn fraction_statistics_cookie<'b, 'g, 'r, 's>(
|
||||
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
|
||||
let (remaining, _) = recognize(tuple((
|
||||
tag("["),
|
||||
nom::character::complete::u64,
|
||||
opt(nom::character::complete::u64),
|
||||
tag("/"),
|
||||
nom::character::complete::u64,
|
||||
opt(nom::character::complete::u64),
|
||||
tag("]"),
|
||||
)))(input)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
|
Loading…
Reference in New Issue
Block a user