Mercurial > hg > octave-lojdl > gnulib-hg
changeset 5449:3b55c2b65e86
(tORDINAL): New token.
(day, relunit): Allow it for relative times.
(relative_time_table): Use tORDINAL for ordinals.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 16 Nov 2004 08:25:37 +0000 |
parents | b0c7c000dad9 |
children | cdbf151dab54 |
files | lib/getdate.y |
diffstat | 1 files changed, 35 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/getdate.y +++ b/lib/getdate.y @@ -201,7 +201,8 @@ %token tAGO tDST %token <intval> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tLOCAL_ZONE tMERIDIAN -%token <intval> tMINUTE_UNIT tMONTH tMONTH_UNIT tSEC_UNIT tYEAR_UNIT tZONE +%token <intval> tMINUTE_UNIT tMONTH tMONTH_UNIT tORDINAL +%token <intval> tSEC_UNIT tYEAR_UNIT tZONE %token <textintval> tSNUMBER tUNUMBER %token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER @@ -317,6 +318,11 @@ pc->day_ordinal = 1; pc->day_number = $1; } + | tORDINAL tDAY + { + pc->day_ordinal = $1; + pc->day_number = $2; + } | tUNUMBER tDAY { pc->day_ordinal = $1.value; @@ -412,36 +418,48 @@ ; relunit: - tUNUMBER tYEAR_UNIT + tORDINAL tYEAR_UNIT + { 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 @@ -579,21 +597,21 @@ { "YESTERDAY",tDAY_UNIT, -1 }, { "TODAY", tDAY_UNIT, 0 }, { "NOW", tDAY_UNIT, 0 }, - { "LAST", tUNUMBER, -1 }, - { "THIS", tUNUMBER, 0 }, - { "NEXT", tUNUMBER, 1 }, - { "FIRST", tUNUMBER, 1 }, -/*{ "SECOND", tUNUMBER, 2 }, */ - { "THIRD", tUNUMBER, 3 }, - { "FOURTH", tUNUMBER, 4 }, - { "FIFTH", tUNUMBER, 5 }, - { "SIXTH", tUNUMBER, 6 }, - { "SEVENTH", tUNUMBER, 7 }, - { "EIGHTH", tUNUMBER, 8 }, - { "NINTH", tUNUMBER, 9 }, - { "TENTH", tUNUMBER, 10 }, - { "ELEVENTH", tUNUMBER, 11 }, - { "TWELFTH", tUNUMBER, 12 }, + { "LAST", tORDINAL, -1 }, + { "THIS", tORDINAL, 0 }, + { "NEXT", tORDINAL, 1 }, + { "FIRST", tORDINAL, 1 }, +/*{ "SECOND", tORDINAL, 2 }, */ + { "THIRD", tORDINAL, 3 }, + { "FOURTH", tORDINAL, 4 }, + { "FIFTH", tORDINAL, 5 }, + { "SIXTH", tORDINAL, 6 }, + { "SEVENTH", tORDINAL, 7 }, + { "EIGHTH", tORDINAL, 8 }, + { "NINTH", tORDINAL, 9 }, + { "TENTH", tORDINAL, 10 }, + { "ELEVENTH", tORDINAL, 11 }, + { "TWELFTH", tORDINAL, 12 }, { "AGO", tAGO, 1 }, { NULL, 0, 0 } };