1 import pry.atoms, pry.stream;
2 import std.range.primitives, std.typecons;
3 alias S = SimpleStream!string;
4 with(parsers!S) {
5 auto elements = seq(tk!'a', range!('a', 'd'), tk!'c');
6 S s = S("abc");
7 Tuple!(dchar, dchar, dchar) val;
8 S.Error err;
9 assert(elements.parse(s, val, err));
10 assert(s.empty);
11 assert(val == tuple('a', 'b', 'c'));
12 s = S("axc");
13 assert(!elements.parse(s, val, err));
14 assert(s.front == 'a');
15 assert(err.location == 1);
16 }
1 import pry.atoms, pry.stream;
2 alias S = SimpleStream!string;
3 with(parsers!S) {
4 auto p = seq(tk!'a', tk!'b', eof);
5 auto s1 = "abc".stream;
6 auto s2 = "ab".stream;
7 S.Error err;
8 Tuple!(dchar, dchar) val;
9 assert(!p.parse(s1, val, err));
10 assert(p.parse(s2, val, err));
11 }
Apply multiple parsers one after another as a sequence.