| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.scanner; | 8 library engine.scanner; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| 11 import "dart:math" as math; |
| 12 |
| 11 import 'java_core.dart'; | 13 import 'java_core.dart'; |
| 12 import 'java_engine.dart'; | 14 import 'java_engine.dart'; |
| 13 import 'source.dart'; | 15 import 'source.dart'; |
| 14 import 'error.dart'; | 16 import 'error.dart'; |
| 15 import 'instrumentation.dart'; | 17 import 'instrumentation.dart'; |
| 16 import 'utilities_collection.dart' show TokenMap; | 18 import 'utilities_collection.dart' show TokenMap; |
| 17 | 19 |
| 18 /** | 20 /** |
| 19 * Instances of the class `BeginToken` represent the opening half of a grouping
pair of | 21 * Instances of the class `BeginToken` represent the opening half of a grouping
pair of |
| 20 * tokens. This is used for curly brackets ('{'), parentheses ('('), and square
brackets ('['). | 22 * tokens. This is used for curly brackets ('{'), parentheses ('('), and square
brackets ('['). |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 308 } |
| 307 // | 309 // |
| 308 // Compute the delta between the character index of characters after the mod
ified region in the | 310 // Compute the delta between the character index of characters after the mod
ified region in the |
| 309 // original source and the index of the corresponding character in the modif
ied source. | 311 // original source and the index of the corresponding character in the modif
ied source. |
| 310 // | 312 // |
| 311 int delta = insertedLength - removedLength; | 313 int delta = insertedLength - removedLength; |
| 312 // | 314 // |
| 313 // Compute the range of characters that are known to need to be rescanned. I
f the index is | 315 // Compute the range of characters that are known to need to be rescanned. I
f the index is |
| 314 // within an existing token, then we need to start at the beginning of the t
oken. | 316 // within an existing token, then we need to start at the beginning of the t
oken. |
| 315 // | 317 // |
| 316 int scanStart = Math.min(oldFirst.offset, index); | 318 int scanStart = math.min(oldFirst.offset, index); |
| 317 int oldEnd = oldLast.end + delta - 1; | 319 int oldEnd = oldLast.end + delta - 1; |
| 318 int newEnd = index + insertedLength - 1; | 320 int newEnd = index + insertedLength - 1; |
| 319 int scanEnd = Math.max(newEnd, oldEnd); | 321 int scanEnd = math.max(newEnd, oldEnd); |
| 320 // | 322 // |
| 321 // Starting at the start of the scan region, scan tokens from the modifiedSo
urce until the end | 323 // Starting at the start of the scan region, scan tokens from the modifiedSo
urce until the end |
| 322 // of the just scanned token is greater than or equal to end of the scan reg
ion in the modified | 324 // of the just scanned token is greater than or equal to end of the scan reg
ion in the modified |
| 323 // source. Include trailing characters of any token that was split as a resu
lt of inserted text, | 325 // source. Include trailing characters of any token that was split as a resu
lt of inserted text, |
| 324 // as in "ab" --> "a.b". | 326 // as in "ab" --> "a.b". |
| 325 // | 327 // |
| 326 _reader.offset = scanStart - 1; | 328 _reader.offset = scanStart - 1; |
| 327 int next = _reader.advance(); | 329 int next = _reader.advance(); |
| 328 while (next != -1 && _reader.offset <= scanEnd) { | 330 while (next != -1 && _reader.offset <= scanEnd) { |
| 329 next = bigSwitch(next); | 331 next = bigSwitch(next); |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2697 * @param precedingComment the first comment in the list of comments that prec
ede this token | 2699 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 2698 */ | 2700 */ |
| 2699 TokenWithComment(TokenType type, int offset, this._precedingComment) : super(t
ype, offset); | 2701 TokenWithComment(TokenType type, int offset, this._precedingComment) : super(t
ype, offset); |
| 2700 | 2702 |
| 2701 @override | 2703 @override |
| 2702 Token copy() => new TokenWithComment(type, offset, _precedingComment); | 2704 Token copy() => new TokenWithComment(type, offset, _precedingComment); |
| 2703 | 2705 |
| 2704 @override | 2706 @override |
| 2705 Token get precedingComments => _precedingComment; | 2707 Token get precedingComments => _precedingComment; |
| 2706 } | 2708 } |
| OLD | NEW |