Skip to content

PrefixUpTo end of line. #206

Answered by stephencelis
alexito4 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @alexito4! The main reason PrefixThrough and PrefixUpTo take sequences and not parsers is that checking a prefix can be guaranteed to have a particular performance profile, but using any arbitrary parser can introduce something that is quite inefficient to run against each element/character of a collection/string.

Depending on your use case and needs for your parser, you could still implement these parsers to take parsers themselves, and if you can benchmark/share and determine that for common cases such parsers are not slow, we could discuss bringing them into the main library.

As for an alternative spelling of the same problem. I believe you can achieve it with the following:

Parse {
  

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexito4
Comment options

Answer selected by alexito4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants