combinator 1.0.0-beta+7

  • README.md
  • Example
  • Installing
  • Versions
  • 71

combinator

version build status

Parser combinators that support static typing, file spans, and more.

Documentation is coming eventually, but I am lazy. Check example/.

example/main.dart

import 'dart:io';
import 'package:combinator/combinator.dart';
import 'package:string_scanner/string_scanner.dart';

final Parser minus = match('-');

final Parser<int> digit = match(
  new RegExp(r'[0-9]'),
  errorMessage: 'Expected a number',
);

final Parser digits = digit.plus();

final Parser separator = match('.');

final Parser decimal = digits.then((separator.then(digits)).opt());

final Parser number =
    minus.opt().then(decimal).map<num>((r) => num.parse(r.span.text));

main() {
  while (true) {
    stdout.write('Enter a number: ');
    var line = stdin.readLineSync();
    var scanner = new SpanScanner(line, sourceUrl: 'stdin');
    var result = number.parse(scanner);

    if (!result.successful) {
      for (var error in result.errors) {
        stderr.writeln(error.toolString);
        stderr.writeln(error.span.highlight(color: true));
      }
    } else
      print(result.value);
  }
}

1. Depend on it

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


dependencies:
  combinator: "^1.0.0-beta+7"

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 packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:combinator/combinator.dart';
        
Version Uploaded Documentation Archive
1.0.0-beta+7 Nov 26, 2017 Go to the documentation of combinator 1.0.0-beta+7 Download combinator 1.0.0-beta+7 archive
1.0.0-beta+6 Nov 20, 2017 Go to the documentation of combinator 1.0.0-beta+6 Download combinator 1.0.0-beta+6 archive
1.0.0-beta+5 Nov 20, 2017 Go to the documentation of combinator 1.0.0-beta+5 Download combinator 1.0.0-beta+5 archive
1.0.0-beta+4 Nov 20, 2017 Go to the documentation of combinator 1.0.0-beta+4 Download combinator 1.0.0-beta+4 archive
1.0.0-beta+3 Nov 20, 2017 Go to the documentation of combinator 1.0.0-beta+3 Download combinator 1.0.0-beta+3 archive
1.0.0-beta+2 Nov 6, 2017 Go to the documentation of combinator 1.0.0-beta+2 Download combinator 1.0.0-beta+2 archive
1.0.0-beta+1 Nov 4, 2017 Go to the documentation of combinator 1.0.0-beta+1 Download combinator 1.0.0-beta+1 archive
1.0.0-beta Nov 4, 2017 Go to the documentation of combinator 1.0.0-beta Download combinator 1.0.0-beta archive

Analysis

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

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
51 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
78 / 100
Overall score:
Weighted score of the above. [more]
71
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Maintain CHANGELOG.md.

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

  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run dartfmt to format lib/src/combinator/util.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0
matcher ^0.12.0 0.12.2
source_span ^1.0.0 1.4.0
string_scanner ^1.0.0 1.0.2
Transitive dependencies
charcode 1.1.1
path 1.5.1
stack_trace 1.9.2
Dev dependencies
test ^0.12.0