Index: pkg/front_end/lib/src/fasta/analyzer/token_utils.dart |
diff --git a/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart b/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart |
index debd20b5b9f14a5f528f90f105b48c6ddd783a20..41481c724aeb87a1e27d401621ed6d5fae9cc054 100644 |
--- a/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart |
+++ b/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart |
@@ -4,46 +4,38 @@ |
library fasta.analyzer.token_utils; |
-import 'package:front_end/src/fasta/parser/error_kind.dart' show |
- ErrorKind; |
+import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind; |
-import 'package:front_end/src/fasta/scanner/error_token.dart' show |
- ErrorToken; |
+import 'package:front_end/src/fasta/scanner/error_token.dart' show ErrorToken; |
-import 'package:front_end/src/fasta/scanner/keyword.dart' show |
- Keyword; |
+import 'package:front_end/src/fasta/scanner/keyword.dart' show Keyword; |
import 'package:front_end/src/fasta/scanner/precedence.dart'; |
-import 'package:front_end/src/fasta/scanner/token.dart' show |
- BeginGroupToken, |
- KeywordToken, |
- StringToken, |
- SymbolToken, |
- Token; |
+import 'package:front_end/src/fasta/scanner/token.dart' |
+ show BeginGroupToken, KeywordToken, StringToken, SymbolToken, Token; |
import 'package:front_end/src/fasta/scanner/token_constants.dart'; |
-import 'package:front_end/src/scanner/token.dart' as analyzer show |
- BeginToken, |
- BeginTokenWithComment, |
- CommentToken, |
- Keyword, |
- KeywordToken, |
- KeywordTokenWithComment, |
- StringToken, |
- StringTokenWithComment, |
- Token, |
- TokenWithComment; |
+import 'package:front_end/src/scanner/token.dart' as analyzer |
+ show |
+ BeginToken, |
+ BeginTokenWithComment, |
+ CommentToken, |
+ Keyword, |
+ KeywordToken, |
+ KeywordTokenWithComment, |
+ StringToken, |
+ StringTokenWithComment, |
+ Token, |
+ TokenWithComment; |
-import 'package:front_end/src/scanner/errors.dart' as analyzer show |
- ScannerErrorCode; |
+import 'package:front_end/src/scanner/errors.dart' as analyzer |
+ show ScannerErrorCode; |
-import 'package:analyzer/dart/ast/token.dart' show |
- TokenType; |
+import 'package:analyzer/dart/ast/token.dart' show TokenType; |
-import '../errors.dart' show |
- internalError; |
+import '../errors.dart' show internalError; |
/// Class capable of converting a stream of Fasta tokens to a stream of analyzer |
/// tokens. |
@@ -631,82 +623,147 @@ final _keywordMap = { |
TokenType getTokenType(Token token) { |
switch (token.kind) { |
- case EOF_TOKEN: return TokenType.EOF; |
- case DOUBLE_TOKEN: return TokenType.DOUBLE; |
- case HEXADECIMAL_TOKEN: return TokenType.HEXADECIMAL; |
- case IDENTIFIER_TOKEN: return TokenType.IDENTIFIER; |
- case INT_TOKEN: return TokenType.INT; |
- case KEYWORD_TOKEN: return TokenType.KEYWORD; |
+ case EOF_TOKEN: |
+ return TokenType.EOF; |
+ case DOUBLE_TOKEN: |
+ return TokenType.DOUBLE; |
+ case HEXADECIMAL_TOKEN: |
+ return TokenType.HEXADECIMAL; |
+ case IDENTIFIER_TOKEN: |
+ return TokenType.IDENTIFIER; |
+ case INT_TOKEN: |
+ return TokenType.INT; |
+ case KEYWORD_TOKEN: |
+ return TokenType.KEYWORD; |
// case MULTI_LINE_COMMENT_TOKEN: return TokenType.MULTI_LINE_COMMENT; |
// case SCRIPT_TAG_TOKEN: return TokenType.SCRIPT_TAG; |
// case SINGLE_LINE_COMMENT_TOKEN: return TokenType.SINGLE_LINE_COMMENT; |
- case STRING_TOKEN: return TokenType.STRING; |
- case AMPERSAND_TOKEN: return TokenType.AMPERSAND; |
- case AMPERSAND_AMPERSAND_TOKEN: return TokenType.AMPERSAND_AMPERSAND; |
+ case STRING_TOKEN: |
+ return TokenType.STRING; |
+ case AMPERSAND_TOKEN: |
+ return TokenType.AMPERSAND; |
+ case AMPERSAND_AMPERSAND_TOKEN: |
+ return TokenType.AMPERSAND_AMPERSAND; |
// case AMPERSAND_AMPERSAND_EQ_TOKEN: |
// return TokenType.AMPERSAND_AMPERSAND_EQ; |
- case AMPERSAND_EQ_TOKEN: return TokenType.AMPERSAND_EQ; |
- case AT_TOKEN: return TokenType.AT; |
- case BANG_TOKEN: return TokenType.BANG; |
- case BANG_EQ_TOKEN: return TokenType.BANG_EQ; |
- case BAR_TOKEN: return TokenType.BAR; |
- case BAR_BAR_TOKEN: return TokenType.BAR_BAR; |
+ case AMPERSAND_EQ_TOKEN: |
+ return TokenType.AMPERSAND_EQ; |
+ case AT_TOKEN: |
+ return TokenType.AT; |
+ case BANG_TOKEN: |
+ return TokenType.BANG; |
+ case BANG_EQ_TOKEN: |
+ return TokenType.BANG_EQ; |
+ case BAR_TOKEN: |
+ return TokenType.BAR; |
+ case BAR_BAR_TOKEN: |
+ return TokenType.BAR_BAR; |
// case BAR_BAR_EQ_TOKEN: return TokenType.BAR_BAR_EQ; |
- case BAR_EQ_TOKEN: return TokenType.BAR_EQ; |
- case COLON_TOKEN: return TokenType.COLON; |
- case COMMA_TOKEN: return TokenType.COMMA; |
- case CARET_TOKEN: return TokenType.CARET; |
- case CARET_EQ_TOKEN: return TokenType.CARET_EQ; |
- case CLOSE_CURLY_BRACKET_TOKEN: return TokenType.CLOSE_CURLY_BRACKET; |
- case CLOSE_PAREN_TOKEN: return TokenType.CLOSE_PAREN; |
- case CLOSE_SQUARE_BRACKET_TOKEN: return TokenType.CLOSE_SQUARE_BRACKET; |
- case EQ_TOKEN: return TokenType.EQ; |
- case EQ_EQ_TOKEN: return TokenType.EQ_EQ; |
- case FUNCTION_TOKEN: return TokenType.FUNCTION; |
- case GT_TOKEN: return TokenType.GT; |
- case GT_EQ_TOKEN: return TokenType.GT_EQ; |
- case GT_GT_TOKEN: return TokenType.GT_GT; |
- case GT_GT_EQ_TOKEN: return TokenType.GT_GT_EQ; |
- case HASH_TOKEN: return TokenType.HASH; |
- case INDEX_TOKEN: return TokenType.INDEX; |
- case INDEX_EQ_TOKEN: return TokenType.INDEX_EQ; |
+ case BAR_EQ_TOKEN: |
+ return TokenType.BAR_EQ; |
+ case COLON_TOKEN: |
+ return TokenType.COLON; |
+ case COMMA_TOKEN: |
+ return TokenType.COMMA; |
+ case CARET_TOKEN: |
+ return TokenType.CARET; |
+ case CARET_EQ_TOKEN: |
+ return TokenType.CARET_EQ; |
+ case CLOSE_CURLY_BRACKET_TOKEN: |
+ return TokenType.CLOSE_CURLY_BRACKET; |
+ case CLOSE_PAREN_TOKEN: |
+ return TokenType.CLOSE_PAREN; |
+ case CLOSE_SQUARE_BRACKET_TOKEN: |
+ return TokenType.CLOSE_SQUARE_BRACKET; |
+ case EQ_TOKEN: |
+ return TokenType.EQ; |
+ case EQ_EQ_TOKEN: |
+ return TokenType.EQ_EQ; |
+ case FUNCTION_TOKEN: |
+ return TokenType.FUNCTION; |
+ case GT_TOKEN: |
+ return TokenType.GT; |
+ case GT_EQ_TOKEN: |
+ return TokenType.GT_EQ; |
+ case GT_GT_TOKEN: |
+ return TokenType.GT_GT; |
+ case GT_GT_EQ_TOKEN: |
+ return TokenType.GT_GT_EQ; |
+ case HASH_TOKEN: |
+ return TokenType.HASH; |
+ case INDEX_TOKEN: |
+ return TokenType.INDEX; |
+ case INDEX_EQ_TOKEN: |
+ return TokenType.INDEX_EQ; |
// case IS_TOKEN: return TokenType.IS; |
- case LT_TOKEN: return TokenType.LT; |
- case LT_EQ_TOKEN: return TokenType.LT_EQ; |
- case LT_LT_TOKEN: return TokenType.LT_LT; |
- case LT_LT_EQ_TOKEN: return TokenType.LT_LT_EQ; |
- case MINUS_TOKEN: return TokenType.MINUS; |
- case MINUS_EQ_TOKEN: return TokenType.MINUS_EQ; |
- case MINUS_MINUS_TOKEN: return TokenType.MINUS_MINUS; |
- case OPEN_CURLY_BRACKET_TOKEN: return TokenType.OPEN_CURLY_BRACKET; |
- case OPEN_PAREN_TOKEN: return TokenType.OPEN_PAREN; |
- case OPEN_SQUARE_BRACKET_TOKEN: return TokenType.OPEN_SQUARE_BRACKET; |
- case PERCENT_TOKEN: return TokenType.PERCENT; |
- case PERCENT_EQ_TOKEN: return TokenType.PERCENT_EQ; |
- case PERIOD_TOKEN: return TokenType.PERIOD; |
- case PERIOD_PERIOD_TOKEN: return TokenType.PERIOD_PERIOD; |
- case PLUS_TOKEN: return TokenType.PLUS; |
- case PLUS_EQ_TOKEN: return TokenType.PLUS_EQ; |
- case PLUS_PLUS_TOKEN: return TokenType.PLUS_PLUS; |
- case QUESTION_TOKEN: return TokenType.QUESTION; |
- case QUESTION_PERIOD_TOKEN: return TokenType.QUESTION_PERIOD; |
- case QUESTION_QUESTION_TOKEN: return TokenType.QUESTION_QUESTION; |
- case QUESTION_QUESTION_EQ_TOKEN: return TokenType.QUESTION_QUESTION_EQ; |
- case SEMICOLON_TOKEN: return TokenType.SEMICOLON; |
- case SLASH_TOKEN: return TokenType.SLASH; |
- case SLASH_EQ_TOKEN: return TokenType.SLASH_EQ; |
- case STAR_TOKEN: return TokenType.STAR; |
- case STAR_EQ_TOKEN: return TokenType.STAR_EQ; |
+ case LT_TOKEN: |
+ return TokenType.LT; |
+ case LT_EQ_TOKEN: |
+ return TokenType.LT_EQ; |
+ case LT_LT_TOKEN: |
+ return TokenType.LT_LT; |
+ case LT_LT_EQ_TOKEN: |
+ return TokenType.LT_LT_EQ; |
+ case MINUS_TOKEN: |
+ return TokenType.MINUS; |
+ case MINUS_EQ_TOKEN: |
+ return TokenType.MINUS_EQ; |
+ case MINUS_MINUS_TOKEN: |
+ return TokenType.MINUS_MINUS; |
+ case OPEN_CURLY_BRACKET_TOKEN: |
+ return TokenType.OPEN_CURLY_BRACKET; |
+ case OPEN_PAREN_TOKEN: |
+ return TokenType.OPEN_PAREN; |
+ case OPEN_SQUARE_BRACKET_TOKEN: |
+ return TokenType.OPEN_SQUARE_BRACKET; |
+ case PERCENT_TOKEN: |
+ return TokenType.PERCENT; |
+ case PERCENT_EQ_TOKEN: |
+ return TokenType.PERCENT_EQ; |
+ case PERIOD_TOKEN: |
+ return TokenType.PERIOD; |
+ case PERIOD_PERIOD_TOKEN: |
+ return TokenType.PERIOD_PERIOD; |
+ case PLUS_TOKEN: |
+ return TokenType.PLUS; |
+ case PLUS_EQ_TOKEN: |
+ return TokenType.PLUS_EQ; |
+ case PLUS_PLUS_TOKEN: |
+ return TokenType.PLUS_PLUS; |
+ case QUESTION_TOKEN: |
+ return TokenType.QUESTION; |
+ case QUESTION_PERIOD_TOKEN: |
+ return TokenType.QUESTION_PERIOD; |
+ case QUESTION_QUESTION_TOKEN: |
+ return TokenType.QUESTION_QUESTION; |
+ case QUESTION_QUESTION_EQ_TOKEN: |
+ return TokenType.QUESTION_QUESTION_EQ; |
+ case SEMICOLON_TOKEN: |
+ return TokenType.SEMICOLON; |
+ case SLASH_TOKEN: |
+ return TokenType.SLASH; |
+ case SLASH_EQ_TOKEN: |
+ return TokenType.SLASH_EQ; |
+ case STAR_TOKEN: |
+ return TokenType.STAR; |
+ case STAR_EQ_TOKEN: |
+ return TokenType.STAR_EQ; |
case STRING_INTERPOLATION_TOKEN: |
return TokenType.STRING_INTERPOLATION_EXPRESSION; |
case STRING_INTERPOLATION_IDENTIFIER_TOKEN: |
return TokenType.STRING_INTERPOLATION_IDENTIFIER; |
- case TILDE_TOKEN: return TokenType.TILDE; |
- case TILDE_SLASH_TOKEN: return TokenType.TILDE_SLASH; |
- case TILDE_SLASH_EQ_TOKEN: return TokenType.TILDE_SLASH_EQ; |
- case BACKPING_TOKEN: return TokenType.BACKPING; |
- case BACKSLASH_TOKEN: return TokenType.BACKSLASH; |
- case PERIOD_PERIOD_PERIOD_TOKEN: return TokenType.PERIOD_PERIOD_PERIOD; |
+ case TILDE_TOKEN: |
+ return TokenType.TILDE; |
+ case TILDE_SLASH_TOKEN: |
+ return TokenType.TILDE_SLASH; |
+ case TILDE_SLASH_EQ_TOKEN: |
+ return TokenType.TILDE_SLASH_EQ; |
+ case BACKPING_TOKEN: |
+ return TokenType.BACKPING; |
+ case BACKSLASH_TOKEN: |
+ return TokenType.BACKSLASH; |
+ case PERIOD_PERIOD_PERIOD_TOKEN: |
+ return TokenType.PERIOD_PERIOD_PERIOD; |
// case GENERIC_METHOD_TYPE_LIST_TOKEN: |
// return TokenType.GENERIC_METHOD_TYPE_LIST; |
// case GENERIC_METHOD_TYPE_ASSIGN_TOKEN: |