diff options
author | ericm <ericm> | 2000-01-12 23:35:52 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-01-12 23:35:52 (GMT) |
commit | d5177d8145a932d9140ebaee920a18ec2c5bb020 (patch) | |
tree | b9130323ee0536df2dfdab8df7769e34e44c27a0 /generic/tclGetDate.y | |
parent | 85c2e86dee67763530bff5f6e74d349cf03cd50c (diff) | |
download | tcl-d5177d8145a932d9140ebaee920a18ec2c5bb020.zip tcl-d5177d8145a932d9140ebaee920a18ec2c5bb020.tar.gz tcl-d5177d8145a932d9140ebaee920a18ec2c5bb020.tar.bz2 |
* tests/clock.test: Added tests for "next <day-of-week>" and
"<day-of-week>"
Diffstat (limited to 'generic/tclGetDate.y')
-rw-r--r-- | generic/tclGetDate.y | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 510f164..ea66fd7 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclGetDate.y,v 1.11 2000/01/12 19:36:42 ericm Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.12 2000/01/12 23:35:52 ericm Exp $ */ %{ @@ -138,11 +138,11 @@ yyparse _ANSI_ARGS_((void)); } %token tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT -%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tEPOCH tDST tISOBASE tDAY_UNIT +%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tEPOCH tDST tISOBASE tDAY_UNIT tNEXT %type <Number> tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT tDST %type <Number> tSEC_UNIT tSNUMBER tUNUMBER tZONE tISOBASE tDAY_UNIT -%type <Number> unit ago sign +%type <Number> unit ago sign tNEXT %type <Meridian> tMERIDIAN o_merid %% @@ -234,6 +234,14 @@ day : tDAY { yyDayOrdinal = $1; yyDayNumber = $2; } + | sign tUNUMBER tDAY { + yyDayOrdinal = $1 * $2; + yyDayNumber = $3; + } + | tNEXT tDAY { + yyDayOrdinal = 2; + yyDayNumber = $2; + } ; date : tUNUMBER '/' tUNUMBER { @@ -315,6 +323,8 @@ iso : tISOBASE tZONE tISOBASE { relspec : sign tUNUMBER unit ago { *yyRelPointer += $1 * $2 * $3 * $4; } | tUNUMBER unit ago { *yyRelPointer += $1 * $2 * $3; } + | tNEXT unit { *yyRelPointer += $2; } + | tNEXT tUNUMBER unit { *yyRelPointer += $2 * $3; } | unit ago { *yyRelPointer += $1 * $2; } ; sign : '-' { $$ = -1; } @@ -415,7 +425,7 @@ static TABLE OtherTable[] = { { "now", tSEC_UNIT, 0 }, { "last", tUNUMBER, -1 }, { "this", tSEC_UNIT, 0 }, - { "next", tUNUMBER, 1 }, + { "next", tNEXT, 1 }, #if 0 { "first", tUNUMBER, 1 }, { "second", tUNUMBER, 2 }, |