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