repeat method

  1. @useResult
Parser<List<R>> repeat(
  1. int min, [
  2. int? max
])

Returns a parser that accepts the receiver between min and max times. The resulting parser returns a list of the parse results of the receiver.

This is a greedy and blind implementation that tries to consume as much input as possible and that does not consider what comes afterwards.

For example, the parser letter().repeat(2, 4) accepts a sequence of two, three, or four letters and returns the accepted letters as a list.

Implementation

@useResult
Parser<List<R>> repeat(int min, [int? max]) =>
    PossessiveRepeatingParser<R>(this, min, max ?? min);