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

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

Issue 2750813002: cleanup duplicate fasta scanner methods (Closed)
Patch Set: Created 3 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 fasta.scanner.utf8_bytes_scanner; 5 library fasta.scanner.utf8_bytes_scanner;
6 6
7 import 'dart:convert' show UNICODE_BOM_CHARACTER_RUNE, UTF8; 7 import 'dart:convert' show UNICODE_BOM_CHARACTER_RUNE, UTF8;
8 8
9 import '../scanner.dart' show unicodeReplacementCharacter; 9 import '../scanner.dart' show unicodeReplacementCharacter;
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 int stringOffsetSlackOffset = -1; 188 int stringOffsetSlackOffset = -1;
189 189
190 int get stringOffset { 190 int get stringOffset {
191 if (stringOffsetSlackOffset == byteOffset) { 191 if (stringOffsetSlackOffset == byteOffset) {
192 return byteOffset - utf8Slack - 1; 192 return byteOffset - utf8Slack - 1;
193 } else { 193 } else {
194 return byteOffset - utf8Slack; 194 return byteOffset - utf8Slack;
195 } 195 }
196 } 196 }
197 197
198 Token firstToken() => tokens.next;
199 Token previousToken() => tail;
200
201 @override 198 @override
202 StringToken createSubstringToken( 199 StringToken createSubstringToken(
203 PrecedenceInfo info, int start, bool asciiOnly, 200 PrecedenceInfo info, int start, bool asciiOnly,
204 [int extraOffset = 0]) { 201 [int extraOffset = 0]) {
205 return new StringToken.fromUtf8Bytes( 202 return new StringToken.fromUtf8Bytes(
206 info, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); 203 info, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
207 } 204 }
208 205
209 bool atEndOfFile() => byteOffset >= bytes.length - 1; 206 bool atEndOfFile() => byteOffset >= bytes.length - 1;
210 } 207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698