"use strict"; const { parse } = require("./index"); const { wholeMatch, either, peek } = require("./operations"); function* A() { yield "hello"; } function* Whitespace() { yield " "; // FIXME } function* B1() { yield peek("world"); yield "world"; } function* B2() { yield "earth"; } function* B3() { let result = yield /(moon|jupiter)/; return result.$positional[0]; } module.exports = function* TestParser() { return yield wholeMatch(function*() { yield A; yield Whitespace; yield either([ B1, B2, B3 ]); }); }; console.log(parse(process.argv[2], module.exports));