parser_error 0.1.0 parser_error: ^0.1.0 copied to clipboard
Parser error formatter with support for the multiple source code parts.
import "package:parser_error/parser_error.dart";
void main() {
var messages = <ParserErrorMessage>[];
var message = new ParserErrorMessage("Malformed 'type'", 25, 30);
messages.add(message);
message = new ParserErrorMessage("Expected ']' but found '`'", 29, 29);
messages.add(message);
var strings = ParserErrorFormatter.format(source, messages);
print(strings.join("\n"));
throw new FormatException();
}
String source = '''
#if defined(FOO)
typedef int[`
#endif
''';