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

Side by Side Diff: pkg/front_end/lib/src/scanner/reader.dart

Issue 2784363002: flag to enable fasta scanner in analyzer (Closed)
Patch Set: rebase Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * An object used by the scanner to read the characters to be scanned. 6 * An object used by the scanner to read the characters to be scanned.
7 */ 7 */
8 abstract class CharacterReader { 8 abstract class CharacterReader {
9 /** 9 /**
10 * The current offset relative to the beginning of the source. Return the 10 * The current offset relative to the beginning of the source. Return the
(...skipping 10 matching lines...) Expand all
21 */ 21 */
22 void set offset(int offset); 22 void set offset(int offset);
23 23
24 /** 24 /**
25 * Advance the current position and return the character at the new current 25 * Advance the current position and return the character at the new current
26 * position. 26 * position.
27 */ 27 */
28 int advance(); 28 int advance();
29 29
30 /** 30 /**
31 * Return the source to be scanned.
32 */
33 String getContents();
34
35 /**
31 * Return the substring of the source code between the [start] offset and the 36 * Return the substring of the source code between the [start] offset and the
32 * modified current position. The current position is modified by adding the 37 * modified current position. The current position is modified by adding the
33 * [endDelta], which is the number of characters after the current location to 38 * [endDelta], which is the number of characters after the current location to
34 * be included in the string, or the number of characters before the current 39 * be included in the string, or the number of characters before the current
35 * location to be excluded if the offset is negative. 40 * location to be excluded if the offset is negative.
36 */ 41 */
37 String getString(int start, int endDelta); 42 String getString(int start, int endDelta);
38 43
39 /** 44 /**
40 * Return the character at the current position without changing the current 45 * Return the character at the current position without changing the current
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 86
82 @override 87 @override
83 int advance() { 88 int advance() {
84 if (_charOffset >= _stringLength) { 89 if (_charOffset >= _stringLength) {
85 return -1; 90 return -1;
86 } 91 }
87 return _sequence.codeUnitAt(_charOffset++); 92 return _sequence.codeUnitAt(_charOffset++);
88 } 93 }
89 94
90 @override 95 @override
96 String getContents() => _sequence;
97
98 @override
91 String getString(int start, int endDelta) => 99 String getString(int start, int endDelta) =>
92 _sequence.substring(start, _charOffset + endDelta); 100 _sequence.substring(start, _charOffset + endDelta);
93 101
94 @override 102 @override
95 int peek() { 103 int peek() {
96 if (_charOffset >= _stringLength) { 104 if (_charOffset >= _stringLength) {
97 return -1; 105 return -1;
98 } 106 }
99 return _sequence.codeUnitAt(_charOffset); 107 return _sequence.codeUnitAt(_charOffset);
100 } 108 }
(...skipping 20 matching lines...) Expand all
121 129
122 @override 130 @override
123 int get offset => _offsetDelta + super.offset; 131 int get offset => _offsetDelta + super.offset;
124 132
125 @override 133 @override
126 void set offset(int offset) { 134 void set offset(int offset) {
127 super.offset = offset - _offsetDelta; 135 super.offset = offset - _offsetDelta;
128 } 136 }
129 137
130 @override 138 @override
139 String getContents() => super.getContents().substring(_offsetDelta);
140
141 @override
131 String getString(int start, int endDelta) => 142 String getString(int start, int endDelta) =>
132 super.getString(start - _offsetDelta, endDelta); 143 super.getString(start - _offsetDelta, endDelta);
133 } 144 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/dependency_grapher_impl.dart ('k') | pkg/front_end/lib/src/scanner/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698