replace use of fold_many0 with many0

in nom 8, `many0` doesn't accumulate when used within `recognize`
This commit is contained in:
llama 2025-06-20 07:47:34 +08:00
parent 001aea4eca
commit 4b8f847cd8
No known key found for this signature in database
GPG key ID: 0B7543854B9413C3

View file

@ -14,7 +14,6 @@ use nom::combinator::recognize;
use nom::combinator::rest; use nom::combinator::rest;
use nom::combinator::success; use nom::combinator::success;
use nom::combinator::value; use nom::combinator::value;
use nom::multi::fold_many0;
use nom::multi::many0; use nom::multi::many0;
use nom::sequence::delimited; use nom::sequence::delimited;
use nom::sequence::pair; use nom::sequence::pair;
@ -179,12 +178,10 @@ fn tag_node(s: &str) -> IResult<Node> {
name: &'name str, name: &'name str,
) -> impl FnMut(&'s str) -> IResult<'s, &'s str> + 'parser { ) -> impl FnMut(&'s str) -> IResult<'s, &'s str> + 'parser {
move |s| { move |s| {
recognize(fold_many0( recognize(many0(pair(
pair(not(closing_parser(name)), take_till_potential_tag_start), not(closing_parser(name)),
// we don't need to accumulate anything take_till_potential_tag_start,
|| (), )))
|_, _| (),
))
.parse(s) .parse(s)
} }
} }