These combinators will produce
Arrays, as opposed to the other combinators
of the same names in the Parsing.Combinators module
which mostly produce
Array combinators will run in a bit
less time (~85% runtime) than the similar
List combinators, and they will run in a
lot less time (~10% runtime) than the similar combinators in Data.Array.
If there is some other combinator which returns
List but we want an
Array, and there is no
Array version of the
combinator in this module, then we can rely on the
function for a pretty fast transformation from
many1 :: forall s m a. ParserT s m a -> ParserT s m (NonEmptyArray a)
Match the phrase
p as many times as possible, at least once.
manyIndex :: forall s m a. Int -> Int -> (Int -> ParserT s m a) -> ParserT s m (Tuple Int (Array a))
Parse the phrase as many times as possible, at least N times, but no more than M times. If the phrase can’t parse as least N times then the whole parser fails. If the phrase parses successfully M times then stop. The current phrase index, starting at 0, is passed to the phrase.
Returns the array of parse results and the number of results.
manyIndex n n (\_ -> p) is equivalent to
replicateA n p.