Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Last active March 2, 2017 06:38
Show Gist options
  • Save ccorcos/c11c3670eb73fa660ae70cd1ea24332e to your computer and use it in GitHub Desktop.
Save ccorcos/c11c3670eb73fa660ae70cd1ea24332e to your computer and use it in GitHub Desktop.
const zeroOrMore = parser =>
new Parser(stream =>
parser.run(stream)
.fold(
(value, s) => zeroOrMore(parser).map(rest => [value].concat(rest)).run(s),
(value, s) => new Success([], stream)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment