• Update Dart SDK constraint to >=2.0.0 <3.0.0.


  • Add @alwaysThrows annotation to error method.


  • Set max SDK version to <3.0.0, and adjust other dependencies.


  • SpanScanner no longer crashes when creating a span that contains a UTF-16 surrogate pair.


  • Fix the error text emitted by StringScanner.expectChar().


  • Breaking change: StringScanner.error()'s length argument now defaults to 0 rather than 1 when no match data is available.

  • Breaking change: StringScanner.lastMatch and related methods are now reset when the scanner's position changes without producing a new match.

Note: While the changes in 1.0.0 are user-visible, they're unlikely to actually break any code in practice. Unless you know that your package is incompatible with 0.1.x, consider using 0.1.5 as your lower bound rather than 1.0.0. For example, string_scanner: ">=0.1.5 <2.0.0".


  • Add new SpanScanner.within(), which scans within a existing FileSpan.

  • Add StringScanner.scanChar() and StringScanner.expectChar().


  • Remove the dependency on path, since we don't actually import it.


  • Add new SpanScanner.eager() for creating a SpanScanner that eagerly computes its current line and column numbers.


  • Fix LineScanner's handling of carriage returns to match that of SpanScanner.


  • Fixed the homepage URL.


  • Add an optional endState argument to SpanScanner.spanFrom.


  • Add StringScanner.substring, which returns a substring of the source string.


  • Declare SpanScanner's exposed SourceSpans and SourceLocations to be FileSpans and FileLocations. They always were underneath, but callers may now rely on it.

  • Add SpanScanner.location, which returns the scanner's current SourceLocation.


  • Switch from source_maps' Span class to source_span's SourceSpan class.

  • new StringScanner()'s sourceUrl parameter is now named to make it clear that it can be safely null.

  • new StringScannerException() takes different arguments in a different order to match SpanFormatException.

  • StringScannerException.string has been renamed to StringScannerException.source to match the FormatException interface.


  • Make StringScannerException inherit from source_map's SpanFormatException.


  • new StringScanner() now takes an optional sourceUrl argument that provides the URL of the source file. This is used for error reporting.

  • Add StringScanner.readChar() and StringScanner.peekChar() methods for doing character-by-character scanning.

  • Scanners now throw StringScannerExceptions which provide more detailed access to information about the errors that were thrown and can provide terminal-colored messages.

  • Add a LineScanner subclass of StringScanner that automatically tracks line and column information of the text being scanned.

  • Add a SpanScanner subclass of LineScanner that exposes matched ranges as [source map][] Span objects.