| Index: lib/src/span_scanner.dart
|
| diff --git a/lib/src/span_scanner.dart b/lib/src/span_scanner.dart
|
| index 2a78b5bc0b0d524e6ae1b9b88e7a29ed588dd9c5..ebe230d8a70bb93bd2eb16e41da73167555a17c6 100644
|
| --- a/lib/src/span_scanner.dart
|
| +++ b/lib/src/span_scanner.dart
|
| @@ -6,6 +6,7 @@ library string_scanner.span_scanner;
|
|
|
| import 'package:source_span/source_span.dart';
|
|
|
| +import 'eager_span_scanner.dart';
|
| import 'exception.dart';
|
| import 'line_scanner.dart';
|
| import 'string_scanner.dart';
|
| @@ -56,6 +57,20 @@ class SpanScanner extends StringScanner implements LineScanner {
|
| : _sourceFile = new SourceFile(string, url: sourceUrl),
|
| super(string, sourceUrl: sourceUrl, position: position);
|
|
|
| + /// Creates a new [SpanScanner] that eagerly computes line and column numbers.
|
| + ///
|
| + /// In general [new SpanScanner] will be more efficient, since it avoids extra
|
| + /// computation on every scan. However, eager scanning can be useful for
|
| + /// situations where the normal course of parsing frequently involves
|
| + /// accessing the current line and column numbers.
|
| + ///
|
| + /// Note that *only* the `line` and `column` fields on the `SpanScanner`
|
| + /// itself and its `LineScannerState` are eagerly computed. To limit their
|
| + /// memory footprint, returned spans and locations will still lazily compute
|
| + /// their line and column numbers.
|
| + factory SpanScanner.eager(String string, {sourceUrl, int position}) =
|
| + EagerSpanScanner;
|
| +
|
| /// Creates a [FileSpan] representing the source range between [startState]
|
| /// and the current position.
|
| FileSpan spanFrom(LineScannerState startState, [LineScannerState endState]) {
|
|
|