parser_error 0.1.0

  • README.md
  • Example
  • Installing
  • Versions
  • 59

#parser_error

Version: 0.1.0

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

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.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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.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]
26
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3

Platforms

Detected platforms: Flutter, web, other

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

Issues and suggestions

Maintain CHANGELOG.md.

Changelog entries help clients to follow the progress in your code.

Format lib/src/parser_error.dart.

Run dartfmt to format lib/src/parser_error.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
text ^0.1.0 0.1.0
Transitive dependencies
lists 0.0.23
Dev dependencies
test ^1.3.0