parser_error 0.1.1 copy "parser_error: ^0.1.1" to clipboard
parser_error: ^0.1.1 copied to clipboard

discontinued
outdated

Parser error formatter with support for the multiple source code parts.

#parser_error #

Version: 0.1.1

Main purpose

  • Use with parsers

Example:

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
''';

Output:

Format exception (2:9): Malformed 'type'
typedef int[`
        ^^^^^
Format exception (2:13): Expected ']' but found '`'
typedef int[`
            ^
Breaking on exception: object of type FormatException: FormatException

2
likes
30
pub points
81%
popularity

Publisher

unverified uploader

Parser error formatter with support for the multiple source code parts.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

text

More

Packages that depend on parser_error