Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: pkg/front_end/lib/src/fasta/analyzer/token_utils.dart

Issue 2701723002: fix token type of first token in converted token stream (Closed)
Patch Set: merge Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/test/scanner_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/parser/error_kind.dart' show 7 import 'package:front_end/src/fasta/parser/error_kind.dart' show
8 ErrorKind; 8 ErrorKind;
9 9
10 import 'package:front_end/src/fasta/scanner/error_token.dart' show 10 import 'package:front_end/src/fasta/scanner/error_token.dart' show
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 /// 85 ///
86 /// The first element of this list is always a sentinel `null` value so that 86 /// The first element of this list is always a sentinel `null` value so that
87 /// we don't have to check if it is empty. 87 /// we don't have to check if it is empty.
88 /// 88 ///
89 /// See additional documentation in [_matchGroups]. 89 /// See additional documentation in [_matchGroups].
90 List<Token> _endTokenStack; 90 List<Token> _endTokenStack;
91 91
92 /// Converts a stream of Fasta tokens (starting with [token] and continuing to 92 /// Converts a stream of Fasta tokens (starting with [token] and continuing to
93 /// EOF) to a stream of analyzer tokens. 93 /// EOF) to a stream of analyzer tokens.
94 analyzer.Token convertTokens(Token token) { 94 analyzer.Token convertTokens(Token token) {
95 _analyzerTokenHead = new analyzer.Token(null, 0); 95 _analyzerTokenHead = new analyzer.Token(TokenType.EOF, -1);
96 _analyzerTokenHead.previous = _analyzerTokenHead; 96 _analyzerTokenHead.previous = _analyzerTokenHead;
97 _analyzerTokenTail = _analyzerTokenHead; 97 _analyzerTokenTail = _analyzerTokenHead;
98 _currentCommentHead = null; 98 _currentCommentHead = null;
99 _currentCommentTail = null; 99 _currentCommentTail = null;
100 _beginTokenStack = [null]; 100 _beginTokenStack = [null];
101 _endTokenStack = <Token>[null]; 101 _endTokenStack = <Token>[null];
102 102
103 while (true) { 103 while (true) {
104 if (token.info.kind == BAD_INPUT_TOKEN) { 104 if (token.info.kind == BAD_INPUT_TOKEN) {
105 ErrorToken errorToken = token; 105 ErrorToken errorToken = token;
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 case BACKSLASH_TOKEN: return TokenType.BACKSLASH; 708 case BACKSLASH_TOKEN: return TokenType.BACKSLASH;
709 case PERIOD_PERIOD_PERIOD_TOKEN: return TokenType.PERIOD_PERIOD_PERIOD; 709 case PERIOD_PERIOD_PERIOD_TOKEN: return TokenType.PERIOD_PERIOD_PERIOD;
710 // case GENERIC_METHOD_TYPE_LIST_TOKEN: 710 // case GENERIC_METHOD_TYPE_LIST_TOKEN:
711 // return TokenType.GENERIC_METHOD_TYPE_LIST; 711 // return TokenType.GENERIC_METHOD_TYPE_LIST;
712 // case GENERIC_METHOD_TYPE_ASSIGN_TOKEN: 712 // case GENERIC_METHOD_TYPE_ASSIGN_TOKEN:
713 // return TokenType.GENERIC_METHOD_TYPE_ASSIGN; 713 // return TokenType.GENERIC_METHOD_TYPE_ASSIGN;
714 default: 714 default:
715 return internalError("Unhandled token ${token.info}"); 715 return internalError("Unhandled token ${token.info}");
716 } 716 }
717 } 717 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/test/scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698