abailly/jparsec — pull request #14 by michbarsinai (2013-12-20 21:55:39+00:00)
Title: ReluctantBetween combinator

Hello @abailly,
I've added a new combinator - reluctant between, to allow for having the start and end parsers be greedy, and the between parser to be reluctant. This allows for parsing of sequences like `(hello is a (word) and...)` into the string "hello is a (word) and...".

I might have missed something, and there may be a better way of doing it inside the existing framework. However, I was not able to, and my stackoverflow question remained unanswered (http://stackoverflow.com/questions/20696847/parsing-text-in-parens-using-jparsec).

Hope you like it. As far as efficiency in concerned, the end combinator is O(n^2), where n=input.length. For performance reasons, there may be a need to have an optional "maximum end length" parameter. It does not "play well" with the rest of the API, so I left it out for now.

Thanks,
Michael