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

Side by Side Diff: dart/frog/leg/scanner/node_scanner_bench.dart

Issue 8497042: Allow error-recovery in top-level nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased, address review comments, and frogsh Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/frog/leg/scanner/parser.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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('node_scanner_bench'); 5 #library('node_scanner_bench');
6 #import('../../lib/node/node.dart'); 6 #import('../../lib/node/node.dart');
7 #import('scannerlib.dart'); 7 #import('scannerlib.dart');
8 #import('scanner_implementation.dart'); 8 #import('scanner_implementation.dart');
9 #import('scanner_bench.dart'); 9 #import('scanner_bench.dart');
10 #source('byte_strings.dart'); 10 #source('byte_strings.dart');
11 #source('byte_array_scanner.dart'); 11 #source('byte_array_scanner.dart');
12 12
13 class NodeScannerBench extends ScannerBench { 13 class NodeScannerBench extends ScannerBench {
14 int getBytes(String filename, void callback(bytes)) { 14 int getBytes(String filename, void callback(bytes)) {
15 List s = fs.readFileSync(filename, null); 15 // This actually returns a buffer, not a String.
16 var s = fs.readFileSync(filename, null);
16 callback(s); 17 callback(s);
17 return s.length; 18 return s.length;
18 } 19 }
19 20
20 Scanner makeScanner(bytes) => new ByteArrayScanner(bytes); 21 Scanner makeScanner(bytes) => new ByteArrayScanner(bytes);
21 22
22 void checkExistence(String filename) { 23 void checkExistence(String filename) {
23 if (!path.existsSync(filename)) { 24 if (!path.existsSync(filename)) {
24 throw "no such file: ${filename}"; 25 throw "no such file: ${filename}";
25 } 26 }
26 } 27 }
27 } 28 }
28 29
29 main() { 30 main() {
30 new NodeScannerBench().main(argv); 31 new NodeScannerBench().main(argv);
31 } 32 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/frog/leg/scanner/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698