"Fossies" - the Fresh Open Source Software Archive

Member "citadel/parsedate.c" (5 Jun 2021, 69571 Bytes) of package /linux/www/citadel.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "parsedate.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 9.01_vs_902.

    1 /* A Bison parser, made by GNU Bison 3.0.4.  */
    2 
    3 /* Bison implementation for Yacc-like parsers in C
    4 
    5    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
    6 
    7    This program is free software: you can redistribute it and/or modify
    8    it under the terms of the GNU General Public License as published by
    9    the Free Software Foundation, either version 3 of the License, or
   10    (at your option) any later version.
   11 
   12    This program is distributed in the hope that it will be useful,
   13    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15    GNU General Public License for more details.
   16 
   17    You should have received a copy of the GNU General Public License
   18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   19 
   20 /* As a special exception, you may create a larger work that contains
   21    part or all of the Bison parser skeleton and distribute that work
   22    under terms of your choice, so long as that work isn't itself a
   23    parser generator using the skeleton or a modified version thereof
   24    as a parser skeleton.  Alternatively, if you modify or redistribute
   25    the parser skeleton itself, you may (at your option) remove this
   26    special exception, which will cause the skeleton and the resulting
   27    Bison output files to be licensed under the GNU General Public
   28    License without this special exception.
   29 
   30    This special exception was added by the Free Software Foundation in
   31    version 2.2 of Bison.  */
   32 
   33 /* C LALR(1) parser skeleton written by Richard Stallman, by
   34    simplifying the original so-called "semantic" parser.  */
   35 
   36 /* All symbols defined below should begin with yy or YY, to avoid
   37    infringing on user name space.  This should be done even for local
   38    variables, as they might otherwise be expanded by user macros.
   39    There are some unavoidable exceptions within include files to
   40    define necessary library symbols; they are noted "INFRINGES ON
   41    USER NAME SPACE" below.  */
   42 
   43 /* Identify Bison output.  */
   44 #define YYBISON 1
   45 
   46 /* Bison version.  */
   47 #define YYBISON_VERSION "3.0.4"
   48 
   49 /* Skeleton name.  */
   50 #define YYSKELETON_NAME "yacc.c"
   51 
   52 /* Pure parsers.  */
   53 #define YYPURE 0
   54 
   55 /* Push parsers.  */
   56 #define YYPUSH 0
   57 
   58 /* Pull parsers.  */
   59 #define YYPULL 1
   60 
   61 
   62 
   63 
   64 /* Copy the first part of user declarations.  */
   65 #line 1 "parsedate.y" /* yacc.c:339  */
   66 
   67 /* $Revision$
   68 **
   69 **  Originally written by Steven M. Bellovin <smb@research.att.com> while
   70 **  at the University of North Carolina at Chapel Hill.  Later tweaked by
   71 **  a couple of people on Usenet.  Completely overhauled by Rich $alz
   72 **  <rsalz@osf.org> and Jim Berets <jberets@bbn.com> in August, 1990.
   73 **  Further revised (removed obsolete constructs and cleaned up timezone
   74 **  names) in August, 1991, by Rich.  Paul Eggert <eggert@twinsun.com>
   75 **  helped in September, 1992.  Art Cancro <ajc@citadel.org> cleaned
   76 **  it up for ANSI C in December, 1999.
   77 **
   78 **  This grammar has six shift/reduce conflicts.
   79 **
   80 **  This code is in the public domain and has no copyright.
   81 */
   82 /* SUPPRESS 530 *//* Empty body for statement */
   83 /* SUPPRESS 593 on yyerrlab *//* Label was not used */
   84 /* SUPPRESS 593 on yynewstate *//* Label was not used */
   85 /* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
   86 
   87 #include "sysdep.h"
   88 
   89 #include <stdio.h>
   90 #include <stdlib.h>
   91 #include <sys/types.h>
   92 #include <ctype.h>
   93 #include <time.h>
   94 #if HAVE_STRING_H
   95 # if !STDC_HEADERS && HAVE_MEMORY_H
   96 #  include <memory.h>
   97 # endif
   98 # include <string.h>
   99 #endif
  100 #if HAVE_STRINGS_H
  101 # include <strings.h>
  102 #endif
  103 
  104 #include "parsedate.h"
  105 
  106 int date_lex(void);
  107 
  108 #define yyparse     date_parse
  109 #define yylex       date_lex
  110 #define yyerror     date_error
  111 
  112 
  113     /* See the LeapYears table in Convert. */
  114 #define EPOCH       1970
  115 #define END_OF_TIME 2038
  116     /* Constants for general time calculations. */
  117 #define DST_OFFSET  1
  118 #define SECSPERDAY  (24L * 60L * 60L)
  119     /* Readability for TABLE stuff. */
  120 #define HOUR(x)     (x * 60)
  121 
  122 #define LPAREN      '('
  123 #define RPAREN      ')'
  124 #define IS7BIT(x)   ((unsigned int)(x) < 0200)
  125 
  126 #define SIZEOF(array)   ((int)(sizeof array / sizeof array[0]))
  127 #define ENDOF(array)    (&array[SIZEOF(array)])
  128 
  129 
  130 /*
  131 **  An entry in the lexical lookup table.
  132 */
  133 typedef struct _TABLE {
  134     char    *name;
  135     int     type;
  136     time_t  value;
  137 } TABLE;
  138 
  139 /*
  140 **  Daylight-savings mode:  on, off, or not yet known.
  141 */
  142 typedef enum _DSTMODE {
  143     DSTon, DSToff, DSTmaybe
  144 } DSTMODE;
  145 
  146 /*
  147 **  Meridian:  am, pm, or 24-hour style.
  148 */
  149 typedef enum _MERIDIAN {
  150     MERam, MERpm, MER24
  151 } MERIDIAN;
  152 
  153 
  154 /*
  155 **  Global variables.  We could get rid of most of them by using a yacc
  156 **  union, but this is more efficient.  (This routine predates the
  157 **  yacc %union construct.)
  158 */
  159 static const char   *yyInput;
  160 static DSTMODE  yyDSTmode;
  161 static int  yyHaveDate;
  162 static int  yyHaveRel;
  163 static int  yyHaveTime;
  164 static time_t   yyTimezone;
  165 static time_t   yyDay;
  166 static time_t   yyHour;
  167 static time_t   yyMinutes;
  168 static time_t   yyMonth;
  169 static time_t   yySeconds;
  170 static time_t   yyYear;
  171 static MERIDIAN yyMeridian;
  172 static time_t   yyRelMonth;
  173 static time_t   yyRelSeconds;
  174 
  175 
  176 static void     date_error(char *);
  177 
  178 #line 179 "y.tab.c" /* yacc.c:339  */
  179 
  180 # ifndef YY_NULLPTR
  181 #  if defined __cplusplus && 201103L <= __cplusplus
  182 #   define YY_NULLPTR nullptr
  183 #  else
  184 #   define YY_NULLPTR 0
  185 #  endif
  186 # endif
  187 
  188 /* Enabling verbose error messages.  */
  189 #ifdef YYERROR_VERBOSE
  190 # undef YYERROR_VERBOSE
  191 # define YYERROR_VERBOSE 1
  192 #else
  193 # define YYERROR_VERBOSE 0
  194 #endif
  195 
  196 
  197 /* Debug traces.  */
  198 #ifndef YYDEBUG
  199 # define YYDEBUG 0
  200 #endif
  201 #if YYDEBUG
  202 extern int yydebug;
  203 #endif
  204 
  205 /* Token type.  */
  206 #ifndef YYTOKENTYPE
  207 # define YYTOKENTYPE
  208   enum yytokentype
  209   {
  210     tDAY = 258,
  211     tDAYZONE = 259,
  212     tMERIDIAN = 260,
  213     tMONTH = 261,
  214     tMONTH_UNIT = 262,
  215     tSEC_UNIT = 263,
  216     tSNUMBER = 264,
  217     tUNUMBER = 265,
  218     tZONE = 266
  219   };
  220 #endif
  221 /* Tokens.  */
  222 #define tDAY 258
  223 #define tDAYZONE 259
  224 #define tMERIDIAN 260
  225 #define tMONTH 261
  226 #define tMONTH_UNIT 262
  227 #define tSEC_UNIT 263
  228 #define tSNUMBER 264
  229 #define tUNUMBER 265
  230 #define tZONE 266
  231 
  232 /* Value type.  */
  233 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  234 
  235 union YYSTYPE
  236 {
  237 #line 114 "parsedate.y" /* yacc.c:355  */
  238 
  239     time_t      Number;
  240     enum _MERIDIAN  Meridian;
  241 
  242 #line 243 "y.tab.c" /* yacc.c:355  */
  243 };
  244 
  245 typedef union YYSTYPE YYSTYPE;
  246 # define YYSTYPE_IS_TRIVIAL 1
  247 # define YYSTYPE_IS_DECLARED 1
  248 #endif
  249 
  250 
  251 extern YYSTYPE yylval;
  252 
  253 int yyparse (void);
  254 
  255 
  256 
  257 /* Copy the second part of user declarations.  */
  258 
  259 #line 260 "y.tab.c" /* yacc.c:358  */
  260 
  261 #ifdef short
  262 # undef short
  263 #endif
  264 
  265 #ifdef YYTYPE_UINT8
  266 typedef YYTYPE_UINT8 yytype_uint8;
  267 #else
  268 typedef unsigned char yytype_uint8;
  269 #endif
  270 
  271 #ifdef YYTYPE_INT8
  272 typedef YYTYPE_INT8 yytype_int8;
  273 #else
  274 typedef signed char yytype_int8;
  275 #endif
  276 
  277 #ifdef YYTYPE_UINT16
  278 typedef YYTYPE_UINT16 yytype_uint16;
  279 #else
  280 typedef unsigned short int yytype_uint16;
  281 #endif
  282 
  283 #ifdef YYTYPE_INT16
  284 typedef YYTYPE_INT16 yytype_int16;
  285 #else
  286 typedef short int yytype_int16;
  287 #endif
  288 
  289 #ifndef YYSIZE_T
  290 # ifdef __SIZE_TYPE__
  291 #  define YYSIZE_T __SIZE_TYPE__
  292 # elif defined size_t
  293 #  define YYSIZE_T size_t
  294 # elif ! defined YYSIZE_T
  295 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  296 #  define YYSIZE_T size_t
  297 # else
  298 #  define YYSIZE_T unsigned int
  299 # endif
  300 #endif
  301 
  302 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  303 
  304 #ifndef YY_
  305 # if defined YYENABLE_NLS && YYENABLE_NLS
  306 #  if ENABLE_NLS
  307 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  308 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  309 #  endif
  310 # endif
  311 # ifndef YY_
  312 #  define YY_(Msgid) Msgid
  313 # endif
  314 #endif
  315 
  316 #ifndef YY_ATTRIBUTE
  317 # if (defined __GNUC__                                               \
  318       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
  319      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  320 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  321 # else
  322 #  define YY_ATTRIBUTE(Spec) /* empty */
  323 # endif
  324 #endif
  325 
  326 #ifndef YY_ATTRIBUTE_PURE
  327 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
  328 #endif
  329 
  330 #ifndef YY_ATTRIBUTE_UNUSED
  331 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  332 #endif
  333 
  334 #if !defined _Noreturn \
  335      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  336 # if defined _MSC_VER && 1200 <= _MSC_VER
  337 #  define _Noreturn __declspec (noreturn)
  338 # else
  339 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  340 # endif
  341 #endif
  342 
  343 /* Suppress unused-variable warnings by "using" E.  */
  344 #if ! defined lint || defined __GNUC__
  345 # define YYUSE(E) ((void) (E))
  346 #else
  347 # define YYUSE(E) /* empty */
  348 #endif
  349 
  350 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  351 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
  352 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  353     _Pragma ("GCC diagnostic push") \
  354     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  355     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  356 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  357     _Pragma ("GCC diagnostic pop")
  358 #else
  359 # define YY_INITIAL_VALUE(Value) Value
  360 #endif
  361 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  362 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  363 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  364 #endif
  365 #ifndef YY_INITIAL_VALUE
  366 # define YY_INITIAL_VALUE(Value) /* Nothing. */
  367 #endif
  368 
  369 
  370 #if ! defined yyoverflow || YYERROR_VERBOSE
  371 
  372 /* The parser invokes alloca or malloc; define the necessary symbols.  */
  373 
  374 # ifdef YYSTACK_USE_ALLOCA
  375 #  if YYSTACK_USE_ALLOCA
  376 #   ifdef __GNUC__
  377 #    define YYSTACK_ALLOC __builtin_alloca
  378 #   elif defined __BUILTIN_VA_ARG_INCR
  379 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  380 #   elif defined _AIX
  381 #    define YYSTACK_ALLOC __alloca
  382 #   elif defined _MSC_VER
  383 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  384 #    define alloca _alloca
  385 #   else
  386 #    define YYSTACK_ALLOC alloca
  387 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  388 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  389       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
  390 #     ifndef EXIT_SUCCESS
  391 #      define EXIT_SUCCESS 0
  392 #     endif
  393 #    endif
  394 #   endif
  395 #  endif
  396 # endif
  397 
  398 # ifdef YYSTACK_ALLOC
  399    /* Pacify GCC's 'empty if-body' warning.  */
  400 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  401 #  ifndef YYSTACK_ALLOC_MAXIMUM
  402     /* The OS might guarantee only one guard page at the bottom of the stack,
  403        and a page size can be as small as 4096 bytes.  So we cannot safely
  404        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
  405        to allow for a few compiler-allocated temporary stack slots.  */
  406 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  407 #  endif
  408 # else
  409 #  define YYSTACK_ALLOC YYMALLOC
  410 #  define YYSTACK_FREE YYFREE
  411 #  ifndef YYSTACK_ALLOC_MAXIMUM
  412 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  413 #  endif
  414 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
  415        && ! ((defined YYMALLOC || defined malloc) \
  416              && (defined YYFREE || defined free)))
  417 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  418 #   ifndef EXIT_SUCCESS
  419 #    define EXIT_SUCCESS 0
  420 #   endif
  421 #  endif
  422 #  ifndef YYMALLOC
  423 #   define YYMALLOC malloc
  424 #   if ! defined malloc && ! defined EXIT_SUCCESS
  425 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  426 #   endif
  427 #  endif
  428 #  ifndef YYFREE
  429 #   define YYFREE free
  430 #   if ! defined free && ! defined EXIT_SUCCESS
  431 void free (void *); /* INFRINGES ON USER NAME SPACE */
  432 #   endif
  433 #  endif
  434 # endif
  435 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  436 
  437 
  438 #if (! defined yyoverflow \
  439      && (! defined __cplusplus \
  440          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  441 
  442 /* A type that is properly aligned for any stack member.  */
  443 union yyalloc
  444 {
  445   yytype_int16 yyss_alloc;
  446   YYSTYPE yyvs_alloc;
  447 };
  448 
  449 /* The size of the maximum gap between one aligned stack and the next.  */
  450 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  451 
  452 /* The size of an array large to enough to hold all stacks, each with
  453    N elements.  */
  454 # define YYSTACK_BYTES(N) \
  455      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  456       + YYSTACK_GAP_MAXIMUM)
  457 
  458 # define YYCOPY_NEEDED 1
  459 
  460 /* Relocate STACK from its old location to the new one.  The
  461    local variables YYSIZE and YYSTACKSIZE give the old and new number of
  462    elements in the stack, and YYPTR gives the new location of the
  463    stack.  Advance YYPTR to a properly aligned location for the next
  464    stack.  */
  465 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
  466     do                                                                  \
  467       {                                                                 \
  468         YYSIZE_T yynewbytes;                                            \
  469         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
  470         Stack = &yyptr->Stack_alloc;                                    \
  471         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  472         yyptr += yynewbytes / sizeof (*yyptr);                          \
  473       }                                                                 \
  474     while (0)
  475 
  476 #endif
  477 
  478 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  479 /* Copy COUNT objects from SRC to DST.  The source and destination do
  480    not overlap.  */
  481 # ifndef YYCOPY
  482 #  if defined __GNUC__ && 1 < __GNUC__
  483 #   define YYCOPY(Dst, Src, Count) \
  484       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  485 #  else
  486 #   define YYCOPY(Dst, Src, Count)              \
  487       do                                        \
  488         {                                       \
  489           YYSIZE_T yyi;                         \
  490           for (yyi = 0; yyi < (Count); yyi++)   \
  491             (Dst)[yyi] = (Src)[yyi];            \
  492         }                                       \
  493       while (0)
  494 #  endif
  495 # endif
  496 #endif /* !YYCOPY_NEEDED */
  497 
  498 /* YYFINAL -- State number of the termination state.  */
  499 #define YYFINAL  2
  500 /* YYLAST -- Last index in YYTABLE.  */
  501 #define YYLAST   40
  502 
  503 /* YYNTOKENS -- Number of terminals.  */
  504 #define YYNTOKENS  15
  505 /* YYNNTS -- Number of nonterminals.  */
  506 #define YYNNTS  9
  507 /* YYNRULES -- Number of rules.  */
  508 #define YYNRULES  30
  509 /* YYNSTATES -- Number of states.  */
  510 #define YYNSTATES  44
  511 
  512 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
  513    by yylex, with out-of-bounds checking.  */
  514 #define YYUNDEFTOK  2
  515 #define YYMAXUTOK   266
  516 
  517 #define YYTRANSLATE(YYX)                                                \
  518   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  519 
  520 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  521    as returned by yylex, without out-of-bounds checking.  */
  522 static const yytype_uint8 yytranslate[] =
  523 {
  524        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  525        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  526        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  527        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  528        2,     2,     2,     2,    14,     2,     2,    13,     2,     2,
  529        2,     2,     2,     2,     2,     2,     2,     2,    12,     2,
  530        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  531        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  532        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  533        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  534        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  535        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  536        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  537        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  538        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  539        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  540        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  541        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  542        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  543        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  544        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  545        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  546        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  547        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  548        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  549        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
  550        5,     6,     7,     8,     9,    10,    11
  551 };
  552 
  553 #if YYDEBUG
  554   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
  555 static const yytype_uint16 yyrline[] =
  556 {
  557        0,   128,   128,   129,   132,   141,   145,   148,   153,   165,
  558      171,   178,   184,   194,   198,   202,   210,   216,   237,   241,
  559      253,   257,   262,   266,   271,   278,   281,   284,   287,   292,
  560      295
  561 };
  562 #endif
  563 
  564 #if YYDEBUG || YYERROR_VERBOSE || 0
  565 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  566    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
  567 static const char *const yytname[] =
  568 {
  569   "$end", "error", "$undefined", "tDAY", "tDAYZONE", "tMERIDIAN",
  570   "tMONTH", "tMONTH_UNIT", "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE",
  571   "':'", "'/'", "','", "$accept", "spec", "item", "time", "zone",
  572   "numzone", "date", "rel", "o_merid", YY_NULLPTR
  573 };
  574 #endif
  575 
  576 # ifdef YYPRINT
  577 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  578    (internal) symbol number NUM (which must be that of a token).  */
  579 static const yytype_uint16 yytoknum[] =
  580 {
  581        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
  582      265,   266,    58,    47,    44
  583 };
  584 # endif
  585 
  586 #define YYPACT_NINF -29
  587 
  588 #define yypact_value_is_default(Yystate) \
  589   (!!((Yystate) == (-29)))
  590 
  591 #define YYTABLE_NINF -1
  592 
  593 #define yytable_value_is_error(Yytable_value) \
  594   0
  595 
  596   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  597      STATE-NUM.  */
  598 static const yytype_int8 yypact[] =
  599 {
  600      -29,     1,   -29,   -11,    11,    20,    12,   -29,     4,   -29,
  601      -29,    13,    16,   -29,   -29,   -29,    21,   -29,   -29,    22,
  602       23,   -29,   -29,   -29,     5,   -29,   -29,    28,    25,   -29,
  603       17,    24,   -29,    26,   -29,    29,   -29,   -29,    30,   -29,
  604        0,   -29,   -29,   -29
  605 };
  606 
  607   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  608      Performed when YYTABLE does not specify something else to do.  Zero
  609      means the default is an error.  */
  610 static const yytype_uint8 yydefact[] =
  611 {
  612        2,     0,     1,     0,     0,     0,    29,     3,     4,     6,
  613        7,     0,    20,    27,    25,    30,    22,    28,    26,     0,
  614        0,     8,    14,    17,    13,     5,    16,     0,     0,    23,
  615       29,    18,    15,     0,    21,     0,    10,     9,     0,    24,
  616       29,    19,    12,    11
  617 };
  618 
  619   /* YYPGOTO[NTERM-NUM].  */
  620 static const yytype_int8 yypgoto[] =
  621 {
  622      -29,   -29,   -29,   -29,   -29,   -24,   -29,   -29,   -28
  623 };
  624 
  625   /* YYDEFGOTO[NTERM-NUM].  */
  626 static const yytype_int8 yydefgoto[] =
  627 {
  628       -1,     1,     7,     8,    25,    26,     9,    10,    21
  629 };
  630 
  631   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
  632      positive, shift that token.  If negative, reduce the rule whose
  633      number is the opposite.  If YYTABLE_NINF, syntax error.  */
  634 static const yytype_uint8 yytable[] =
  635 {
  636       32,     2,    37,    11,     3,    15,    36,     4,    22,    23,
  637        5,     6,    43,    23,    23,    24,    42,    15,    16,    17,
  638       18,    12,    15,    27,    19,    20,    23,    13,    14,    35,
  639       28,    29,    30,    31,    33,    34,    39,    38,     0,    40,
  640       41
  641 };
  642 
  643 static const yytype_int8 yycheck[] =
  644 {
  645       24,     0,    30,    14,     3,     5,    30,     6,     4,     9,
  646        9,    10,    40,     9,     9,    11,    40,     5,     6,     7,
  647        8,    10,     5,    10,    12,    13,     9,     7,     8,    12,
  648       14,    10,    10,    10,     6,    10,    10,    13,    -1,    10,
  649       10
  650 };
  651 
  652   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  653      symbol of state STATE-NUM.  */
  654 static const yytype_uint8 yystos[] =
  655 {
  656        0,    16,     0,     3,     6,     9,    10,    17,    18,    21,
  657       22,    14,    10,     7,     8,     5,     6,     7,     8,    12,
  658       13,    23,     4,     9,    11,    19,    20,    10,    14,    10,
  659       10,    10,    20,     6,    10,    12,    20,    23,    13,    10,
  660       10,    10,    20,    23
  661 };
  662 
  663   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  664 static const yytype_uint8 yyr1[] =
  665 {
  666        0,    15,    16,    16,    17,    17,    17,    17,    18,    18,
  667       18,    18,    18,    19,    19,    19,    19,    20,    21,    21,
  668       21,    21,    21,    21,    21,    22,    22,    22,    22,    23,
  669       23
  670 };
  671 
  672   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
  673 static const yytype_uint8 yyr2[] =
  674 {
  675        0,     2,     0,     2,     1,     2,     1,     1,     2,     4,
  676        4,     6,     6,     1,     1,     2,     1,     1,     3,     5,
  677        2,     4,     2,     3,     5,     2,     2,     2,     2,     0,
  678        1
  679 };
  680 
  681 
  682 #define yyerrok         (yyerrstatus = 0)
  683 #define yyclearin       (yychar = YYEMPTY)
  684 #define YYEMPTY         (-2)
  685 #define YYEOF           0
  686 
  687 #define YYACCEPT        goto yyacceptlab
  688 #define YYABORT         goto yyabortlab
  689 #define YYERROR         goto yyerrorlab
  690 
  691 
  692 #define YYRECOVERING()  (!!yyerrstatus)
  693 
  694 #define YYBACKUP(Token, Value)                                  \
  695 do                                                              \
  696   if (yychar == YYEMPTY)                                        \
  697     {                                                           \
  698       yychar = (Token);                                         \
  699       yylval = (Value);                                         \
  700       YYPOPSTACK (yylen);                                       \
  701       yystate = *yyssp;                                         \
  702       goto yybackup;                                            \
  703     }                                                           \
  704   else                                                          \
  705     {                                                           \
  706       yyerror (YY_("syntax error: cannot back up")); \
  707       YYERROR;                                                  \
  708     }                                                           \
  709 while (0)
  710 
  711 /* Error token number */
  712 #define YYTERROR        1
  713 #define YYERRCODE       256
  714 
  715 
  716 
  717 /* Enable debugging if requested.  */
  718 #if YYDEBUG
  719 
  720 # ifndef YYFPRINTF
  721 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  722 #  define YYFPRINTF fprintf
  723 # endif
  724 
  725 # define YYDPRINTF(Args)                        \
  726 do {                                            \
  727   if (yydebug)                                  \
  728     YYFPRINTF Args;                             \
  729 } while (0)
  730 
  731 /* This macro is provided for backward compatibility. */
  732 #ifndef YY_LOCATION_PRINT
  733 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  734 #endif
  735 
  736 
  737 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
  738 do {                                                                      \
  739   if (yydebug)                                                            \
  740     {                                                                     \
  741       YYFPRINTF (stderr, "%s ", Title);                                   \
  742       yy_symbol_print (stderr,                                            \
  743                   Type, Value); \
  744       YYFPRINTF (stderr, "\n");                                           \
  745     }                                                                     \
  746 } while (0)
  747 
  748 
  749 /*----------------------------------------.
  750 | Print this symbol's value on YYOUTPUT.  |
  751 `----------------------------------------*/
  752 
  753 static void
  754 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  755 {
  756   FILE *yyo = yyoutput;
  757   YYUSE (yyo);
  758   if (!yyvaluep)
  759     return;
  760 # ifdef YYPRINT
  761   if (yytype < YYNTOKENS)
  762     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  763 # endif
  764   YYUSE (yytype);
  765 }
  766 
  767 
  768 /*--------------------------------.
  769 | Print this symbol on YYOUTPUT.  |
  770 `--------------------------------*/
  771 
  772 static void
  773 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  774 {
  775   YYFPRINTF (yyoutput, "%s %s (",
  776              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  777 
  778   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  779   YYFPRINTF (yyoutput, ")");
  780 }
  781 
  782 /*------------------------------------------------------------------.
  783 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  784 | TOP (included).                                                   |
  785 `------------------------------------------------------------------*/
  786 
  787 static void
  788 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  789 {
  790   YYFPRINTF (stderr, "Stack now");
  791   for (; yybottom <= yytop; yybottom++)
  792     {
  793       int yybot = *yybottom;
  794       YYFPRINTF (stderr, " %d", yybot);
  795     }
  796   YYFPRINTF (stderr, "\n");
  797 }
  798 
  799 # define YY_STACK_PRINT(Bottom, Top)                            \
  800 do {                                                            \
  801   if (yydebug)                                                  \
  802     yy_stack_print ((Bottom), (Top));                           \
  803 } while (0)
  804 
  805 
  806 /*------------------------------------------------.
  807 | Report that the YYRULE is going to be reduced.  |
  808 `------------------------------------------------*/
  809 
  810 static void
  811 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
  812 {
  813   unsigned long int yylno = yyrline[yyrule];
  814   int yynrhs = yyr2[yyrule];
  815   int yyi;
  816   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  817              yyrule - 1, yylno);
  818   /* The symbols being reduced.  */
  819   for (yyi = 0; yyi < yynrhs; yyi++)
  820     {
  821       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
  822       yy_symbol_print (stderr,
  823                        yystos[yyssp[yyi + 1 - yynrhs]],
  824                        &(yyvsp[(yyi + 1) - (yynrhs)])
  825                                               );
  826       YYFPRINTF (stderr, "\n");
  827     }
  828 }
  829 
  830 # define YY_REDUCE_PRINT(Rule)          \
  831 do {                                    \
  832   if (yydebug)                          \
  833     yy_reduce_print (yyssp, yyvsp, Rule); \
  834 } while (0)
  835 
  836 /* Nonzero means print parse trace.  It is left uninitialized so that
  837    multiple parsers can coexist.  */
  838 int yydebug;
  839 #else /* !YYDEBUG */
  840 # define YYDPRINTF(Args)
  841 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  842 # define YY_STACK_PRINT(Bottom, Top)
  843 # define YY_REDUCE_PRINT(Rule)
  844 #endif /* !YYDEBUG */
  845 
  846 
  847 /* YYINITDEPTH -- initial size of the parser's stacks.  */
  848 #ifndef YYINITDEPTH
  849 # define YYINITDEPTH 200
  850 #endif
  851 
  852 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  853    if the built-in stack extension method is used).
  854 
  855    Do not make this value too large; the results are undefined if
  856    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  857    evaluated with infinite-precision integer arithmetic.  */
  858 
  859 #ifndef YYMAXDEPTH
  860 # define YYMAXDEPTH 10000
  861 #endif
  862 
  863 
  864 #if YYERROR_VERBOSE
  865 
  866 # ifndef yystrlen
  867 #  if defined __GLIBC__ && defined _STRING_H
  868 #   define yystrlen strlen
  869 #  else
  870 /* Return the length of YYSTR.  */
  871 static YYSIZE_T
  872 yystrlen (const char *yystr)
  873 {
  874   YYSIZE_T yylen;
  875   for (yylen = 0; yystr[yylen]; yylen++)
  876     continue;
  877   return yylen;
  878 }
  879 #  endif
  880 # endif
  881 
  882 # ifndef yystpcpy
  883 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  884 #   define yystpcpy stpcpy
  885 #  else
  886 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  887    YYDEST.  */
  888 static char *
  889 yystpcpy (char *yydest, const char *yysrc)
  890 {
  891   char *yyd = yydest;
  892   const char *yys = yysrc;
  893 
  894   while ((*yyd++ = *yys++) != '\0')
  895     continue;
  896 
  897   return yyd - 1;
  898 }
  899 #  endif
  900 # endif
  901 
  902 # ifndef yytnamerr
  903 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  904    quotes and backslashes, so that it's suitable for yyerror.  The
  905    heuristic is that double-quoting is unnecessary unless the string
  906    contains an apostrophe, a comma, or backslash (other than
  907    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
  908    null, do not copy; instead, return the length of what the result
  909    would have been.  */
  910 static YYSIZE_T
  911 yytnamerr (char *yyres, const char *yystr)
  912 {
  913   if (*yystr == '"')
  914     {
  915       YYSIZE_T yyn = 0;
  916       char const *yyp = yystr;
  917 
  918       for (;;)
  919         switch (*++yyp)
  920           {
  921           case '\'':
  922           case ',':
  923             goto do_not_strip_quotes;
  924 
  925           case '\\':
  926             if (*++yyp != '\\')
  927               goto do_not_strip_quotes;
  928             /* Fall through.  */
  929           default:
  930             if (yyres)
  931               yyres[yyn] = *yyp;
  932             yyn++;
  933             break;
  934 
  935           case '"':
  936             if (yyres)
  937               yyres[yyn] = '\0';
  938             return yyn;
  939           }
  940     do_not_strip_quotes: ;
  941     }
  942 
  943   if (! yyres)
  944     return yystrlen (yystr);
  945 
  946   return yystpcpy (yyres, yystr) - yyres;
  947 }
  948 # endif
  949 
  950 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  951    about the unexpected token YYTOKEN for the state stack whose top is
  952    YYSSP.
  953 
  954    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
  955    not large enough to hold the message.  In that case, also set
  956    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
  957    required number of bytes is too large to store.  */
  958 static int
  959 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  960                 yytype_int16 *yyssp, int yytoken)
  961 {
  962   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  963   YYSIZE_T yysize = yysize0;
  964   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  965   /* Internationalized format string. */
  966   const char *yyformat = YY_NULLPTR;
  967   /* Arguments of yyformat. */
  968   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  969   /* Number of reported tokens (one for the "unexpected", one per
  970      "expected"). */
  971   int yycount = 0;
  972 
  973   /* There are many possibilities here to consider:
  974      - If this state is a consistent state with a default action, then
  975        the only way this function was invoked is if the default action
  976        is an error action.  In that case, don't check for expected
  977        tokens because there are none.
  978      - The only way there can be no lookahead present (in yychar) is if
  979        this state is a consistent state with a default action.  Thus,
  980        detecting the absence of a lookahead is sufficient to determine
  981        that there is no unexpected or expected token to report.  In that
  982        case, just report a simple "syntax error".
  983      - Don't assume there isn't a lookahead just because this state is a
  984        consistent state with a default action.  There might have been a
  985        previous inconsistent state, consistent state with a non-default
  986        action, or user semantic action that manipulated yychar.
  987      - Of course, the expected token list depends on states to have
  988        correct lookahead information, and it depends on the parser not
  989        to perform extra reductions after fetching a lookahead from the
  990        scanner and before detecting a syntax error.  Thus, state merging
  991        (from LALR or IELR) and default reductions corrupt the expected
  992        token list.  However, the list is correct for canonical LR with
  993        one exception: it will still contain any token that will not be
  994        accepted due to an error action in a later state.
  995   */
  996   if (yytoken != YYEMPTY)
  997     {
  998       int yyn = yypact[*yyssp];
  999       yyarg[yycount++] = yytname[yytoken];
 1000       if (!yypact_value_is_default (yyn))
 1001         {
 1002           /* Start YYX at -YYN if negative to avoid negative indexes in
 1003              YYCHECK.  In other words, skip the first -YYN actions for
 1004              this state because they are default actions.  */
 1005           int yyxbegin = yyn < 0 ? -yyn : 0;
 1006           /* Stay within bounds of both yycheck and yytname.  */
 1007           int yychecklim = YYLAST - yyn + 1;
 1008           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
 1009           int yyx;
 1010 
 1011           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 1012             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
 1013                 && !yytable_value_is_error (yytable[yyx + yyn]))
 1014               {
 1015                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
 1016                   {
 1017                     yycount = 1;
 1018                     yysize = yysize0;
 1019                     break;
 1020                   }
 1021                 yyarg[yycount++] = yytname[yyx];
 1022                 {
 1023                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
 1024                   if (! (yysize <= yysize1
 1025                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
 1026                     return 2;
 1027                   yysize = yysize1;
 1028                 }
 1029               }
 1030         }
 1031     }
 1032 
 1033   switch (yycount)
 1034     {
 1035 # define YYCASE_(N, S)                      \
 1036       case N:                               \
 1037         yyformat = S;                       \
 1038       break
 1039       YYCASE_(0, YY_("syntax error"));
 1040       YYCASE_(1, YY_("syntax error, unexpected %s"));
 1041       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
 1042       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
 1043       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
 1044       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
 1045 # undef YYCASE_
 1046     }
 1047 
 1048   {
 1049     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
 1050     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
 1051       return 2;
 1052     yysize = yysize1;
 1053   }
 1054 
 1055   if (*yymsg_alloc < yysize)
 1056     {
 1057       *yymsg_alloc = 2 * yysize;
 1058       if (! (yysize <= *yymsg_alloc
 1059              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
 1060         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
 1061       return 1;
 1062     }
 1063 
 1064   /* Avoid sprintf, as that infringes on the user's name space.
 1065      Don't have undefined behavior even if the translation
 1066      produced a string with the wrong number of "%s"s.  */
 1067   {
 1068     char *yyp = *yymsg;
 1069     int yyi = 0;
 1070     while ((*yyp = *yyformat) != '\0')
 1071       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
 1072         {
 1073           yyp += yytnamerr (yyp, yyarg[yyi++]);
 1074           yyformat += 2;
 1075         }
 1076       else
 1077         {
 1078           yyp++;
 1079           yyformat++;
 1080         }
 1081   }
 1082   return 0;
 1083 }
 1084 #endif /* YYERROR_VERBOSE */
 1085 
 1086 /*-----------------------------------------------.
 1087 | Release the memory associated to this symbol.  |
 1088 `-----------------------------------------------*/
 1089 
 1090 static void
 1091 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
 1092 {
 1093   YYUSE (yyvaluep);
 1094   if (!yymsg)
 1095     yymsg = "Deleting";
 1096   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 1097 
 1098   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 1099   YYUSE (yytype);
 1100   YY_IGNORE_MAYBE_UNINITIALIZED_END
 1101 }
 1102 
 1103 
 1104 
 1105 
 1106 /* The lookahead symbol.  */
 1107 int yychar;
 1108 
 1109 /* The semantic value of the lookahead symbol.  */
 1110 YYSTYPE yylval;
 1111 /* Number of syntax errors so far.  */
 1112 int yynerrs;
 1113 
 1114 
 1115 /*----------.
 1116 | yyparse.  |
 1117 `----------*/
 1118 
 1119 int
 1120 yyparse (void)
 1121 {
 1122     int yystate;
 1123     /* Number of tokens to shift before error messages enabled.  */
 1124     int yyerrstatus;
 1125 
 1126     /* The stacks and their tools:
 1127        'yyss': related to states.
 1128        'yyvs': related to semantic values.
 1129 
 1130        Refer to the stacks through separate pointers, to allow yyoverflow
 1131        to reallocate them elsewhere.  */
 1132 
 1133     /* The state stack.  */
 1134     yytype_int16 yyssa[YYINITDEPTH];
 1135     yytype_int16 *yyss;
 1136     yytype_int16 *yyssp;
 1137 
 1138     /* The semantic value stack.  */
 1139     YYSTYPE yyvsa[YYINITDEPTH];
 1140     YYSTYPE *yyvs;
 1141     YYSTYPE *yyvsp;
 1142 
 1143     YYSIZE_T yystacksize;
 1144 
 1145   int yyn;
 1146   int yyresult;
 1147   /* Lookahead token as an internal (translated) token number.  */
 1148   int yytoken = 0;
 1149   /* The variables used to return semantic value and location from the
 1150      action routines.  */
 1151   YYSTYPE yyval;
 1152 
 1153 #if YYERROR_VERBOSE
 1154   /* Buffer for error messages, and its allocated size.  */
 1155   char yymsgbuf[128];
 1156   char *yymsg = yymsgbuf;
 1157   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 1158 #endif
 1159 
 1160 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 1161 
 1162   /* The number of symbols on the RHS of the reduced rule.
 1163      Keep to zero when no symbol should be popped.  */
 1164   int yylen = 0;
 1165 
 1166   yyssp = yyss = yyssa;
 1167   yyvsp = yyvs = yyvsa;
 1168   yystacksize = YYINITDEPTH;
 1169 
 1170   YYDPRINTF ((stderr, "Starting parse\n"));
 1171 
 1172   yystate = 0;
 1173   yyerrstatus = 0;
 1174   yynerrs = 0;
 1175   yychar = YYEMPTY; /* Cause a token to be read.  */
 1176   goto yysetstate;
 1177 
 1178 /*------------------------------------------------------------.
 1179 | yynewstate -- Push a new state, which is found in yystate.  |
 1180 `------------------------------------------------------------*/
 1181  yynewstate:
 1182   /* In all cases, when you get here, the value and location stacks
 1183      have just been pushed.  So pushing a state here evens the stacks.  */
 1184   yyssp++;
 1185 
 1186  yysetstate:
 1187   *yyssp = yystate;
 1188 
 1189   if (yyss + yystacksize - 1 <= yyssp)
 1190     {
 1191       /* Get the current used size of the three stacks, in elements.  */
 1192       YYSIZE_T yysize = yyssp - yyss + 1;
 1193 
 1194 #ifdef yyoverflow
 1195       {
 1196         /* Give user a chance to reallocate the stack.  Use copies of
 1197            these so that the &'s don't force the real ones into
 1198            memory.  */
 1199         YYSTYPE *yyvs1 = yyvs;
 1200         yytype_int16 *yyss1 = yyss;
 1201 
 1202         /* Each stack pointer address is followed by the size of the
 1203            data in use in that stack, in bytes.  This used to be a
 1204            conditional around just the two extra args, but that might
 1205            be undefined if yyoverflow is a macro.  */
 1206         yyoverflow (YY_("memory exhausted"),
 1207                     &yyss1, yysize * sizeof (*yyssp),
 1208                     &yyvs1, yysize * sizeof (*yyvsp),
 1209                     &yystacksize);
 1210 
 1211         yyss = yyss1;
 1212         yyvs = yyvs1;
 1213       }
 1214 #else /* no yyoverflow */
 1215 # ifndef YYSTACK_RELOCATE
 1216       goto yyexhaustedlab;
 1217 # else
 1218       /* Extend the stack our own way.  */
 1219       if (YYMAXDEPTH <= yystacksize)
 1220         goto yyexhaustedlab;
 1221       yystacksize *= 2;
 1222       if (YYMAXDEPTH < yystacksize)
 1223         yystacksize = YYMAXDEPTH;
 1224 
 1225       {
 1226         yytype_int16 *yyss1 = yyss;
 1227         union yyalloc *yyptr =
 1228           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 1229         if (! yyptr)
 1230           goto yyexhaustedlab;
 1231         YYSTACK_RELOCATE (yyss_alloc, yyss);
 1232         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 1233 #  undef YYSTACK_RELOCATE
 1234         if (yyss1 != yyssa)
 1235           YYSTACK_FREE (yyss1);
 1236       }
 1237 # endif
 1238 #endif /* no yyoverflow */
 1239 
 1240       yyssp = yyss + yysize - 1;
 1241       yyvsp = yyvs + yysize - 1;
 1242 
 1243       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 1244                   (unsigned long int) yystacksize));
 1245 
 1246       if (yyss + yystacksize - 1 <= yyssp)
 1247         YYABORT;
 1248     }
 1249 
 1250   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 1251 
 1252   if (yystate == YYFINAL)
 1253     YYACCEPT;
 1254 
 1255   goto yybackup;
 1256 
 1257 /*-----------.
 1258 | yybackup.  |
 1259 `-----------*/
 1260 yybackup:
 1261 
 1262   /* Do appropriate processing given the current state.  Read a
 1263      lookahead token if we need one and don't already have one.  */
 1264 
 1265   /* First try to decide what to do without reference to lookahead token.  */
 1266   yyn = yypact[yystate];
 1267   if (yypact_value_is_default (yyn))
 1268     goto yydefault;
 1269 
 1270   /* Not known => get a lookahead token if don't already have one.  */
 1271 
 1272   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 1273   if (yychar == YYEMPTY)
 1274     {
 1275       YYDPRINTF ((stderr, "Reading a token: "));
 1276       yychar = yylex ();
 1277     }
 1278 
 1279   if (yychar <= YYEOF)
 1280     {
 1281       yychar = yytoken = YYEOF;
 1282       YYDPRINTF ((stderr, "Now at end of input.\n"));
 1283     }
 1284   else
 1285     {
 1286       yytoken = YYTRANSLATE (yychar);
 1287       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
 1288     }
 1289 
 1290   /* If the proper action on seeing token YYTOKEN is to reduce or to
 1291      detect an error, take that action.  */
 1292   yyn += yytoken;
 1293   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 1294     goto yydefault;
 1295   yyn = yytable[yyn];
 1296   if (yyn <= 0)
 1297     {
 1298       if (yytable_value_is_error (yyn))
 1299         goto yyerrlab;
 1300       yyn = -yyn;
 1301       goto yyreduce;
 1302     }
 1303 
 1304   /* Count tokens shifted since error; after three, turn off error
 1305      status.  */
 1306   if (yyerrstatus)
 1307     yyerrstatus--;
 1308 
 1309   /* Shift the lookahead token.  */
 1310   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 1311 
 1312   /* Discard the shifted token.  */
 1313   yychar = YYEMPTY;
 1314 
 1315   yystate = yyn;
 1316   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 1317   *++yyvsp = yylval;
 1318   YY_IGNORE_MAYBE_UNINITIALIZED_END
 1319 
 1320   goto yynewstate;
 1321 
 1322 
 1323 /*-----------------------------------------------------------.
 1324 | yydefault -- do the default action for the current state.  |
 1325 `-----------------------------------------------------------*/
 1326 yydefault:
 1327   yyn = yydefact[yystate];
 1328   if (yyn == 0)
 1329     goto yyerrlab;
 1330   goto yyreduce;
 1331 
 1332 
 1333 /*-----------------------------.
 1334 | yyreduce -- Do a reduction.  |
 1335 `-----------------------------*/
 1336 yyreduce:
 1337   /* yyn is the number of a rule to reduce with.  */
 1338   yylen = yyr2[yyn];
 1339 
 1340   /* If YYLEN is nonzero, implement the default value of the action:
 1341      '$$ = $1'.
 1342 
 1343      Otherwise, the following line sets YYVAL to garbage.
 1344      This behavior is undocumented and Bison
 1345      users should not rely upon it.  Assigning to YYVAL
 1346      unconditionally makes the parser a bit smaller, and it avoids a
 1347      GCC warning that YYVAL may be used uninitialized.  */
 1348   yyval = yyvsp[1-yylen];
 1349 
 1350 
 1351   YY_REDUCE_PRINT (yyn);
 1352   switch (yyn)
 1353     {
 1354         case 4:
 1355 #line 132 "parsedate.y" /* yacc.c:1646  */
 1356     {
 1357         yyHaveTime++;
 1358 #ifdef lint
 1359         /* I am compulsive about lint natterings... */
 1360         if (yyHaveTime == -1) {
 1361         YYERROR;
 1362         }
 1363 #endif /* lint */
 1364     }
 1365 #line 1366 "y.tab.c" /* yacc.c:1646  */
 1366     break;
 1367 
 1368   case 5:
 1369 #line 141 "parsedate.y" /* yacc.c:1646  */
 1370     {
 1371         yyHaveTime++;
 1372         yyTimezone = (yyvsp[0].Number);
 1373     }
 1374 #line 1375 "y.tab.c" /* yacc.c:1646  */
 1375     break;
 1376 
 1377   case 6:
 1378 #line 145 "parsedate.y" /* yacc.c:1646  */
 1379     {
 1380         yyHaveDate++;
 1381     }
 1382 #line 1383 "y.tab.c" /* yacc.c:1646  */
 1383     break;
 1384 
 1385   case 7:
 1386 #line 148 "parsedate.y" /* yacc.c:1646  */
 1387     {
 1388         yyHaveRel = 1;
 1389     }
 1390 #line 1391 "y.tab.c" /* yacc.c:1646  */
 1391     break;
 1392 
 1393   case 8:
 1394 #line 153 "parsedate.y" /* yacc.c:1646  */
 1395     {
 1396         if ((yyvsp[-1].Number) < 100) {
 1397         yyHour = (yyvsp[-1].Number);
 1398         yyMinutes = 0;
 1399         }
 1400         else {
 1401         yyHour = (yyvsp[-1].Number) / 100;
 1402         yyMinutes = (yyvsp[-1].Number) % 100;
 1403         }
 1404         yySeconds = 0;
 1405         yyMeridian = (yyvsp[0].Meridian);
 1406     }
 1407 #line 1408 "y.tab.c" /* yacc.c:1646  */
 1408     break;
 1409 
 1410   case 9:
 1411 #line 165 "parsedate.y" /* yacc.c:1646  */
 1412     {
 1413         yyHour = (yyvsp[-3].Number);
 1414         yyMinutes = (yyvsp[-1].Number);
 1415         yySeconds = 0;
 1416         yyMeridian = (yyvsp[0].Meridian);
 1417     }
 1418 #line 1419 "y.tab.c" /* yacc.c:1646  */
 1419     break;
 1420 
 1421   case 10:
 1422 #line 171 "parsedate.y" /* yacc.c:1646  */
 1423     {
 1424         yyHour = (yyvsp[-3].Number);
 1425         yyMinutes = (yyvsp[-1].Number);
 1426         yyTimezone = (yyvsp[0].Number);
 1427         yyMeridian = MER24;
 1428         yyDSTmode = DSToff;
 1429     }
 1430 #line 1431 "y.tab.c" /* yacc.c:1646  */
 1431     break;
 1432 
 1433   case 11:
 1434 #line 178 "parsedate.y" /* yacc.c:1646  */
 1435     {
 1436         yyHour = (yyvsp[-5].Number);
 1437         yyMinutes = (yyvsp[-3].Number);
 1438         yySeconds = (yyvsp[-1].Number);
 1439         yyMeridian = (yyvsp[0].Meridian);
 1440     }
 1441 #line 1442 "y.tab.c" /* yacc.c:1646  */
 1442     break;
 1443 
 1444   case 12:
 1445 #line 184 "parsedate.y" /* yacc.c:1646  */
 1446     {
 1447         yyHour = (yyvsp[-5].Number);
 1448         yyMinutes = (yyvsp[-3].Number);
 1449         yySeconds = (yyvsp[-1].Number);
 1450         yyTimezone = (yyvsp[0].Number);
 1451         yyMeridian = MER24;
 1452         yyDSTmode = DSToff;
 1453     }
 1454 #line 1455 "y.tab.c" /* yacc.c:1646  */
 1455     break;
 1456 
 1457   case 13:
 1458 #line 194 "parsedate.y" /* yacc.c:1646  */
 1459     {
 1460         (yyval.Number) = (yyvsp[0].Number);
 1461         yyDSTmode = DSToff;
 1462     }
 1463 #line 1464 "y.tab.c" /* yacc.c:1646  */
 1464     break;
 1465 
 1466   case 14:
 1467 #line 198 "parsedate.y" /* yacc.c:1646  */
 1468     {
 1469         (yyval.Number) = (yyvsp[0].Number);
 1470         yyDSTmode = DSTon;
 1471     }
 1472 #line 1473 "y.tab.c" /* yacc.c:1646  */
 1473     break;
 1474 
 1475   case 15:
 1476 #line 202 "parsedate.y" /* yacc.c:1646  */
 1477     {
 1478         /* Only allow "GMT+300" and "GMT-0800" */
 1479         if ((yyvsp[-1].Number) != 0) {
 1480         YYABORT;
 1481         }
 1482         (yyval.Number) = (yyvsp[0].Number);
 1483         yyDSTmode = DSToff;
 1484     }
 1485 #line 1486 "y.tab.c" /* yacc.c:1646  */
 1486     break;
 1487 
 1488   case 16:
 1489 #line 210 "parsedate.y" /* yacc.c:1646  */
 1490     {
 1491         (yyval.Number) = (yyvsp[0].Number);
 1492         yyDSTmode = DSToff;
 1493     }
 1494 #line 1495 "y.tab.c" /* yacc.c:1646  */
 1495     break;
 1496 
 1497   case 17:
 1498 #line 216 "parsedate.y" /* yacc.c:1646  */
 1499     {
 1500         int     i;
 1501 
 1502         /* Unix and GMT and numeric timezones -- a little confusing. */
 1503         if ((yyvsp[0].Number) < 0) {
 1504         /* Don't work with negative modulus. */
 1505         (yyvsp[0].Number) = -(yyvsp[0].Number);
 1506         if ((yyvsp[0].Number) > 9999 || (i = (yyvsp[0].Number) % 100) >= 60) {
 1507             YYABORT;
 1508         }
 1509         (yyval.Number) = ((yyvsp[0].Number) / 100) * 60 + i;
 1510         }
 1511         else {
 1512         if ((yyvsp[0].Number) > 9999 || (i = (yyvsp[0].Number) % 100) >= 60) {
 1513             YYABORT;
 1514         }
 1515         (yyval.Number) = -(((yyvsp[0].Number) / 100) * 60 + i);
 1516         }
 1517     }
 1518 #line 1519 "y.tab.c" /* yacc.c:1646  */
 1519     break;
 1520 
 1521   case 18:
 1522 #line 237 "parsedate.y" /* yacc.c:1646  */
 1523     {
 1524         yyMonth = (yyvsp[-2].Number);
 1525         yyDay = (yyvsp[0].Number);
 1526     }
 1527 #line 1528 "y.tab.c" /* yacc.c:1646  */
 1528     break;
 1529 
 1530   case 19:
 1531 #line 241 "parsedate.y" /* yacc.c:1646  */
 1532     {
 1533         if ((yyvsp[-4].Number) > 100) {
 1534         yyYear = (yyvsp[-4].Number);
 1535         yyMonth = (yyvsp[-2].Number);
 1536         yyDay = (yyvsp[0].Number);
 1537         }
 1538         else {
 1539         yyMonth = (yyvsp[-4].Number);
 1540         yyDay = (yyvsp[-2].Number);
 1541         yyYear = (yyvsp[0].Number);
 1542         }
 1543     }
 1544 #line 1545 "y.tab.c" /* yacc.c:1646  */
 1545     break;
 1546 
 1547   case 20:
 1548 #line 253 "parsedate.y" /* yacc.c:1646  */
 1549     {
 1550         yyMonth = (yyvsp[-1].Number);
 1551         yyDay = (yyvsp[0].Number);
 1552     }
 1553 #line 1554 "y.tab.c" /* yacc.c:1646  */
 1554     break;
 1555 
 1556   case 21:
 1557 #line 257 "parsedate.y" /* yacc.c:1646  */
 1558     {
 1559         yyMonth = (yyvsp[-3].Number);
 1560         yyDay = (yyvsp[-2].Number);
 1561         yyYear = (yyvsp[0].Number);
 1562     }
 1563 #line 1564 "y.tab.c" /* yacc.c:1646  */
 1564     break;
 1565 
 1566   case 22:
 1567 #line 262 "parsedate.y" /* yacc.c:1646  */
 1568     {
 1569         yyDay = (yyvsp[-1].Number);
 1570         yyMonth = (yyvsp[0].Number);
 1571     }
 1572 #line 1573 "y.tab.c" /* yacc.c:1646  */
 1573     break;
 1574 
 1575   case 23:
 1576 #line 266 "parsedate.y" /* yacc.c:1646  */
 1577     {
 1578         yyDay = (yyvsp[-2].Number);
 1579         yyMonth = (yyvsp[-1].Number);
 1580         yyYear = (yyvsp[0].Number);
 1581     }
 1582 #line 1583 "y.tab.c" /* yacc.c:1646  */
 1583     break;
 1584 
 1585   case 24:
 1586 #line 271 "parsedate.y" /* yacc.c:1646  */
 1587     {
 1588         yyDay = (yyvsp[-2].Number);
 1589         yyMonth = (yyvsp[-1].Number);
 1590         yyYear = (yyvsp[0].Number);
 1591     }
 1592 #line 1593 "y.tab.c" /* yacc.c:1646  */
 1593     break;
 1594 
 1595   case 25:
 1596 #line 278 "parsedate.y" /* yacc.c:1646  */
 1597     {
 1598         yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number);
 1599     }
 1600 #line 1601 "y.tab.c" /* yacc.c:1646  */
 1601     break;
 1602 
 1603   case 26:
 1604 #line 281 "parsedate.y" /* yacc.c:1646  */
 1605     {
 1606         yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number);
 1607     }
 1608 #line 1609 "y.tab.c" /* yacc.c:1646  */
 1609     break;
 1610 
 1611   case 27:
 1612 #line 284 "parsedate.y" /* yacc.c:1646  */
 1613     {
 1614         yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number);
 1615     }
 1616 #line 1617 "y.tab.c" /* yacc.c:1646  */
 1617     break;
 1618 
 1619   case 28:
 1620 #line 287 "parsedate.y" /* yacc.c:1646  */
 1621     {
 1622         yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number);
 1623     }
 1624 #line 1625 "y.tab.c" /* yacc.c:1646  */
 1625     break;
 1626 
 1627   case 29:
 1628 #line 292 "parsedate.y" /* yacc.c:1646  */
 1629     {
 1630         (yyval.Meridian) = MER24;
 1631     }
 1632 #line 1633 "y.tab.c" /* yacc.c:1646  */
 1633     break;
 1634 
 1635   case 30:
 1636 #line 295 "parsedate.y" /* yacc.c:1646  */
 1637     {
 1638         (yyval.Meridian) = (yyvsp[0].Meridian);
 1639     }
 1640 #line 1641 "y.tab.c" /* yacc.c:1646  */
 1641     break;
 1642 
 1643 
 1644 #line 1645 "y.tab.c" /* yacc.c:1646  */
 1645       default: break;
 1646     }
 1647   /* User semantic actions sometimes alter yychar, and that requires
 1648      that yytoken be updated with the new translation.  We take the
 1649      approach of translating immediately before every use of yytoken.
 1650      One alternative is translating here after every semantic action,
 1651      but that translation would be missed if the semantic action invokes
 1652      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
 1653      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
 1654      incorrect destructor might then be invoked immediately.  In the
 1655      case of YYERROR or YYBACKUP, subsequent parser actions might lead
 1656      to an incorrect destructor call or verbose syntax error message
 1657      before the lookahead is translated.  */
 1658   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 1659 
 1660   YYPOPSTACK (yylen);
 1661   yylen = 0;
 1662   YY_STACK_PRINT (yyss, yyssp);
 1663 
 1664   *++yyvsp = yyval;
 1665 
 1666   /* Now 'shift' the result of the reduction.  Determine what state
 1667      that goes to, based on the state we popped back to and the rule
 1668      number reduced by.  */
 1669 
 1670   yyn = yyr1[yyn];
 1671 
 1672   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 1673   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 1674     yystate = yytable[yystate];
 1675   else
 1676     yystate = yydefgoto[yyn - YYNTOKENS];
 1677 
 1678   goto yynewstate;
 1679 
 1680 
 1681 /*--------------------------------------.
 1682 | yyerrlab -- here on detecting error.  |
 1683 `--------------------------------------*/
 1684 yyerrlab:
 1685   /* Make sure we have latest lookahead translation.  See comments at
 1686      user semantic actions for why this is necessary.  */
 1687   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
 1688 
 1689   /* If not already recovering from an error, report this error.  */
 1690   if (!yyerrstatus)
 1691     {
 1692       ++yynerrs;
 1693 #if ! YYERROR_VERBOSE
 1694       yyerror (YY_("syntax error"));
 1695 #else
 1696 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
 1697                                         yyssp, yytoken)
 1698       {
 1699         char const *yymsgp = YY_("syntax error");
 1700         int yysyntax_error_status;
 1701         yysyntax_error_status = YYSYNTAX_ERROR;
 1702         if (yysyntax_error_status == 0)
 1703           yymsgp = yymsg;
 1704         else if (yysyntax_error_status == 1)
 1705           {
 1706             if (yymsg != yymsgbuf)
 1707               YYSTACK_FREE (yymsg);
 1708             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
 1709             if (!yymsg)
 1710               {
 1711                 yymsg = yymsgbuf;
 1712                 yymsg_alloc = sizeof yymsgbuf;
 1713                 yysyntax_error_status = 2;
 1714               }
 1715             else
 1716               {
 1717                 yysyntax_error_status = YYSYNTAX_ERROR;
 1718                 yymsgp = yymsg;
 1719               }
 1720           }
 1721         yyerror (yymsgp);
 1722         if (yysyntax_error_status == 2)
 1723           goto yyexhaustedlab;
 1724       }
 1725 # undef YYSYNTAX_ERROR
 1726 #endif
 1727     }
 1728 
 1729 
 1730 
 1731   if (yyerrstatus == 3)
 1732     {
 1733       /* If just tried and failed to reuse lookahead token after an
 1734          error, discard it.  */
 1735 
 1736       if (yychar <= YYEOF)
 1737         {
 1738           /* Return failure if at end of input.  */
 1739           if (yychar == YYEOF)
 1740             YYABORT;
 1741         }
 1742       else
 1743         {
 1744           yydestruct ("Error: discarding",
 1745                       yytoken, &yylval);
 1746           yychar = YYEMPTY;
 1747         }
 1748     }
 1749 
 1750   /* Else will try to reuse lookahead token after shifting the error
 1751      token.  */
 1752   goto yyerrlab1;
 1753 
 1754 
 1755 /*---------------------------------------------------.
 1756 | yyerrorlab -- error raised explicitly by YYERROR.  |
 1757 `---------------------------------------------------*/
 1758 yyerrorlab:
 1759 
 1760   /* Pacify compilers like GCC when the user code never invokes
 1761      YYERROR and the label yyerrorlab therefore never appears in user
 1762      code.  */
 1763   if (/*CONSTCOND*/ 0)
 1764      goto yyerrorlab;
 1765 
 1766   /* Do not reclaim the symbols of the rule whose action triggered
 1767      this YYERROR.  */
 1768   YYPOPSTACK (yylen);
 1769   yylen = 0;
 1770   YY_STACK_PRINT (yyss, yyssp);
 1771   yystate = *yyssp;
 1772   goto yyerrlab1;
 1773 
 1774 
 1775 /*-------------------------------------------------------------.
 1776 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 1777 `-------------------------------------------------------------*/
 1778 yyerrlab1:
 1779   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 1780 
 1781   for (;;)
 1782     {
 1783       yyn = yypact[yystate];
 1784       if (!yypact_value_is_default (yyn))
 1785         {
 1786           yyn += YYTERROR;
 1787           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 1788             {
 1789               yyn = yytable[yyn];
 1790               if (0 < yyn)
 1791                 break;
 1792             }
 1793         }
 1794 
 1795       /* Pop the current state because it cannot handle the error token.  */
 1796       if (yyssp == yyss)
 1797         YYABORT;
 1798 
 1799 
 1800       yydestruct ("Error: popping",
 1801                   yystos[yystate], yyvsp);
 1802       YYPOPSTACK (1);
 1803       yystate = *yyssp;
 1804       YY_STACK_PRINT (yyss, yyssp);
 1805     }
 1806 
 1807   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 1808   *++yyvsp = yylval;
 1809   YY_IGNORE_MAYBE_UNINITIALIZED_END
 1810 
 1811 
 1812   /* Shift the error token.  */
 1813   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
 1814 
 1815   yystate = yyn;
 1816   goto yynewstate;
 1817 
 1818 
 1819 /*-------------------------------------.
 1820 | yyacceptlab -- YYACCEPT comes here.  |
 1821 `-------------------------------------*/
 1822 yyacceptlab:
 1823   yyresult = 0;
 1824   goto yyreturn;
 1825 
 1826 /*-----------------------------------.
 1827 | yyabortlab -- YYABORT comes here.  |
 1828 `-----------------------------------*/
 1829 yyabortlab:
 1830   yyresult = 1;
 1831   goto yyreturn;
 1832 
 1833 #if !defined yyoverflow || YYERROR_VERBOSE
 1834 /*-------------------------------------------------.
 1835 | yyexhaustedlab -- memory exhaustion comes here.  |
 1836 `-------------------------------------------------*/
 1837 yyexhaustedlab:
 1838   yyerror (YY_("memory exhausted"));
 1839   yyresult = 2;
 1840   /* Fall through.  */
 1841 #endif
 1842 
 1843 yyreturn:
 1844   if (yychar != YYEMPTY)
 1845     {
 1846       /* Make sure we have latest lookahead translation.  See comments at
 1847          user semantic actions for why this is necessary.  */
 1848       yytoken = YYTRANSLATE (yychar);
 1849       yydestruct ("Cleanup: discarding lookahead",
 1850                   yytoken, &yylval);
 1851     }
 1852   /* Do not reclaim the symbols of the rule whose action triggered
 1853      this YYABORT or YYACCEPT.  */
 1854   YYPOPSTACK (yylen);
 1855   YY_STACK_PRINT (yyss, yyssp);
 1856   while (yyssp != yyss)
 1857     {
 1858       yydestruct ("Cleanup: popping",
 1859                   yystos[*yyssp], yyvsp);
 1860       YYPOPSTACK (1);
 1861     }
 1862 #ifndef yyoverflow
 1863   if (yyss != yyssa)
 1864     YYSTACK_FREE (yyss);
 1865 #endif
 1866 #if YYERROR_VERBOSE
 1867   if (yymsg != yymsgbuf)
 1868     YYSTACK_FREE (yymsg);
 1869 #endif
 1870   return yyresult;
 1871 }
 1872 #line 300 "parsedate.y" /* yacc.c:1906  */
 1873 
 1874 
 1875 /* Month and day table. */
 1876 static TABLE    MonthDayTable[] = {
 1877     { "january",    tMONTH,  1 },
 1878     { "february",   tMONTH,  2 },
 1879     { "march",      tMONTH,  3 },
 1880     { "april",      tMONTH,  4 },
 1881     { "may",        tMONTH,  5 },
 1882     { "june",       tMONTH,  6 },
 1883     { "july",       tMONTH,  7 },
 1884     { "august",     tMONTH,  8 },
 1885     { "september",  tMONTH,  9 },
 1886     { "october",    tMONTH, 10 },
 1887     { "november",   tMONTH, 11 },
 1888     { "december",   tMONTH, 12 },
 1889     /* The value of the day isn't used... */
 1890     { "sunday",     tDAY, 0 },
 1891     { "monday",     tDAY, 0 },
 1892     { "tuesday",    tDAY, 0 },
 1893     { "wednesday",  tDAY, 0 },
 1894     { "thursday",   tDAY, 0 },
 1895     { "friday",     tDAY, 0 },
 1896     { "saturday",   tDAY, 0 },
 1897 };
 1898 
 1899 /* Time units table. */
 1900 static TABLE    UnitsTable[] = {
 1901     { "year",       tMONTH_UNIT,    12 },
 1902     { "month",      tMONTH_UNIT,    1 },
 1903     { "week",       tSEC_UNIT,  7L * 24 * 60 * 60 },
 1904     { "day",        tSEC_UNIT,  1L * 24 * 60 * 60 },
 1905     { "hour",       tSEC_UNIT,  60 * 60 },
 1906     { "minute",     tSEC_UNIT,  60 },
 1907     { "min",        tSEC_UNIT,  60 },
 1908     { "second",     tSEC_UNIT,  1 },
 1909     { "sec",        tSEC_UNIT,  1 },
 1910 };
 1911 
 1912 /* Timezone table. */
 1913 static TABLE    TimezoneTable[] = {
 1914     { "gmt",    tZONE,     HOUR( 0) },  /* Greenwich Mean */
 1915     { "ut", tZONE,     HOUR( 0) },  /* Universal */
 1916     { "utc",    tZONE,     HOUR( 0) },  /* Universal Coordinated */
 1917     { "cut",    tZONE,     HOUR( 0) },  /* Coordinated Universal */
 1918     { "z",  tZONE,     HOUR( 0) },  /* Greenwich Mean */
 1919     { "wet",    tZONE,     HOUR( 0) },  /* Western European */
 1920     { "bst",    tDAYZONE,  HOUR( 0) },  /* British Summer */
 1921     { "nst",    tZONE,     HOUR(3)+30 }, /* Newfoundland Standard */
 1922     { "ndt",    tDAYZONE,  HOUR(3)+30 }, /* Newfoundland Daylight */
 1923     { "ast",    tZONE,     HOUR( 4) },  /* Atlantic Standard */
 1924     { "adt",    tDAYZONE,  HOUR( 4) },  /* Atlantic Daylight */
 1925     { "est",    tZONE,     HOUR( 5) },  /* Eastern Standard */
 1926     { "edt",    tDAYZONE,  HOUR( 5) },  /* Eastern Daylight */
 1927     { "cst",    tZONE,     HOUR( 6) },  /* Central Standard */
 1928     { "cdt",    tDAYZONE,  HOUR( 6) },  /* Central Daylight */
 1929     { "mst",    tZONE,     HOUR( 7) },  /* Mountain Standard */
 1930     { "mdt",    tDAYZONE,  HOUR( 7) },  /* Mountain Daylight */
 1931     { "pst",    tZONE,     HOUR( 8) },  /* Pacific Standard */
 1932     { "pdt",    tDAYZONE,  HOUR( 8) },  /* Pacific Daylight */
 1933     { "yst",    tZONE,     HOUR( 9) },  /* Yukon Standard */
 1934     { "ydt",    tDAYZONE,  HOUR( 9) },  /* Yukon Daylight */
 1935     { "akst",   tZONE,     HOUR( 9) },  /* Alaska Standard */
 1936     { "akdt",   tDAYZONE,  HOUR( 9) },  /* Alaska Daylight */
 1937     { "hst",    tZONE,     HOUR(10) },  /* Hawaii Standard */
 1938     { "hast",   tZONE,     HOUR(10) },  /* Hawaii-Aleutian Standard */
 1939     { "hadt",   tDAYZONE,  HOUR(10) },  /* Hawaii-Aleutian Daylight */
 1940     { "ces",    tDAYZONE,  -HOUR(1) },  /* Central European Summer */
 1941     { "cest",   tDAYZONE,  -HOUR(1) },  /* Central European Summer */
 1942     { "mez",    tZONE,     -HOUR(1) },  /* Middle European */
 1943     { "mezt",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
 1944     { "cet",    tZONE,     -HOUR(1) },  /* Central European */
 1945     { "met",    tZONE,     -HOUR(1) },  /* Middle European */
 1946     { "eet",    tZONE,     -HOUR(2) },  /* Eastern Europe */
 1947     { "msk",    tZONE,     -HOUR(3) },  /* Moscow Winter */
 1948     { "msd",    tDAYZONE,  -HOUR(3) },  /* Moscow Summer */
 1949     { "wast",   tZONE,     -HOUR(8) },  /* West Australian Standard */
 1950     { "wadt",   tDAYZONE,  -HOUR(8) },  /* West Australian Daylight */
 1951     { "hkt",    tZONE,     -HOUR(8) },  /* Hong Kong */
 1952     { "cct",    tZONE,     -HOUR(8) },  /* China Coast */
 1953     { "jst",    tZONE,     -HOUR(9) },  /* Japan Standard */
 1954     { "kst",    tZONE,     -HOUR(9) },  /* Korean Standard */
 1955     { "kdt",    tZONE,     -HOUR(9) },  /* Korean Daylight */
 1956     { "cast",   tZONE,     -(HOUR(9)+30) }, /* Central Australian Standard */
 1957     { "cadt",   tDAYZONE,  -(HOUR(9)+30) }, /* Central Australian Daylight */
 1958     { "east",   tZONE,     -HOUR(10) }, /* Eastern Australian Standard */
 1959     { "eadt",   tDAYZONE,  -HOUR(10) }, /* Eastern Australian Daylight */
 1960     { "nzst",   tZONE,     -HOUR(12) }, /* New Zealand Standard */
 1961     { "nzdt",   tDAYZONE,  -HOUR(12) }, /* New Zealand Daylight */
 1962 
 1963     /* For completeness we include the following entries. */
 1964 #if 0
 1965 
 1966     /* Duplicate names.  Either they conflict with a zone listed above
 1967      * (which is either more likely to be seen or just been in circulation
 1968      * longer), or they conflict with another zone in this section and
 1969      * we could not reasonably choose one over the other. */
 1970     { "fst",    tZONE,     HOUR( 2) },  /* Fernando De Noronha Standard */
 1971     { "fdt",    tDAYZONE,  HOUR( 2) },  /* Fernando De Noronha Daylight */
 1972     { "bst",    tZONE,     HOUR( 3) },  /* Brazil Standard */
 1973     { "est",    tZONE,     HOUR( 3) },  /* Eastern Standard (Brazil) */
 1974     { "edt",    tDAYZONE,  HOUR( 3) },  /* Eastern Daylight (Brazil) */
 1975     { "wst",    tZONE,     HOUR( 4) },  /* Western Standard (Brazil) */
 1976     { "wdt",    tDAYZONE,  HOUR( 4) },  /* Western Daylight (Brazil) */
 1977     { "cst",    tZONE,     HOUR( 5) },  /* Chile Standard */
 1978     { "cdt",    tDAYZONE,  HOUR( 5) },  /* Chile Daylight */
 1979     { "ast",    tZONE,     HOUR( 5) },  /* Acre Standard */
 1980     { "adt",    tDAYZONE,  HOUR( 5) },  /* Acre Daylight */
 1981     { "cst",    tZONE,     HOUR( 5) },  /* Cuba Standard */
 1982     { "cdt",    tDAYZONE,  HOUR( 5) },  /* Cuba Daylight */
 1983     { "est",    tZONE,     HOUR( 6) },  /* Easter Island Standard */
 1984     { "edt",    tDAYZONE,  HOUR( 6) },  /* Easter Island Daylight */
 1985     { "sst",    tZONE,     HOUR(11) },  /* Samoa Standard */
 1986     { "ist",    tZONE,     -HOUR(2) },  /* Israel Standard */
 1987     { "idt",    tDAYZONE,  -HOUR(2) },  /* Israel Daylight */
 1988     { "idt",    tDAYZONE,  -(HOUR(3)+30) }, /* Iran Daylight */
 1989     { "ist",    tZONE,     -(HOUR(3)+30) }, /* Iran Standard */
 1990     { "cst",     tZONE,     -HOUR(8) }, /* China Standard */
 1991     { "cdt",     tDAYZONE,  -HOUR(8) }, /* China Daylight */
 1992     { "sst",     tZONE,     -HOUR(8) }, /* Singapore Standard */
 1993 
 1994     /* Dubious (e.g., not in Olson's TIMEZONE package) or obsolete. */
 1995     { "gst",    tZONE,     HOUR( 3) },  /* Greenland Standard */
 1996     { "wat",    tZONE,     -HOUR(1) },  /* West Africa */
 1997     { "at", tZONE,     HOUR( 2) },  /* Azores */
 1998     { "gst",    tZONE,     -HOUR(10) }, /* Guam Standard */
 1999     { "nft",    tZONE,     HOUR(3)+30 }, /* Newfoundland */
 2000     { "idlw",   tZONE,     HOUR(12) },  /* International Date Line West */
 2001     { "mewt",   tZONE,     -HOUR(1) },  /* Middle European Winter */
 2002     { "mest",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
 2003     { "swt",    tZONE,     -HOUR(1) },  /* Swedish Winter */
 2004     { "sst",    tDAYZONE,  -HOUR(1) },  /* Swedish Summer */
 2005     { "fwt",    tZONE,     -HOUR(1) },  /* French Winter */
 2006     { "fst",    tDAYZONE,  -HOUR(1) },  /* French Summer */
 2007     { "bt", tZONE,     -HOUR(3) },  /* Baghdad */
 2008     { "it", tZONE,     -(HOUR(3)+30) }, /* Iran */
 2009     { "zp4",    tZONE,     -HOUR(4) },  /* USSR Zone 3 */
 2010     { "zp5",    tZONE,     -HOUR(5) },  /* USSR Zone 4 */
 2011     { "ist",    tZONE,     -(HOUR(5)+30) }, /* Indian Standard */
 2012     { "zp6",    tZONE,     -HOUR(6) },  /* USSR Zone 5 */
 2013     { "nst",    tZONE,     -HOUR(7) },  /* North Sumatra */
 2014     { "sst",    tZONE,     -HOUR(7) },  /* South Sumatra */
 2015     { "jt", tZONE,     -(HOUR(7)+30) }, /* Java (3pm in Cronusland!) */
 2016     { "nzt",    tZONE,     -HOUR(12) }, /* New Zealand */
 2017     { "idle",   tZONE,     -HOUR(12) }, /* International Date Line East */
 2018     { "cat",    tZONE,     HOUR(10) },  /* -- expired 1967 */
 2019     { "nt", tZONE,     HOUR(11) },  /* -- expired 1967 */
 2020     { "ahst",   tZONE,     HOUR(10) },  /* -- expired 1983 */
 2021     { "hdt",    tDAYZONE,  HOUR(10) },  /* -- expired 1986 */
 2022 #endif /* 0 */
 2023 };
 2024 
 2025 
 2026 /* ARGSUSED */
 2027 static void
 2028 date_error(char *s)
 2029 {
 2030     /* NOTREACHED */
 2031 }
 2032 
 2033 
 2034 static time_t
 2035 ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
 2036 {
 2037     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61)
 2038     return -1;
 2039     if (Meridian == MER24) {
 2040     if (Hours < 0 || Hours > 23)
 2041         return -1;
 2042     }
 2043     else {
 2044     if (Hours < 1 || Hours > 12)
 2045         return -1;
 2046     if (Hours == 12)
 2047         Hours = 0;
 2048     if (Meridian == MERpm)
 2049         Hours += 12;
 2050     }
 2051     return (Hours * 60L + Minutes) * 60L + Seconds;
 2052 }
 2053 
 2054 
 2055 static time_t
 2056 Convert(time_t Month, time_t Day, time_t Year,
 2057     time_t Hours, time_t Minutes, time_t Seconds,
 2058     MERIDIAN Meridian, DSTMODE dst)
 2059 {
 2060     static int  DaysNormal[13] = {
 2061     0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
 2062     };
 2063     static int  DaysLeap[13] = {
 2064     0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
 2065     };
 2066     static int  LeapYears[] = {
 2067     1972, 1976, 1980, 1984, 1988, 1992, 1996,
 2068     2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036
 2069     };
 2070     register int    *yp;
 2071     register int    *mp;
 2072     register time_t Julian;
 2073     register int    i;
 2074     time_t      tod;
 2075 
 2076     if (Year < 0)
 2077     Year = -Year;
 2078     if (Year < 100)
 2079     Year += 1900;
 2080     if (Year < EPOCH)
 2081     Year += 100;
 2082     for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++)
 2083     if (Year == *yp) {
 2084         mp = DaysLeap;
 2085         break;
 2086     }
 2087     if (Year < EPOCH || Year > END_OF_TIME
 2088      || Month < 1 || Month > 12
 2089      /* NOSTRICT *//* conversion from long may lose accuracy */
 2090      || Day < 1 || Day > mp[(int)Month])
 2091     return -1;
 2092 
 2093     Julian = Day - 1 + (Year - EPOCH) * 365;
 2094     for (yp = LeapYears; yp < ENDOF(LeapYears); yp++, Julian++)
 2095     if (Year <= *yp)
 2096         break;
 2097     for (i = 1; i < Month; i++)
 2098     Julian += *++mp;
 2099     Julian *= SECSPERDAY;
 2100     Julian += yyTimezone * 60L;
 2101     if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
 2102     return -1;
 2103     Julian += tod;
 2104     tod = Julian;
 2105     if (dst == DSTon || (dst == DSTmaybe && localtime(&tod)->tm_isdst))
 2106     Julian -= DST_OFFSET * 60L * 60L;
 2107     return Julian;
 2108 }
 2109 
 2110 
 2111 static time_t
 2112 DSTcorrect(time_t Start, time_t Future)
 2113 {
 2114     time_t  StartDay;
 2115     time_t  FutureDay;
 2116 
 2117     StartDay = (localtime(&Start)->tm_hour + 1) % 24;
 2118     FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
 2119     return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60L * 60L;
 2120 }
 2121 
 2122 
 2123 static time_t
 2124 RelativeMonth(time_t Start, time_t RelMonth)
 2125 {
 2126     struct tm   *tm;
 2127     time_t  Month;
 2128     time_t  Year;
 2129 
 2130     tm = localtime(&Start);
 2131     Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
 2132     Year = Month / 12;
 2133     Month = Month % 12 + 1;
 2134     return DSTcorrect(Start,
 2135         Convert(Month, (time_t)tm->tm_mday, Year,
 2136         (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
 2137         MER24, DSTmaybe));
 2138 }
 2139 
 2140 
 2141 static int
 2142 LookupWord(char *buff, register int length)
 2143 {
 2144     register char   *p;
 2145     register char   *q;
 2146     register TABLE  *tp;
 2147     register int    c;
 2148 
 2149     p = buff;
 2150     c = p[0];
 2151 
 2152     /* See if we have an abbreviation for a month. */
 2153     if (length == 3 || (length == 4 && p[3] == '.'))
 2154     for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++) {
 2155         q = tp->name;
 2156         if (c == q[0] && p[1] == q[1] && p[2] == q[2]) {
 2157         yylval.Number = tp->value;
 2158         return tp->type;
 2159         }
 2160     }
 2161     else
 2162     for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++)
 2163         if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
 2164         yylval.Number = tp->value;
 2165         return tp->type;
 2166         }
 2167 
 2168     /* Try for a timezone. */
 2169     for (tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++)
 2170     if (c == tp->name[0] && p[1] == tp->name[1]
 2171      && strcmp(p, tp->name) == 0) {
 2172         yylval.Number = tp->value;
 2173         return tp->type;
 2174     }
 2175 
 2176     /* Try the units table. */
 2177     for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++)
 2178     if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
 2179         yylval.Number = tp->value;
 2180         return tp->type;
 2181     }
 2182 
 2183     /* Strip off any plural and try the units table again. */
 2184     if (--length > 0 && p[length] == 's') {
 2185     p[length] = '\0';
 2186     for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++)
 2187         if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
 2188         p[length] = 's';
 2189         yylval.Number = tp->value;
 2190         return tp->type;
 2191         }
 2192     p[length] = 's';
 2193     }
 2194     length++;
 2195 
 2196     /* Drop out any periods. */
 2197     for (p = buff, q = (char*)buff; *q; q++)
 2198     if (*q != '.')
 2199         *p++ = *q;
 2200     *p = '\0';
 2201 
 2202     /* Try the meridians. */
 2203     if (buff[1] == 'm' && buff[2] == '\0') {
 2204     if (buff[0] == 'a') {
 2205         yylval.Meridian = MERam;
 2206         return tMERIDIAN;
 2207     }
 2208     if (buff[0] == 'p') {
 2209         yylval.Meridian = MERpm;
 2210         return tMERIDIAN;
 2211     }
 2212     }
 2213 
 2214     /* If we saw any periods, try the timezones again. */
 2215     if (p - buff != length) {
 2216     c = buff[0];
 2217     for (p = buff, tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++)
 2218         if (c == tp->name[0] && p[1] == tp->name[1]
 2219         && strcmp(p, tp->name) == 0) {
 2220         yylval.Number = tp->value;
 2221         return tp->type;
 2222         }
 2223     }
 2224 
 2225     /* Unknown word -- assume GMT timezone. */
 2226     yylval.Number = 0;
 2227     return tZONE;
 2228 }
 2229 
 2230 
 2231 int
 2232 date_lex(void)
 2233 {
 2234     register char   c;
 2235     register char   *p;
 2236     char        buff[20];
 2237     register int    sign;
 2238     register int    i;
 2239     register int    nesting;
 2240 
 2241     for ( ; ; ) {
 2242     /* Get first character after the whitespace. */
 2243     for ( ; ; ) {
 2244         while (isspace(*yyInput))
 2245         yyInput++;
 2246         c = *yyInput;
 2247 
 2248         /* Ignore RFC 822 comments, typically time zone names. */
 2249         if (c != LPAREN)
 2250         break;
 2251         for (nesting = 1; (c = *++yyInput) != RPAREN || --nesting; )
 2252         if (c == LPAREN)
 2253             nesting++;
 2254         else if (!IS7BIT(c) || c == '\0' || c == '\r'
 2255              || (c == '\\' && ((c = *++yyInput) == '\0' || !IS7BIT(c))))
 2256             /* Lexical error: bad comment. */
 2257             return '?';
 2258         yyInput++;
 2259     }
 2260 
 2261     /* A number? */
 2262     if (isdigit(c) || c == '-' || c == '+') {
 2263         if (c == '-' || c == '+') {
 2264         sign = c == '-' ? -1 : 1;
 2265         yyInput++;
 2266         if (!isdigit(*yyInput))
 2267             /* Skip the plus or minus sign. */
 2268             continue;
 2269         }
 2270         else
 2271         sign = 0;
 2272         for (i = 0; (c = *yyInput++) != '\0' && isdigit(c); )
 2273         i = 10 * i + c - '0';
 2274         yyInput--;
 2275         yylval.Number = sign < 0 ? -i : i;
 2276         return sign ? tSNUMBER : tUNUMBER;
 2277     }
 2278 
 2279     /* A word? */
 2280     if (isalpha(c)) {
 2281         for (p = buff; (c = *yyInput++) == '.' || isalpha(c); )
 2282         if (p < &buff[sizeof buff - 1])
 2283             *p++ = isupper(c) ? tolower(c) : c;
 2284         *p = '\0';
 2285         yyInput--;
 2286         return LookupWord(buff, p - buff);
 2287     }
 2288 
 2289     return *yyInput++;
 2290     }
 2291 }
 2292 
 2293 
 2294 time_t
 2295 parsedate(const char *p)
 2296 {
 2297     extern int      date_parse(void);
 2298     time_t      Start;
 2299 
 2300     yyInput = p; /* well, its supposed to be const... */
 2301 
 2302     yyYear = 0;
 2303     yyMonth = 0;
 2304     yyDay = 0;
 2305     yyTimezone = 0;
 2306     yyDSTmode = DSTmaybe;
 2307     yyHour = 0;
 2308     yyMinutes = 0;
 2309     yySeconds = 0;
 2310     yyMeridian = MER24;
 2311     yyRelSeconds = 0;
 2312     yyRelMonth = 0;
 2313     yyHaveDate = 0;
 2314     yyHaveRel = 0;
 2315     yyHaveTime = 0;
 2316 
 2317     if (date_parse() || yyHaveTime > 1 || yyHaveDate > 1)
 2318     return -1;
 2319 
 2320     if (yyHaveDate || yyHaveTime) {
 2321     Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
 2322             yyMeridian, yyDSTmode);
 2323     if (Start < 0)
 2324         return -1;
 2325     }
 2326     else
 2327     return -1;
 2328 
 2329     Start += yyRelSeconds;
 2330     if (yyRelMonth)
 2331     Start += RelativeMonth(Start, yyRelMonth);
 2332 
 2333     /* Have to do *something* with a legitimate -1 so it's distinguishable
 2334      * from the error return value.  (Alternately could set errno on error.) */
 2335     return Start == -1 ? 0 : Start;
 2336 }
 2337 
 2338 
 2339 #ifdef TEST
 2340 
 2341 #if YYDEBUG
 2342 extern int  yydebug;
 2343 #endif /* YYDEBUG */
 2344 
 2345 /* ARGSUSED */
 2346 int
 2347 main(int ac, char *av[])
 2348 {
 2349     char    buff[128];
 2350     time_t  d;
 2351 
 2352 #if YYDEBUG
 2353     yydebug = 1;
 2354 #endif /* YYDEBUG */
 2355 
 2356     (void)printf("Enter date, or blank line to exit.\n\t> ");
 2357     for ( ; ; ) {
 2358     (void)printf("\t> ");
 2359     (void)fflush(stdout);
 2360     if (fgets(buff, sizeof buff, stdin) == NULL || buff[0] == '\n')
 2361         break;
 2362 #if YYDEBUG
 2363     if (strcmp(buff, "yydebug") == 0) {
 2364         yydebug = !yydebug;
 2365         printf("yydebug = %s\n", yydebug ? "on" : "off");
 2366         continue;
 2367     }
 2368 #endif /* YYDEBUG */
 2369     d = parsedate(buff, (TIMEINFO *)NULL);
 2370     if (d == -1)
 2371         (void)printf("Bad format - couldn't convert.\n");
 2372     else
 2373         (void)printf("%s", ctime(&d));
 2374     }
 2375 
 2376     exit(0);
 2377     /* NOTREACHED */
 2378 }
 2379 #endif /* TEST */