OLD | NEW |
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 SyntheticStringToken, TokenType; | 9 import '../../scanner/token.dart' show SyntheticStringToken, TokenType; |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return new StringToken.fromUtf8Bytes( | 206 return new StringToken.fromUtf8Bytes( |
207 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart, | 207 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart, |
208 precedingComments: comments); | 208 precedingComments: comments); |
209 } | 209 } |
210 | 210 |
211 @override | 211 @override |
212 analyzer.StringToken createSyntheticSubstringToken( | 212 analyzer.StringToken createSyntheticSubstringToken( |
213 TokenType type, int start, bool asciiOnly, String closingQuotes) { | 213 TokenType type, int start, bool asciiOnly, String closingQuotes) { |
214 String source = StringToken.decodeUtf8(bytes, start, byteOffset, asciiOnly); | 214 String source = StringToken.decodeUtf8(bytes, start, byteOffset, asciiOnly); |
215 return new SyntheticStringToken( | 215 return new SyntheticStringToken( |
216 type, source + closingQuotes, start, source.length); | 216 type, source + closingQuotes, tokenStart, source.length); |
217 } | 217 } |
218 | 218 |
219 @override | 219 @override |
220 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, | 220 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, |
221 [int extraOffset = 0]) { | 221 [int extraOffset = 0]) { |
222 return new CommentToken.fromUtf8Bytes( | 222 return new CommentToken.fromUtf8Bytes( |
223 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); | 223 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); |
224 } | 224 } |
225 | 225 |
226 @override | 226 @override |
227 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly, | 227 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly, |
228 [int extraOffset = 0]) { | 228 [int extraOffset = 0]) { |
229 return new DartDocToken.fromUtf8Bytes( | 229 return new DartDocToken.fromUtf8Bytes( |
230 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); | 230 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); |
231 } | 231 } |
232 | 232 |
233 bool atEndOfFile() => byteOffset >= bytes.length - 1; | 233 bool atEndOfFile() => byteOffset >= bytes.length - 1; |
234 } | 234 } |
OLD | NEW |