[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] date: accept 'hence' as opposite of 'ago'
From: |
Jim Meyering |
Subject: |
Re: [PATCH] date: accept 'hence' as opposite of 'ago' |
Date: |
Sun, 18 Sep 2011 19:19:52 +0200 |
Eric Blake wrote:
> + date: accept 'hence' as opposite of 'ago'
> + * lib/parse-datetime.y (relative_time_table): Add 'hence'.
> + * tests/test-parse-datetime.c (main): Enhance test.
> + Suggested by Jesse Wilson.
...
> diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
> index 33ef01a..d99c955 100644
> --- a/lib/parse-datetime.y
> +++ b/lib/parse-datetime.y
> @@ -296,7 +296,8 @@ set_hhmmss (parser_control *pc, long int hour, long int
> minutes,
> relative_time rel;
> }
>
> -%token tAGO tDST
> +%token <intval> tAGO
> +%token tDST
>
> %token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
> %token <intval> tDAY_UNIT tDAY_SHIFT
> @@ -544,7 +545,7 @@ iso_8601_date:
>
> rel:
> relunit tAGO
> - { apply_relative_time (pc, $1, -1); }
> + { apply_relative_time (pc, $1, $2); }
> | relunit
> { apply_relative_time (pc, $1, 1); }
> | dayshift
> @@ -733,7 +734,8 @@ static table const relative_time_table[] =
> { "TENTH", tORDINAL, 10 },
> { "ELEVENTH", tORDINAL, 11 },
> { "TWELFTH", tORDINAL, 12 },
> - { "AGO", tAGO, 1 },
> + { "AGO", tAGO, -1 },
> + { "HENCE", tAGO, 1 },
I like the addition, too, and your patch looks fine.
Thanks to both of you.