delegatingParser function
A delegatingParser delegates to work to other parsers. Text that is not handled by the delegates will also be collected
Implementation
Parser<List<Object>> delegatingParser({
required List<Parser<Object>> delegates,
required String tagStart,
required String tagEnd,
}) {
if (delegates.isEmpty) {
return any().star().flatten().map((value) => [value]);
}
var parser = ChoiceParser<Object>([
ChoiceParser<Object>(delegates),
untilEndOfTagParser(tagStart, tagEnd),
untilEndParser(),
]);
return parser.plus();
}