nom icon indicating copy to clipboard operation
nom copied to clipboard

Followup: Candidates for range syntax

Open cenodis opened this issue 3 years ago • 4 comments

This is a followup to #1402 which was merged in #1608. The merged implementation only includes range variants for many and fold. More parsers were mentioned as candidates in #1402.

This issue tracks the status of those candidates for conversion to a range syntax.

Current candidates

  • [ ] take_till* (take_till, take_till1)
  • [ ] take_while* (take_while, take_while1, take_while_m_n)
  • [ ] take_until* (take_until, take_until1)
  • [ ] many_till
  • [ ] seperated_list* (seperated_list0, seperated_list1)

cenodis avatar Jan 07 '23 16:01 cenodis

I'm less sure about converting those right now, because they rely on specialized implementations (the split_at_position* methods) to make most parsers fast, but maybe those methods could be generalized

Geal avatar Jan 07 '23 16:01 Geal

One way to handle this is to dispatch to different implementations like my complete/streaming work, hoping the compiler inlines enough to remove the overhead.

epage avatar Jan 07 '23 18:01 epage

separated_list could be a good target for this

Geal avatar Jan 17 '23 22:01 Geal

+1 for a separated_list that accepts an additional range argument like 2..10.

Currently, there is only separated_list0 and separated_list1. If you wanted say separated_list2 you'd have to add more stuff like wrapping it in a separated_pair, duplicating the parser and separator, and mapping to push the first item onto the Vec of the rest. If you wanted a separated_list21to42 you'd probably need to dive down and implement it yourself.

All multi parsers accepting a range argument would be very nice!

vwkd avatar Feb 07 '23 15:02 vwkd