Lucretiel / nom-supreme

A collection of utilities for a superior nom experience
Mozilla Public License 2.0
149 stars 11 forks source link

Add map_res_cut combinator to ParserExt #2

Closed loewenheim closed 3 years ago

loewenheim commented 3 years ago

This adds a combinator that runs a fallible function f on the result of a parser p, like map_res, but returns a Failure instead of an Error if f fails. This is useful if a success on p means that you know for sure which branch you are in and there is no need to try any other branches if f fails.