winnow-rs / winnow

Making parsing a breeze
https://docs.rs/winnow
Other
525 stars 40 forks source link

"recognize" meaning is non-obvious #488

Closed epage closed 2 months ago

epage commented 7 months ago

We have Parser::recognize, Parser::with_recognize, and use of "recognize" in various parsers (especially token)

The leap from the word and its meaning is unclear

See also #95

epage commented 7 months ago

In reading through the docs, I realized I would sometimes insert the word "capture" which I think works well as a parallel to regex.

baoyachi commented 7 months ago

Why not use concat for naming.

Related links: https://doc.rust-lang.org/stable/std/macro.concat.html

epage commented 7 months ago

That works if you are doing (parser1, parser2).concat() but if you are doing parser1.concat(), it no longer makes sense.

Looking at #489 is reminding me that we also use take to mean "capture a slice".

epage commented 2 months ago

For now at least, I lean towards take / with_taken. Capture works well but is longer.