chumsky icon indicating copy to clipboard operation
chumsky copied to clipboard

request: ignore_until primitive

Open Lokathor opened this issue 1 year ago • 1 comments

It looks like if you use take_until( ).ignored() the actual taking still makes a vec internally, it just throws it away after filling it up.

but heck maybe this is already done in zero-copy i dunno

Lokathor avatar Aug 13 '22 03:08 Lokathor

An idea I had recently was to generalise a lot of these "pull tokens until x" patterns with an and_is and not combinator. In such a formulation, you'd just do:

x.not().ignored().repeated().then(x)

It's a bit wordier, but it IMO it generalises to more cases and the common ones can always be wrapped up in a more ergonomic combinator. I will take this onboard and do a bit of thinking read for zero-copy.

zesterer avatar Aug 13 '22 11:08 zesterer