buildError method
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);
}