| OLD | NEW |
| 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 /** | 5 /** |
| 6 * A benchmark for the Dart parser. | 6 * A benchmark for the Dart parser. |
| 7 */ | 7 */ |
| 8 class ParserBench extends BaseParserBench { | 8 class ParserBench extends BaseParserBench { |
| 9 int charCount = 0; | 9 int charCount = 0; |
| 10 double score = 0.0; | 10 double score = 0.0; |
| 11 | 11 |
| 12 Token scanFileNamed(String filename) { | 12 Token scanFileNamed(String filename) { |
| 13 Token token; | 13 Token token; |
| 14 getBytes(filename, (bytes) { | 14 getBytes(filename, (bytes) { |
| 15 Scanner scanner = makeScanner(bytes); | 15 AbstractScanner scanner = makeScanner(bytes); |
| 16 try { | 16 try { |
| 17 token = scanner.tokenize(); | 17 token = scanner.tokenize(); |
| 18 printTokens(token); | 18 printTokens(token); |
| 19 charCount += scanner.charOffset; | 19 charCount += scanner.charOffset; |
| 20 } catch (MalformedInputException e) { | 20 } catch (MalformedInputException e) { |
| 21 print("${filename}: ${e}"); | 21 print("${filename}: ${e}"); |
| 22 } | 22 } |
| 23 }); | 23 }); |
| 24 return token; | 24 return token; |
| 25 } | 25 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 void beginClass(Token token) { | 107 void beginClass(Token token) { |
| 108 classCount++; | 108 classCount++; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void beginFunctionTypeAlias(Token token) { | 111 void beginFunctionTypeAlias(Token token) { |
| 112 aliasCount++; | 112 aliasCount++; |
| 113 } | 113 } |
| 114 } | 114 } |
| OLD | NEW |