| 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 TokenType; | 9 import '../../scanner/token.dart' show TokenType; |
| 10 | 10 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return byteOffset - utf8Slack - 1; | 194 return byteOffset - utf8Slack - 1; |
| 195 } else { | 195 } else { |
| 196 return byteOffset - utf8Slack; | 196 return byteOffset - utf8Slack; |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 @override | 200 @override |
| 201 StringToken createSubstringToken(TokenType type, int start, bool asciiOnly, | 201 StringToken createSubstringToken(TokenType type, int start, bool asciiOnly, |
| 202 [int extraOffset = 0]) { | 202 [int extraOffset = 0]) { |
| 203 return new StringToken.fromUtf8Bytes( | 203 return new StringToken.fromUtf8Bytes( |
| 204 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); | 204 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart, |
| 205 precedingComments: comments); |
| 205 } | 206 } |
| 206 | 207 |
| 207 @override | 208 @override |
| 208 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, | 209 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, |
| 209 [int extraOffset = 0]) { | 210 [int extraOffset = 0]) { |
| 210 return new CommentToken.fromUtf8Bytes( | 211 return new CommentToken.fromUtf8Bytes( |
| 211 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); | 212 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); |
| 212 } | 213 } |
| 213 | 214 |
| 214 @override | 215 @override |
| 215 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly, | 216 DartDocToken createDartDocToken(TokenType type, int start, bool asciiOnly, |
| 216 [int extraOffset = 0]) { | 217 [int extraOffset = 0]) { |
| 217 return new DartDocToken.fromUtf8Bytes( | 218 return new DartDocToken.fromUtf8Bytes( |
| 218 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); | 219 type, bytes, start, byteOffset + extraOffset, asciiOnly, tokenStart); |
| 219 } | 220 } |
| 220 | 221 |
| 221 bool atEndOfFile() => byteOffset >= bytes.length - 1; | 222 bool atEndOfFile() => byteOffset >= bytes.length - 1; |
| 222 } | 223 } |
| OLD | NEW |