Parse strings with a sequence of patterns in Dart
open sourceBSD-3-Clausefree
string_scanner is the Dart team's package for parsing a string with a series of patterns. Its StringScanner moves a pointer through the source: scan tries to consume a pattern and says whether it matched, expect consumes one or throws a format error, and lastMatch holds the most recent match. It lives in the dart-lang/tools repository and is under the BSD-3-Clause licence.
Problems it solves
- write a small hand-written parser in Dart
- consume a string pattern by pattern with regular expressions in Dart
- parse a simple text format without a parser generator in Dart
Features
- StringScanner for parsing a string with a sequence of patterns
- scan, expect and matches with the last match kept
- format errors that point at the failing position
