many

Match func* or func+

Return array of func's result

@safe
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;
auto i = "abcdaaddcc";
alias abcdparser = many!(choice!(token!"a", token!"b", token!"c", token!"d"));
auto r2 = abcdparser(i);
assert(r2.ok);
assert(!r2.cont.length);

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

Meta