| 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 part of intl; | 5 part of intl; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * DateFormat is for formatting and parsing dates in a locale-sensitive | 8 * DateFormat is for formatting and parsing dates in a locale-sensitive |
| 9 * manner. | 9 * manner. |
| 10 * It allows the user to choose from a set of standard date time formats as well | 10 * It allows the user to choose from a set of standard date time formats as well |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 */ | 438 */ |
| 439 _useDefaultPattern() { | 439 _useDefaultPattern() { |
| 440 add_yMMMMd(); | 440 add_yMMMMd(); |
| 441 add_jms(); | 441 add_jms(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 /** | 444 /** |
| 445 * A series of regular expressions used to parse a format string into its | 445 * A series of regular expressions used to parse a format string into its |
| 446 * component fields. | 446 * component fields. |
| 447 */ | 447 */ |
| 448 static List<Pattern> _matchers = [ | 448 static var _matchers = const [ |
| 449 // Quoted String - anything between single quotes, with escaping | 449 // Quoted String - anything between single quotes, with escaping |
| 450 // of single quotes by doubling them. | 450 // of single quotes by doubling them. |
| 451 // e.g. in the pattern "hh 'o''clock'" will match 'o''clock' | 451 // e.g. in the pattern "hh 'o''clock'" will match 'o''clock' |
| 452 new RegExp("^\'(?:[^\']|\'\')*\'"), | 452 const RegExp("^\'(?:[^\']|\'\')*\'"), |
| 453 // Fields - any sequence of 1 or more of the same field characters. | 453 // Fields - any sequence of 1 or more of the same field characters. |
| 454 // e.g. in "hh:mm:ss" will match hh, mm, and ss. But in "hms" would | 454 // e.g. in "hh:mm:ss" will match hh, mm, and ss. But in "hms" would |
| 455 // match each letter individually. | 455 // match each letter individually. |
| 456 new RegExp( | 456 const RegExp( |
| 457 "^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)"), | 457 "^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)"), |
| 458 // Everything else - A sequence that is not quotes or field characters. | 458 // Everything else - A sequence that is not quotes or field characters. |
| 459 // e.g. in "hh:mm:ss" will match the colons. | 459 // e.g. in "hh:mm:ss" will match the colons. |
| 460 new RegExp("^[^\'GyMkSEahKHcLQdmsvzZ]+") | 460 const RegExp("^[^\'GyMkSEahKHcLQdmsvzZ]+") |
| 461 ]; | 461 ]; |
| 462 | 462 |
| 463 /** | 463 /** |
| 464 * Set our pattern, appending it to any existing patterns. Also adds a single | 464 * Set our pattern, appending it to any existing patterns. Also adds a single |
| 465 * space to separate the two. | 465 * space to separate the two. |
| 466 */ | 466 */ |
| 467 _appendPattern(String inputPattern, [String separator = ' ']) { | 467 _appendPattern(String inputPattern, [String separator = ' ']) { |
| 468 if (_pattern == null) { | 468 if (_pattern == null) { |
| 469 _pattern = inputPattern; | 469 _pattern = inputPattern; |
| 470 } else { | 470 } else { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 List _reverse(List list) { | 561 List _reverse(List list) { |
| 562 // TODO(alanknight): Use standardized list reverse when implemented. | 562 // TODO(alanknight): Use standardized list reverse when implemented. |
| 563 // See Issue 2804. | 563 // See Issue 2804. |
| 564 var result = new List(); | 564 var result = new List(); |
| 565 for (var i = list.length-1; i >= 0; i--) { | 565 for (var i = list.length-1; i >= 0; i--) { |
| 566 result.addLast(list[i]); | 566 result.addLast(list[i]); |
| 567 } | 567 } |
| 568 return result; | 568 return result; |
| 569 } | 569 } |
| 570 } | 570 } |
| OLD | NEW |