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 /** | 5 /** |
6 * A class for holding onto the data for a date so that it can be built | 6 * A class for holding onto the data for a date so that it can be built |
7 * up incrementally. | 7 * up incrementally. |
8 */ | 8 */ |
9 class _DateBuilder { | 9 class _DateBuilder { |
10 // Default the date values to the EPOCH so that there's a valid date | 10 // Default the date values to the EPOCH so that there's a valid date |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return results; | 126 return results; |
127 } | 127 } |
128 | 128 |
129 /** | 129 /** |
130 * Assuming that the contents are characters, read as many digits as we | 130 * Assuming that the contents are characters, read as many digits as we |
131 * can see and then return the corresponding integer. Advance the stream. | 131 * can see and then return the corresponding integer. Advance the stream. |
132 */ | 132 */ |
133 var digitMatcher = const RegExp(r'\d+'); | 133 var digitMatcher = const RegExp(r'\d+'); |
134 int nextInteger() { | 134 int nextInteger() { |
135 var string = digitMatcher.stringMatch(rest()); | 135 var string = digitMatcher.stringMatch(rest()); |
136 if (string == null || string.isEmpty()) return null; | 136 if (string == null || string.isEmpty) return null; |
137 read(string.length); | 137 read(string.length); |
138 return int.parse(string); | 138 return int.parse(string); |
139 } | 139 } |
140 } | 140 } |
OLD | NEW |