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

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

Issue 2903063003: update lazy assignment operators (Closed)
Patch Set: Created 3 years, 7 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/token.dart' show TokenType; 9 import '../../scanner/token.dart' show TokenType;
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /** 73 /**
74 * Creates a new Utf8BytesScanner. The source file is expected to be a 74 * Creates a new Utf8BytesScanner. The source file is expected to be a
75 * [Utf8BytesSourceFile] that holds a list of UTF-8 bytes. Otherwise the 75 * [Utf8BytesSourceFile] that holds a list of UTF-8 bytes. Otherwise the
76 * string text of the source file is decoded. 76 * string text of the source file is decoded.
77 * 77 *
78 * The list of UTF-8 bytes [file.slowUtf8Bytes()] is expected to return an 78 * The list of UTF-8 bytes [file.slowUtf8Bytes()] is expected to return an
79 * array whose last element is '0' to signal the end of the file. If this 79 * array whose last element is '0' to signal the end of the file. If this
80 * is not the case, the entire array is copied before scanning. 80 * is not the case, the entire array is copied before scanning.
81 */ 81 */
82 Utf8BytesScanner(this.bytes, 82 Utf8BytesScanner(this.bytes,
83 {bool includeComments: false, 83 {bool includeComments: false, bool scanGenericMethodComments: false})
84 bool scanGenericMethodComments: false,
85 bool scanLazyAssignmentOperators: false})
86 : super(includeComments, scanGenericMethodComments, 84 : super(includeComments, scanGenericMethodComments,
87 scanLazyAssignmentOperators,
88 numberOfBytesHint: bytes.length) { 85 numberOfBytesHint: bytes.length) {
89 assert(bytes.last == 0); 86 assert(bytes.last == 0);
90 // Skip a leading BOM. 87 // Skip a leading BOM.
91 if (containsBomAt(0)) byteOffset += 3; 88 if (containsBomAt(0)) byteOffset += 3;
92 } 89 }
93 90
94 bool containsBomAt(int offset) { 91 bool containsBomAt(int offset) {
95 const BOM_UTF8 = const [0xEF, 0xBB, 0xBF]; 92 const BOM_UTF8 = const [0xEF, 0xBB, 0xBF];
96 93
97 return offset + 3 < bytes.length && 94 return offset + 3 < bytes.length &&
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 214
218 @override 215 @override
219 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly, 216 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly,
220 [int extraOffset = 0]) { 217 [int extraOffset = 0]) {
221 return new DartDocToken.fromUtf8Bytes( 218 return new DartDocToken.fromUtf8Bytes(
222 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); 219 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
223 } 220 }
224 221
225 bool atEndOfFile() => byteOffset >= bytes.length - 1; 222 bool atEndOfFile() => byteOffset >= bytes.length - 1;
226 } 223 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/token_constants.dart ('k') | pkg/front_end/lib/src/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698