repeatSeparated<S> method

  1. @useResult
Parser<SeparatedList<R, S>> repeatSeparated<S>(
  1. Parser<S> separator,
  2. int min,
  3. int max
)

Returns a parser that consumes the receiver between min and max times separated by the separator parser. The resulting parser returns a SeparatedList containing collections of both the elements of type R as well as the separators of type S.

For example, the parser digit().repeatSeparated(char(','), 2, 3) returns a parser that consumes input like '1,2' or '1,2,3' and that returns a SeparatedList of elements and separators.

Implementation

@useResult
Parser<SeparatedList<R, S>> repeatSeparated<S>(
  Parser<S> separator,
  int min,
  int max,
) => SeparatedRepeatingParser<R, S>(this, separator, min, max);