bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] problem with getdate


From: Paul Eggert
Subject: Re: [bug-gnulib] problem with getdate
Date: Wed, 13 Apr 2005 12:01:36 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

"Dmitry V. Levin" <address@hidden> writes:

> This change breaks five tests from coreutils test suite (tests/date):
> utc-0a, utc-1a, date2sec-0a, relative-1, relative-2.

Thanks for catching that.  That glitch had been there all the time,
but the previous change made it occur even with the UTC time stamps in
the test cases.  I installed this further patch.

2005-04-13  Paul Eggert  <address@hidden>

        * getdate.y (zone): Allow relunit_snumber after tZONE, so
        that "UTC +1 second" continues to work.  Problem reported
        by Dmitry V. Levin.
        (relunit_snumber): New rule.
        (relunit): Use it.

--- getdate.y.~1.98.~   2005-04-12 00:22:14 -0700
+++ getdate.y   2005-04-13 11:42:44 -0700
@@ -202,8 +202,8 @@ static long int time_zone_hhmm (textint,
 %parse-param { parser_control *pc }
 %lex-param { parser_control *pc }
 
-/* This grammar has 14 shift/reduce conflicts. */
-%expect 14
+/* This grammar has 20 shift/reduce conflicts. */
+%expect 20
 
 %union
 {
@@ -321,6 +321,8 @@ local_zone:
 zone:
     tZONE
       { pc->time_zone = $1; }
+  | tZONE relunit_snumber
+      { pc->time_zone = $1; pc->rels_seen = true; }
   | tZONE tSNUMBER o_colon_minutes
       { pc->time_zone = $1 + time_zone_hhmm ($2, $3); }
   | tDAYZONE
@@ -444,54 +446,58 @@ relunit:
       { pc->rel_year += $1 * $2; }
   | tUNUMBER tYEAR_UNIT
       { pc->rel_year += $1.value * $2; }
-  | tSNUMBER tYEAR_UNIT
-      { pc->rel_year += $1.value * $2; }
   | tYEAR_UNIT
       { pc->rel_year += $1; }
   | tORDINAL tMONTH_UNIT
       { pc->rel_month += $1 * $2; }
   | tUNUMBER tMONTH_UNIT
       { pc->rel_month += $1.value * $2; }
-  | tSNUMBER tMONTH_UNIT
-      { pc->rel_month += $1.value * $2; }
   | tMONTH_UNIT
       { pc->rel_month += $1; }
   | tORDINAL tDAY_UNIT
       { pc->rel_day += $1 * $2; }
   | tUNUMBER tDAY_UNIT
       { pc->rel_day += $1.value * $2; }
-  | tSNUMBER tDAY_UNIT
-      { pc->rel_day += $1.value * $2; }
   | tDAY_UNIT
       { pc->rel_day += $1; }
   | tORDINAL tHOUR_UNIT
       { pc->rel_hour += $1 * $2; }
   | tUNUMBER tHOUR_UNIT
       { pc->rel_hour += $1.value * $2; }
-  | tSNUMBER tHOUR_UNIT
-      { pc->rel_hour += $1.value * $2; }
   | tHOUR_UNIT
       { pc->rel_hour += $1; }
   | tORDINAL tMINUTE_UNIT
       { pc->rel_minutes += $1 * $2; }
   | tUNUMBER tMINUTE_UNIT
       { pc->rel_minutes += $1.value * $2; }
-  | tSNUMBER tMINUTE_UNIT
-      { pc->rel_minutes += $1.value * $2; }
   | tMINUTE_UNIT
       { pc->rel_minutes += $1; }
   | tORDINAL tSEC_UNIT
       { pc->rel_seconds += $1 * $2; }
   | tUNUMBER tSEC_UNIT
       { pc->rel_seconds += $1.value * $2; }
-  | tSNUMBER tSEC_UNIT
-      { pc->rel_seconds += $1.value * $2; }
   | tSDECIMAL_NUMBER tSEC_UNIT
       { pc->rel_seconds += $1.tv_sec * $2; pc->rel_ns += $1.tv_nsec * $2; }
   | tUDECIMAL_NUMBER tSEC_UNIT
       { pc->rel_seconds += $1.tv_sec * $2; pc->rel_ns += $1.tv_nsec * $2; }
   | tSEC_UNIT
       { pc->rel_seconds += $1; }
+  | relunit_snumber
+  ;
+
+relunit_snumber:
+    tSNUMBER tYEAR_UNIT
+      { pc->rel_year += $1.value * $2; }
+  | tSNUMBER tMONTH_UNIT
+      { pc->rel_month += $1.value * $2; }
+  | tSNUMBER tDAY_UNIT
+      { pc->rel_day += $1.value * $2; }
+  | tSNUMBER tHOUR_UNIT
+      { pc->rel_hour += $1.value * $2; }
+  | tSNUMBER tMINUTE_UNIT
+      { pc->rel_minutes += $1.value * $2; }
+  | tSNUMBER tSEC_UNIT
+      { pc->rel_seconds += $1.value * $2; }
   ;
 
 seconds: signed_seconds | unsigned_seconds;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]