tclDate.c

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.3.  */
00002 
00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
00004 
00005    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00006    Free Software Foundation, Inc.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 /* As a special exception, you may create a larger work that contains
00024    part or all of the Bison parser skeleton and distribute that work
00025    under terms of your choice, so long as that work isn't itself a
00026    parser generator using the skeleton or a modified version thereof
00027    as a parser skeleton.  Alternatively, if you modify or redistribute
00028    the parser skeleton itself, you may (at your option) remove this
00029    special exception, which will cause the skeleton and the resulting
00030    Bison output files to be licensed under the GNU General Public
00031    License without this special exception.
00032 
00033    This special exception was added by the Free Software Foundation in
00034    version 2.2 of Bison.  */
00035 
00036 /* C LALR(1) parser skeleton written by Richard Stallman, by
00037    simplifying the original so-called "semantic" parser.  */
00038 
00039 /* All symbols defined below should begin with yy or YY, to avoid
00040    infringing on user name space.  This should be done even for local
00041    variables, as they might otherwise be expanded by user macros.
00042    There are some unavoidable exceptions within include files to
00043    define necessary library symbols; they are noted "INFRINGES ON
00044    USER NAME SPACE" below.  */
00045 
00046 /* Identify Bison output.  */
00047 #define YYBISON 1
00048 
00049 /* Bison version.  */
00050 #define YYBISON_VERSION "2.3"
00051 
00052 /* Skeleton name.  */
00053 #define YYSKELETON_NAME "yacc.c"
00054 
00055 /* Pure parsers.  */
00056 #define YYPURE 0
00057 
00058 /* Using locations.  */
00059 #define YYLSP_NEEDED 0
00060 
00061 /* Substitute the variable and function names.  */
00062 #define yyparse TclDateparse
00063 #define yylex   TclDatelex
00064 #define yyerror TclDateerror
00065 #define yylval  TclDatelval
00066 #define yychar  TclDatechar
00067 #define yydebug TclDatedebug
00068 #define yynerrs TclDatenerrs
00069 
00070 
00071 /* Tokens.  */
00072 #ifndef YYTOKENTYPE
00073 # define YYTOKENTYPE
00074    /* Put the tokens into the symbol table, so that GDB and other debuggers
00075       know about them.  */
00076    enum yytokentype {
00077      tAGO = 258,
00078      tDAY = 259,
00079      tDAYZONE = 260,
00080      tID = 261,
00081      tMERIDIAN = 262,
00082      tMINUTE_UNIT = 263,
00083      tMONTH = 264,
00084      tMONTH_UNIT = 265,
00085      tSTARDATE = 266,
00086      tSEC_UNIT = 267,
00087      tSNUMBER = 268,
00088      tUNUMBER = 269,
00089      tZONE = 270,
00090      tEPOCH = 271,
00091      tDST = 272,
00092      tISOBASE = 273,
00093      tDAY_UNIT = 274,
00094      tNEXT = 275
00095    };
00096 #endif
00097 /* Tokens.  */
00098 #define tAGO 258
00099 #define tDAY 259
00100 #define tDAYZONE 260
00101 #define tID 261
00102 #define tMERIDIAN 262
00103 #define tMINUTE_UNIT 263
00104 #define tMONTH 264
00105 #define tMONTH_UNIT 265
00106 #define tSTARDATE 266
00107 #define tSEC_UNIT 267
00108 #define tSNUMBER 268
00109 #define tUNUMBER 269
00110 #define tZONE 270
00111 #define tEPOCH 271
00112 #define tDST 272
00113 #define tISOBASE 273
00114 #define tDAY_UNIT 274
00115 #define tNEXT 275
00116 
00117 
00118 
00119 
00120 /* Copy the first part of user declarations.  */
00121 
00122 
00123 /*
00124  * tclDate.c --
00125  *
00126  *      This file is generated from a yacc grammar defined in the file
00127  *      tclGetDate.y. It should not be edited directly.
00128  *
00129  * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
00130  * Copyright (c) 1995-1997 Sun Microsystems, Inc.
00131  *
00132  * See the file "license.terms" for information on usage and redistribution of
00133  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
00134  *
00135  */
00136 
00137 #include "tclInt.h"
00138 
00139 /*
00140  * Bison generates several labels that happen to be unused. MS Visual C++
00141  * doesn't like that, and complains. Tell it to shut up.
00142  */
00143 
00144 #ifdef _MSC_VER
00145 #pragma warning( disable : 4102 )
00146 #endif /* _MSC_VER */
00147 
00148 /*
00149  * yyparse will accept a 'struct DateInfo' as its parameter; that's where the
00150  * parsed fields will be returned.
00151  */
00152 
00153 typedef struct DateInfo {
00154     time_t dateYear;
00155     time_t dateMonth;
00156     time_t dateDay;
00157     int dateHaveDate;
00158 
00159     time_t dateHour;
00160     time_t dateMinutes;
00161     time_t dateSeconds;
00162     int dateMeridian;
00163     int dateHaveTime;
00164 
00165     time_t dateTimezone;
00166     int dateDSTmode;
00167     int dateHaveZone;
00168 
00169     time_t dateRelMonth;
00170     time_t dateRelDay;
00171     time_t dateRelSeconds;
00172     int dateHaveRel;
00173 
00174     time_t dateMonthOrdinal;
00175     int dateHaveOrdinalMonth;
00176 
00177     time_t dateDayOrdinal;
00178     time_t dateDayNumber;
00179     int dateHaveDay;
00180 
00181     char *dateInput;
00182     time_t *dateRelPointer;
00183 
00184     int dateDigitCount;
00185 } DateInfo;
00186 
00187 #define YYPARSE_PARAM   info
00188 #define YYLEX_PARAM     info
00189 
00190 #define YYMALLOC        ckalloc
00191 #define YYFREE(x)       (ckfree((void*) (x)))
00192 
00193 #define yyDSTmode       (((DateInfo *) info)->dateDSTmode)
00194 #define yyDayOrdinal    (((DateInfo *) info)->dateDayOrdinal)
00195 #define yyDayNumber     (((DateInfo *) info)->dateDayNumber)
00196 #define yyMonthOrdinal  (((DateInfo *) info)->dateMonthOrdinal)
00197 #define yyHaveDate      (((DateInfo *) info)->dateHaveDate)
00198 #define yyHaveDay       (((DateInfo *) info)->dateHaveDay)
00199 #define yyHaveOrdinalMonth (((DateInfo *) info)->dateHaveOrdinalMonth)
00200 #define yyHaveRel       (((DateInfo *) info)->dateHaveRel)
00201 #define yyHaveTime      (((DateInfo *) info)->dateHaveTime)
00202 #define yyHaveZone      (((DateInfo *) info)->dateHaveZone)
00203 #define yyTimezone      (((DateInfo *) info)->dateTimezone)
00204 #define yyDay           (((DateInfo *) info)->dateDay)
00205 #define yyMonth         (((DateInfo *) info)->dateMonth)
00206 #define yyYear          (((DateInfo *) info)->dateYear)
00207 #define yyHour          (((DateInfo *) info)->dateHour)
00208 #define yyMinutes       (((DateInfo *) info)->dateMinutes)
00209 #define yySeconds       (((DateInfo *) info)->dateSeconds)
00210 #define yyMeridian      (((DateInfo *) info)->dateMeridian)
00211 #define yyRelMonth      (((DateInfo *) info)->dateRelMonth)
00212 #define yyRelDay        (((DateInfo *) info)->dateRelDay)
00213 #define yyRelSeconds    (((DateInfo *) info)->dateRelSeconds)
00214 #define yyRelPointer    (((DateInfo *) info)->dateRelPointer)
00215 #define yyInput         (((DateInfo *) info)->dateInput)
00216 #define yyDigitCount    (((DateInfo *) info)->dateDigitCount)
00217 
00218 #define EPOCH           1970
00219 #define START_OF_TIME   1902
00220 #define END_OF_TIME     2037
00221 
00222 /*
00223  * The offset of tm_year of struct tm returned by localtime, gmtime, etc.
00224  * Posix requires 1900.
00225  */
00226 
00227 #define TM_YEAR_BASE    1900
00228 
00229 #define HOUR(x)         ((int) (60 * x))
00230 #define SECSPERDAY      (24L * 60L * 60L)
00231 #define IsLeapYear(x)   ((x % 4 == 0) && (x % 100 != 0 || x % 400 == 0))
00232 
00233 /*
00234  * An entry in the lexical lookup table.
00235  */
00236 
00237 typedef struct _TABLE {
00238     char *name;
00239     int type;
00240     time_t value;
00241 } TABLE;
00242 
00243 /*
00244  * Daylight-savings mode: on, off, or not yet known.
00245  */
00246 
00247 typedef enum _DSTMODE {
00248     DSTon, DSToff, DSTmaybe
00249 } DSTMODE;
00250 
00251 /*
00252  * Meridian: am, pm, or 24-hour style.
00253  */
00254 
00255 typedef enum _MERIDIAN {
00256     MERam, MERpm, MER24
00257 } MERIDIAN;
00258 
00259 /*
00260  * Prototypes of internal functions.
00261  */
00262 
00263 static int              LookupWord(char *buff);
00264 static void             TclDateerror(char *s);
00265 static int              TclDatelex(void *info);
00266 static time_t           ToSeconds(time_t Hours, time_t Minutes,
00267                             time_t Seconds, MERIDIAN Meridian);
00268 MODULE_SCOPE int        yyparse(void *);
00269 
00270 
00271 
00272 /* Enabling traces.  */
00273 #ifndef YYDEBUG
00274 # define YYDEBUG 0
00275 #endif
00276 
00277 /* Enabling verbose error messages.  */
00278 #ifdef YYERROR_VERBOSE
00279 # undef YYERROR_VERBOSE
00280 # define YYERROR_VERBOSE 1
00281 #else
00282 # define YYERROR_VERBOSE 0
00283 #endif
00284 
00285 /* Enabling the token table.  */
00286 #ifndef YYTOKEN_TABLE
00287 # define YYTOKEN_TABLE 0
00288 #endif
00289 
00290 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00291 typedef union YYSTYPE
00292 
00293 {
00294     time_t Number;
00295     enum _MERIDIAN Meridian;
00296 }
00297 /* Line 187 of yacc.c.  */
00298 
00299         YYSTYPE;
00300 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00301 # define YYSTYPE_IS_DECLARED 1
00302 # define YYSTYPE_IS_TRIVIAL 1
00303 #endif
00304 
00305 
00306 
00307 /* Copy the second part of user declarations.  */
00308 
00309 
00310 /* Line 216 of yacc.c.  */
00311 
00312 
00313 #ifdef short
00314 # undef short
00315 #endif
00316 
00317 #ifdef YYTYPE_UINT8
00318 typedef YYTYPE_UINT8 yytype_uint8;
00319 #else
00320 typedef unsigned char yytype_uint8;
00321 #endif
00322 
00323 #ifdef YYTYPE_INT8
00324 typedef YYTYPE_INT8 yytype_int8;
00325 #elif (defined __STDC__ || defined __C99__FUNC__ \
00326      || defined __cplusplus || defined _MSC_VER)
00327 typedef signed char yytype_int8;
00328 #else
00329 typedef short int yytype_int8;
00330 #endif
00331 
00332 #ifdef YYTYPE_UINT16
00333 typedef YYTYPE_UINT16 yytype_uint16;
00334 #else
00335 typedef unsigned short int yytype_uint16;
00336 #endif
00337 
00338 #ifdef YYTYPE_INT16
00339 typedef YYTYPE_INT16 yytype_int16;
00340 #else
00341 typedef short int yytype_int16;
00342 #endif
00343 
00344 #ifndef YYSIZE_T
00345 # ifdef __SIZE_TYPE__
00346 #  define YYSIZE_T __SIZE_TYPE__
00347 # elif defined size_t
00348 #  define YYSIZE_T size_t
00349 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00350      || defined __cplusplus || defined _MSC_VER)
00351 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00352 #  define YYSIZE_T size_t
00353 # else
00354 #  define YYSIZE_T unsigned int
00355 # endif
00356 #endif
00357 
00358 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00359 
00360 #ifndef YY_
00361 # if YYENABLE_NLS
00362 #  if ENABLE_NLS
00363 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00364 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00365 #  endif
00366 # endif
00367 # ifndef YY_
00368 #  define YY_(msgid) msgid
00369 # endif
00370 #endif
00371 
00372 /* Suppress unused-variable warnings by "using" E.  */
00373 #if ! defined lint || defined __GNUC__
00374 # define YYUSE(e) ((void) (e))
00375 #else
00376 # define YYUSE(e) /* empty */
00377 #endif
00378 
00379 /* Identity function, used to suppress warnings about constant conditions.  */
00380 #ifndef lint
00381 # define YYID(n) (n)
00382 #else
00383 #if (defined __STDC__ || defined __C99__FUNC__ \
00384      || defined __cplusplus || defined _MSC_VER)
00385 static int
00386 YYID (int i)
00387 #else
00388 static int
00389 YYID (i)
00390     int i;
00391 #endif
00392 {
00393   return i;
00394 }
00395 #endif
00396 
00397 #if ! defined yyoverflow || YYERROR_VERBOSE
00398 
00399 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00400 
00401 # ifdef YYSTACK_USE_ALLOCA
00402 #  if YYSTACK_USE_ALLOCA
00403 #   ifdef __GNUC__
00404 #    define YYSTACK_ALLOC __builtin_alloca
00405 #   elif defined __BUILTIN_VA_ARG_INCR
00406 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00407 #   elif defined _AIX
00408 #    define YYSTACK_ALLOC __alloca
00409 #   elif defined _MSC_VER
00410 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00411 #    define alloca _alloca
00412 #   else
00413 #    define YYSTACK_ALLOC alloca
00414 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00415      || defined __cplusplus || defined _MSC_VER)
00416 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00417 #     ifndef _STDLIB_H
00418 #      define _STDLIB_H 1
00419 #     endif
00420 #    endif
00421 #   endif
00422 #  endif
00423 # endif
00424 
00425 # ifdef YYSTACK_ALLOC
00426    /* Pacify GCC's `empty if-body' warning.  */
00427 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00428 #  ifndef YYSTACK_ALLOC_MAXIMUM
00429     /* The OS might guarantee only one guard page at the bottom of the stack,
00430        and a page size can be as small as 4096 bytes.  So we cannot safely
00431        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00432        to allow for a few compiler-allocated temporary stack slots.  */
00433 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00434 #  endif
00435 # else
00436 #  define YYSTACK_ALLOC YYMALLOC
00437 #  define YYSTACK_FREE YYFREE
00438 #  ifndef YYSTACK_ALLOC_MAXIMUM
00439 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00440 #  endif
00441 #  if (defined __cplusplus && ! defined _STDLIB_H \
00442        && ! ((defined YYMALLOC || defined malloc) \
00443              && (defined YYFREE || defined free)))
00444 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00445 #   ifndef _STDLIB_H
00446 #    define _STDLIB_H 1
00447 #   endif
00448 #  endif
00449 #  ifndef YYMALLOC
00450 #   define YYMALLOC malloc
00451 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00452      || defined __cplusplus || defined _MSC_VER)
00453 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00454 #   endif
00455 #  endif
00456 #  ifndef YYFREE
00457 #   define YYFREE free
00458 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00459      || defined __cplusplus || defined _MSC_VER)
00460 void free (void *); /* INFRINGES ON USER NAME SPACE */
00461 #   endif
00462 #  endif
00463 # endif
00464 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
00465 
00466 
00467 #if (! defined yyoverflow \
00468      && (! defined __cplusplus \
00469          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00470 
00471 /* A type that is properly aligned for any stack member.  */
00472 union yyalloc
00473 {
00474   yytype_int16 yyss;
00475   YYSTYPE yyvs;
00476   };
00477 
00478 /* The size of the maximum gap between one aligned stack and the next.  */
00479 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00480 
00481 /* The size of an array large to enough to hold all stacks, each with
00482    N elements.  */
00483 # define YYSTACK_BYTES(N) \
00484      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00485       + YYSTACK_GAP_MAXIMUM)
00486 
00487 /* Copy COUNT objects from FROM to TO.  The source and destination do
00488    not overlap.  */
00489 # ifndef YYCOPY
00490 #  if defined __GNUC__ && 1 < __GNUC__
00491 #   define YYCOPY(To, From, Count) \
00492       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00493 #  else
00494 #   define YYCOPY(To, From, Count)              \
00495       do                                        \
00496         {                                       \
00497           YYSIZE_T yyi;                         \
00498           for (yyi = 0; yyi < (Count); yyi++)   \
00499             (To)[yyi] = (From)[yyi];            \
00500         }                                       \
00501       while (YYID (0))
00502 #  endif
00503 # endif
00504 
00505 /* Relocate STACK from its old location to the new one.  The
00506    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00507    elements in the stack, and YYPTR gives the new location of the
00508    stack.  Advance YYPTR to a properly aligned location for the next
00509    stack.  */
00510 # define YYSTACK_RELOCATE(Stack)                                        \
00511     do                                                                  \
00512       {                                                                 \
00513         YYSIZE_T yynewbytes;                                            \
00514         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
00515         Stack = &yyptr->Stack;                                          \
00516         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00517         yyptr += yynewbytes / sizeof (*yyptr);                          \
00518       }                                                                 \
00519     while (YYID (0))
00520 
00521 #endif
00522 
00523 /* YYFINAL -- State number of the termination state.  */
00524 #define YYFINAL  2
00525 /* YYLAST -- Last index in YYTABLE.  */
00526 #define YYLAST   79
00527 
00528 /* YYNTOKENS -- Number of terminals.  */
00529 #define YYNTOKENS  27
00530 /* YYNNTS -- Number of nonterminals.  */
00531 #define YYNNTS  16
00532 /* YYNRULES -- Number of rules.  */
00533 #define YYNRULES  56
00534 /* YYNRULES -- Number of states.  */
00535 #define YYNSTATES  83
00536 
00537 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00538 #define YYUNDEFTOK  2
00539 #define YYMAXUTOK   275
00540 
00541 #define YYTRANSLATE(YYX)                                                \
00542   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00543 
00544 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00545 static const yytype_uint8 yytranslate[] =
00546 {
00547        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00548        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00549        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00550        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00551        2,     2,     2,    26,    23,    22,    25,    24,     2,     2,
00552        2,     2,     2,     2,     2,     2,     2,     2,    21,     2,
00553        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00554        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00555        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00556        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00557        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00558        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00559        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00560        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00561        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00562        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00563        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00564        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00565        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00566        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00567        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00568        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00569        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00570        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00571        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00572        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00573        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00574       15,    16,    17,    18,    19,    20
00575 };
00576 
00577 #if YYDEBUG
00578 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00579    YYRHS.  */
00580 static const yytype_uint8 yyprhs[] =
00581 {
00582        0,     0,     3,     4,     7,     9,    11,    13,    15,    17,
00583       19,    21,    23,    25,    28,    33,    39,    46,    54,    57,
00584       59,    61,    63,    66,    69,    73,    76,    80,    86,    88,
00585       94,   100,   103,   108,   111,   113,   117,   120,   124,   128,
00586      136,   139,   144,   147,   149,   153,   156,   159,   163,   165,
00587      167,   169,   171,   173,   175,   177,   178
00588 };
00589 
00590 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00591 static const yytype_int8 yyrhs[] =
00592 {
00593       28,     0,    -1,    -1,    28,    29,    -1,    30,    -1,    31,
00594       -1,    33,    -1,    34,    -1,    32,    -1,    37,    -1,    35,
00595       -1,    36,    -1,    41,    -1,    14,     7,    -1,    14,    21,
00596       14,    42,    -1,    14,    21,    14,    22,    14,    -1,    14,
00597       21,    14,    21,    14,    42,    -1,    14,    21,    14,    21,
00598       14,    22,    14,    -1,    15,    17,    -1,    15,    -1,     5,
00599       -1,     4,    -1,     4,    23,    -1,    14,     4,    -1,    39,
00600       14,     4,    -1,    20,     4,    -1,    14,    24,    14,    -1,
00601       14,    24,    14,    24,    14,    -1,    18,    -1,    14,    22,
00602        9,    22,    14,    -1,    14,    22,    14,    22,    14,    -1,
00603        9,    14,    -1,     9,    14,    23,    14,    -1,    14,     9,
00604       -1,    16,    -1,    14,     9,    14,    -1,    20,     9,    -1,
00605       20,    14,     9,    -1,    18,    15,    18,    -1,    18,    15,
00606       14,    21,    14,    21,    14,    -1,    18,    18,    -1,    11,
00607       14,    25,    14,    -1,    38,     3,    -1,    38,    -1,    39,
00608       14,    40,    -1,    14,    40,    -1,    20,    40,    -1,    20,
00609       14,    40,    -1,    40,    -1,    22,    -1,    26,    -1,    12,
00610       -1,    19,    -1,    10,    -1,    14,    -1,    -1,     7,    -1
00611 };
00612 
00613 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00614 static const yytype_uint16 yyrline[] =
00615 {
00616        0,   185,   185,   186,   189,   192,   195,   198,   201,   204,
00617      207,   211,   216,   219,   225,   231,   239,   245,   256,   260,
00618      264,   270,   274,   278,   282,   286,   292,   296,   301,   306,
00619      311,   316,   320,   325,   329,   334,   341,   345,   351,   360,
00620      369,   379,   393,   398,   401,   404,   407,   410,   413,   418,
00621      421,   426,   430,   434,   440,   458,   461
00622 };
00623 #endif
00624 
00625 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00626 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00627    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00628 static const char *const yytname[] =
00629 {
00630   "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID",
00631   "tMERIDIAN", "tMINUTE_UNIT", "tMONTH", "tMONTH_UNIT", "tSTARDATE",
00632   "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST",
00633   "tISOBASE", "tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'",
00634   "'+'", "$accept", "spec", "item", "time", "zone", "day", "date",
00635   "ordMonth", "iso", "trek", "relspec", "relunits", "sign", "unit",
00636   "number", "o_merid", 0
00637 };
00638 #endif
00639 
00640 # ifdef YYPRINT
00641 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00642    token YYLEX-NUM.  */
00643 static const yytype_uint16 yytoknum[] =
00644 {
00645        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00646      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00647      275,    58,    45,    44,    47,    46,    43
00648 };
00649 # endif
00650 
00651 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00652 static const yytype_uint8 yyr1[] =
00653 {
00654        0,    27,    28,    28,    29,    29,    29,    29,    29,    29,
00655       29,    29,    29,    30,    30,    30,    30,    30,    31,    31,
00656       31,    32,    32,    32,    32,    32,    33,    33,    33,    33,
00657       33,    33,    33,    33,    33,    33,    34,    34,    35,    35,
00658       35,    36,    37,    37,    38,    38,    38,    38,    38,    39,
00659       39,    40,    40,    40,    41,    42,    42
00660 };
00661 
00662 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00663 static const yytype_uint8 yyr2[] =
00664 {
00665        0,     2,     0,     2,     1,     1,     1,     1,     1,     1,
00666        1,     1,     1,     2,     4,     5,     6,     7,     2,     1,
00667        1,     1,     2,     2,     3,     2,     3,     5,     1,     5,
00668        5,     2,     4,     2,     1,     3,     2,     3,     3,     7,
00669        2,     4,     2,     1,     3,     2,     2,     3,     1,     1,
00670        1,     1,     1,     1,     1,     0,     1
00671 };
00672 
00673 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00674    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00675    means the default is an error.  */
00676 static const yytype_uint8 yydefact[] =
00677 {
00678        2,     0,     1,    21,    20,     0,    53,     0,    51,    54,
00679       19,    34,    28,    52,     0,    49,    50,     3,     4,     5,
00680        8,     6,     7,    10,    11,     9,    43,     0,    48,    12,
00681       22,    31,     0,    23,    13,    33,     0,     0,     0,    45,
00682       18,     0,    40,    25,    36,     0,    46,    42,     0,     0,
00683        0,    35,    55,     0,     0,    26,     0,    38,    37,    47,
00684       24,    44,    32,    41,    56,     0,     0,    14,     0,     0,
00685        0,     0,    55,    15,    29,    30,    27,     0,     0,    16,
00686        0,    17,    39
00687 };
00688 
00689 /* YYDEFGOTO[NTERM-NUM].  */
00690 static const yytype_int8 yydefgoto[] =
00691 {
00692       -1,     1,    17,    18,    19,    20,    21,    22,    23,    24,
00693       25,    26,    27,    28,    29,    67
00694 };
00695 
00696 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00697    STATE-NUM.  */
00698 #define YYPACT_NINF -23
00699 static const yytype_int8 yypact[] =
00700 {
00701      -23,     2,   -23,   -22,   -23,    -5,   -23,    -4,   -23,    22,
00702       -2,   -23,    12,   -23,    38,   -23,   -23,   -23,   -23,   -23,
00703      -23,   -23,   -23,   -23,   -23,   -23,    30,    11,   -23,   -23,
00704      -23,    17,    10,   -23,   -23,    35,    40,    -6,    47,   -23,
00705      -23,    45,   -23,   -23,   -23,    46,   -23,   -23,    41,    48,
00706       50,   -23,    16,    44,    49,    43,    51,   -23,   -23,   -23,
00707      -23,   -23,   -23,   -23,   -23,    54,    55,   -23,    56,    59,
00708       60,    61,    -3,   -23,   -23,   -23,   -23,    57,    62,   -23,
00709       63,   -23,   -23
00710 };
00711 
00712 /* YYPGOTO[NTERM-NUM].  */
00713 static const yytype_int8 yypgoto[] =
00714 {
00715      -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,
00716      -23,   -23,   -23,    -9,   -23,     7
00717 };
00718 
00719 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00720    positive, shift that token.  If negative, reduce the rule which
00721    number is the opposite.  If zero, do what YYDEFACT says.
00722    If YYTABLE_NINF, syntax error.  */
00723 #define YYTABLE_NINF -1
00724 static const yytype_uint8 yytable[] =
00725 {
00726       39,    30,     2,    53,    64,    46,     3,     4,    54,    31,
00727       32,     5,     6,     7,     8,    40,     9,    10,    11,    78,
00728       12,    13,    14,    64,    15,    48,    33,    41,    16,    34,
00729       42,    35,     6,    47,     8,    50,    59,    65,    66,    61,
00730       49,    13,    43,    36,    37,    60,    38,    44,     6,    51,
00731        8,     6,    45,     8,    52,    58,     6,    13,     8,    56,
00732       13,    55,    62,    57,    63,    13,    68,    70,    72,    73,
00733       74,    69,    71,    75,    76,    77,    81,    82,    80,    79
00734 };
00735 
00736 static const yytype_uint8 yycheck[] =
00737 {
00738        9,    23,     0,     9,     7,    14,     4,     5,    14,    14,
00739       14,     9,    10,    11,    12,    17,    14,    15,    16,    22,
00740       18,    19,    20,     7,    22,    14,     4,    15,    26,     7,
00741       18,     9,    10,     3,    12,    25,    45,    21,    22,    48,
00742       23,    19,     4,    21,    22,     4,    24,     9,    10,    14,
00743       12,    10,    14,    12,    14,     9,    10,    19,    12,    14,
00744       19,    14,    14,    18,    14,    19,    22,    24,    14,    14,
00745       14,    22,    21,    14,    14,    14,    14,    14,    21,    72
00746 };
00747 
00748 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00749    symbol of state STATE-NUM.  */
00750 static const yytype_uint8 yystos[] =
00751 {
00752        0,    28,     0,     4,     5,     9,    10,    11,    12,    14,
00753       15,    16,    18,    19,    20,    22,    26,    29,    30,    31,
00754       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
00755       23,    14,    14,     4,     7,     9,    21,    22,    24,    40,
00756       17,    15,    18,     4,     9,    14,    40,     3,    14,    23,
00757       25,    14,    14,     9,    14,    14,    14,    18,     9,    40,
00758        4,    40,    14,    14,     7,    21,    22,    42,    22,    22,
00759       24,    21,    14,    14,    14,    14,    14,    14,    22,    42,
00760       21,    14,    14
00761 };
00762 
00763 #define yyerrok         (yyerrstatus = 0)
00764 #define yyclearin       (yychar = YYEMPTY)
00765 #define YYEMPTY         (-2)
00766 #define YYEOF           0
00767 
00768 #define YYACCEPT        goto yyacceptlab
00769 #define YYABORT         goto yyabortlab
00770 #define YYERROR         goto yyerrorlab
00771 
00772 
00773 /* Like YYERROR except do call yyerror.  This remains here temporarily
00774    to ease the transition to the new meaning of YYERROR, for GCC.
00775    Once GCC version 2 has supplanted version 1, this can go.  */
00776 
00777 #define YYFAIL          goto yyerrlab
00778 
00779 #define YYRECOVERING()  (!!yyerrstatus)
00780 
00781 #define YYBACKUP(Token, Value)                                  \
00782 do                                                              \
00783   if (yychar == YYEMPTY && yylen == 1)                          \
00784     {                                                           \
00785       yychar = (Token);                                         \
00786       yylval = (Value);                                         \
00787       yytoken = YYTRANSLATE (yychar);                           \
00788       YYPOPSTACK (1);                                           \
00789       goto yybackup;                                            \
00790     }                                                           \
00791   else                                                          \
00792     {                                                           \
00793       yyerror (YY_("syntax error: cannot back up")); \
00794       YYERROR;                                                  \
00795     }                                                           \
00796 while (YYID (0))
00797 
00798 
00799 #define YYTERROR        1
00800 #define YYERRCODE       256
00801 
00802 
00803 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00804    If N is 0, then set CURRENT to the empty location which ends
00805    the previous symbol: RHS[0] (always defined).  */
00806 
00807 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00808 #ifndef YYLLOC_DEFAULT
00809 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
00810     do                                                                  \
00811       if (YYID (N))                                                    \
00812         {                                                               \
00813           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
00814           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
00815           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
00816           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
00817         }                                                               \
00818       else                                                              \
00819         {                                                               \
00820           (Current).first_line   = (Current).last_line   =              \
00821             YYRHSLOC (Rhs, 0).last_line;                                \
00822           (Current).first_column = (Current).last_column =              \
00823             YYRHSLOC (Rhs, 0).last_column;                              \
00824         }                                                               \
00825     while (YYID (0))
00826 #endif
00827 
00828 
00829 /* YY_LOCATION_PRINT -- Print the location on the stream.
00830    This macro was not mandated originally: define only if we know
00831    we won't break user code: when these are the locations we know.  */
00832 
00833 #ifndef YY_LOCATION_PRINT
00834 # if YYLTYPE_IS_TRIVIAL
00835 #  define YY_LOCATION_PRINT(File, Loc)                  \
00836      fprintf (File, "%d.%d-%d.%d",                      \
00837               (Loc).first_line, (Loc).first_column,     \
00838               (Loc).last_line,  (Loc).last_column)
00839 # else
00840 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00841 # endif
00842 #endif
00843 
00844 
00845 /* YYLEX -- calling `yylex' with the right arguments.  */
00846 
00847 #ifdef YYLEX_PARAM
00848 # define YYLEX yylex (YYLEX_PARAM)
00849 #else
00850 # define YYLEX yylex ()
00851 #endif
00852 
00853 /* Enable debugging if requested.  */
00854 #if YYDEBUG
00855 
00856 # ifndef YYFPRINTF
00857 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00858 #  define YYFPRINTF fprintf
00859 # endif
00860 
00861 # define YYDPRINTF(Args)                        \
00862 do {                                            \
00863   if (yydebug)                                  \
00864     YYFPRINTF Args;                             \
00865 } while (YYID (0))
00866 
00867 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
00868 do {                                                                      \
00869   if (yydebug)                                                            \
00870     {                                                                     \
00871       YYFPRINTF (stderr, "%s ", Title);                                   \
00872       yy_symbol_print (stderr,                                            \
00873                   Type, Value); \
00874       YYFPRINTF (stderr, "\n");                                           \
00875     }                                                                     \
00876 } while (YYID (0))
00877 
00878 
00879 /*--------------------------------.
00880 | Print this symbol on YYOUTPUT.  |
00881 `--------------------------------*/
00882 
00883 /*ARGSUSED*/
00884 #if (defined __STDC__ || defined __C99__FUNC__ \
00885      || defined __cplusplus || defined _MSC_VER)
00886 static void
00887 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00888 #else
00889 static void
00890 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
00891     FILE *yyoutput;
00892     int yytype;
00893     YYSTYPE const * const yyvaluep;
00894 #endif
00895 {
00896   if (!yyvaluep)
00897     return;
00898 # ifdef YYPRINT
00899   if (yytype < YYNTOKENS)
00900     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00901 # else
00902   YYUSE (yyoutput);
00903 # endif
00904   switch (yytype)
00905     {
00906       default:
00907         break;
00908     }
00909 }
00910 
00911 
00912 /*--------------------------------.
00913 | Print this symbol on YYOUTPUT.  |
00914 `--------------------------------*/
00915 
00916 #if (defined __STDC__ || defined __C99__FUNC__ \
00917      || defined __cplusplus || defined _MSC_VER)
00918 static void
00919 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00920 #else
00921 static void
00922 yy_symbol_print (yyoutput, yytype, yyvaluep)
00923     FILE *yyoutput;
00924     int yytype;
00925     YYSTYPE const * const yyvaluep;
00926 #endif
00927 {
00928   if (yytype < YYNTOKENS)
00929     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00930   else
00931     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00932 
00933   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
00934   YYFPRINTF (yyoutput, ")");
00935 }
00936 
00937 /*------------------------------------------------------------------.
00938 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
00939 | TOP (included).                                                   |
00940 `------------------------------------------------------------------*/
00941 
00942 #if (defined __STDC__ || defined __C99__FUNC__ \
00943      || defined __cplusplus || defined _MSC_VER)
00944 static void
00945 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
00946 #else
00947 static void
00948 yy_stack_print (bottom, top)
00949     yytype_int16 *bottom;
00950     yytype_int16 *top;
00951 #endif
00952 {
00953   YYFPRINTF (stderr, "Stack now");
00954   for (; bottom <= top; ++bottom)
00955     YYFPRINTF (stderr, " %d", *bottom);
00956   YYFPRINTF (stderr, "\n");
00957 }
00958 
00959 # define YY_STACK_PRINT(Bottom, Top)                            \
00960 do {                                                            \
00961   if (yydebug)                                                  \
00962     yy_stack_print ((Bottom), (Top));                           \
00963 } while (YYID (0))
00964 
00965 
00966 /*------------------------------------------------.
00967 | Report that the YYRULE is going to be reduced.  |
00968 `------------------------------------------------*/
00969 
00970 #if (defined __STDC__ || defined __C99__FUNC__ \
00971      || defined __cplusplus || defined _MSC_VER)
00972 static void
00973 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
00974 #else
00975 static void
00976 yy_reduce_print (yyvsp, yyrule)
00977     YYSTYPE *yyvsp;
00978     int yyrule;
00979 #endif
00980 {
00981   int yynrhs = yyr2[yyrule];
00982   int yyi;
00983   unsigned long int yylno = yyrline[yyrule];
00984   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00985              yyrule - 1, yylno);
00986   /* The symbols being reduced.  */
00987   for (yyi = 0; yyi < yynrhs; yyi++)
00988     {
00989       fprintf (stderr, "   $%d = ", yyi + 1);
00990       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00991                        &(yyvsp[(yyi + 1) - (yynrhs)])
00992                                        );
00993       fprintf (stderr, "\n");
00994     }
00995 }
00996 
00997 # define YY_REDUCE_PRINT(Rule)          \
00998 do {                                    \
00999   if (yydebug)                          \
01000     yy_reduce_print (yyvsp, Rule); \
01001 } while (YYID (0))
01002 
01003 /* Nonzero means print parse trace.  It is left uninitialized so that
01004    multiple parsers can coexist.  */
01005 int yydebug;
01006 #else /* !YYDEBUG */
01007 # define YYDPRINTF(Args)
01008 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01009 # define YY_STACK_PRINT(Bottom, Top)
01010 # define YY_REDUCE_PRINT(Rule)
01011 #endif /* !YYDEBUG */
01012 
01013 
01014 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01015 #ifndef YYINITDEPTH
01016 # define YYINITDEPTH 200
01017 #endif
01018 
01019 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01020    if the built-in stack extension method is used).
01021 
01022    Do not make this value too large; the results are undefined if
01023    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
01024    evaluated with infinite-precision integer arithmetic.  */
01025 
01026 #ifndef YYMAXDEPTH
01027 # define YYMAXDEPTH 10000
01028 #endif
01029 
01030 
01031 
01032 #if YYERROR_VERBOSE
01033 
01034 # ifndef yystrlen
01035 #  if defined __GLIBC__ && defined _STRING_H
01036 #   define yystrlen strlen
01037 #  else
01038 /* Return the length of YYSTR.  */
01039 #if (defined __STDC__ || defined __C99__FUNC__ \
01040      || defined __cplusplus || defined _MSC_VER)
01041 static YYSIZE_T
01042 yystrlen (const char *yystr)
01043 #else
01044 static YYSIZE_T
01045 yystrlen (yystr)
01046     const char *yystr;
01047 #endif
01048 {
01049   YYSIZE_T yylen;
01050   for (yylen = 0; yystr[yylen]; yylen++)
01051     continue;
01052   return yylen;
01053 }
01054 #  endif
01055 # endif
01056 
01057 # ifndef yystpcpy
01058 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01059 #   define yystpcpy stpcpy
01060 #  else
01061 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01062    YYDEST.  */
01063 #if (defined __STDC__ || defined __C99__FUNC__ \
01064      || defined __cplusplus || defined _MSC_VER)
01065 static char *
01066 yystpcpy (char *yydest, const char *yysrc)
01067 #else
01068 static char *
01069 yystpcpy (yydest, yysrc)
01070     char *yydest;
01071     const char *yysrc;
01072 #endif
01073 {
01074   char *yyd = yydest;
01075   const char *yys = yysrc;
01076 
01077   while ((*yyd++ = *yys++) != '\0')
01078     continue;
01079 
01080   return yyd - 1;
01081 }
01082 #  endif
01083 # endif
01084 
01085 # ifndef yytnamerr
01086 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
01087    quotes and backslashes, so that it's suitable for yyerror.  The
01088    heuristic is that double-quoting is unnecessary unless the string
01089    contains an apostrophe, a comma, or backslash (other than
01090    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
01091    null, do not copy; instead, return the length of what the result
01092    would have been.  */
01093 static YYSIZE_T
01094 yytnamerr (char *yyres, const char *yystr)
01095 {
01096   if (*yystr == '"')
01097     {
01098       YYSIZE_T yyn = 0;
01099       char const *yyp = yystr;
01100 
01101       for (;;)
01102         switch (*++yyp)
01103           {
01104           case '\'':
01105           case ',':
01106             goto do_not_strip_quotes;
01107 
01108           case '\\':
01109             if (*++yyp != '\\')
01110               goto do_not_strip_quotes;
01111             /* Fall through.  */
01112           default:
01113             if (yyres)
01114               yyres[yyn] = *yyp;
01115             yyn++;
01116             break;
01117 
01118           case '"':
01119             if (yyres)
01120               yyres[yyn] = '\0';
01121             return yyn;
01122           }
01123     do_not_strip_quotes: ;
01124     }
01125 
01126   if (! yyres)
01127     return yystrlen (yystr);
01128 
01129   return yystpcpy (yyres, yystr) - yyres;
01130 }
01131 # endif
01132 
01133 /* Copy into YYRESULT an error message about the unexpected token
01134    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
01135    including the terminating null byte.  If YYRESULT is null, do not
01136    copy anything; just return the number of bytes that would be
01137    copied.  As a special case, return 0 if an ordinary "syntax error"
01138    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
01139    size calculation.  */
01140 static YYSIZE_T
01141 yysyntax_error (char *yyresult, int yystate, int yychar)
01142 {
01143   int yyn = yypact[yystate];
01144 
01145   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01146     return 0;
01147   else
01148     {
01149       int yytype = YYTRANSLATE (yychar);
01150       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01151       YYSIZE_T yysize = yysize0;
01152       YYSIZE_T yysize1;
01153       int yysize_overflow = 0;
01154       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01155       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01156       int yyx;
01157 
01158 # if 0
01159       /* This is so xgettext sees the translatable formats that are
01160          constructed on the fly.  */
01161       YY_("syntax error, unexpected %s");
01162       YY_("syntax error, unexpected %s, expecting %s");
01163       YY_("syntax error, unexpected %s, expecting %s or %s");
01164       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01165       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01166 # endif
01167       char *yyfmt;
01168       char const *yyf;
01169       static char const yyunexpected[] = "syntax error, unexpected %s";
01170       static char const yyexpecting[] = ", expecting %s";
01171       static char const yyor[] = " or %s";
01172       char yyformat[sizeof yyunexpected
01173                     + sizeof yyexpecting - 1
01174                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01175                        * (sizeof yyor - 1))];
01176       char const *yyprefix = yyexpecting;
01177 
01178       /* Start YYX at -YYN if negative to avoid negative indexes in
01179          YYCHECK.  */
01180       int yyxbegin = yyn < 0 ? -yyn : 0;
01181 
01182       /* Stay within bounds of both yycheck and yytname.  */
01183       int yychecklim = YYLAST - yyn + 1;
01184       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01185       int yycount = 1;
01186 
01187       yyarg[0] = yytname[yytype];
01188       yyfmt = yystpcpy (yyformat, yyunexpected);
01189 
01190       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01191         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01192           {
01193             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01194               {
01195                 yycount = 1;
01196                 yysize = yysize0;
01197                 yyformat[sizeof yyunexpected - 1] = '\0';
01198                 break;
01199               }
01200             yyarg[yycount++] = yytname[yyx];
01201             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01202             yysize_overflow |= (yysize1 < yysize);
01203             yysize = yysize1;
01204             yyfmt = yystpcpy (yyfmt, yyprefix);
01205             yyprefix = yyor;
01206           }
01207 
01208       yyf = YY_(yyformat);
01209       yysize1 = yysize + yystrlen (yyf);
01210       yysize_overflow |= (yysize1 < yysize);
01211       yysize = yysize1;
01212 
01213       if (yysize_overflow)
01214         return YYSIZE_MAXIMUM;
01215 
01216       if (yyresult)
01217         {
01218           /* Avoid sprintf, as that infringes on the user's name space.
01219              Don't have undefined behavior even if the translation
01220              produced a string with the wrong number of "%s"s.  */
01221           char *yyp = yyresult;
01222           int yyi = 0;
01223           while ((*yyp = *yyf) != '\0')
01224             {
01225               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01226                 {
01227                   yyp += yytnamerr (yyp, yyarg[yyi++]);
01228                   yyf += 2;
01229                 }
01230               else
01231                 {
01232                   yyp++;
01233                   yyf++;
01234                 }
01235             }
01236         }
01237       return yysize;
01238     }
01239 }
01240 #endif /* YYERROR_VERBOSE */
01241 
01242 
01243 /*-----------------------------------------------.
01244 | Release the memory associated to this symbol.  |
01245 `-----------------------------------------------*/
01246 
01247 /*ARGSUSED*/
01248 #if (defined __STDC__ || defined __C99__FUNC__ \
01249      || defined __cplusplus || defined _MSC_VER)
01250 static void
01251 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01252 #else
01253 static void
01254 yydestruct (yymsg, yytype, yyvaluep)
01255     const char *yymsg;
01256     int yytype;
01257     YYSTYPE *yyvaluep;
01258 #endif
01259 {
01260   YYUSE (yyvaluep);
01261 
01262   if (!yymsg)
01263     yymsg = "Deleting";
01264   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01265 
01266   switch (yytype)
01267     {
01268 
01269       default:
01270         break;
01271     }
01272 }
01273 
01274 
01275 /* Prevent warnings from -Wmissing-prototypes.  */
01276 
01277 #ifdef YYPARSE_PARAM
01278 #if defined __STDC__ || defined __cplusplus
01279 int yyparse (void *YYPARSE_PARAM);
01280 #else
01281 int yyparse ();
01282 #endif
01283 #else /* ! YYPARSE_PARAM */
01284 #if defined __STDC__ || defined __cplusplus
01285 int yyparse (void);
01286 #else
01287 int yyparse ();
01288 #endif
01289 #endif /* ! YYPARSE_PARAM */
01290 
01291 
01292 
01293 /* The look-ahead symbol.  */
01294 int yychar;
01295 
01296 /* The semantic value of the look-ahead symbol.  */
01297 YYSTYPE yylval;
01298 
01299 /* Number of syntax errors so far.  */
01300 int yynerrs;
01301 
01302 
01303 
01304 /*----------.
01305 | yyparse.  |
01306 `----------*/
01307 
01308 #ifdef YYPARSE_PARAM
01309 #if (defined __STDC__ || defined __C99__FUNC__ \
01310      || defined __cplusplus || defined _MSC_VER)
01311 int
01312 yyparse (void *YYPARSE_PARAM)
01313 #else
01314 int
01315 yyparse (YYPARSE_PARAM)
01316     void *YYPARSE_PARAM;
01317 #endif
01318 #else /* ! YYPARSE_PARAM */
01319 #if (defined __STDC__ || defined __C99__FUNC__ \
01320      || defined __cplusplus || defined _MSC_VER)
01321 int
01322 yyparse (void)
01323 #else
01324 int
01325 yyparse ()
01326 
01327 #endif
01328 #endif
01329 {
01330   
01331   int yystate;
01332   int yyn;
01333   int yyresult;
01334   /* Number of tokens to shift before error messages enabled.  */
01335   int yyerrstatus;
01336   /* Look-ahead token as an internal (translated) token number.  */
01337   int yytoken = 0;
01338 #if YYERROR_VERBOSE
01339   /* Buffer for error messages, and its allocated size.  */
01340   char yymsgbuf[128];
01341   char *yymsg = yymsgbuf;
01342   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01343 #endif
01344 
01345   /* Three stacks and their tools:
01346      `yyss': related to states,
01347      `yyvs': related to semantic values,
01348      `yyls': related to locations.
01349 
01350      Refer to the stacks thru separate pointers, to allow yyoverflow
01351      to reallocate them elsewhere.  */
01352 
01353   /* The state stack.  */
01354   yytype_int16 yyssa[YYINITDEPTH];
01355   yytype_int16 *yyss = yyssa;
01356   yytype_int16 *yyssp;
01357 
01358   /* The semantic value stack.  */
01359   YYSTYPE yyvsa[YYINITDEPTH];
01360   YYSTYPE *yyvs = yyvsa;
01361   YYSTYPE *yyvsp;
01362 
01363 
01364 
01365 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
01366 
01367   YYSIZE_T yystacksize = YYINITDEPTH;
01368 
01369   /* The variables used to return semantic value and location from the
01370      action routines.  */
01371   YYSTYPE yyval;
01372 
01373 
01374   /* The number of symbols on the RHS of the reduced rule.
01375      Keep to zero when no symbol should be popped.  */
01376   int yylen = 0;
01377 
01378   YYDPRINTF ((stderr, "Starting parse\n"));
01379 
01380   yystate = 0;
01381   yyerrstatus = 0;
01382   yynerrs = 0;
01383   yychar = YYEMPTY;             /* Cause a token to be read.  */
01384 
01385   /* Initialize stack pointers.
01386      Waste one element of value and location stack
01387      so that they stay on the same level as the state stack.
01388      The wasted elements are never initialized.  */
01389 
01390   yyssp = yyss;
01391   yyvsp = yyvs;
01392 
01393   goto yysetstate;
01394 
01395 /*------------------------------------------------------------.
01396 | yynewstate -- Push a new state, which is found in yystate.  |
01397 `------------------------------------------------------------*/
01398  yynewstate:
01399   /* In all cases, when you get here, the value and location stacks
01400      have just been pushed.  So pushing a state here evens the stacks.  */
01401   yyssp++;
01402 
01403  yysetstate:
01404   *yyssp = yystate;
01405 
01406   if (yyss + yystacksize - 1 <= yyssp)
01407     {
01408       /* Get the current used size of the three stacks, in elements.  */
01409       YYSIZE_T yysize = yyssp - yyss + 1;
01410 
01411 #ifdef yyoverflow
01412       {
01413         /* Give user a chance to reallocate the stack.  Use copies of
01414            these so that the &'s don't force the real ones into
01415            memory.  */
01416         YYSTYPE *yyvs1 = yyvs;
01417         yytype_int16 *yyss1 = yyss;
01418 
01419 
01420         /* Each stack pointer address is followed by the size of the
01421            data in use in that stack, in bytes.  This used to be a
01422            conditional around just the two extra args, but that might
01423            be undefined if yyoverflow is a macro.  */
01424         yyoverflow (YY_("memory exhausted"),
01425                     &yyss1, yysize * sizeof (*yyssp),
01426                     &yyvs1, yysize * sizeof (*yyvsp),
01427 
01428                     &yystacksize);
01429 
01430         yyss = yyss1;
01431         yyvs = yyvs1;
01432       }
01433 #else /* no yyoverflow */
01434 # ifndef YYSTACK_RELOCATE
01435       goto yyexhaustedlab;
01436 # else
01437       /* Extend the stack our own way.  */
01438       if (YYMAXDEPTH <= yystacksize)
01439         goto yyexhaustedlab;
01440       yystacksize *= 2;
01441       if (YYMAXDEPTH < yystacksize)
01442         yystacksize = YYMAXDEPTH;
01443 
01444       {
01445         yytype_int16 *yyss1 = yyss;
01446         union yyalloc *yyptr =
01447           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01448         if (! yyptr)
01449           goto yyexhaustedlab;
01450         YYSTACK_RELOCATE (yyss);
01451         YYSTACK_RELOCATE (yyvs);
01452 
01453 #  undef YYSTACK_RELOCATE
01454         if (yyss1 != yyssa)
01455           YYSTACK_FREE (yyss1);
01456       }
01457 # endif
01458 #endif /* no yyoverflow */
01459 
01460       yyssp = yyss + yysize - 1;
01461       yyvsp = yyvs + yysize - 1;
01462 
01463 
01464       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01465                   (unsigned long int) yystacksize));
01466 
01467       if (yyss + yystacksize - 1 <= yyssp)
01468         YYABORT;
01469     }
01470 
01471   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01472 
01473   goto yybackup;
01474 
01475 /*-----------.
01476 | yybackup.  |
01477 `-----------*/
01478 yybackup:
01479 
01480   /* Do appropriate processing given the current state.  Read a
01481      look-ahead token if we need one and don't already have one.  */
01482 
01483   /* First try to decide what to do without reference to look-ahead token.  */
01484   yyn = yypact[yystate];
01485   if (yyn == YYPACT_NINF)
01486     goto yydefault;
01487 
01488   /* Not known => get a look-ahead token if don't already have one.  */
01489 
01490   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
01491   if (yychar == YYEMPTY)
01492     {
01493       YYDPRINTF ((stderr, "Reading a token: "));
01494       yychar = YYLEX;
01495     }
01496 
01497   if (yychar <= YYEOF)
01498     {
01499       yychar = yytoken = YYEOF;
01500       YYDPRINTF ((stderr, "Now at end of input.\n"));
01501     }
01502   else
01503     {
01504       yytoken = YYTRANSLATE (yychar);
01505       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01506     }
01507 
01508   /* If the proper action on seeing token YYTOKEN is to reduce or to
01509      detect an error, take that action.  */
01510   yyn += yytoken;
01511   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01512     goto yydefault;
01513   yyn = yytable[yyn];
01514   if (yyn <= 0)
01515     {
01516       if (yyn == 0 || yyn == YYTABLE_NINF)
01517         goto yyerrlab;
01518       yyn = -yyn;
01519       goto yyreduce;
01520     }
01521 
01522   if (yyn == YYFINAL)
01523     YYACCEPT;
01524 
01525   /* Count tokens shifted since error; after three, turn off error
01526      status.  */
01527   if (yyerrstatus)
01528     yyerrstatus--;
01529 
01530   /* Shift the look-ahead token.  */
01531   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01532 
01533   /* Discard the shifted token unless it is eof.  */
01534   if (yychar != YYEOF)
01535     yychar = YYEMPTY;
01536 
01537   yystate = yyn;
01538   *++yyvsp = yylval;
01539 
01540   goto yynewstate;
01541 
01542 
01543 /*-----------------------------------------------------------.
01544 | yydefault -- do the default action for the current state.  |
01545 `-----------------------------------------------------------*/
01546 yydefault:
01547   yyn = yydefact[yystate];
01548   if (yyn == 0)
01549     goto yyerrlab;
01550   goto yyreduce;
01551 
01552 
01553 /*-----------------------------.
01554 | yyreduce -- Do a reduction.  |
01555 `-----------------------------*/
01556 yyreduce:
01557   /* yyn is the number of a rule to reduce with.  */
01558   yylen = yyr2[yyn];
01559 
01560   /* If YYLEN is nonzero, implement the default value of the action:
01561      `$$ = $1'.
01562 
01563      Otherwise, the following line sets YYVAL to garbage.
01564      This behavior is undocumented and Bison
01565      users should not rely upon it.  Assigning to YYVAL
01566      unconditionally makes the parser a bit smaller, and it avoids a
01567      GCC warning that YYVAL may be used uninitialized.  */
01568   yyval = yyvsp[1-yylen];
01569 
01570 
01571   YY_REDUCE_PRINT (yyn);
01572   switch (yyn)
01573     {
01574         case 4:
01575 
01576     {
01577             yyHaveTime++;
01578         ;}
01579     break;
01580 
01581   case 5:
01582 
01583     {
01584             yyHaveZone++;
01585         ;}
01586     break;
01587 
01588   case 6:
01589 
01590     {
01591             yyHaveDate++;
01592         ;}
01593     break;
01594 
01595   case 7:
01596 
01597     {
01598             yyHaveOrdinalMonth++;
01599         ;}
01600     break;
01601 
01602   case 8:
01603 
01604     {
01605             yyHaveDay++;
01606         ;}
01607     break;
01608 
01609   case 9:
01610 
01611     {
01612             yyHaveRel++;
01613         ;}
01614     break;
01615 
01616   case 10:
01617 
01618     {
01619             yyHaveTime++;
01620             yyHaveDate++;
01621         ;}
01622     break;
01623 
01624   case 11:
01625 
01626     {
01627             yyHaveTime++;
01628             yyHaveDate++;
01629             yyHaveRel++;
01630         ;}
01631     break;
01632 
01633   case 13:
01634 
01635     {
01636             yyHour = (yyvsp[(1) - (2)].Number);
01637             yyMinutes = 0;
01638             yySeconds = 0;
01639             yyMeridian = (yyvsp[(2) - (2)].Meridian);
01640         ;}
01641     break;
01642 
01643   case 14:
01644 
01645     {
01646             yyHour = (yyvsp[(1) - (4)].Number);
01647             yyMinutes = (yyvsp[(3) - (4)].Number);
01648             yySeconds = 0;
01649             yyMeridian = (yyvsp[(4) - (4)].Meridian);
01650         ;}
01651     break;
01652 
01653   case 15:
01654 
01655     {
01656             yyHour = (yyvsp[(1) - (5)].Number);
01657             yyMinutes = (yyvsp[(3) - (5)].Number);
01658             yyMeridian = MER24;
01659             yyDSTmode = DSToff;
01660             yyTimezone = ((yyvsp[(5) - (5)].Number) % 100 + ((yyvsp[(5) - (5)].Number) / 100) * 60);
01661             ++yyHaveZone;
01662         ;}
01663     break;
01664 
01665   case 16:
01666 
01667     {
01668             yyHour = (yyvsp[(1) - (6)].Number);
01669             yyMinutes = (yyvsp[(3) - (6)].Number);
01670             yySeconds = (yyvsp[(5) - (6)].Number);
01671             yyMeridian = (yyvsp[(6) - (6)].Meridian);
01672         ;}
01673     break;
01674 
01675   case 17:
01676 
01677     {
01678             yyHour = (yyvsp[(1) - (7)].Number);
01679             yyMinutes = (yyvsp[(3) - (7)].Number);
01680             yySeconds = (yyvsp[(5) - (7)].Number);
01681             yyMeridian = MER24;
01682             yyDSTmode = DSToff;
01683             yyTimezone = ((yyvsp[(7) - (7)].Number) % 100 + ((yyvsp[(7) - (7)].Number) / 100) * 60);
01684             ++yyHaveZone;
01685         ;}
01686     break;
01687 
01688   case 18:
01689 
01690     {
01691             yyTimezone = (yyvsp[(1) - (2)].Number);
01692             yyDSTmode = DSTon;
01693         ;}
01694     break;
01695 
01696   case 19:
01697 
01698     {
01699             yyTimezone = (yyvsp[(1) - (1)].Number);
01700             yyDSTmode = DSToff;
01701         ;}
01702     break;
01703 
01704   case 20:
01705 
01706     {
01707             yyTimezone = (yyvsp[(1) - (1)].Number);
01708             yyDSTmode = DSTon;
01709         ;}
01710     break;
01711 
01712   case 21:
01713 
01714     {
01715             yyDayOrdinal = 1;
01716             yyDayNumber = (yyvsp[(1) - (1)].Number);
01717         ;}
01718     break;
01719 
01720   case 22:
01721 
01722     {
01723             yyDayOrdinal = 1;
01724             yyDayNumber = (yyvsp[(1) - (2)].Number);
01725         ;}
01726     break;
01727 
01728   case 23:
01729 
01730     {
01731             yyDayOrdinal = (yyvsp[(1) - (2)].Number);
01732             yyDayNumber = (yyvsp[(2) - (2)].Number);
01733         ;}
01734     break;
01735 
01736   case 24:
01737 
01738     {
01739             yyDayOrdinal = (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number);
01740             yyDayNumber = (yyvsp[(3) - (3)].Number);
01741         ;}
01742     break;
01743 
01744   case 25:
01745 
01746     {
01747             yyDayOrdinal = 2;
01748             yyDayNumber = (yyvsp[(2) - (2)].Number);
01749         ;}
01750     break;
01751 
01752   case 26:
01753 
01754     {
01755             yyMonth = (yyvsp[(1) - (3)].Number);
01756             yyDay = (yyvsp[(3) - (3)].Number);
01757         ;}
01758     break;
01759 
01760   case 27:
01761 
01762     {
01763             yyMonth = (yyvsp[(1) - (5)].Number);
01764             yyDay = (yyvsp[(3) - (5)].Number);
01765             yyYear = (yyvsp[(5) - (5)].Number);
01766         ;}
01767     break;
01768 
01769   case 28:
01770 
01771     {
01772             yyYear = (yyvsp[(1) - (1)].Number) / 10000;
01773             yyMonth = ((yyvsp[(1) - (1)].Number) % 10000)/100;
01774             yyDay = (yyvsp[(1) - (1)].Number) % 100;
01775         ;}
01776     break;
01777 
01778   case 29:
01779 
01780     {
01781             yyDay = (yyvsp[(1) - (5)].Number);
01782             yyMonth = (yyvsp[(3) - (5)].Number);
01783             yyYear = (yyvsp[(5) - (5)].Number);
01784         ;}
01785     break;
01786 
01787   case 30:
01788 
01789     {
01790             yyMonth = (yyvsp[(3) - (5)].Number);
01791             yyDay = (yyvsp[(5) - (5)].Number);
01792             yyYear = (yyvsp[(1) - (5)].Number);
01793         ;}
01794     break;
01795 
01796   case 31:
01797 
01798     {
01799             yyMonth = (yyvsp[(1) - (2)].Number);
01800             yyDay = (yyvsp[(2) - (2)].Number);
01801         ;}
01802     break;
01803 
01804   case 32:
01805 
01806     {
01807             yyMonth = (yyvsp[(1) - (4)].Number);
01808             yyDay = (yyvsp[(2) - (4)].Number);
01809             yyYear = (yyvsp[(4) - (4)].Number);
01810         ;}
01811     break;
01812 
01813   case 33:
01814 
01815     {
01816             yyMonth = (yyvsp[(2) - (2)].Number);
01817             yyDay = (yyvsp[(1) - (2)].Number);
01818         ;}
01819     break;
01820 
01821   case 34:
01822 
01823     {
01824             yyMonth = 1;
01825             yyDay = 1;
01826             yyYear = EPOCH;
01827         ;}
01828     break;
01829 
01830   case 35:
01831 
01832     {
01833             yyMonth = (yyvsp[(2) - (3)].Number);
01834             yyDay = (yyvsp[(1) - (3)].Number);
01835             yyYear = (yyvsp[(3) - (3)].Number);
01836         ;}
01837     break;
01838 
01839   case 36:
01840 
01841     {
01842             yyMonthOrdinal = 1;
01843             yyMonth = (yyvsp[(2) - (2)].Number);
01844         ;}
01845     break;
01846 
01847   case 37:
01848 
01849     {
01850             yyMonthOrdinal = (yyvsp[(2) - (3)].Number);
01851             yyMonth = (yyvsp[(3) - (3)].Number);
01852         ;}
01853     break;
01854 
01855   case 38:
01856 
01857     {
01858             if ((yyvsp[(2) - (3)].Number) != HOUR( 7)) YYABORT;
01859             yyYear = (yyvsp[(1) - (3)].Number) / 10000;
01860             yyMonth = ((yyvsp[(1) - (3)].Number) % 10000)/100;
01861             yyDay = (yyvsp[(1) - (3)].Number) % 100;
01862             yyHour = (yyvsp[(3) - (3)].Number) / 10000;
01863             yyMinutes = ((yyvsp[(3) - (3)].Number) % 10000)/100;
01864             yySeconds = (yyvsp[(3) - (3)].Number) % 100;
01865         ;}
01866     break;
01867 
01868   case 39:
01869 
01870     {
01871             if ((yyvsp[(2) - (7)].Number) != HOUR( 7)) YYABORT;
01872             yyYear = (yyvsp[(1) - (7)].Number) / 10000;
01873             yyMonth = ((yyvsp[(1) - (7)].Number) % 10000)/100;
01874             yyDay = (yyvsp[(1) - (7)].Number) % 100;
01875             yyHour = (yyvsp[(3) - (7)].Number);
01876             yyMinutes = (yyvsp[(5) - (7)].Number);
01877             yySeconds = (yyvsp[(7) - (7)].Number);
01878         ;}
01879     break;
01880 
01881   case 40:
01882 
01883     {
01884             yyYear = (yyvsp[(1) - (2)].Number) / 10000;
01885             yyMonth = ((yyvsp[(1) - (2)].Number) % 10000)/100;
01886             yyDay = (yyvsp[(1) - (2)].Number) % 100;
01887             yyHour = (yyvsp[(2) - (2)].Number) / 10000;
01888             yyMinutes = ((yyvsp[(2) - (2)].Number) % 10000)/100;
01889             yySeconds = (yyvsp[(2) - (2)].Number) % 100;
01890         ;}
01891     break;
01892 
01893   case 41:
01894 
01895     {
01896             /*
01897              * Offset computed year by -377 so that the returned years will be
01898              * in a range accessible with a 32 bit clock seconds value.
01899              */
01900 
01901             yyYear = (yyvsp[(2) - (4)].Number)/1000 + 2323 - 377;
01902             yyDay  = 1;
01903             yyMonth = 1;
01904             yyRelDay += (((yyvsp[(2) - (4)].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000;
01905             yyRelSeconds += (yyvsp[(4) - (4)].Number) * 144 * 60;
01906         ;}
01907     break;
01908 
01909   case 42:
01910 
01911     {
01912             yyRelSeconds *= -1;
01913             yyRelMonth *= -1;
01914             yyRelDay *= -1;
01915         ;}
01916     break;
01917 
01918   case 44:
01919 
01920     {
01921             *yyRelPointer += (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number);
01922         ;}
01923     break;
01924 
01925   case 45:
01926 
01927     {
01928             *yyRelPointer += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
01929         ;}
01930     break;
01931 
01932   case 46:
01933 
01934     {
01935             *yyRelPointer += (yyvsp[(2) - (2)].Number);
01936         ;}
01937     break;
01938 
01939   case 47:
01940 
01941     {
01942             *yyRelPointer += (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number);
01943         ;}
01944     break;
01945 
01946   case 48:
01947 
01948     {
01949             *yyRelPointer += (yyvsp[(1) - (1)].Number);
01950         ;}
01951     break;
01952 
01953   case 49:
01954 
01955     {
01956             (yyval.Number) = -1;
01957         ;}
01958     break;
01959 
01960   case 50:
01961 
01962     {
01963             (yyval.Number) =  1;
01964         ;}
01965     break;
01966 
01967   case 51:
01968 
01969     {
01970             (yyval.Number) = (yyvsp[(1) - (1)].Number);
01971             yyRelPointer = &yyRelSeconds;
01972         ;}
01973     break;
01974 
01975   case 52:
01976 
01977     {
01978             (yyval.Number) = (yyvsp[(1) - (1)].Number);
01979             yyRelPointer = &yyRelDay;
01980         ;}
01981     break;
01982 
01983   case 53:
01984 
01985     {
01986             (yyval.Number) = (yyvsp[(1) - (1)].Number);
01987             yyRelPointer = &yyRelMonth;
01988         ;}
01989     break;
01990 
01991   case 54:
01992 
01993     {
01994             if (yyHaveTime && yyHaveDate && !yyHaveRel) {
01995                 yyYear = (yyvsp[(1) - (1)].Number);
01996             } else {
01997                 yyHaveTime++;
01998                 if (yyDigitCount <= 2) {
01999                     yyHour = (yyvsp[(1) - (1)].Number);
02000                     yyMinutes = 0;
02001                 } else {
02002                     yyHour = (yyvsp[(1) - (1)].Number) / 100;
02003                     yyMinutes = (yyvsp[(1) - (1)].Number) % 100;
02004                 }
02005                 yySeconds = 0;
02006                 yyMeridian = MER24;
02007             }
02008         ;}
02009     break;
02010 
02011   case 55:
02012 
02013     {
02014             (yyval.Meridian) = MER24;
02015         ;}
02016     break;
02017 
02018   case 56:
02019 
02020     {
02021             (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);
02022         ;}
02023     break;
02024 
02025 
02026 /* Line 1267 of yacc.c.  */
02027 
02028       default: break;
02029     }
02030   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
02031 
02032   YYPOPSTACK (yylen);
02033   yylen = 0;
02034   YY_STACK_PRINT (yyss, yyssp);
02035 
02036   *++yyvsp = yyval;
02037 
02038 
02039   /* Now `shift' the result of the reduction.  Determine what state
02040      that goes to, based on the state we popped back to and the rule
02041      number reduced by.  */
02042 
02043   yyn = yyr1[yyn];
02044 
02045   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02046   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02047     yystate = yytable[yystate];
02048   else
02049     yystate = yydefgoto[yyn - YYNTOKENS];
02050 
02051   goto yynewstate;
02052 
02053 
02054 /*------------------------------------.
02055 | yyerrlab -- here on detecting error |
02056 `------------------------------------*/
02057 yyerrlab:
02058   /* If not already recovering from an error, report this error.  */
02059   if (!yyerrstatus)
02060     {
02061       ++yynerrs;
02062 #if ! YYERROR_VERBOSE
02063       yyerror (YY_("syntax error"));
02064 #else
02065       {
02066         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
02067         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
02068           {
02069             YYSIZE_T yyalloc = 2 * yysize;
02070             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
02071               yyalloc = YYSTACK_ALLOC_MAXIMUM;
02072             if (yymsg != yymsgbuf)
02073               YYSTACK_FREE (yymsg);
02074             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
02075             if (yymsg)
02076               yymsg_alloc = yyalloc;
02077             else
02078               {
02079                 yymsg = yymsgbuf;
02080                 yymsg_alloc = sizeof yymsgbuf;
02081               }
02082           }
02083 
02084         if (0 < yysize && yysize <= yymsg_alloc)
02085           {
02086             (void) yysyntax_error (yymsg, yystate, yychar);
02087             yyerror (yymsg);
02088           }
02089         else
02090           {
02091             yyerror (YY_("syntax error"));
02092             if (yysize != 0)
02093               goto yyexhaustedlab;
02094           }
02095       }
02096 #endif
02097     }
02098 
02099 
02100 
02101   if (yyerrstatus == 3)
02102     {
02103       /* If just tried and failed to reuse look-ahead token after an
02104          error, discard it.  */
02105 
02106       if (yychar <= YYEOF)
02107         {
02108           /* Return failure if at end of input.  */
02109           if (yychar == YYEOF)
02110             YYABORT;
02111         }
02112       else
02113         {
02114           yydestruct ("Error: discarding",
02115                       yytoken, &yylval);
02116           yychar = YYEMPTY;
02117         }
02118     }
02119 
02120   /* Else will try to reuse look-ahead token after shifting the error
02121      token.  */
02122   goto yyerrlab1;
02123 
02124 
02125 /*---------------------------------------------------.
02126 | yyerrorlab -- error raised explicitly by YYERROR.  |
02127 `---------------------------------------------------*/
02128 yyerrorlab:
02129 
02130   /* Pacify compilers like GCC when the user code never invokes
02131      YYERROR and the label yyerrorlab therefore never appears in user
02132      code.  */
02133   if (/*CONSTCOND*/ 0)
02134      goto yyerrorlab;
02135 
02136   /* Do not reclaim the symbols of the rule which action triggered
02137      this YYERROR.  */
02138   YYPOPSTACK (yylen);
02139   yylen = 0;
02140   YY_STACK_PRINT (yyss, yyssp);
02141   yystate = *yyssp;
02142   goto yyerrlab1;
02143 
02144 
02145 /*-------------------------------------------------------------.
02146 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
02147 `-------------------------------------------------------------*/
02148 yyerrlab1:
02149   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
02150 
02151   for (;;)
02152     {
02153       yyn = yypact[yystate];
02154       if (yyn != YYPACT_NINF)
02155         {
02156           yyn += YYTERROR;
02157           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02158             {
02159               yyn = yytable[yyn];
02160               if (0 < yyn)
02161                 break;
02162             }
02163         }
02164 
02165       /* Pop the current state because it cannot handle the error token.  */
02166       if (yyssp == yyss)
02167         YYABORT;
02168 
02169 
02170       yydestruct ("Error: popping",
02171                   yystos[yystate], yyvsp);
02172       YYPOPSTACK (1);
02173       yystate = *yyssp;
02174       YY_STACK_PRINT (yyss, yyssp);
02175     }
02176 
02177   if (yyn == YYFINAL)
02178     YYACCEPT;
02179 
02180   *++yyvsp = yylval;
02181 
02182 
02183   /* Shift the error token.  */
02184   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02185 
02186   yystate = yyn;
02187   goto yynewstate;
02188 
02189 
02190 /*-------------------------------------.
02191 | yyacceptlab -- YYACCEPT comes here.  |
02192 `-------------------------------------*/
02193 yyacceptlab:
02194   yyresult = 0;
02195   goto yyreturn;
02196 
02197 /*-----------------------------------.
02198 | yyabortlab -- YYABORT comes here.  |
02199 `-----------------------------------*/
02200 yyabortlab:
02201   yyresult = 1;
02202   goto yyreturn;
02203 
02204 #ifndef yyoverflow
02205 /*-------------------------------------------------.
02206 | yyexhaustedlab -- memory exhaustion comes here.  |
02207 `-------------------------------------------------*/
02208 yyexhaustedlab:
02209   yyerror (YY_("memory exhausted"));
02210   yyresult = 2;
02211   /* Fall through.  */
02212 #endif
02213 
02214 yyreturn:
02215   if (yychar != YYEOF && yychar != YYEMPTY)
02216      yydestruct ("Cleanup: discarding lookahead",
02217                  yytoken, &yylval);
02218   /* Do not reclaim the symbols of the rule which action triggered
02219      this YYABORT or YYACCEPT.  */
02220   YYPOPSTACK (yylen);
02221   YY_STACK_PRINT (yyss, yyssp);
02222   while (yyssp != yyss)
02223     {
02224       yydestruct ("Cleanup: popping",
02225                   yystos[*yyssp], yyvsp);
02226       YYPOPSTACK (1);
02227     }
02228 #ifndef yyoverflow
02229   if (yyss != yyssa)
02230     YYSTACK_FREE (yyss);
02231 #endif
02232 #if YYERROR_VERBOSE
02233   if (yymsg != yymsgbuf)
02234     YYSTACK_FREE (yymsg);
02235 #endif
02236   /* Make sure YYID is used.  */
02237   return YYID (yyresult);
02238 }
02239 
02240 
02241 
02242 
02243 MODULE_SCOPE int yychar;
02244 MODULE_SCOPE YYSTYPE yylval;
02245 MODULE_SCOPE int yynerrs;
02246 
02247 /*
02248  * Month and day table.
02249  */
02250 
02251 static TABLE MonthDayTable[] = {
02252     { "january",        tMONTH,  1 },
02253     { "february",       tMONTH,  2 },
02254     { "march",          tMONTH,  3 },
02255     { "april",          tMONTH,  4 },
02256     { "may",            tMONTH,  5 },
02257     { "june",           tMONTH,  6 },
02258     { "july",           tMONTH,  7 },
02259     { "august",         tMONTH,  8 },
02260     { "september",      tMONTH,  9 },
02261     { "sept",           tMONTH,  9 },
02262     { "october",        tMONTH, 10 },
02263     { "november",       tMONTH, 11 },
02264     { "december",       tMONTH, 12 },
02265     { "sunday",         tDAY, 0 },
02266     { "monday",         tDAY, 1 },
02267     { "tuesday",        tDAY, 2 },
02268     { "tues",           tDAY, 2 },
02269     { "wednesday",      tDAY, 3 },
02270     { "wednes",         tDAY, 3 },
02271     { "thursday",       tDAY, 4 },
02272     { "thur",           tDAY, 4 },
02273     { "thurs",          tDAY, 4 },
02274     { "friday",         tDAY, 5 },
02275     { "saturday",       tDAY, 6 },
02276     { NULL }
02277 };
02278 
02279 /*
02280  * Time units table.
02281  */
02282 
02283 static TABLE UnitsTable[] = {
02284     { "year",           tMONTH_UNIT,    12 },
02285     { "month",          tMONTH_UNIT,     1 },
02286     { "fortnight",      tDAY_UNIT,      14 },
02287     { "week",           tDAY_UNIT,       7 },
02288     { "day",            tDAY_UNIT,       1 },
02289     { "hour",           tSEC_UNIT, 60 * 60 },
02290     { "minute",         tSEC_UNIT,      60 },
02291     { "min",            tSEC_UNIT,      60 },
02292     { "second",         tSEC_UNIT,       1 },
02293     { "sec",            tSEC_UNIT,       1 },
02294     { NULL }
02295 };
02296 
02297 /*
02298  * Assorted relative-time words.
02299  */
02300 
02301 static TABLE OtherTable[] = {
02302     { "tomorrow",       tDAY_UNIT,      1 },
02303     { "yesterday",      tDAY_UNIT,      -1 },
02304     { "today",          tDAY_UNIT,      0 },
02305     { "now",            tSEC_UNIT,      0 },
02306     { "last",           tUNUMBER,       -1 },
02307     { "this",           tSEC_UNIT,      0 },
02308     { "next",           tNEXT,          1 },
02309 #if 0
02310     { "first",          tUNUMBER,       1 },
02311     { "second",         tUNUMBER,       2 },
02312     { "third",          tUNUMBER,       3 },
02313     { "fourth",         tUNUMBER,       4 },
02314     { "fifth",          tUNUMBER,       5 },
02315     { "sixth",          tUNUMBER,       6 },
02316     { "seventh",        tUNUMBER,       7 },
02317     { "eighth",         tUNUMBER,       8 },
02318     { "ninth",          tUNUMBER,       9 },
02319     { "tenth",          tUNUMBER,       10 },
02320     { "eleventh",       tUNUMBER,       11 },
02321     { "twelfth",        tUNUMBER,       12 },
02322 #endif
02323     { "ago",            tAGO,           1 },
02324     { "epoch",          tEPOCH,         0 },
02325     { "stardate",       tSTARDATE,      0 },
02326     { NULL }
02327 };
02328 
02329 /*
02330  * The timezone table. (Note: This table was modified to not use any floating
02331  * point constants to work around an SGI compiler bug).
02332  */
02333 
02334 static TABLE TimezoneTable[] = {
02335     { "gmt",    tZONE,     HOUR( 0) },      /* Greenwich Mean */
02336     { "ut",     tZONE,     HOUR( 0) },      /* Universal (Coordinated) */
02337     { "utc",    tZONE,     HOUR( 0) },
02338     { "uct",    tZONE,     HOUR( 0) },      /* Universal Coordinated Time */
02339     { "wet",    tZONE,     HOUR( 0) },      /* Western European */
02340     { "bst",    tDAYZONE,  HOUR( 0) },      /* British Summer */
02341     { "wat",    tZONE,     HOUR( 1) },      /* West Africa */
02342     { "at",     tZONE,     HOUR( 2) },      /* Azores */
02343 #if     0
02344     /* For completeness.  BST is also British Summer, and GST is
02345      * also Guam Standard. */
02346     { "bst",    tZONE,     HOUR( 3) },      /* Brazil Standard */
02347     { "gst",    tZONE,     HOUR( 3) },      /* Greenland Standard */
02348 #endif
02349     { "nft",    tZONE,     HOUR( 7/2) },    /* Newfoundland */
02350     { "nst",    tZONE,     HOUR( 7/2) },    /* Newfoundland Standard */
02351     { "ndt",    tDAYZONE,  HOUR( 7/2) },    /* Newfoundland Daylight */
02352     { "ast",    tZONE,     HOUR( 4) },      /* Atlantic Standard */
02353     { "adt",    tDAYZONE,  HOUR( 4) },      /* Atlantic Daylight */
02354     { "est",    tZONE,     HOUR( 5) },      /* Eastern Standard */
02355     { "edt",    tDAYZONE,  HOUR( 5) },      /* Eastern Daylight */
02356     { "cst",    tZONE,     HOUR( 6) },      /* Central Standard */
02357     { "cdt",    tDAYZONE,  HOUR( 6) },      /* Central Daylight */
02358     { "mst",    tZONE,     HOUR( 7) },      /* Mountain Standard */
02359     { "mdt",    tDAYZONE,  HOUR( 7) },      /* Mountain Daylight */
02360     { "pst",    tZONE,     HOUR( 8) },      /* Pacific Standard */
02361     { "pdt",    tDAYZONE,  HOUR( 8) },      /* Pacific Daylight */
02362     { "yst",    tZONE,     HOUR( 9) },      /* Yukon Standard */
02363     { "ydt",    tDAYZONE,  HOUR( 9) },      /* Yukon Daylight */
02364     { "hst",    tZONE,     HOUR(10) },      /* Hawaii Standard */
02365     { "hdt",    tDAYZONE,  HOUR(10) },      /* Hawaii Daylight */
02366     { "cat",    tZONE,     HOUR(10) },      /* Central Alaska */
02367     { "ahst",   tZONE,     HOUR(10) },      /* Alaska-Hawaii Standard */
02368     { "nt",     tZONE,     HOUR(11) },      /* Nome */
02369     { "idlw",   tZONE,     HOUR(12) },      /* International Date Line West */
02370     { "cet",    tZONE,    -HOUR( 1) },      /* Central European */
02371     { "cest",   tDAYZONE, -HOUR( 1) },      /* Central European Summer */
02372     { "met",    tZONE,    -HOUR( 1) },      /* Middle European */
02373     { "mewt",   tZONE,    -HOUR( 1) },      /* Middle European Winter */
02374     { "mest",   tDAYZONE, -HOUR( 1) },      /* Middle European Summer */
02375     { "swt",    tZONE,    -HOUR( 1) },      /* Swedish Winter */
02376     { "sst",    tDAYZONE, -HOUR( 1) },      /* Swedish Summer */
02377     { "fwt",    tZONE,    -HOUR( 1) },      /* French Winter */
02378     { "fst",    tDAYZONE, -HOUR( 1) },      /* French Summer */
02379     { "eet",    tZONE,    -HOUR( 2) },      /* Eastern Europe, USSR Zone 1 */
02380     { "bt",     tZONE,    -HOUR( 3) },      /* Baghdad, USSR Zone 2 */
02381     { "it",     tZONE,    -HOUR( 7/2) },    /* Iran */
02382     { "zp4",    tZONE,    -HOUR( 4) },      /* USSR Zone 3 */
02383     { "zp5",    tZONE,    -HOUR( 5) },      /* USSR Zone 4 */
02384     { "ist",    tZONE,    -HOUR(11/2) },    /* Indian Standard */
02385     { "zp6",    tZONE,    -HOUR( 6) },      /* USSR Zone 5 */
02386 #if     0
02387     /* For completeness.  NST is also Newfoundland Stanard, nad SST is
02388      * also Swedish Summer. */
02389     { "nst",    tZONE,    -HOUR(13/2) },    /* North Sumatra */
02390     { "sst",    tZONE,    -HOUR( 7) },      /* South Sumatra, USSR Zone 6 */
02391 #endif  /* 0 */
02392     { "wast",   tZONE,    -HOUR( 7) },      /* West Australian Standard */
02393     { "wadt",   tDAYZONE, -HOUR( 7) },      /* West Australian Daylight */
02394     { "jt",     tZONE,    -HOUR(15/2) },    /* Java (3pm in Cronusland!) */
02395     { "cct",    tZONE,    -HOUR( 8) },      /* China Coast, USSR Zone 7 */
02396     { "jst",    tZONE,    -HOUR( 9) },      /* Japan Standard, USSR Zone 8 */
02397     { "jdt",    tDAYZONE, -HOUR( 9) },      /* Japan Daylight */
02398     { "kst",    tZONE,    -HOUR( 9) },      /* Korea Standard */
02399     { "kdt",    tDAYZONE, -HOUR( 9) },      /* Korea Daylight */
02400     { "cast",   tZONE,    -HOUR(19/2) },    /* Central Australian Standard */
02401     { "cadt",   tDAYZONE, -HOUR(19/2) },    /* Central Australian Daylight */
02402     { "east",   tZONE,    -HOUR(10) },      /* Eastern Australian Standard */
02403     { "eadt",   tDAYZONE, -HOUR(10) },      /* Eastern Australian Daylight */
02404     { "gst",    tZONE,    -HOUR(10) },      /* Guam Standard, USSR Zone 9 */
02405     { "nzt",    tZONE,    -HOUR(12) },      /* New Zealand */
02406     { "nzst",   tZONE,    -HOUR(12) },      /* New Zealand Standard */
02407     { "nzdt",   tDAYZONE, -HOUR(12) },      /* New Zealand Daylight */
02408     { "idle",   tZONE,    -HOUR(12) },      /* International Date Line East */
02409     /* ADDED BY Marco Nijdam */
02410     { "dst",    tDST,     HOUR( 0) },       /* DST on (hour is ignored) */
02411     /* End ADDED */
02412     {  NULL  }
02413 };
02414 
02415 /*
02416  * Military timezone table.
02417  */
02418 
02419 static TABLE    MilitaryTable[] = {
02420     { "a",      tZONE,  -HOUR( 1) },
02421     { "b",      tZONE,  -HOUR( 2) },
02422     { "c",      tZONE,  -HOUR( 3) },
02423     { "d",      tZONE,  -HOUR( 4) },
02424     { "e",      tZONE,  -HOUR( 5) },
02425     { "f",      tZONE,  -HOUR( 6) },
02426     { "g",      tZONE,  -HOUR( 7) },
02427     { "h",      tZONE,  -HOUR( 8) },
02428     { "i",      tZONE,  -HOUR( 9) },
02429     { "k",      tZONE,  -HOUR(10) },
02430     { "l",      tZONE,  -HOUR(11) },
02431     { "m",      tZONE,  -HOUR(12) },
02432     { "n",      tZONE,  HOUR(  1) },
02433     { "o",      tZONE,  HOUR(  2) },
02434     { "p",      tZONE,  HOUR(  3) },
02435     { "q",      tZONE,  HOUR(  4) },
02436     { "r",      tZONE,  HOUR(  5) },
02437     { "s",      tZONE,  HOUR(  6) },
02438     { "t",      tZONE,  HOUR(  7) },
02439     { "u",      tZONE,  HOUR(  8) },
02440     { "v",      tZONE,  HOUR(  9) },
02441     { "w",      tZONE,  HOUR( 10) },
02442     { "x",      tZONE,  HOUR( 11) },
02443     { "y",      tZONE,  HOUR( 12) },
02444     { "z",      tZONE,  HOUR( 0) },
02445     { NULL }
02446 };
02447 
02448 /*
02449  * Dump error messages in the bit bucket.
02450  */
02451 
02452 static void
02453 TclDateerror(
02454     char *s)
02455 {
02456 }
02457 
02458 static time_t
02459 ToSeconds(
02460     time_t Hours,
02461     time_t Minutes,
02462     time_t Seconds,
02463     MERIDIAN Meridian)
02464 {
02465     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) {
02466         return -1;
02467     }
02468     switch (Meridian) {
02469     case MER24:
02470         if (Hours < 0 || Hours > 23) {
02471             return -1;
02472         }
02473         return (Hours * 60L + Minutes) * 60L + Seconds;
02474     case MERam:
02475         if (Hours < 1 || Hours > 12) {
02476             return -1;
02477         }
02478         return ((Hours % 12) * 60L + Minutes) * 60L + Seconds;
02479     case MERpm:
02480         if (Hours < 1 || Hours > 12) {
02481             return -1;
02482         }
02483         return (((Hours % 12) + 12) * 60L + Minutes) * 60L + Seconds;
02484     }
02485     return -1;                  /* Should never be reached */
02486 }
02487 
02488 static int
02489 LookupWord(
02490     char *buff)
02491 {
02492     register char *p;
02493     register char *q;
02494     register TABLE *tp;
02495     int i, abbrev;
02496 
02497     /*
02498      * Make it lowercase.
02499      */
02500 
02501     Tcl_UtfToLower(buff);
02502 
02503     if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
02504         yylval.Meridian = MERam;
02505         return tMERIDIAN;
02506     }
02507     if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
02508         yylval.Meridian = MERpm;
02509         return tMERIDIAN;
02510     }
02511 
02512     /*
02513      * See if we have an abbreviation for a month.
02514      */
02515 
02516     if (strlen(buff) == 3) {
02517         abbrev = 1;
02518     } else if (strlen(buff) == 4 && buff[3] == '.') {
02519         abbrev = 1;
02520         buff[3] = '\0';
02521     } else {
02522         abbrev = 0;
02523     }
02524 
02525     for (tp = MonthDayTable; tp->name; tp++) {
02526         if (abbrev) {
02527             if (strncmp(buff, tp->name, 3) == 0) {
02528                 yylval.Number = tp->value;
02529                 return tp->type;
02530             }
02531         } else if (strcmp(buff, tp->name) == 0) {
02532             yylval.Number = tp->value;
02533             return tp->type;
02534         }
02535     }
02536 
02537     for (tp = TimezoneTable; tp->name; tp++) {
02538         if (strcmp(buff, tp->name) == 0) {
02539             yylval.Number = tp->value;
02540             return tp->type;
02541         }
02542     }
02543 
02544     for (tp = UnitsTable; tp->name; tp++) {
02545         if (strcmp(buff, tp->name) == 0) {
02546             yylval.Number = tp->value;
02547             return tp->type;
02548         }
02549     }
02550 
02551     /*
02552      * Strip off any plural and try the units table again.
02553      */
02554 
02555     i = strlen(buff) - 1;
02556     if (i > 0 && buff[i] == 's') {
02557         buff[i] = '\0';
02558         for (tp = UnitsTable; tp->name; tp++) {
02559             if (strcmp(buff, tp->name) == 0) {
02560                 yylval.Number = tp->value;
02561                 return tp->type;
02562             }
02563         }
02564     }
02565 
02566     for (tp = OtherTable; tp->name; tp++) {
02567         if (strcmp(buff, tp->name) == 0) {
02568             yylval.Number = tp->value;
02569             return tp->type;
02570         }
02571     }
02572 
02573     /*
02574      * Military timezones.
02575      */
02576 
02577     if (buff[1] == '\0' && !(*buff & 0x80)
02578             && isalpha(UCHAR(*buff))) {                 /* INTL: ISO only */
02579         for (tp = MilitaryTable; tp->name; tp++) {
02580             if (strcmp(buff, tp->name) == 0) {
02581                 yylval.Number = tp->value;
02582                 return tp->type;
02583             }
02584         }
02585     }
02586 
02587     /*
02588      * Drop out any periods and try the timezone table again.
02589      */
02590 
02591     for (i = 0, p = q = buff; *q; q++) {
02592         if (*q != '.') {
02593             *p++ = *q;
02594         } else {
02595             i++;
02596         }
02597     }
02598     *p = '\0';
02599     if (i) {
02600         for (tp = TimezoneTable; tp->name; tp++) {
02601             if (strcmp(buff, tp->name) == 0) {
02602                 yylval.Number = tp->value;
02603                 return tp->type;
02604             }
02605         }
02606     }
02607 
02608     return tID;
02609 }
02610 
02611 static int
02612 TclDatelex(
02613     void *info)
02614 {
02615     register char c;
02616     register char *p;
02617     char buff[20];
02618     int Count;
02619 
02620     for ( ; ; ) {
02621         while (isspace(UCHAR(*yyInput))) {
02622             yyInput++;
02623         }
02624 
02625         if (isdigit(UCHAR(c = *yyInput))) { /* INTL: digit */
02626             /*
02627              * Convert the string into a number; count the number of digits.
02628              */
02629 
02630             Count = 0;
02631             for (yylval.Number = 0;
02632                     isdigit(UCHAR(c = *yyInput++)); ) {   /* INTL: digit */
02633                 yylval.Number = 10 * yylval.Number + c - '0';
02634                 Count++;
02635             }
02636             yyInput--;
02637             yyDigitCount = Count;
02638 
02639             /*
02640              * A number with 6 or more digits is considered an ISO 8601 base.
02641              */
02642 
02643             if (Count >= 6) {
02644                 return tISOBASE;
02645             } else {
02646                 return tUNUMBER;
02647             }
02648         }
02649         if (!(c & 0x80) && isalpha(UCHAR(c))) {           /* INTL: ISO only. */
02650             for (p = buff; isalpha(UCHAR(c = *yyInput++)) /* INTL: ISO only. */
02651                      || c == '.'; ) {
02652                 if (p < &buff[sizeof buff - 1]) {
02653                     *p++ = c;
02654                 }
02655             }
02656             *p = '\0';
02657             yyInput--;
02658             return LookupWord(buff);
02659         }
02660         if (c != '(') {
02661             return *yyInput++;
02662         }
02663         Count = 0;
02664         do {
02665             c = *yyInput++;
02666             if (c == '\0') {
02667                 return c;
02668             } else if (c == '(') {
02669                 Count++;
02670             } else if (c == ')') {
02671                 Count--;
02672             }
02673         } while (Count > 0);
02674     }
02675 }
02676 
02677 int
02678 TclClockOldscanObjCmd(
02679     ClientData clientData,      /* Unused */
02680     Tcl_Interp *interp,         /* Tcl interpreter */
02681     int objc,                   /* Count of paraneters */
02682     Tcl_Obj *CONST *objv)       /* Parameters */
02683 {
02684     Tcl_Obj *result, *resultElement;
02685     int yr, mo, da;
02686     DateInfo dateInfo;
02687     void *info = (void *) &dateInfo;
02688 
02689     if (objc != 5) {
02690         Tcl_WrongNumArgs(interp, 1, objv,
02691                 "stringToParse baseYear baseMonth baseDay" );
02692         return TCL_ERROR;
02693     }
02694 
02695     yyInput = Tcl_GetString( objv[1] );
02696 
02697     yyHaveDate = 0;
02698     if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK
02699             || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK
02700             || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) {
02701         return TCL_ERROR;
02702     }
02703     yyYear = yr; yyMonth = mo; yyDay = da;
02704 
02705     yyHaveTime = 0;
02706     yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24;
02707 
02708     yyHaveZone = 0;
02709     yyTimezone = 0; yyDSTmode = DSTmaybe;
02710 
02711     yyHaveOrdinalMonth = 0;
02712     yyMonthOrdinal = 0;
02713 
02714     yyHaveDay = 0;
02715     yyDayOrdinal = 0; yyDayNumber = 0;
02716 
02717     yyHaveRel = 0;
02718     yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL;
02719 
02720     if (yyparse(info)) {
02721         Tcl_SetObjResult(interp, Tcl_NewStringObj("syntax error", -1));
02722         return TCL_ERROR;
02723     }
02724 
02725     if (yyHaveDate > 1) {
02726         Tcl_SetObjResult(interp,
02727                 Tcl_NewStringObj("more than one date in string", -1));
02728         return TCL_ERROR;
02729     }
02730     if (yyHaveTime > 1) {
02731         Tcl_SetObjResult(interp,
02732                 Tcl_NewStringObj("more than one time of day in string", -1));
02733         return TCL_ERROR;
02734     }
02735     if (yyHaveZone > 1) {
02736         Tcl_SetObjResult(interp,
02737                 Tcl_NewStringObj("more than one time zone in string", -1));
02738         return TCL_ERROR;
02739     }
02740     if (yyHaveDay > 1) {
02741         Tcl_SetObjResult(interp,
02742                 Tcl_NewStringObj("more than one weekday in string", -1));
02743         return TCL_ERROR;
02744     }
02745     if (yyHaveOrdinalMonth > 1) {
02746         Tcl_SetObjResult(interp,
02747                 Tcl_NewStringObj("more than one ordinal month in string", -1));
02748         return TCL_ERROR;
02749     }
02750 
02751     result = Tcl_NewObj();
02752     resultElement = Tcl_NewObj();
02753     if (yyHaveDate) {
02754         Tcl_ListObjAppendElement(interp, resultElement,
02755                 Tcl_NewIntObj((int) yyYear));
02756         Tcl_ListObjAppendElement(interp, resultElement,
02757                 Tcl_NewIntObj((int) yyMonth));
02758         Tcl_ListObjAppendElement(interp, resultElement,
02759                 Tcl_NewIntObj((int) yyDay));
02760     }
02761     Tcl_ListObjAppendElement(interp, result, resultElement);
02762 
02763     if (yyHaveTime) {
02764         Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj((int)
02765                 ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian)));
02766     } else {
02767         Tcl_ListObjAppendElement(interp, result, Tcl_NewObj());
02768     }
02769 
02770     resultElement = Tcl_NewObj();
02771     if (yyHaveZone) {
02772         Tcl_ListObjAppendElement(interp, resultElement,
02773                 Tcl_NewIntObj((int) -yyTimezone));
02774         Tcl_ListObjAppendElement(interp, resultElement,
02775                 Tcl_NewIntObj(1 - yyDSTmode));
02776     }
02777     Tcl_ListObjAppendElement(interp, result, resultElement);
02778 
02779     resultElement = Tcl_NewObj();
02780     if (yyHaveRel) {
02781         Tcl_ListObjAppendElement(interp, resultElement,
02782                 Tcl_NewIntObj((int) yyRelMonth));
02783         Tcl_ListObjAppendElement(interp, resultElement,
02784                 Tcl_NewIntObj((int) yyRelDay));
02785         Tcl_ListObjAppendElement(interp, resultElement,
02786                 Tcl_NewIntObj((int) yyRelSeconds));
02787     }
02788     Tcl_ListObjAppendElement(interp, result, resultElement);
02789 
02790     resultElement = Tcl_NewObj();
02791     if (yyHaveDay && !yyHaveDate) {
02792         Tcl_ListObjAppendElement(interp, resultElement,
02793                 Tcl_NewIntObj((int) yyDayOrdinal));
02794         Tcl_ListObjAppendElement(interp, resultElement,
02795                 Tcl_NewIntObj((int) yyDayNumber));
02796     }
02797     Tcl_ListObjAppendElement(interp, result, resultElement);
02798 
02799     resultElement = Tcl_NewObj();
02800     if (yyHaveOrdinalMonth) {
02801         Tcl_ListObjAppendElement(interp, resultElement,
02802                 Tcl_NewIntObj((int) yyMonthOrdinal));
02803         Tcl_ListObjAppendElement(interp, resultElement,
02804                 Tcl_NewIntObj((int) yyMonth));
02805     }
02806     Tcl_ListObjAppendElement(interp, result, resultElement);
02807 
02808     Tcl_SetObjResult(interp, result);
02809     return TCL_OK;
02810 }
02811 
02812 /*
02813  * Local Variables:
02814  * mode: c
02815  * c-basic-offset: 4
02816  * fill-column: 78
02817  * End:
02818  */
02819 



Generated on Wed Mar 12 12:18:14 2008 by  doxygen 1.5.1