Function nom_supreme::multi::parse_separated_terminated [−][src]
pub fn parse_separated_terminated<Input, ParseOutput, SepOutput, TermOutput, ParseErr, Accum>(
parser: impl Parser<Input, ParseOutput, ParseErr>,
separator: impl Parser<Input, SepOutput, ParseErr>,
terminator: impl Parser<Input, TermOutput, ParseErr>,
init: impl FnMut() -> Accum,
fold: impl FnMut(Accum, ParseOutput) -> Accum
) -> impl Parser<Input, Accum, ParseErr> where
Input: Clone + PartialEq,
ParseErr: ParseError<Input>,
Expand description
Parse a series of 1 or more things, separated by separator
, terminated by
terminator
, and fold them together using a folding function.
When this parser is run, it will first create an accumulator value with init
.
It will then combine it with every parsed item using fold
, which should
return the new accumulator for each item. See the module docs for details
of how this parser parses a sequence.