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/scanner/token.dart' show Keyword, Token; | 9 import 'package:front_end/src/scanner/token.dart' show Keyword, Token; |
10 | 10 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 case TokenType.TILDE_SLASH: | 434 case TokenType.TILDE_SLASH: |
435 return symbol(TokenType.TILDE_SLASH); | 435 return symbol(TokenType.TILDE_SLASH); |
436 case TokenType.TILDE_SLASH_EQ: | 436 case TokenType.TILDE_SLASH_EQ: |
437 return symbol(TokenType.TILDE_SLASH_EQ); | 437 return symbol(TokenType.TILDE_SLASH_EQ); |
438 case TokenType.BACKPING: | 438 case TokenType.BACKPING: |
439 return symbol(TokenType.BACKPING); | 439 return symbol(TokenType.BACKPING); |
440 case TokenType.BACKSLASH: | 440 case TokenType.BACKSLASH: |
441 return symbol(TokenType.BACKSLASH); | 441 return symbol(TokenType.BACKSLASH); |
442 case TokenType.PERIOD_PERIOD_PERIOD: | 442 case TokenType.PERIOD_PERIOD_PERIOD: |
443 return symbol(TokenType.PERIOD_PERIOD_PERIOD); | 443 return symbol(TokenType.PERIOD_PERIOD_PERIOD); |
444 // case TokenType.GENERIC_METHOD_TYPE_ASSIGN | 444 case TokenType.GENERIC_METHOD_TYPE_ASSIGN: |
445 // case TokenType.GENERIC_METHOD_TYPE_LIST | 445 return new CommentToken.fromSubstring( |
| 446 TokenType.GENERIC_METHOD_TYPE_ASSIGN, |
| 447 token.lexeme, |
| 448 0, |
| 449 token.lexeme.length, |
| 450 0); |
| 451 case TokenType.GENERIC_METHOD_TYPE_LIST: |
| 452 return new CommentToken.fromSubstring(TokenType.GENERIC_METHOD_TYPE_LIST, |
| 453 token.lexeme, 0, token.lexeme.length, 0); |
446 default: | 454 default: |
447 return internalError('Unhandled token type ${token.type}'); | 455 return internalError('Unhandled token type ${token.type}'); |
448 } | 456 } |
449 } | 457 } |
450 | 458 |
451 analyzer.Token toAnalyzerToken(Token token, | 459 analyzer.Token toAnalyzerToken(Token token, |
452 [analyzer.CommentToken commentToken]) { | 460 [analyzer.CommentToken commentToken]) { |
453 if (token == null) return null; | 461 if (token == null) return null; |
454 analyzer.Token makeStringToken(TokenType tokenType) { | 462 analyzer.Token makeStringToken(TokenType tokenType) { |
455 if (commentToken == null) { | 463 if (commentToken == null) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 "hide": analyzer.Keyword.HIDE, | 607 "hide": analyzer.Keyword.HIDE, |
600 "native": analyzer.Keyword.NATIVE, | 608 "native": analyzer.Keyword.NATIVE, |
601 "of": analyzer.Keyword.OF, | 609 "of": analyzer.Keyword.OF, |
602 "on": analyzer.Keyword.ON, | 610 "on": analyzer.Keyword.ON, |
603 "patch": analyzer.Keyword.PATCH, | 611 "patch": analyzer.Keyword.PATCH, |
604 "show": analyzer.Keyword.SHOW, | 612 "show": analyzer.Keyword.SHOW, |
605 "source": analyzer.Keyword.SOURCE, | 613 "source": analyzer.Keyword.SOURCE, |
606 "sync": analyzer.Keyword.SYNC, | 614 "sync": analyzer.Keyword.SYNC, |
607 "yield": analyzer.Keyword.YIELD, | 615 "yield": analyzer.Keyword.YIELD, |
608 }; | 616 }; |
OLD | NEW |