many

Like many_r but with default reduce function that put all return values into an array, or return number of matches

version(legacy)
struct many (
alias func
bool allow_none = false
) {}

Members

Static functions

opCall
auto opCall(R i)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

import sdpc.parsers;
import std.array : array;
auto i = "aabcdaaddcc";
alias abcdparser = choice!(token!"a", token!"b", token!"c", token!"d");
auto r2 = abcdparser(i);
assert(!r2.empty);
assert(r2.array.length == 2); // only matches the first two 'a's

/*
i = "abcde";
auto r3 = abcdparser(i);
assert(r3.ok); //Parse is OK because 4 char are consumed
assert(r3.v.length == 4);
assert(r3.cont.length); //But the end-of-buffer is not reached
*/

Meta