Chromium Code Reviews| 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 #library("status_file_parser"); | 5 #library("status_file_parser"); |
| 6 | 6 |
| 7 | 7 |
| 8 #import("status_expression.dart"); | 8 #import("status_expression.dart"); |
| 9 | 9 |
| 10 final RegExp StripComment = const RegExp("^[^#]*"); | 10 final RegExp StripComment = const RegExp("^[^#]*"); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 | 24 |
| 25 // Helper method to be able to run the test from the runtime | 25 // Helper method to be able to run the test from the runtime |
| 26 // directory, or the top directory. | 26 // directory, or the top directory. |
| 27 String getFilename(String path) => | 27 String getFilename(String path) => |
| 28 new File(path).existsSync() ? path : '../$path'; | 28 new File(path).existsSync() ? path : '../$path'; |
| 29 | 29 |
| 30 | 30 |
| 31 void ReadConfigurationInto(path, sections) { | 31 void ReadConfigurationInto(path, sections) { |
| 32 File file = new File(getFilename(path)); | 32 File file = new File(getFilename(path)); |
| 33 Expect.isTrue(file.existsSync()); // TODO(whesse): Handle missing file. | 33 if (!file.existsSync()) return; // TODO(whesse): Handle missing file. |
|
Mads Ager (google)
2011/11/02 10:47:34
This seems like the wrong fix. Please change the t
| |
| 34 FileInputStream file_stream = file.openInputStream(); | 34 FileInputStream file_stream = file.openInputStream(); |
| 35 StringInputStream lines = new StringInputStream(file_stream); | 35 StringInputStream lines = new StringInputStream(file_stream); |
| 36 | 36 |
| 37 Section current = new Section.always(); | 37 Section current = new Section.always(); |
| 38 sections.add(current); | 38 sections.add(current); |
| 39 String prefix = ""; | 39 String prefix = ""; |
| 40 | 40 |
| 41 String line; | 41 String line; |
| 42 while ((line = lines.readLine()) != null) { | 42 while ((line = lines.readLine()) != null) { |
| 43 Match match = StripComment.firstMatch(line); | 43 Match match = StripComment.firstMatch(line); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 71 prefix = match[1]; | 71 prefix = match[1]; |
| 72 continue; | 72 continue; |
| 73 } | 73 } |
| 74 | 74 |
| 75 print("unmatched line: $line"); | 75 print("unmatched line: $line"); |
| 76 } | 76 } |
| 77 | 77 |
| 78 file_stream.close(); | 78 file_stream.close(); |
| 79 } | 79 } |
| 80 | 80 |
| OLD | NEW |