parser_error 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 51

#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

0.1.1 #

  • Minor changes

example/example.dart

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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  parser_error: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:parser_error/parser_error.dart';
  
Version Uploaded Documentation Archive
0.1.1 May 20, 2019 Go to the documentation of parser_error 0.1.1 Download parser_error 0.1.1 archive
0.1.0 Aug 29, 2018 Go to the documentation of parser_error 0.1.0 Download parser_error 0.1.0 archive
0.0.1 Jan 21, 2015 Go to the documentation of parser_error 0.0.1 Download parser_error 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
2
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
51
Learn more about scoring.

We analyzed this package on Jun 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.17

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:parser_error/parser_error.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
text ^0.1.1 0.1.1
Transitive dependencies
lists 0.1.3
Dev dependencies
pedantic any
test ^1.6.3