| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.analyzer.token_utils; | 5 library fasta.analyzer.token_utils; |
| 6 | 6 |
| 7 import 'package:front_end/src/fasta/scanner/error_token.dart' show ErrorToken; | 7 import 'package:front_end/src/fasta/scanner/error_token.dart' show ErrorToken; |
| 8 | 8 |
| 9 import 'package:front_end/src/fasta/scanner/keyword.dart' show Keyword; | 9 import 'package:front_end/src/fasta/scanner/keyword.dart' show Keyword; |
| 10 | 10 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 Token translateComments(analyzer.Token token) { | 230 Token translateComments(analyzer.Token token) { |
| 231 if (token == null) { | 231 if (token == null) { |
| 232 return null; | 232 return null; |
| 233 } | 233 } |
| 234 Token head = fromAnalyzerToken(token); | 234 Token head = fromAnalyzerToken(token); |
| 235 Token tail = head; | 235 Token tail = head; |
| 236 token = token.next; | 236 token = token.next; |
| 237 while (token != null) { | 237 while (token != null) { |
| 238 tail.next = fromAnalyzerToken(token); | 238 tail.next = fromAnalyzerToken(token); |
| 239 tail.next.previousToken = tail; | 239 tail.next.previousToken = tail; // ignore: deprecated_member_use |
| 240 tail = tail.next; | 240 tail = tail.next; |
| 241 token = token.next; | 241 token = token.next; |
| 242 } | 242 } |
| 243 return head; | 243 return head; |
| 244 } | 244 } |
| 245 | 245 |
| 246 analyzer.Token translateAndAppend(analyzer.Token analyzerToken) { | 246 analyzer.Token translateAndAppend(analyzer.Token analyzerToken) { |
| 247 var token = fromAnalyzerToken(analyzerToken); | 247 var token = fromAnalyzerToken(analyzerToken); |
| 248 token.precedingCommentTokens = | 248 token.precedingCommentTokens = |
| 249 translateComments(analyzerToken.precedingComments); | 249 translateComments(analyzerToken.precedingComments); |
| 250 tokenTail.next = token; | 250 tokenTail.next = token; |
| 251 tokenTail.next.previousToken = tokenTail; | 251 tokenTail.next.previousToken = tokenTail; // ignore: deprecated_member_use |
| 252 tokenTail = token; | 252 tokenTail = token; |
| 253 matchGroups(analyzerToken, token); | 253 matchGroups(analyzerToken, token); |
| 254 return analyzerToken.next; | 254 return analyzerToken.next; |
| 255 } | 255 } |
| 256 | 256 |
| 257 while (true) { | 257 while (true) { |
| 258 // TODO(paulberry): join up begingroup/endgroup. | 258 // TODO(paulberry): join up begingroup/endgroup. |
| 259 if (analyzerToken.type == TokenType.EOF) { | 259 if (analyzerToken.type == TokenType.EOF) { |
| 260 tokenTail.next = new SymbolToken.eof(analyzerToken.offset); | 260 tokenTail.next = new SymbolToken.eof(analyzerToken.offset); |
| 261 tokenTail.next.previousToken = tokenTail; | 261 tokenTail.next.previousToken = tokenTail; // ignore: deprecated_member_use |
| 262 tokenTail.next.precedingCommentTokens = | 262 tokenTail.next.precedingCommentTokens = |
| 263 translateComments(analyzerToken.precedingComments); | 263 translateComments(analyzerToken.precedingComments); |
| 264 tokenTail.next.next = tokenTail.next; | 264 tokenTail.next.next = tokenTail.next; |
| 265 return tokenHead.next; | 265 return tokenHead.next; |
| 266 } | 266 } |
| 267 analyzerToken = translateAndAppend(analyzerToken); | 267 analyzerToken = translateAndAppend(analyzerToken); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 /// Converts a single analyzer token into a Fasta token. | 271 /// Converts a single analyzer token into a Fasta token. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 case PERIOD_PERIOD_PERIOD_TOKEN: | 732 case PERIOD_PERIOD_PERIOD_TOKEN: |
| 733 return TokenType.PERIOD_PERIOD_PERIOD; | 733 return TokenType.PERIOD_PERIOD_PERIOD; |
| 734 // case GENERIC_METHOD_TYPE_LIST_TOKEN: | 734 // case GENERIC_METHOD_TYPE_LIST_TOKEN: |
| 735 // return TokenType.GENERIC_METHOD_TYPE_LIST; | 735 // return TokenType.GENERIC_METHOD_TYPE_LIST; |
| 736 // case GENERIC_METHOD_TYPE_ASSIGN_TOKEN: | 736 // case GENERIC_METHOD_TYPE_ASSIGN_TOKEN: |
| 737 // return TokenType.GENERIC_METHOD_TYPE_ASSIGN; | 737 // return TokenType.GENERIC_METHOD_TYPE_ASSIGN; |
| 738 default: | 738 default: |
| 739 return internalError("Unhandled token ${token.info}"); | 739 return internalError("Unhandled token ${token.info}"); |
| 740 } | 740 } |
| 741 } | 741 } |
| OLD | NEW |