Gal
Gal

Reputation: 5416

Haskell Parsec: primitive for greedy many?

I'm only just starting to learn the Parsec library, and I was wondering if there is any primitive in the library that can do the following: given a parser let a = char 'a', and a string aaab, would return Right ['a', 'a', 'a'], with "b" remaining, i.e., would parse as much as it can, but no more. I feel this is so necessary that it has to exist in some form or another in the library.

Upvotes: 1

Views: 185

Answers (1)

pat
pat

Reputation: 12749

You want to use many a, which will parse as many a's as it can.

Upvotes: 2

Related Questions