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

Side by Side Diff: pkg/front_end/tool/fasta_perf.dart

Issue 2767083002: fasta scanner recovery and error code translation improvements (Closed)
Patch Set: revert address comments and fix for token_stream_rewriter test Created 3 years, 9 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 | « pkg/front_end/test/scanner_test.dart ('k') | no next file » | 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) 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 license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// An entrypoint used to run portions of fasta and measure its performance. 5 /// An entrypoint used to run portions of fasta and measure its performance.
6 library front_end.tool.fasta_perf; 6 library front_end.tool.fasta_perf;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 var listener = new DirectiveListener(); 161 var listener = new DirectiveListener();
162 new DirectiveParser(listener).parseUnit(tokenize(contents)); 162 new DirectiveParser(listener).parseUnit(tokenize(contents));
163 return listener.uris; 163 return listener.uris;
164 } 164 }
165 165
166 /// Diet parser that stops eagerly at the first sign that we have seen all the 166 /// Diet parser that stops eagerly at the first sign that we have seen all the
167 /// import, export, and part directives. 167 /// import, export, and part directives.
168 class DirectiveParser extends ClassMemberParser { 168 class DirectiveParser extends ClassMemberParser {
169 DirectiveParser(listener) : super(listener); 169 DirectiveParser(listener) : super(listener);
170 170
171 static final _endToken = new SymbolToken(EOF_INFO, -1); 171 static final _endToken = new SymbolToken.eof(-1);
172 172
173 Token parseClassOrNamedMixinApplication(Token token) => _endToken; 173 Token parseClassOrNamedMixinApplication(Token token) => _endToken;
174 Token parseEnum(Token token) => _endToken; 174 Token parseEnum(Token token) => _endToken;
175 parseTypedef(token) => _endToken; 175 parseTypedef(token) => _endToken;
176 parseTopLevelMember(Token token) => _endToken; 176 parseTopLevelMember(Token token) => _endToken;
177 } 177 }
178 178
179 /// Listener that records the URIs from imports, exports, and part directives. 179 /// Listener that records the URIs from imports, exports, and part directives.
180 class DirectiveListener extends Listener { 180 class DirectiveListener extends Listener {
181 bool _inDirective = false; 181 bool _inDirective = false;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 /// Report that metric [name] took [time] micro-seconds to process 288 /// Report that metric [name] took [time] micro-seconds to process
289 /// [inputSize] characters. 289 /// [inputSize] characters.
290 void report(String name, int time) { 290 void report(String name, int time) {
291 var sb = new StringBuffer(); 291 var sb = new StringBuffer();
292 var padding = ' ' * (20 - name.length); 292 var padding = ' ' * (20 - name.length);
293 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); 293 sb.write('$name:$padding $time us, ${time ~/ 1000} ms');
294 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); 294 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2);
295 sb.write(', $invSpeed ns/char'); 295 sb.write(', $invSpeed ns/char');
296 print('$sb'); 296 print('$sb');
297 } 297 }
OLDNEW
« no previous file with comments | « pkg/front_end/test/scanner_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698