the pc4d.alternative parser and its dsl '|'
1 import unit_threaded; 2 3 auto parser = match("abc") | match("def"); 4 auto res = parser.parse("abc"); 5 res.success.shouldBeTrue; 6 7 res = parser.parse("def"); 8 res.success.shouldBeTrue; 9 10 res = parser.parse("ghi"); 11 res.success.shouldBeFalse;
dsl for alternatives e.g. match("abc") | match("def") matches "abc" or "def"