@@ -27,10 +27,12 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
2727 /// This is used to convert between span-relative and file-relative fields.
2828 final FileLocation _startLocation;
2929
30+ @override
3031 int get line =>
3132 _sourceFile.getLine (_startLocation.offset + position) -
3233 _startLocation.line;
3334
35+ @override
3436 int get column {
3537 var line = _sourceFile.getLine (_startLocation.offset + position);
3638 var column =
@@ -40,37 +42,44 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
4042 : column;
4143 }
4244
45+ @override
4346 LineScannerState get state => _SpanScannerState (this , position);
4447
48+ @override
4549 set state (LineScannerState state) {
4650 if (state is ! _SpanScannerState ||
4751 ! identical ((state as _SpanScannerState )._scanner, this )) {
48- throw ArgumentError (" The given LineScannerState was not returned by "
49- " this LineScanner." );
52+ throw ArgumentError (' The given LineScannerState was not returned by '
53+ ' this LineScanner.' );
5054 }
5155
5256 position = state.position;
5357 }
5458
59+ @override
5560 FileSpan get lastSpan => _lastSpan;
5661 FileSpan _lastSpan;
5762
63+ @override
5864 FileLocation get location =>
5965 _sourceFile.location (_startLocation.offset + position);
6066
67+ @override
6168 FileSpan get emptySpan => location.pointSpan ();
6269
6370 RelativeSpanScanner (FileSpan span)
6471 : _sourceFile = span.file,
6572 _startLocation = span.start,
6673 super (span.text, sourceUrl: span.sourceUrl);
6774
75+ @override
6876 FileSpan spanFrom (LineScannerState startState, [LineScannerState endState]) {
6977 var endPosition = endState == null ? position : endState.position;
7078 return _sourceFile.span (_startLocation.offset + startState.position,
7179 _startLocation.offset + endPosition);
7280 }
7381
82+ @override
7483 bool matches (Pattern pattern) {
7584 if (! super .matches (pattern)) {
7685 _lastSpan = null ;
@@ -82,6 +91,7 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
8291 return true ;
8392 }
8493
94+ @override
8595 void error (String message, {Match match, int position, int length}) {
8696 validateErrorArgs (string, match, position, length);
8797
@@ -100,8 +110,11 @@ class _SpanScannerState implements LineScannerState {
100110 /// The [SpanScanner] that created this.
101111 final RelativeSpanScanner _scanner;
102112
113+ @override
103114 final int position;
115+ @override
104116 int get line => _scanner._sourceFile.getLine (position);
117+ @override
105118 int get column => _scanner._sourceFile.getColumn (position);
106119
107120 _SpanScannerState (this ._scanner, this .position);
0 commit comments