buildError method

FormatException buildError({
  1. String? quote = '\'',
})

Implementation

FormatException buildError({String? quote = '\''}) {
  quote ??= '';
  final sink = StringBuffer();
  final expected = getExpected();
  if (expected.isNotEmpty) {
    sink.write('Expected ');
    sink.write(expected.map((e) => e).join(', '));
  } else {
    sink.write('Unexpected ');
    if (failPos < pos) {
      sink.write('character');
    } else {
      sink.write('end of file');
    }
  }

  return FormatException(sink.toString(), source, failPos);
}