diff options
author | ericm <ericm@noemail.net> | 2000-01-12 23:35:52 (GMT) |
---|---|---|
committer | ericm <ericm@noemail.net> | 2000-01-12 23:35:52 (GMT) |
commit | 7ee5bb96a916cee6fea13ab7188d4d5be5d6dc36 (patch) | |
tree | b9130323ee0536df2dfdab8df7769e34e44c27a0 /generic/tclGetDate.y | |
parent | e78228fbb468ab080d16d8fa28e5f2ca8f590b6d (diff) | |
download | tcl-7ee5bb96a916cee6fea13ab7188d4d5be5d6dc36.zip tcl-7ee5bb96a916cee6fea13ab7188d4d5be5d6dc36.tar.gz tcl-7ee5bb96a916cee6fea13ab7188d4d5be5d6dc36.tar.bz2 |
* tests/clock.test: Added tests for "next <day-of-week>" and
"<day-of-week>"
FossilOrigin-Name: 927e25a961366cf30f4722dabf6417dc391213c9
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 }, |