SpanScanner.eager constructor

SpanScanner.eager(String string, { dynamic sourceUrl, int 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.

Implementation

factory SpanScanner.eager(String string, {sourceUrl, int position}) =
    EagerSpanScanner;