OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #import("dart:io"); | 7 #import("dart:io"); |
8 #import("status_expression.dart"); | 8 #import("status_expression.dart"); |
9 | 9 |
10 // Possible outcomes of running a test. | 10 // Possible outcomes of running a test. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (!file.existsSync()) { | 59 if (!file.existsSync()) { |
60 throw new Exception('Cannot find test status file $path'); | 60 throw new Exception('Cannot find test status file $path'); |
61 } | 61 } |
62 InputStream file_stream = file.openInputStream(); | 62 InputStream file_stream = file.openInputStream(); |
63 StringInputStream lines = new StringInputStream(file_stream); | 63 StringInputStream lines = new StringInputStream(file_stream); |
64 | 64 |
65 Section current = new Section.always(); | 65 Section current = new Section.always(); |
66 sections.add(current); | 66 sections.add(current); |
67 String prefix = ""; | 67 String prefix = ""; |
68 | 68 |
69 lines.lineHandler = () { | 69 lines.onLine = () { |
70 String line; | 70 String line; |
71 while ((line = lines.readLine()) != null) { | 71 while ((line = lines.readLine()) != null) { |
72 Match match = StripComment.firstMatch(line); | 72 Match match = StripComment.firstMatch(line); |
73 line = (match == null) ? "" : match[0]; | 73 line = (match == null) ? "" : match[0]; |
74 line = line.trim(); | 74 line = line.trim(); |
75 if (line.isEmpty()) continue; | 75 if (line.isEmpty()) continue; |
76 | 76 |
77 match = HeaderPattern.firstMatch(line); | 77 match = HeaderPattern.firstMatch(line); |
78 if (match != null) { | 78 if (match != null) { |
79 String condition_string = match[1].trim(); | 79 String condition_string = match[1].trim(); |
(...skipping 19 matching lines...) Expand all Loading... |
99 match = PrefixPattern.firstMatch(line); | 99 match = PrefixPattern.firstMatch(line); |
100 if (match != null) { | 100 if (match != null) { |
101 prefix = match[1]; | 101 prefix = match[1]; |
102 continue; | 102 continue; |
103 } | 103 } |
104 | 104 |
105 print("unmatched line: $line"); | 105 print("unmatched line: $line"); |
106 } | 106 } |
107 }; | 107 }; |
108 | 108 |
109 lines.closeHandler = () { | 109 lines.onClosed = () { |
110 onDone(); | 110 onDone(); |
111 }; | 111 }; |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 class TestRule { | 115 class TestRule { |
116 String name; | 116 String name; |
117 SetExpression expression; | 117 SetExpression expression; |
118 | 118 |
119 TestRule(this.name, this.expression); | 119 TestRule(this.name, this.expression); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 regExps[i] = regExp; | 206 regExps[i] = regExp; |
207 } | 207 } |
208 _keyToRegExps[key] = regExps; | 208 _keyToRegExps[key] = regExps; |
209 }); | 209 }); |
210 | 210 |
211 _regExpCache = null; | 211 _regExpCache = null; |
212 _preprocessed = true; | 212 _preprocessed = true; |
213 } | 213 } |
214 } | 214 } |
OLD | NEW |