diff --git a/ChangeLog b/ChangeLog index 73e62c2780..488bb11cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Nov 23 07:57:31 2010 Tadayoshi Funaba + + * lib/date/delta/parser.{ry,rb}: fixed a bug of token scanner. + Tue Nov 23 07:29:24 2010 Tadayoshi Funaba * complex.c, rational.c ({nucomp,nurat}_expt): added a check. diff --git a/lib/date/delta/parser.rb b/lib/date/delta/parser.rb index 7efe29f4c2..459d77a572 100644 --- a/lib/date/delta/parser.rb +++ b/lib/date/delta/parser.rb @@ -13,7 +13,7 @@ class Date class Parser < Racc::Parser -module_eval <<'..end parser.ry modeval..id43bff5dec9', 'parser.ry', 42 +module_eval <<'..end parser.ry modeval..idf2987de166', 'parser.ry', 42 def lookup(str) t = str.downcase @@ -28,7 +28,8 @@ module_eval <<'..end parser.ry modeval..id43bff5dec9', 'parser.ry', 42 until str.empty? case str when /\A\s+/ - when /\AP(\d+y)?(\d+m)?(\d+d)?t?(\d+h)?(\d+m)?(\d+s)?(\d+w)?/i + when /\Ap\d+[ymdhsw]/i + /\Ap(\d+y)?(\d+m)?(\d+d)?t?(\d+h)?(\d+m)?(\d+s)?(\d+w)?/i =~ str y, m, d, h, min, s, w = [$1, $2, $3, $4, $5, $6, $7].collect{|x| x.to_i} y *= UNITS4KEY['years'] @@ -56,7 +57,7 @@ module_eval <<'..end parser.ry modeval..id43bff5dec9', 'parser.ry', 42 @q.shift end -..end parser.ry modeval..id43bff5dec9 +..end parser.ry modeval..idf2987de166 ##### racc 1.4.5 generates ### diff --git a/lib/date/delta/parser.ry b/lib/date/delta/parser.ry index 84d4c22c3c..4de8aa1e46 100644 --- a/lib/date/delta/parser.ry +++ b/lib/date/delta/parser.ry @@ -1,4 +1,4 @@ -# parser.ry: Written by Tadayoshi Funaba 2006,2008,2009 -*- ruby -*- +# parser.ry: Written by Tadayoshi Funaba 2006,2008-2010 -*- ruby -*- class Date::Delta::Parser @@ -53,7 +53,8 @@ class Date::Delta::Parser until str.empty? case str when /\A\s+/ - when /\AP(\d+y)?(\d+m)?(\d+d)?t?(\d+h)?(\d+m)?(\d+s)?(\d+w)?/i + when /\Ap\d+[ymdhsw]/i + /\Ap(\d+y)?(\d+m)?(\d+d)?t?(\d+h)?(\d+m)?(\d+s)?(\d+w)?/i =~ str y, m, d, h, min, s, w = [$1, $2, $3, $4, $5, $6, $7].collect{|x| x.to_i} y *= UNITS4KEY['years']