| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.abstract_scanner; | 5 library fasta.scanner.abstract_scanner; |
| 6 | 6 |
| 7 import 'dart:collection' show ListMixin; | 7 import 'dart:collection' show ListMixin; |
| 8 | 8 |
| 9 import 'dart:typed_data' show Uint16List, Uint32List; | 9 import 'dart:typed_data' show Uint16List, Uint32List; |
| 10 | 10 |
| 11 import '../../scanner/token.dart' show TokenType; | 11 import '../../scanner/token.dart' show Token, TokenType; |
| 12 | 12 |
| 13 import '../scanner.dart' | 13 import '../scanner.dart' |
| 14 show ErrorToken, Keyword, Scanner, buildUnexpectedCharacterToken; | 14 show ErrorToken, Keyword, Scanner, buildUnexpectedCharacterToken; |
| 15 | 15 |
| 16 import 'error_token.dart' show UnterminatedToken; | 16 import 'error_token.dart' show UnterminatedToken; |
| 17 | 17 |
| 18 import 'keyword_state.dart' show KeywordState; | 18 import 'keyword_state.dart' show KeywordState; |
| 19 | 19 |
| 20 import 'token.dart' | 20 import 'token.dart' |
| 21 show BeginGroupToken, CommentToken, DartDocToken, SymbolToken, Token; | 21 show BeginGroupToken, CommentToken, DartDocToken, SymbolToken; |
| 22 | 22 |
| 23 import 'token_constants.dart'; | 23 import 'token_constants.dart'; |
| 24 | 24 |
| 25 import 'characters.dart'; | 25 import 'characters.dart'; |
| 26 | 26 |
| 27 abstract class AbstractScanner implements Scanner { | 27 abstract class AbstractScanner implements Scanner { |
| 28 final bool includeComments; | 28 final bool includeComments; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * A flag indicating whether to parse generic method comments, of the form | 31 * A flag indicating whether to parse generic method comments, of the form |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 863 } |
| 864 | 864 |
| 865 /** | 865 /** |
| 866 * Append the given token to the [tail] of the current stream of tokens. | 866 * Append the given token to the [tail] of the current stream of tokens. |
| 867 */ | 867 */ |
| 868 void appendToken(Token token) { | 868 void appendToken(Token token) { |
| 869 tail.next = token; | 869 tail.next = token; |
| 870 tail.next.previous = tail; | 870 tail.next.previous = tail; |
| 871 tail = tail.next; | 871 tail = tail.next; |
| 872 if (comments != null) { | 872 if (comments != null) { |
| 873 for (CommentToken c = comments; c != null; c = c.next) { | 873 // It is the responsibility of the caller to construct the token |
| 874 c.parent = tail; | 874 // being appended with preceeding comments if any |
| 875 } | 875 assert(identical(token.precedingComments, comments)); |
| 876 tail.precedingComments = comments; | |
| 877 comments = null; | 876 comments = null; |
| 878 commentsTail = null; | 877 commentsTail = null; |
| 879 } | 878 } |
| 880 } | 879 } |
| 881 | 880 |
| 882 void _appendToCommentStream(Token newComment) { | 881 void _appendToCommentStream(Token newComment) { |
| 883 if (comments == null) { | 882 if (comments == null) { |
| 884 comments = newComment; | 883 comments = newComment; |
| 885 commentsTail = comments; | 884 commentsTail = comments; |
| 886 } else { | 885 } else { |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 switchToUint32(newLength); | 1288 switchToUint32(newLength); |
| 1290 } | 1289 } |
| 1291 } | 1290 } |
| 1292 | 1291 |
| 1293 void switchToUint32(int newLength) { | 1292 void switchToUint32(int newLength) { |
| 1294 final newArray = new Uint32List(newLength); | 1293 final newArray = new Uint32List(newLength); |
| 1295 newArray.setRange(0, arrayLength, array); | 1294 newArray.setRange(0, arrayLength, array); |
| 1296 array = newArray; | 1295 array = newArray; |
| 1297 } | 1296 } |
| 1298 } | 1297 } |
| OLD | NEW |