nom icon indicating copy to clipboard operation
nom copied to clipboard

Improving the `preceded!` macro documentation

Open Songbird0 opened this issue 7 years ago • 2 comments

Hi!

I've just started using nom and I'd like to know if anyone could give me a better description of the preceded! macro?

If no one is available to commit the new version of its documentation, I will.

Thanks for advance!

Songbird0 avatar Mar 14 '19 18:03 Songbird0

The idea behind preceded! is that there's some part which the first argument of the macro will parse and return Ok(T) if found. T can be (), and is dropped. The second argument should be something which parses the next portion of the stream, and returns the desired output type, O, when successful.

A normal usage of preceded would be when parsing something in key:value form, you could parse preceded!(tag!("key:"), /*value parser/*)

Zarenor avatar Mar 14 '19 20:03 Zarenor

the preceded macro doc was already rewritten

Geal avatar Jun 17 '19 14:06 Geal