Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: lib/src/line_scanner.dart

Issue 1318603008: Add new SpanScanner.eager(). (Closed) Base URL: git@github.com:dart-lang/string_scanner@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/eager_span_scanner.dart ('k') | lib/src/span_scanner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library string_scanner.line_scanner; 5 library string_scanner.line_scanner;
6 6
7 import 'package:charcode/ascii.dart'; 7 import 'package:charcode/ascii.dart';
8 8
9 import 'string_scanner.dart'; 9 import 'string_scanner.dart';
10 10
11 // Note that much of this code is duplicated in eager_span_scanner.dart.
12
11 /// A regular expression matching newlines across platforms. 13 /// A regular expression matching newlines across platforms.
12 final _newlineRegExp = new RegExp(r"\r\n?|\n"); 14 final _newlineRegExp = new RegExp(r"\r\n?|\n");
13 15
14 /// A subclass of [StringScanner] that tracks line and column information. 16 /// A subclass of [StringScanner] that tracks line and column information.
15 class LineScanner extends StringScanner { 17 class LineScanner extends StringScanner {
16 /// The scanner's current (zero-based) line number. 18 /// The scanner's current (zero-based) line number.
17 int get line => _line; 19 int get line => _line;
18 int _line = 0; 20 int _line = 0;
19 21
20 /// The scanner's current (zero-based) column number. 22 /// The scanner's current (zero-based) column number.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 final int position; 118 final int position;
117 119
118 /// The zero-based line number of the scanner in this state. 120 /// The zero-based line number of the scanner in this state.
119 final int line; 121 final int line;
120 122
121 /// The zero-based column number of the scanner in this state. 123 /// The zero-based column number of the scanner in this state.
122 final int column; 124 final int column;
123 125
124 LineScannerState._(this._scanner, this.position, this.line, this.column); 126 LineScannerState._(this._scanner, this.position, this.line, this.column);
125 } 127 }
OLDNEW
« no previous file with comments | « lib/src/eager_span_scanner.dart ('k') | lib/src/span_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698