lookahead

Match u but doesn't consume anything from the input range

@safe
struct lookahead (
bool negative = 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;

// Accept "asdf" if followed by "g"
alias p = seq!(token!"asdf", lookahead!(token!"g"));
auto i = "asdfg";
auto r1 = p(i);
assert(r1.ok);
assert(r1.cont == "g", r1.cont);

i = "asdff";
auto r2 = p(i);
assert(!r2.ok);

Meta