combinator 1.0.0-beta+7

  • Example
  • Installing
  • Versions
  • 71


version build status

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

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


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

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.span.highlight(color: true));
    } else

1. Depend on it

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

  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


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


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


Detected platforms: Flutter, web, other

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


  • Maintain

    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.


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