| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.incremental_scanner; | 5 library engine.incremental_scanner; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 | 8 |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'scanner.dart'; | 10 import 'scanner.dart'; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 return token; | 211 return token; |
| 212 } | 212 } |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * Scan the token between the [start] (inclusive) and [end] (exclusive) | 215 * Scan the token between the [start] (inclusive) and [end] (exclusive) |
| 216 * offsets. | 216 * offsets. |
| 217 */ | 217 */ |
| 218 Token _scanRange(int start, int end) { | 218 Token _scanRange(int start, int end) { |
| 219 Scanner scanner = new Scanner( | 219 Scanner scanner = new Scanner( |
| 220 source, | 220 source, new CharacterRangeReader(reader, start, end), errorListener); |
| 221 new CharacterRangeReader(reader, start, end), | |
| 222 errorListener); | |
| 223 return scanner.tokenize(); | 221 return scanner.tokenize(); |
| 224 } | 222 } |
| 225 | 223 |
| 226 /** | 224 /** |
| 227 * Update the offsets of every token from the given [token] to the end of the | 225 * Update the offsets of every token from the given [token] to the end of the |
| 228 * stream by adding the given [delta]. | 226 * stream by adding the given [delta]. |
| 229 */ | 227 */ |
| 230 void _updateOffsets(Token token, int delta) { | 228 void _updateOffsets(Token token, int delta) { |
| 231 while (token.type != TokenType.EOF) { | 229 while (token.type != TokenType.EOF) { |
| 232 _tokenMap.put(token, token); | 230 _tokenMap.put(token, token); |
| 233 token.offset += delta; | 231 token.offset += delta; |
| 234 Token comment = token.precedingComments; | 232 Token comment = token.precedingComments; |
| 235 while (comment != null) { | 233 while (comment != null) { |
| 236 comment.offset += delta; | 234 comment.offset += delta; |
| 237 comment = comment.next; | 235 comment = comment.next; |
| 238 } | 236 } |
| 239 token = token.next; | 237 token = token.next; |
| 240 } | 238 } |
| 241 _tokenMap.put(token, token); | 239 _tokenMap.put(token, token); |
| 242 token.offset += delta; | 240 token.offset += delta; |
| 243 } | 241 } |
| 244 } | 242 } |
| OLD | NEW |