[−][src]Function kul_core::premade::inmem::parse_text_with
pub fn parse_text_with<'t, 'p, 'input, 'alloc, 'funs, 'bind, Extra, CombinerError>(
input: &'t Text<'input, 'alloc, Extra>,
parser: &'p mut Parser<'input, 'alloc, 'funs, 'bind, Extra, CombinerError>
) -> TakeWhile<ParseIter<'p, Parser<'input, 'alloc, 'funs, 'bind, Extra, CombinerError>, Iter<'t, Text<'input, 'alloc, Extra>>>, impl FnMut(&Result<DatumType<'input, 'alloc, Extra>, Error<StrPos<'input>, CombinerError>>) -> bool> where
Extra: Eq,
Parse the given Text
, that contains the input string, using the given
Parser
, and return an Iterator
of the results as Datum
ASTs for each
successfully-parsed top-level form and/or an Error
.
This enables you to give bindings for parsing certain nest forms in your
custom ways and enables you to choose what to use for
the Extra
and CombinerError
type parameters.
If an error is returned by the parser, parsing will be immediately aborted
and the last item of the returned iterator will be that error. If instead
you want to continue trying to parse after an error occurred, use the
parser
function to directly work with a Parser
.
The reason this function takes borrows of Text
and Parser
values is
because the returned iterator borrows them itself and this is the only way
the lifetimes can work.