winnow-rs / winnow

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

RFC: Add `recognize_till` #541

Open 9999years opened 5 months ago

9999years commented 5 months ago

This is a variant of repeat_till that recognizes the repeated portion of the input instead of accumulating it.

See: “Recognizing repeat_till0 to () without the suffix”.

I have found this combinator useful in my own code for recognizing ambiguous delimiters.

This code needs to be cleaned up before being merged (we'd probably want a Range argument and an infinite loop check, for example), so consider this a proof of concept. If you're on board with the idea, let me know what the next steps are. Otherwise, feel free to close this PR. Thanks!

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9523540454

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/combinator/multi.rs 0 17 0.0%
<!-- Total: 0 17 0.0% -->
Files with Coverage Reduction New Missed Lines %
src/macros/seq.rs 2 85.71%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 9407425121: 0.2%
Covered Lines: 1309
Relevant Lines: 3128

💛 - Coveralls
epage commented 4 months ago

Moved to draft as I take a fairly strict policy to close (or move to draft) PRs that have not formerly been accepted

9999years commented 4 months ago

@epage That's OK by me. Would you like me to open an issue for recognizing the repeated part of a repeat_till invocation?

epage commented 4 months ago

You are welcome to create an issue from that discussion.