times method

ListParser<T> times(
  1. int count, {
  2. bool exact = true,
  3. String tooFew = 'Too few',
  4. String tooMany = 'Too many',
  5. bool backtrack = true,
  6. SyntaxErrorSeverity? severity,
})

Expect this pattern a certain number of times.

If exact is false (default: true), then the generated parser will accept an infinite amount of occurrences after the specified count.

You can provide custom error messages for when there are tooFew or tooMany occurrences.

Implementation

ListParser<T> times(int count,
    {bool exact = true,
    String tooFew = 'Too few',
    String tooMany = 'Too many',
    bool backtrack = true,
    SyntaxErrorSeverity? severity}) {
  return _Repeat<T>(this, count, exact, tooFew, tooMany, backtrack,
      severity ?? SyntaxErrorSeverity.error);
}