rust-bakery/nom

add `map_res`/`map_opt` combinators to Parser

flier opened this issue · 1 comments

flier commented

Prerequisites

  • Rust version : rustc 1.64.0 (a55dd71d5 2022-09-19)
  • nom version : 7.1.1
  • nom compilation features used: default

Test case

Add map_res and map_opt combinators to Parser, and improve code style.

Example test case:

map(map_res(recognize(pair(tag("0"), oct_digit1)), from_str_radix::<_, 8>), Number::Integer)

That could be rewrite to a call chain.

recognize(pair(tag("0"), oct_digit1))
    .map_res(from_str_radix::<_, 8>)
    .map(Number::Integer)
Geal commented

closed by #1563