foldErrors method

Parser<T> foldErrors(
  1. {bool equal(
    1. SyntaxError a,
    2. SyntaxError b
    )}
)

Removes multiple errors that occur in the same spot; this can reduce noise in parser output.

Implementation

Parser<T> foldErrors({bool equal(SyntaxError a, SyntaxError b)}) {
  equal ??= (b, e) => b.span.start.offset == e.span.start.offset;
  return new _FoldErrors<T>(this, equal);
}