diff options
author | Kevin B Kenny <kennykb@acm.org> | 2007-08-25 16:53:24 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2007-08-25 16:53:24 (GMT) |
commit | e49284b70f26fd21f2b9751427b43b076965d60c (patch) | |
tree | 6c33a0dd669e487058840c3763b86973bf747b91 /library/clock.tcl | |
parent | 30befb3c49274ee4989a40ab39af49e2d2838891 (diff) | |
download | tcl-e49284b70f26fd21f2b9751427b43b076965d60c.zip tcl-e49284b70f26fd21f2b9751427b43b076965d60c.tar.gz tcl-e49284b70f26fd21f2b9751427b43b076965d60c.tar.bz2 |
* library/clock.tcl (ParseClockScanFormat): Modified code to allow
* tests/clock.test (clock-60.*): case-insensitive
matching of time zone and month names. [Bug 1781282]
Diffstat (limited to 'library/clock.tcl')
-rw-r--r-- | library/clock.tcl | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/library/clock.tcl b/library/clock.tcl index dfc5d73..fcce1b4 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: clock.tcl,v 1.43 2007/04/20 02:23:31 kennykb Exp $ +# RCS: @(#) $Id: clock.tcl,v 1.44 2007/08/25 16:53:25 kennykb Exp $ # #---------------------------------------------------------------------- @@ -1643,16 +1643,16 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { i {7 1 2 3 4 5 6} \ abr [mc DAYS_OF_WEEK_ABBREV] \ full [mc DAYS_OF_WEEK_FULL] { - dict set l $abr $i - dict set l $full $i + dict set l [string tolower $abr] $i + dict set l [string tolower $full] $i incr i } foreach { regex lookup } [UniquePrefixRegexp $l] break append re ( $regex ) dict set fieldSet dayOfWeek [incr fieldCount] append postcode "dict set date dayOfWeek \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ + "dict get " [list $lookup] " " \ + \[ {string tolower $field} [incr captureCount] \] \ "\]\n" } b - B - h { # Name of month @@ -1662,15 +1662,16 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { abr [mc MONTHS_ABBREV] \ full [mc MONTHS_FULL] { incr i - dict set l $abr $i - dict set l $full $i + dict set l [string tolower $abr] $i + dict set l [string tolower $full] $i } foreach { regex lookup } [UniquePrefixRegexp $l] break append re ( $regex ) dict set fieldSet month [incr fieldCount] append postcode "dict set date month \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ + "dict get " [list $lookup] \ + " " \[ {string tolower $field} \ + [incr captureCount] \] \ "\]\n" } C { # Gregorian century @@ -1761,7 +1762,8 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { set state %O } p - P { # AM/PM indicator - set l [list [mc AM] 0 [mc PM] 1] + set l [list [string tolower [mc AM]] 0 \ + [string tolower [mc PM]] 1] foreach { regex lookup } [UniquePrefixRegexp $l] break append re ( $regex ) dict set fieldSet amPmIndicator [incr fieldCount] @@ -1889,25 +1891,26 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { set d {} foreach triple [mc LOCALE_ERAS] { foreach {t symbol year} $triple break - dict set d $symbol $year + dict set d [string tolower $symbol] $year } foreach { regex lookup } [UniquePrefixRegexp $d] break append re (?: $regex ) } E { set l {} - dict set l [mc BCE] BCE - dict set l [mc CE] CE - dict set l B.C.E. BCE - dict set l C.E. CE - dict set l B.C. BCE - dict set l A.D. CE + dict set l [string tolower [mc BCE]] BCE + dict set l [string tolower [mc CE]] CE + dict set l b.c.e. BCE + dict set l c.e. CE + dict set l b.c. BCE + dict set l a.d. CE foreach {regex lookup} [UniquePrefixRegexp $l] break append re ( $regex ) dict set fieldSet era [incr fieldCount] append postcode "dict set date era \["\ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ + "dict get " [list $lookup] \ + { } \[ {string tolower $field} \ + [incr captureCount] \] \ "\]\n" } y { # Locale-dependent year of the era |