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

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

Issue 2850853004: Add 'scanGenericMethodComments' parameter to constructors and scan() functions. (Closed)
Patch Set: Parse generic method comments only in strong mode. 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
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, {bool includeComments: false}) 82 Utf8BytesScanner(this.bytes,
83 : super(includeComments, numberOfBytesHint: bytes.length) { 83 {bool includeComments: false, bool scanGenericMethodComments: false})
84 : super(includeComments, scanGenericMethodComments,
85 numberOfBytesHint: bytes.length) {
84 assert(bytes.last == 0); 86 assert(bytes.last == 0);
85 // Skip a leading BOM. 87 // Skip a leading BOM.
86 if (containsBomAt(0)) byteOffset += 3; 88 if (containsBomAt(0)) byteOffset += 3;
87 } 89 }
88 90
89 bool containsBomAt(int offset) { 91 bool containsBomAt(int offset) {
90 const BOM_UTF8 = const [0xEF, 0xBB, 0xBF]; 92 const BOM_UTF8 = const [0xEF, 0xBB, 0xBF];
91 93
92 return offset + 3 < bytes.length && 94 return offset + 3 < bytes.length &&
93 bytes[offset] == BOM_UTF8[0] && 95 bytes[offset] == BOM_UTF8[0] &&
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 213
212 @override 214 @override
213 DartDocToken createDartDocToken(TokenType info, int start, bool asciiOnly, 215 DartDocToken createDartDocToken(TokenType info, int start, bool asciiOnly,
214 [int extraOffset = 0]) { 216 [int extraOffset = 0]) {
215 return new DartDocToken.fromUtf8Bytes( 217 return new DartDocToken.fromUtf8Bytes(
216 info, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); 218 info, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart);
217 } 219 }
218 220
219 bool atEndOfFile() => byteOffset >= bytes.length - 1; 221 bool atEndOfFile() => byteOffset >= bytes.length - 1;
220 } 222 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/string_scanner.dart ('k') | pkg/front_end/test/scanner_replacement_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698