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

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/recover.dart

Issue 2872453004: cleanup TokenType var names (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 licenset hat can be found in the LICENSE file. 3 // BSD-style licenset hat can be found in the LICENSE file.
4 4
5 library fasta.scanner.recover; 5 library fasta.scanner.recover;
6 6
7 import '../../scanner/token.dart' show TokenType; 7 import '../../scanner/token.dart' show TokenType;
8 8
9 import '../fasta_codes.dart' 9 import '../fasta_codes.dart'
10 show 10 show
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // NonAsciiIdentifierToken("ø"), 77 // NonAsciiIdentifierToken("ø"),
78 // StringToken("d"), 78 // StringToken("d"),
79 // EOF, 79 // EOF,
80 // ] 80 // ]
81 bool prepend = false; 81 bool prepend = false;
82 82
83 // True if following token is also an identifier that starts right where 83 // True if following token is also an identifier that starts right where
84 // [errorTail] ends. This is the case for "b" above. 84 // [errorTail] ends. This is the case for "b" above.
85 bool append = false; 85 bool append = false;
86 if (goodTail != null) { 86 if (goodTail != null) {
87 if (goodTail.info == TokenType.IDENTIFIER && 87 if (goodTail.type == TokenType.IDENTIFIER &&
88 goodTail.charEnd == first.charOffset) { 88 goodTail.charEnd == first.charOffset) {
89 prepend = true; 89 prepend = true;
90 } 90 }
91 } 91 }
92 Token next = errorTail.next; 92 Token next = errorTail.next;
93 if (next.info == TokenType.IDENTIFIER && 93 if (next.type == TokenType.IDENTIFIER &&
94 errorTail.charOffset + 1 == next.charOffset) { 94 errorTail.charOffset + 1 == next.charOffset) {
95 append = true; 95 append = true;
96 } 96 }
97 if (prepend) { 97 if (prepend) {
98 codeUnits.addAll(goodTail.lexeme.codeUnits); 98 codeUnits.addAll(goodTail.lexeme.codeUnits);
99 } 99 }
100 NonAsciiIdentifierToken current = first; 100 NonAsciiIdentifierToken current = first;
101 while (current != errorTail) { 101 while (current != errorTail) {
102 codeUnits.add(current.character); 102 codeUnits.add(current.character);
103 current = current.next; 103 current = current.next;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 good.previousToken = errorTail; 221 good.previousToken = errorTail;
222 tail = goodTail; 222 tail = goodTail;
223 } else { 223 } else {
224 tail = errorTail; 224 tail = errorTail;
225 } 225 }
226 if (!tail.isEof) 226 if (!tail.isEof)
227 tail.next = new SymbolToken.eof(tail.end)..previousToken = tail; 227 tail.next = new SymbolToken.eof(tail.end)..previousToken = tail;
228 return error; 228 return error;
229 } 229 }
230 230
231 Token synthesizeToken(int charOffset, String value, TokenType info) { 231 Token synthesizeToken(int charOffset, String value, TokenType type) {
232 return new StringToken.fromString(info, value, charOffset); 232 return new StringToken.fromString(type, value, charOffset);
233 } 233 }
234 234
235 Token skipToEof(Token token) { 235 Token skipToEof(Token token) {
236 while (!token.isEof) { 236 while (!token.isEof) {
237 token = token.next; 237 token = token.next;
238 } 238 }
239 return token; 239 return token;
240 } 240 }
241 241
242 String closeBraceFor(String openBrace) { 242 String closeBraceFor(String openBrace) {
243 return const { 243 return const {
244 '(': ')', 244 '(': ')',
245 '[': ']', 245 '[': ']',
246 '{': '}', 246 '{': '}',
247 '<': '>', 247 '<': '>',
248 r'${': '}', 248 r'${': '}',
249 }[openBrace]; 249 }[openBrace];
250 } 250 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/error_token.dart ('k') | pkg/front_end/lib/src/fasta/scanner/string_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698