1 --- /dev/null 2013-09-17 15:58:48.159024252 +0200
2 +++ pwlib-new/src/ptlib/common/getdate.tab.c 2013-10-06 16:52:52.000000000 +0200
4 +/* A Bison parser, made by GNU Bison 2.7. */
6 +/* Bison implementation for Yacc-like parsers in C
8 + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
10 + This program is free software: you can redistribute it and/or modify
11 + it under the terms of the GNU General Public License as published by
12 + the Free Software Foundation, either version 3 of the License, or
13 + (at your option) any later version.
15 + This program is distributed in the hope that it will be useful,
16 + but WITHOUT ANY WARRANTY; without even the implied warranty of
17 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 + GNU General Public License for more details.
20 + You should have received a copy of the GNU General Public License
21 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 +/* As a special exception, you may create a larger work that contains
24 + part or all of the Bison parser skeleton and distribute that work
25 + under terms of your choice, so long as that work isn't itself a
26 + parser generator using the skeleton or a modified version thereof
27 + as a parser skeleton. Alternatively, if you modify or redistribute
28 + the parser skeleton itself, you may (at your option) remove this
29 + special exception, which will cause the skeleton and the resulting
30 + Bison output files to be licensed under the GNU General Public
31 + License without this special exception.
33 + This special exception was added by the Free Software Foundation in
34 + version 2.2 of Bison. */
36 +/* C LALR(1) parser skeleton written by Richard Stallman, by
37 + simplifying the original so-called "semantic" parser. */
39 +/* All symbols defined below should begin with yy or YY, to avoid
40 + infringing on user name space. This should be done even for local
41 + variables, as they might otherwise be expanded by user macros.
42 + There are some unavoidable exceptions within include files to
43 + define necessary library symbols; they are noted "INFRINGES ON
44 + USER NAME SPACE" below. */
46 +/* Identify Bison output. */
50 +#define YYBISON_VERSION "2.7"
53 +#define YYSKELETON_NAME "yacc.c"
67 +/* Copy the first part of user declarations. */
68 +/* Line 371 of yacc.c */
69 +#line 1 "../common/getdate.y"
72 +** Originally written by Steven M. Bellovin <smb@research.att.com> while
73 +** at the University of North Carolina at Chapel Hill. Later tweaked by
74 +** a couple of people on Usenet. Completely overhauled by Rich $alz
75 +** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
77 +** Major hack to coerce it into use with the Equivalence Portable
80 +** This grammar has 10 shift/reduce conflicts.
82 +** This code is in the public domain and has no copyright.
84 +/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
85 +/* SUPPRESS 288 on yyerrlab *//* Label unused */
100 +#pragma warning(disable:4131 4701 4996)
102 +#define STDAPICALLTYPE __stdcall
105 +#define STDAPICALLTYPE
109 +extern int STDAPICALLTYPE PTimeGetChar(void * stream);
110 +extern void STDAPICALLTYPE PTimeUngetChar(void * stream, int c);
111 +int STDAPICALLTYPE PTimeGetDateOrder();
112 +int STDAPICALLTYPE PTimeIsMonthName(const char *, int, int);
113 +int STDAPICALLTYPE PTimeIsDayName(const char *, int, int);
117 +#define HOUR(x) ((time_t)(x) * 60)
118 +#define SECSPERDAY (24L * 60L * 60L)
122 +** An entry in the lexical lookup table.
124 +typedef struct _TABLE {
132 +** Daylight-savings mode: on, off, or not yet known.
134 +typedef enum _DSTMODE {
135 + DSTon, DSToff, DSTmaybe
139 +** Meridian: am, pm, or 24-hour style.
141 +typedef enum _MERIDIAN {
142 + MERam, MERpm, MER24
147 +** Global variables. We could get rid of most of these by using a good
148 +** union as the yacc stack. (This routine was originally written before
149 +** yacc had the %union construct.) Maybe someday; right now we only use
150 +** the %union very rarely.
155 + time_t yyDayOrdinal;
156 + time_t yyDayNumber;
169 + MERIDIAN yyMeridian;
171 + time_t yyRelSeconds;
174 +#define VARIABLE ((struct Variables*)parseParam)
178 +#define YYLEX_PARAM VARIABLE->yyInput
179 +#define YYPARSE_PARAM parseParam
181 +#define yyparse PTime_yyparse
182 +#define yylex PTime_yylex
183 +#define yyerror PTime_yyerror
185 +static int yyparse(void *);
189 +static int yyerror();
191 +static void yyerror();
195 +static void SetPossibleDate(struct Variables*, time_t, time_t, time_t);
199 +/* Line 371 of yacc.c */
200 +#line 198 "../common/getdate.tab.c"
203 +# if defined __cplusplus && 201103L <= __cplusplus
204 +# define YY_NULL nullptr
210 +/* Enabling verbose error messages. */
211 +#ifdef YYERROR_VERBOSE
212 +# undef YYERROR_VERBOSE
213 +# define YYERROR_VERBOSE 1
215 +# define YYERROR_VERBOSE 0
219 +/* Enabling traces. */
229 +# define YYTOKENTYPE
230 + /* Put the tokens into the symbol table, so that GDB and other debuggers
231 + know about them. */
238 + tMINUTE_UNIT = 263,
243 + t4DIGITNUMBER = 268,
244 + t6DIGITNUMBER = 269,
253 +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
254 +typedef union YYSTYPE
256 +/* Line 387 of yacc.c */
257 +#line 133 "../common/getdate.y"
260 + enum _MERIDIAN Meridian;
263 +/* Line 387 of yacc.c */
264 +#line 262 "../common/getdate.tab.c"
266 +# define YYSTYPE_IS_TRIVIAL 1
267 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */
268 +# define YYSTYPE_IS_DECLARED 1
272 +#ifdef YYPARSE_PARAM
273 +#if defined __STDC__ || defined __cplusplus
274 +int yyparse (void *YYPARSE_PARAM);
278 +#else /* ! YYPARSE_PARAM */
279 +#if defined __STDC__ || defined __cplusplus
284 +#endif /* ! YYPARSE_PARAM */
288 +/* Copy the second part of user declarations. */
290 +/* Line 390 of yacc.c */
291 +#line 289 "../common/getdate.tab.c"
298 +typedef YYTYPE_UINT8 yytype_uint8;
300 +typedef unsigned char yytype_uint8;
304 +typedef YYTYPE_INT8 yytype_int8;
305 +#elif (defined __STDC__ || defined __C99__FUNC__ \
306 + || defined __cplusplus || defined _MSC_VER)
307 +typedef signed char yytype_int8;
309 +typedef short int yytype_int8;
312 +#ifdef YYTYPE_UINT16
313 +typedef YYTYPE_UINT16 yytype_uint16;
315 +typedef unsigned short int yytype_uint16;
319 +typedef YYTYPE_INT16 yytype_int16;
321 +typedef short int yytype_int16;
325 +# ifdef __SIZE_TYPE__
326 +# define YYSIZE_T __SIZE_TYPE__
327 +# elif defined size_t
328 +# define YYSIZE_T size_t
329 +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
330 + || defined __cplusplus || defined _MSC_VER)
331 +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
332 +# define YYSIZE_T size_t
334 +# define YYSIZE_T unsigned int
338 +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
341 +# if defined YYENABLE_NLS && YYENABLE_NLS
343 +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
344 +# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
348 +# define YY_(Msgid) Msgid
352 +/* Suppress unused-variable warnings by "using" E. */
353 +#if ! defined lint || defined __GNUC__
354 +# define YYUSE(E) ((void) (E))
356 +# define YYUSE(E) /* empty */
359 +/* Identity function, used to suppress warnings about constant conditions. */
361 +# define YYID(N) (N)
363 +#if (defined __STDC__ || defined __C99__FUNC__ \
364 + || defined __cplusplus || defined _MSC_VER)
377 +#if ! defined yyoverflow || YYERROR_VERBOSE
379 +/* The parser invokes alloca or malloc; define the necessary symbols. */
381 +# ifdef YYSTACK_USE_ALLOCA
382 +# if YYSTACK_USE_ALLOCA
384 +# define YYSTACK_ALLOC __builtin_alloca
385 +# elif defined __BUILTIN_VA_ARG_INCR
386 +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
388 +# define YYSTACK_ALLOC __alloca
389 +# elif defined _MSC_VER
390 +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
391 +# define alloca _alloca
393 +# define YYSTACK_ALLOC alloca
394 +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
395 + || defined __cplusplus || defined _MSC_VER)
396 +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
397 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */
398 +# ifndef EXIT_SUCCESS
399 +# define EXIT_SUCCESS 0
406 +# ifdef YYSTACK_ALLOC
407 + /* Pacify GCC's `empty if-body' warning. */
408 +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
409 +# ifndef YYSTACK_ALLOC_MAXIMUM
410 + /* The OS might guarantee only one guard page at the bottom of the stack,
411 + and a page size can be as small as 4096 bytes. So we cannot safely
412 + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
413 + to allow for a few compiler-allocated temporary stack slots. */
414 +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
417 +# define YYSTACK_ALLOC YYMALLOC
418 +# define YYSTACK_FREE YYFREE
419 +# ifndef YYSTACK_ALLOC_MAXIMUM
420 +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
422 +# if (defined __cplusplus && ! defined EXIT_SUCCESS \
423 + && ! ((defined YYMALLOC || defined malloc) \
424 + && (defined YYFREE || defined free)))
425 +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
426 +# ifndef EXIT_SUCCESS
427 +# define EXIT_SUCCESS 0
431 +# define YYMALLOC malloc
432 +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
433 + || defined __cplusplus || defined _MSC_VER)
434 +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
438 +# define YYFREE free
439 +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
440 + || defined __cplusplus || defined _MSC_VER)
441 +void free (void *); /* INFRINGES ON USER NAME SPACE */
445 +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
448 +#if (! defined yyoverflow \
449 + && (! defined __cplusplus \
450 + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
452 +/* A type that is properly aligned for any stack member. */
455 + yytype_int16 yyss_alloc;
456 + YYSTYPE yyvs_alloc;
459 +/* The size of the maximum gap between one aligned stack and the next. */
460 +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
462 +/* The size of an array large to enough to hold all stacks, each with
464 +# define YYSTACK_BYTES(N) \
465 + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
466 + + YYSTACK_GAP_MAXIMUM)
468 +# define YYCOPY_NEEDED 1
470 +/* Relocate STACK from its old location to the new one. The
471 + local variables YYSIZE and YYSTACKSIZE give the old and new number of
472 + elements in the stack, and YYPTR gives the new location of the
473 + stack. Advance YYPTR to a properly aligned location for the next
475 +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
478 + YYSIZE_T yynewbytes; \
479 + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
480 + Stack = &yyptr->Stack_alloc; \
481 + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
482 + yyptr += yynewbytes / sizeof (*yyptr); \
488 +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
489 +/* Copy COUNT objects from SRC to DST. The source and destination do
492 +# if defined __GNUC__ && 1 < __GNUC__
493 +# define YYCOPY(Dst, Src, Count) \
494 + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
496 +# define YYCOPY(Dst, Src, Count) \
500 + for (yyi = 0; yyi < (Count); yyi++) \
501 + (Dst)[yyi] = (Src)[yyi]; \
506 +#endif /* !YYCOPY_NEEDED */
508 +/* YYFINAL -- State number of the termination state. */
510 +/* YYLAST -- Last index in YYTABLE. */
513 +/* YYNTOKENS -- Number of terminals. */
514 +#define YYNTOKENS 22
515 +/* YYNNTS -- Number of nonterminals. */
517 +/* YYNRULES -- Number of rules. */
519 +/* YYNRULES -- Number of states. */
520 +#define YYNSTATES 61
522 +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
523 +#define YYUNDEFTOK 2
524 +#define YYMAXUTOK 273
526 +#define YYTRANSLATE(YYX) \
527 + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
529 +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
530 +static const yytype_uint8 yytranslate[] =
532 + 0, 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, 20, 2, 2, 21, 2, 2,
537 + 2, 2, 2, 2, 2, 2, 2, 2, 19, 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, 2, 2, 2, 2,
550 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
558 + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
563 +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
565 +static const yytype_uint8 yyprhs[] =
567 + 0, 0, 3, 4, 7, 9, 11, 13, 15, 17,
568 + 19, 22, 25, 28, 33, 38, 45, 52, 54, 56,
569 + 59, 61, 63, 66, 69, 73, 79, 83, 87, 90,
570 + 95, 98, 102, 105, 107, 110, 113, 115, 118, 121,
571 + 123, 126, 129, 131, 133, 135, 137, 139, 141, 143,
575 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */
576 +static const yytype_int8 yyrhs[] =
578 + 23, 0, -1, -1, 23, 24, -1, 25, -1, 26,
579 + -1, 28, -1, 27, -1, 29, -1, 32, -1, 12,
580 + 7, -1, 13, 11, -1, 14, 11, -1, 31, 19,
581 + 31, 33, -1, 31, 19, 31, 11, -1, 31, 19,
582 + 31, 19, 31, 33, -1, 31, 19, 31, 19, 31,
583 + 11, -1, 16, -1, 5, -1, 16, 18, -1, 17,
584 + -1, 4, -1, 4, 20, -1, 31, 4, -1, 31,
585 + 21, 31, -1, 31, 21, 31, 21, 31, -1, 31,
586 + 11, 11, -1, 31, 9, 11, -1, 9, 31, -1,
587 + 9, 31, 20, 31, -1, 31, 9, -1, 31, 9,
588 + 31, -1, 30, 3, -1, 30, -1, 31, 8, -1,
589 + 11, 8, -1, 8, -1, 11, 15, -1, 31, 15,
590 + -1, 15, -1, 11, 10, -1, 31, 10, -1, 10,
591 + -1, 12, -1, 13, -1, 14, -1, 12, -1, 13,
592 + -1, 14, -1, -1, 7, -1
595 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
596 +static const yytype_uint16 yyrline[] =
598 + 0, 149, 149, 150, 153, 156, 159, 162, 165, 168,
599 + 171, 177, 185, 193, 199, 206, 212, 222, 226, 231,
600 + 235, 245, 249, 253, 259, 262, 265, 275, 281, 285,
601 + 290, 294, 301, 305, 308, 311, 314, 317, 320, 323,
602 + 326, 329, 332, 337, 340, 343, 348, 374, 385, 402,
607 +#if YYDEBUG || YYERROR_VERBOSE || 0
608 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
609 + First, the terminals, then, starting at YYNTOKENS, nonterminals. */
610 +static const char *const yytname[] =
612 + "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID",
613 + "tMERIDIAN", "tMINUTE_UNIT", "tMONTH", "tMONTH_UNIT", "tSNUMBER",
614 + "tUNUMBER", "t4DIGITNUMBER", "t6DIGITNUMBER", "tSEC_UNIT", "tZONE",
615 + "tMILZONE", "tDST", "':'", "','", "'/'", "$accept", "spec", "item",
616 + "time", "zone", "day", "date", "rel", "relunit", "unumber", "number",
622 +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
623 + token YYLEX-NUM. */
624 +static const yytype_uint16 yytoknum[] =
626 + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
627 + 265, 266, 267, 268, 269, 270, 271, 272, 273, 58,
632 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
633 +static const yytype_uint8 yyr1[] =
635 + 0, 22, 23, 23, 24, 24, 24, 24, 24, 24,
636 + 25, 25, 25, 25, 25, 25, 25, 26, 26, 26,
637 + 26, 27, 27, 27, 28, 28, 28, 28, 28, 28,
638 + 28, 28, 29, 29, 30, 30, 30, 30, 30, 30,
639 + 30, 30, 30, 31, 31, 31, 32, 32, 32, 33,
643 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
644 +static const yytype_uint8 yyr2[] =
646 + 0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
647 + 2, 2, 2, 4, 4, 6, 6, 1, 1, 2,
648 + 1, 1, 2, 2, 3, 5, 3, 3, 2, 4,
649 + 2, 3, 2, 1, 2, 2, 1, 2, 2, 1,
650 + 2, 2, 1, 1, 1, 1, 1, 1, 1, 0,
654 +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
655 + Performed when YYTABLE doesn't specify something else to do. Zero
656 + means the default is an error. */
657 +static const yytype_uint8 yydefact[] =
659 + 2, 0, 1, 21, 18, 36, 0, 42, 0, 43,
660 + 44, 45, 39, 17, 20, 3, 4, 5, 7, 6,
661 + 8, 33, 0, 9, 22, 43, 44, 45, 28, 35,
662 + 40, 37, 10, 11, 12, 19, 32, 23, 34, 30,
663 + 41, 0, 38, 0, 0, 0, 27, 31, 26, 49,
664 + 24, 29, 50, 14, 0, 13, 0, 49, 25, 16,
668 +/* YYDEFGOTO[NTERM-NUM]. */
669 +static const yytype_int8 yydefgoto[] =
671 + -1, 1, 15, 16, 17, 18, 19, 20, 21, 22,
675 +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
677 +#define YYPACT_NINF -28
678 +static const yytype_int8 yypact[] =
680 + -28, 1, -28, -18, -28, -28, 8, -28, 17, 29,
681 + 44, 54, -28, -14, -28, -28, -28, -28, -28, -28,
682 + -28, 5, 65, -28, -28, -28, -28, -28, 4, -28,
683 + -28, -28, -28, -28, -28, -28, -28, -28, -28, 76,
684 + -28, 15, -28, 8, 8, 8, -28, -28, -28, 12,
685 + 7, -28, -28, -28, 8, -28, 8, -4, -28, -28,
689 +/* YYPGOTO[NTERM-NUM]. */
690 +static const yytype_int8 yypgoto[] =
692 + -28, -28, -28, -28, -28, -28, -28, -28, -28, -6,
696 +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
697 + positive, shift that token. If negative, reduce the rule which
698 + number is the opposite. If YYTABLE_NINF, syntax error. */
699 +#define YYTABLE_NINF -49
700 +static const yytype_int8 yytable[] =
702 + 28, 2, 24, 52, 35, 3, 4, 59, 36, 5,
703 + 6, 7, 8, 9, 10, 11, 12, 13, 14, 52,
704 + 25, 26, 27, 53, 45, 29, 48, 30, 56, -46,
705 + 60, 54, 31, 47, -46, 0, 32, 49, 50, 51,
706 + 0, -46, -46, -46, -47, -46, -46, 0, 57, -47,
707 + 58, 0, 0, 0, -48, 33, -47, -47, -47, -48,
708 + -47, -47, 0, 0, 0, 34, -48, -48, -48, 37,
709 + -48, -48, 0, 38, 39, 40, 41, 0, 0, 0,
710 + 42, 0, 0, 0, 43, 0, 44, 46, 25, 26,
714 +#define yypact_value_is_default(Yystate) \
715 + (!!((Yystate) == (-28)))
717 +#define yytable_value_is_error(Yytable_value) \
720 +static const yytype_int8 yycheck[] =
722 + 6, 0, 20, 7, 18, 4, 5, 11, 3, 8,
723 + 9, 10, 11, 12, 13, 14, 15, 16, 17, 7,
724 + 12, 13, 14, 11, 20, 8, 11, 10, 21, 0,
725 + 57, 19, 15, 39, 5, -1, 7, 43, 44, 45,
726 + -1, 12, 13, 14, 0, 16, 17, -1, 54, 5,
727 + 56, -1, -1, -1, 0, 11, 12, 13, 14, 5,
728 + 16, 17, -1, -1, -1, 11, 12, 13, 14, 4,
729 + 16, 17, -1, 8, 9, 10, 11, -1, -1, -1,
730 + 15, -1, -1, -1, 19, -1, 21, 11, 12, 13,
734 +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
735 + symbol of state STATE-NUM. */
736 +static const yytype_uint8 yystos[] =
738 + 0, 23, 0, 4, 5, 8, 9, 10, 11, 12,
739 + 13, 14, 15, 16, 17, 24, 25, 26, 27, 28,
740 + 29, 30, 31, 32, 20, 12, 13, 14, 31, 8,
741 + 10, 15, 7, 11, 11, 18, 3, 4, 8, 9,
742 + 10, 11, 15, 19, 21, 20, 11, 31, 11, 31,
743 + 31, 31, 7, 11, 19, 33, 21, 31, 31, 11,
747 +#define yyerrok (yyerrstatus = 0)
748 +#define yyclearin (yychar = YYEMPTY)
749 +#define YYEMPTY (-2)
752 +#define YYACCEPT goto yyacceptlab
753 +#define YYABORT goto yyabortlab
754 +#define YYERROR goto yyerrorlab
757 +/* Like YYERROR except do call yyerror. This remains here temporarily
758 + to ease the transition to the new meaning of YYERROR, for GCC.
759 + Once GCC version 2 has supplanted version 1, this can go. However,
760 + YYFAIL appears to be in use. Nevertheless, it is formally deprecated
761 + in Bison 2.4.2's NEWS entry, where a plan to phase it out is
764 +#define YYFAIL goto yyerrlab
766 + /* This is here to suppress warnings from the GCC cpp's
767 + -Wunused-macros. Normally we don't worry about that warning, but
768 + some users do, and we want to make it easy for users to remove
769 + YYFAIL uses, which will produce warnings from Bison 2.5. */
772 +#define YYRECOVERING() (!!yyerrstatus)
774 +#define YYBACKUP(Token, Value) \
776 + if (yychar == YYEMPTY) \
778 + yychar = (Token); \
779 + yylval = (Value); \
780 + YYPOPSTACK (yylen); \
781 + yystate = *yyssp; \
786 + yyerror (YY_("syntax error: cannot back up")); \
791 +/* Error token number */
793 +#define YYERRCODE 256
796 +/* This macro is provided for backward compatibility. */
797 +#ifndef YY_LOCATION_PRINT
798 +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
802 +/* YYLEX -- calling `yylex' with the right arguments. */
804 +# define YYLEX yylex (&yylval, YYLEX_PARAM)
806 +# define YYLEX yylex (&yylval)
809 +/* Enable debugging if requested. */
813 +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
814 +# define YYFPRINTF fprintf
817 +# define YYDPRINTF(Args) \
823 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
827 + YYFPRINTF (stderr, "%s ", Title); \
828 + yy_symbol_print (stderr, \
830 + YYFPRINTF (stderr, "\n"); \
835 +/*--------------------------------.
836 +| Print this symbol on YYOUTPUT. |
837 +`--------------------------------*/
840 +#if (defined __STDC__ || defined __C99__FUNC__ \
841 + || defined __cplusplus || defined _MSC_VER)
843 +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
846 +yy_symbol_value_print (yyoutput, yytype, yyvaluep)
849 + YYSTYPE const * const yyvaluep;
852 + FILE *yyo = yyoutput;
857 + if (yytype < YYNTOKENS)
858 + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
870 +/*--------------------------------.
871 +| Print this symbol on YYOUTPUT. |
872 +`--------------------------------*/
874 +#if (defined __STDC__ || defined __C99__FUNC__ \
875 + || defined __cplusplus || defined _MSC_VER)
877 +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
880 +yy_symbol_print (yyoutput, yytype, yyvaluep)
883 + YYSTYPE const * const yyvaluep;
886 + if (yytype < YYNTOKENS)
887 + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
889 + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
891 + yy_symbol_value_print (yyoutput, yytype, yyvaluep);
892 + YYFPRINTF (yyoutput, ")");
895 +/*------------------------------------------------------------------.
896 +| yy_stack_print -- Print the state stack from its BOTTOM up to its |
898 +`------------------------------------------------------------------*/
900 +#if (defined __STDC__ || defined __C99__FUNC__ \
901 + || defined __cplusplus || defined _MSC_VER)
903 +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
906 +yy_stack_print (yybottom, yytop)
907 + yytype_int16 *yybottom;
908 + yytype_int16 *yytop;
911 + YYFPRINTF (stderr, "Stack now");
912 + for (; yybottom <= yytop; yybottom++)
914 + int yybot = *yybottom;
915 + YYFPRINTF (stderr, " %d", yybot);
917 + YYFPRINTF (stderr, "\n");
920 +# define YY_STACK_PRINT(Bottom, Top) \
923 + yy_stack_print ((Bottom), (Top)); \
927 +/*------------------------------------------------.
928 +| Report that the YYRULE is going to be reduced. |
929 +`------------------------------------------------*/
931 +#if (defined __STDC__ || defined __C99__FUNC__ \
932 + || defined __cplusplus || defined _MSC_VER)
934 +yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
937 +yy_reduce_print (yyvsp, yyrule)
942 + int yynrhs = yyr2[yyrule];
944 + unsigned long int yylno = yyrline[yyrule];
945 + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
946 + yyrule - 1, yylno);
947 + /* The symbols being reduced. */
948 + for (yyi = 0; yyi < yynrhs; yyi++)
950 + YYFPRINTF (stderr, " $%d = ", yyi + 1);
951 + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
952 + &(yyvsp[(yyi + 1) - (yynrhs)])
954 + YYFPRINTF (stderr, "\n");
958 +# define YY_REDUCE_PRINT(Rule) \
961 + yy_reduce_print (yyvsp, Rule); \
964 +/* Nonzero means print parse trace. It is left uninitialized so that
965 + multiple parsers can coexist. */
967 +#else /* !YYDEBUG */
968 +# define YYDPRINTF(Args)
969 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
970 +# define YY_STACK_PRINT(Bottom, Top)
971 +# define YY_REDUCE_PRINT(Rule)
972 +#endif /* !YYDEBUG */
975 +/* YYINITDEPTH -- initial size of the parser's stacks. */
977 +# define YYINITDEPTH 200
980 +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
981 + if the built-in stack extension method is used).
983 + Do not make this value too large; the results are undefined if
984 + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
985 + evaluated with infinite-precision integer arithmetic. */
988 +# define YYMAXDEPTH 10000
995 +# if defined __GLIBC__ && defined _STRING_H
996 +# define yystrlen strlen
998 +/* Return the length of YYSTR. */
999 +#if (defined __STDC__ || defined __C99__FUNC__ \
1000 + || defined __cplusplus || defined _MSC_VER)
1002 +yystrlen (const char *yystr)
1006 + const char *yystr;
1010 + for (yylen = 0; yystr[yylen]; yylen++)
1018 +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1019 +# define yystpcpy stpcpy
1021 +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1023 +#if (defined __STDC__ || defined __C99__FUNC__ \
1024 + || defined __cplusplus || defined _MSC_VER)
1026 +yystpcpy (char *yydest, const char *yysrc)
1029 +yystpcpy (yydest, yysrc)
1031 + const char *yysrc;
1034 + char *yyd = yydest;
1035 + const char *yys = yysrc;
1037 + while ((*yyd++ = *yys++) != '\0')
1046 +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1047 + quotes and backslashes, so that it's suitable for yyerror. The
1048 + heuristic is that double-quoting is unnecessary unless the string
1049 + contains an apostrophe, a comma, or backslash (other than
1050 + backslash-backslash). YYSTR is taken from yytname. If YYRES is
1051 + null, do not copy; instead, return the length of what the result
1052 + would have been. */
1054 +yytnamerr (char *yyres, const char *yystr)
1056 + if (*yystr == '"')
1059 + char const *yyp = yystr;
1066 + goto do_not_strip_quotes;
1069 + if (*++yyp != '\\')
1070 + goto do_not_strip_quotes;
1071 + /* Fall through. */
1074 + yyres[yyn] = *yyp;
1080 + yyres[yyn] = '\0';
1083 + do_not_strip_quotes: ;
1087 + return yystrlen (yystr);
1089 + return yystpcpy (yyres, yystr) - yyres;
1093 +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1094 + about the unexpected token YYTOKEN for the state stack whose top is
1097 + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1098 + not large enough to hold the message. In that case, also set
1099 + *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1100 + required number of bytes is too large to store. */
1102 +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1103 + yytype_int16 *yyssp, int yytoken)
1105 + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1106 + YYSIZE_T yysize = yysize0;
1107 + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1108 + /* Internationalized format string. */
1109 + const char *yyformat = YY_NULL;
1110 + /* Arguments of yyformat. */
1111 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1112 + /* Number of reported tokens (one for the "unexpected", one per
1116 + /* There are many possibilities here to consider:
1117 + - Assume YYFAIL is not used. It's too flawed to consider. See
1118 + <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1119 + for details. YYERROR is fine as it does not invoke this
1121 + - If this state is a consistent state with a default action, then
1122 + the only way this function was invoked is if the default action
1123 + is an error action. In that case, don't check for expected
1124 + tokens because there are none.
1125 + - The only way there can be no lookahead present (in yychar) is if
1126 + this state is a consistent state with a default action. Thus,
1127 + detecting the absence of a lookahead is sufficient to determine
1128 + that there is no unexpected or expected token to report. In that
1129 + case, just report a simple "syntax error".
1130 + - Don't assume there isn't a lookahead just because this state is a
1131 + consistent state with a default action. There might have been a
1132 + previous inconsistent state, consistent state with a non-default
1133 + action, or user semantic action that manipulated yychar.
1134 + - Of course, the expected token list depends on states to have
1135 + correct lookahead information, and it depends on the parser not
1136 + to perform extra reductions after fetching a lookahead from the
1137 + scanner and before detecting a syntax error. Thus, state merging
1138 + (from LALR or IELR) and default reductions corrupt the expected
1139 + token list. However, the list is correct for canonical LR with
1140 + one exception: it will still contain any token that will not be
1141 + accepted due to an error action in a later state.
1143 + if (yytoken != YYEMPTY)
1145 + int yyn = yypact[*yyssp];
1146 + yyarg[yycount++] = yytname[yytoken];
1147 + if (!yypact_value_is_default (yyn))
1149 + /* Start YYX at -YYN if negative to avoid negative indexes in
1150 + YYCHECK. In other words, skip the first -YYN actions for
1151 + this state because they are default actions. */
1152 + int yyxbegin = yyn < 0 ? -yyn : 0;
1153 + /* Stay within bounds of both yycheck and yytname. */
1154 + int yychecklim = YYLAST - yyn + 1;
1155 + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1158 + for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1159 + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1160 + && !yytable_value_is_error (yytable[yyx + yyn]))
1162 + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1168 + yyarg[yycount++] = yytname[yyx];
1170 + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1171 + if (! (yysize <= yysize1
1172 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1182 +# define YYCASE_(N, S) \
1186 + YYCASE_(0, YY_("syntax error"));
1187 + YYCASE_(1, YY_("syntax error, unexpected %s"));
1188 + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1189 + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1190 + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1191 + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1196 + YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1197 + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1202 + if (*yymsg_alloc < yysize)
1204 + *yymsg_alloc = 2 * yysize;
1205 + if (! (yysize <= *yymsg_alloc
1206 + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1207 + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1211 + /* Avoid sprintf, as that infringes on the user's name space.
1212 + Don't have undefined behavior even if the translation
1213 + produced a string with the wrong number of "%s"s. */
1215 + char *yyp = *yymsg;
1217 + while ((*yyp = *yyformat) != '\0')
1218 + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1220 + yyp += yytnamerr (yyp, yyarg[yyi++]);
1231 +#endif /* YYERROR_VERBOSE */
1233 +/*-----------------------------------------------.
1234 +| Release the memory associated to this symbol. |
1235 +`-----------------------------------------------*/
1238 +#if (defined __STDC__ || defined __C99__FUNC__ \
1239 + || defined __cplusplus || defined _MSC_VER)
1241 +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1244 +yydestruct (yymsg, yytype, yyvaluep)
1245 + const char *yymsg;
1247 + YYSTYPE *yyvaluep;
1253 + yymsg = "Deleting";
1254 + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1271 +#ifdef YYPARSE_PARAM
1272 +#if (defined __STDC__ || defined __C99__FUNC__ \
1273 + || defined __cplusplus || defined _MSC_VER)
1275 +yyparse (void *YYPARSE_PARAM)
1278 +yyparse (YYPARSE_PARAM)
1279 + void *YYPARSE_PARAM;
1281 +#else /* ! YYPARSE_PARAM */
1282 +#if (defined __STDC__ || defined __C99__FUNC__ \
1283 + || defined __cplusplus || defined _MSC_VER)
1293 +/* The lookahead symbol. */
1297 +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1298 +/* Suppress an incorrect diagnostic about yylval being uninitialized. */
1299 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1300 + _Pragma ("GCC diagnostic push") \
1301 + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1302 + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1303 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1304 + _Pragma ("GCC diagnostic pop")
1306 +/* Default value used for initialization, for pacifying older GCCs
1307 + or non-GCC compilers. */
1308 +static YYSTYPE yyval_default;
1309 +# define YY_INITIAL_VALUE(Value) = Value
1311 +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1312 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1313 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1315 +#ifndef YY_INITIAL_VALUE
1316 +# define YY_INITIAL_VALUE(Value) /* Nothing. */
1319 +/* The semantic value of the lookahead symbol. */
1320 +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1322 + /* Number of syntax errors so far. */
1326 + /* Number of tokens to shift before error messages enabled. */
1329 + /* The stacks and their tools:
1330 + `yyss': related to states.
1331 + `yyvs': related to semantic values.
1333 + Refer to the stacks through separate pointers, to allow yyoverflow
1334 + to reallocate them elsewhere. */
1336 + /* The state stack. */
1337 + yytype_int16 yyssa[YYINITDEPTH];
1338 + yytype_int16 *yyss;
1339 + yytype_int16 *yyssp;
1341 + /* The semantic value stack. */
1342 + YYSTYPE yyvsa[YYINITDEPTH];
1346 + YYSIZE_T yystacksize;
1350 + /* Lookahead token as an internal (translated) token number. */
1352 + /* The variables used to return semantic value and location from the
1353 + action routines. */
1356 +#if YYERROR_VERBOSE
1357 + /* Buffer for error messages, and its allocated size. */
1358 + char yymsgbuf[128];
1359 + char *yymsg = yymsgbuf;
1360 + YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1363 +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1365 + /* The number of symbols on the RHS of the reduced rule.
1366 + Keep to zero when no symbol should be popped. */
1369 + yyssp = yyss = yyssa;
1370 + yyvsp = yyvs = yyvsa;
1371 + yystacksize = YYINITDEPTH;
1373 + YYDPRINTF ((stderr, "Starting parse\n"));
1378 + yychar = YYEMPTY; /* Cause a token to be read. */
1381 +/*------------------------------------------------------------.
1382 +| yynewstate -- Push a new state, which is found in yystate. |
1383 +`------------------------------------------------------------*/
1385 + /* In all cases, when you get here, the value and location stacks
1386 + have just been pushed. So pushing a state here evens the stacks. */
1392 + if (yyss + yystacksize - 1 <= yyssp)
1394 + /* Get the current used size of the three stacks, in elements. */
1395 + YYSIZE_T yysize = yyssp - yyss + 1;
1399 + /* Give user a chance to reallocate the stack. Use copies of
1400 + these so that the &'s don't force the real ones into
1402 + YYSTYPE *yyvs1 = yyvs;
1403 + yytype_int16 *yyss1 = yyss;
1405 + /* Each stack pointer address is followed by the size of the
1406 + data in use in that stack, in bytes. This used to be a
1407 + conditional around just the two extra args, but that might
1408 + be undefined if yyoverflow is a macro. */
1409 + yyoverflow (YY_("memory exhausted"),
1410 + &yyss1, yysize * sizeof (*yyssp),
1411 + &yyvs1, yysize * sizeof (*yyvsp),
1417 +#else /* no yyoverflow */
1418 +# ifndef YYSTACK_RELOCATE
1419 + goto yyexhaustedlab;
1421 + /* Extend the stack our own way. */
1422 + if (YYMAXDEPTH <= yystacksize)
1423 + goto yyexhaustedlab;
1425 + if (YYMAXDEPTH < yystacksize)
1426 + yystacksize = YYMAXDEPTH;
1429 + yytype_int16 *yyss1 = yyss;
1430 + union yyalloc *yyptr =
1431 + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1433 + goto yyexhaustedlab;
1434 + YYSTACK_RELOCATE (yyss_alloc, yyss);
1435 + YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1436 +# undef YYSTACK_RELOCATE
1437 + if (yyss1 != yyssa)
1438 + YYSTACK_FREE (yyss1);
1441 +#endif /* no yyoverflow */
1443 + yyssp = yyss + yysize - 1;
1444 + yyvsp = yyvs + yysize - 1;
1446 + YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1447 + (unsigned long int) yystacksize));
1449 + if (yyss + yystacksize - 1 <= yyssp)
1453 + YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1455 + if (yystate == YYFINAL)
1465 + /* Do appropriate processing given the current state. Read a
1466 + lookahead token if we need one and don't already have one. */
1468 + /* First try to decide what to do without reference to lookahead token. */
1469 + yyn = yypact[yystate];
1470 + if (yypact_value_is_default (yyn))
1473 + /* Not known => get a lookahead token if don't already have one. */
1475 + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1476 + if (yychar == YYEMPTY)
1478 + YYDPRINTF ((stderr, "Reading a token: "));
1482 + if (yychar <= YYEOF)
1484 + yychar = yytoken = YYEOF;
1485 + YYDPRINTF ((stderr, "Now at end of input.\n"));
1489 + yytoken = YYTRANSLATE (yychar);
1490 + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1493 + /* If the proper action on seeing token YYTOKEN is to reduce or to
1494 + detect an error, take that action. */
1496 + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1498 + yyn = yytable[yyn];
1501 + if (yytable_value_is_error (yyn))
1507 + /* Count tokens shifted since error; after three, turn off error
1512 + /* Shift the lookahead token. */
1513 + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1515 + /* Discard the shifted token. */
1519 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1520 + *++yyvsp = yylval;
1521 + YY_IGNORE_MAYBE_UNINITIALIZED_END
1526 +/*-----------------------------------------------------------.
1527 +| yydefault -- do the default action for the current state. |
1528 +`-----------------------------------------------------------*/
1530 + yyn = yydefact[yystate];
1536 +/*-----------------------------.
1537 +| yyreduce -- Do a reduction. |
1538 +`-----------------------------*/
1540 + /* yyn is the number of a rule to reduce with. */
1541 + yylen = yyr2[yyn];
1543 + /* If YYLEN is nonzero, implement the default value of the action:
1546 + Otherwise, the following line sets YYVAL to garbage.
1547 + This behavior is undocumented and Bison
1548 + users should not rely upon it. Assigning to YYVAL
1549 + unconditionally makes the parser a bit smaller, and it avoids a
1550 + GCC warning that YYVAL may be used uninitialized. */
1551 + yyval = yyvsp[1-yylen];
1554 + YY_REDUCE_PRINT (yyn);
1558 +/* Line 1792 of yacc.c */
1559 +#line 153 "../common/getdate.y"
1561 + VARIABLE->yyHaveTime++;
1566 +/* Line 1792 of yacc.c */
1567 +#line 156 "../common/getdate.y"
1569 + VARIABLE->yyHaveZone++;
1574 +/* Line 1792 of yacc.c */
1575 +#line 159 "../common/getdate.y"
1577 + VARIABLE->yyHaveDate++;
1582 +/* Line 1792 of yacc.c */
1583 +#line 162 "../common/getdate.y"
1585 + VARIABLE->yyHaveDay++;
1590 +/* Line 1792 of yacc.c */
1591 +#line 165 "../common/getdate.y"
1593 + VARIABLE->yyHaveRel++;
1598 +/* Line 1792 of yacc.c */
1599 +#line 171 "../common/getdate.y"
1601 + VARIABLE->yyHour = (yyvsp[(1) - (2)].Number);
1602 + VARIABLE->yyMinutes = 0;
1603 + VARIABLE->yySeconds = 0;
1604 + VARIABLE->yyMeridian = (yyvsp[(2) - (2)].Meridian);
1609 +/* Line 1792 of yacc.c */
1610 +#line 177 "../common/getdate.y"
1612 + VARIABLE->yyHour = (yyvsp[(1) - (2)].Number)/100;
1613 + VARIABLE->yyMinutes = (yyvsp[(1) - (2)].Number)%100;
1614 + VARIABLE->yySeconds = 0;
1615 + VARIABLE->yyMeridian = MER24;
1616 + VARIABLE->yyDSTmode = DSToff;
1617 + VARIABLE->yyTimezone = - ((yyvsp[(2) - (2)].Number) % 100 + ((yyvsp[(2) - (2)].Number) / 100) * 60);
1622 +/* Line 1792 of yacc.c */
1623 +#line 185 "../common/getdate.y"
1625 + VARIABLE->yyHour = (yyvsp[(1) - (2)].Number)/10000;
1626 + VARIABLE->yyMinutes = ((yyvsp[(1) - (2)].Number)/100)%100;
1627 + VARIABLE->yySeconds = (yyvsp[(1) - (2)].Number) % 100;
1628 + VARIABLE->yyMeridian = MER24;
1629 + VARIABLE->yyDSTmode = DSToff;
1630 + VARIABLE->yyTimezone = - ((yyvsp[(2) - (2)].Number) % 100 + ((yyvsp[(2) - (2)].Number) / 100) * 60);
1635 +/* Line 1792 of yacc.c */
1636 +#line 193 "../common/getdate.y"
1638 + VARIABLE->yyHour = (yyvsp[(1) - (4)].Number);
1639 + VARIABLE->yyMinutes = (yyvsp[(3) - (4)].Number);
1640 + VARIABLE->yySeconds = 0;
1641 + VARIABLE->yyMeridian = (yyvsp[(4) - (4)].Meridian);
1646 +/* Line 1792 of yacc.c */
1647 +#line 199 "../common/getdate.y"
1649 + VARIABLE->yyHour = (yyvsp[(1) - (4)].Number);
1650 + VARIABLE->yyMinutes = (yyvsp[(3) - (4)].Number);
1651 + VARIABLE->yyMeridian = MER24;
1652 + VARIABLE->yyDSTmode = DSToff;
1653 + VARIABLE->yyTimezone = - ((yyvsp[(4) - (4)].Number) % 100 + ((yyvsp[(4) - (4)].Number) / 100) * 60);
1658 +/* Line 1792 of yacc.c */
1659 +#line 206 "../common/getdate.y"
1661 + VARIABLE->yyHour = (yyvsp[(1) - (6)].Number);
1662 + VARIABLE->yyMinutes = (yyvsp[(3) - (6)].Number);
1663 + VARIABLE->yySeconds = (yyvsp[(5) - (6)].Number);
1664 + VARIABLE->yyMeridian = (yyvsp[(6) - (6)].Meridian);
1669 +/* Line 1792 of yacc.c */
1670 +#line 212 "../common/getdate.y"
1672 + VARIABLE->yyHour = (yyvsp[(1) - (6)].Number);
1673 + VARIABLE->yyMinutes = (yyvsp[(3) - (6)].Number);
1674 + VARIABLE->yySeconds = (yyvsp[(5) - (6)].Number);
1675 + VARIABLE->yyMeridian = MER24;
1676 + VARIABLE->yyDSTmode = DSToff;
1677 + VARIABLE->yyTimezone = - ((yyvsp[(6) - (6)].Number) % 100 + ((yyvsp[(6) - (6)].Number) / 100) * 60);
1682 +/* Line 1792 of yacc.c */
1683 +#line 222 "../common/getdate.y"
1685 + VARIABLE->yyTimezone = (yyvsp[(1) - (1)].Number);
1686 + VARIABLE->yyDSTmode = DSToff;
1691 +/* Line 1792 of yacc.c */
1692 +#line 226 "../common/getdate.y"
1694 + VARIABLE->yyTimezone = (yyvsp[(1) - (1)].Number);
1695 + VARIABLE->yyDSTmode = DSTon;
1700 +/* Line 1792 of yacc.c */
1701 +#line 231 "../common/getdate.y"
1703 + VARIABLE->yyTimezone = (yyvsp[(1) - (2)].Number);
1704 + VARIABLE->yyDSTmode = DSTon;
1709 +/* Line 1792 of yacc.c */
1710 +#line 235 "../common/getdate.y"
1712 + if (VARIABLE->yyHaveTime > 0) {
1713 + VARIABLE->yyTimezone = (yyvsp[(1) - (1)].Number);
1714 + VARIABLE->yyDSTmode = DSToff;
1717 + VARIABLE->yyHaveZone--;
1722 +/* Line 1792 of yacc.c */
1723 +#line 245 "../common/getdate.y"
1725 + VARIABLE->yyDayOrdinal = 1;
1726 + VARIABLE->yyDayNumber = (yyvsp[(1) - (1)].Number);
1731 +/* Line 1792 of yacc.c */
1732 +#line 249 "../common/getdate.y"
1734 + VARIABLE->yyDayOrdinal = 1;
1735 + VARIABLE->yyDayNumber = (yyvsp[(1) - (2)].Number);
1740 +/* Line 1792 of yacc.c */
1741 +#line 253 "../common/getdate.y"
1743 + VARIABLE->yyDayOrdinal = (yyvsp[(1) - (2)].Number);
1744 + VARIABLE->yyDayNumber = (yyvsp[(2) - (2)].Number);
1749 +/* Line 1792 of yacc.c */
1750 +#line 259 "../common/getdate.y"
1752 + SetPossibleDate(VARIABLE, (yyvsp[(1) - (3)].Number), (yyvsp[(3) - (3)].Number), VARIABLE->yyYear);
1757 +/* Line 1792 of yacc.c */
1758 +#line 262 "../common/getdate.y"
1760 + SetPossibleDate(VARIABLE, (yyvsp[(1) - (5)].Number), (yyvsp[(3) - (5)].Number), (yyvsp[(5) - (5)].Number));
1765 +/* Line 1792 of yacc.c */
1766 +#line 265 "../common/getdate.y"
1768 + /* ISO 8601 format. yyyy-mm-dd. */
1769 + if ((yyvsp[(1) - (3)].Number) > 31) {
1770 + VARIABLE->yyYear = (yyvsp[(1) - (3)].Number);
1771 + VARIABLE->yyMonth = -(yyvsp[(2) - (3)].Number);
1772 + VARIABLE->yyDay = -(yyvsp[(3) - (3)].Number);
1775 + SetPossibleDate(VARIABLE, (yyvsp[(1) - (3)].Number), -(yyvsp[(2) - (3)].Number), -(yyvsp[(3) - (3)].Number));
1780 +/* Line 1792 of yacc.c */
1781 +#line 275 "../common/getdate.y"
1783 + /* e.g. 17-JUN-1992. */
1784 + VARIABLE->yyDay = (yyvsp[(1) - (3)].Number);
1785 + VARIABLE->yyMonth = (yyvsp[(2) - (3)].Number);
1786 + VARIABLE->yyYear = -(yyvsp[(3) - (3)].Number);
1791 +/* Line 1792 of yacc.c */
1792 +#line 281 "../common/getdate.y"
1794 + VARIABLE->yyMonth = (yyvsp[(1) - (2)].Number);
1795 + VARIABLE->yyDay = (yyvsp[(2) - (2)].Number);
1800 +/* Line 1792 of yacc.c */
1801 +#line 285 "../common/getdate.y"
1803 + VARIABLE->yyMonth = (yyvsp[(1) - (4)].Number);
1804 + VARIABLE->yyDay = (yyvsp[(2) - (4)].Number);
1805 + VARIABLE->yyYear = (yyvsp[(4) - (4)].Number);
1810 +/* Line 1792 of yacc.c */
1811 +#line 290 "../common/getdate.y"
1813 + VARIABLE->yyMonth = (yyvsp[(2) - (2)].Number);
1814 + VARIABLE->yyDay = (yyvsp[(1) - (2)].Number);
1819 +/* Line 1792 of yacc.c */
1820 +#line 294 "../common/getdate.y"
1822 + VARIABLE->yyMonth = (yyvsp[(2) - (3)].Number);
1823 + VARIABLE->yyDay = (yyvsp[(1) - (3)].Number);
1824 + VARIABLE->yyYear = (yyvsp[(3) - (3)].Number);
1829 +/* Line 1792 of yacc.c */
1830 +#line 301 "../common/getdate.y"
1832 + VARIABLE->yyRelSeconds = -VARIABLE->yyRelSeconds;
1833 + VARIABLE->yyRelMonth = -VARIABLE->yyRelMonth;
1838 +/* Line 1792 of yacc.c */
1839 +#line 308 "../common/getdate.y"
1841 + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number) * 60L;
1846 +/* Line 1792 of yacc.c */
1847 +#line 311 "../common/getdate.y"
1849 + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number) * 60L;
1854 +/* Line 1792 of yacc.c */
1855 +#line 314 "../common/getdate.y"
1857 + VARIABLE->yyRelSeconds += (yyvsp[(1) - (1)].Number) * 60L;
1862 +/* Line 1792 of yacc.c */
1863 +#line 317 "../common/getdate.y"
1865 + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number);
1870 +/* Line 1792 of yacc.c */
1871 +#line 320 "../common/getdate.y"
1873 + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number);
1878 +/* Line 1792 of yacc.c */
1879 +#line 323 "../common/getdate.y"
1881 + VARIABLE->yyRelSeconds++;
1886 +/* Line 1792 of yacc.c */
1887 +#line 326 "../common/getdate.y"
1889 + VARIABLE->yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
1894 +/* Line 1792 of yacc.c */
1895 +#line 329 "../common/getdate.y"
1897 + VARIABLE->yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
1902 +/* Line 1792 of yacc.c */
1903 +#line 332 "../common/getdate.y"
1905 + VARIABLE->yyRelMonth += (yyvsp[(1) - (1)].Number);
1910 +/* Line 1792 of yacc.c */
1911 +#line 337 "../common/getdate.y"
1913 + (yyval.Number) = (yyvsp[(1) - (1)].Number);
1918 +/* Line 1792 of yacc.c */
1919 +#line 340 "../common/getdate.y"
1921 + (yyval.Number) = (yyvsp[(1) - (1)].Number);
1926 +/* Line 1792 of yacc.c */
1927 +#line 343 "../common/getdate.y"
1929 + (yyval.Number) = (yyvsp[(1) - (1)].Number);
1934 +/* Line 1792 of yacc.c */
1935 +#line 348 "../common/getdate.y"
1937 + if (VARIABLE->yyHaveTime && VARIABLE->yyHaveDate && !VARIABLE->yyHaveRel)
1938 + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number);
1940 + if((yyvsp[(1) - (1)].Number)>240000) {
1941 + VARIABLE->yyHaveDate++;
1942 + VARIABLE->yyDay= ((yyvsp[(1) - (1)].Number))%100;
1943 + VARIABLE->yyMonth= ((yyvsp[(1) - (1)].Number)/100)%100;
1944 + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number)/10000;
1947 + VARIABLE->yyHaveTime++;
1948 + if ((yyvsp[(1) - (1)].Number) < 10000) {
1949 + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number) / 100;
1950 + VARIABLE->yyMinutes = (yyvsp[(1) - (1)].Number) % 100;
1951 + VARIABLE->yySeconds = 0;
1954 + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number)/10000;
1955 + VARIABLE->yyMinutes = ((yyvsp[(1) - (1)].Number)/100)%100;
1956 + VARIABLE->yySeconds = (yyvsp[(1) - (1)].Number) % 100;
1958 + VARIABLE->yyMeridian = MER24;
1965 +/* Line 1792 of yacc.c */
1966 +#line 374 "../common/getdate.y"
1968 + if (VARIABLE->yyHaveTime && VARIABLE->yyHaveDate && !VARIABLE->yyHaveRel)
1969 + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number);
1971 + VARIABLE->yyHaveTime++;
1972 + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number)/100;
1973 + VARIABLE->yyMinutes = (yyvsp[(1) - (1)].Number)%100;
1974 + VARIABLE->yySeconds = 0;
1975 + VARIABLE->yyMeridian = MER24;
1981 +/* Line 1792 of yacc.c */
1982 +#line 385 "../common/getdate.y"
1984 + if (!VARIABLE->yyHaveDate && (yyvsp[(1) - (1)].Number)>240000) {
1985 + VARIABLE->yyHaveDate++;
1986 + VARIABLE->yyDay= ((yyvsp[(1) - (1)].Number))%100;
1987 + VARIABLE->yyMonth= ((yyvsp[(1) - (1)].Number)/100)%100;
1988 + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number)/10000;
1990 + else if (!VARIABLE->yyHaveTime) {
1991 + VARIABLE->yyHaveTime++;
1992 + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number)/10000;
1993 + VARIABLE->yyMinutes = ((yyvsp[(1) - (1)].Number)/100)%100;
1994 + VARIABLE->yySeconds = (yyvsp[(1) - (1)].Number) % 100;
1995 + VARIABLE->yyMeridian = MER24;
2001 +/* Line 1792 of yacc.c */
2002 +#line 402 "../common/getdate.y"
2004 + (yyval.Meridian) = MER24;
2009 +/* Line 1792 of yacc.c */
2010 +#line 405 "../common/getdate.y"
2012 + (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);
2017 +/* Line 1792 of yacc.c */
2018 +#line 2016 "../common/getdate.tab.c"
2021 + /* User semantic actions sometimes alter yychar, and that requires
2022 + that yytoken be updated with the new translation. We take the
2023 + approach of translating immediately before every use of yytoken.
2024 + One alternative is translating here after every semantic action,
2025 + but that translation would be missed if the semantic action invokes
2026 + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2027 + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2028 + incorrect destructor might then be invoked immediately. In the
2029 + case of YYERROR or YYBACKUP, subsequent parser actions might lead
2030 + to an incorrect destructor call or verbose syntax error message
2031 + before the lookahead is translated. */
2032 + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2034 + YYPOPSTACK (yylen);
2036 + YY_STACK_PRINT (yyss, yyssp);
2040 + /* Now `shift' the result of the reduction. Determine what state
2041 + that goes to, based on the state we popped back to and the rule
2042 + number reduced by. */
2046 + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2047 + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2048 + yystate = yytable[yystate];
2050 + yystate = yydefgoto[yyn - YYNTOKENS];
2055 +/*------------------------------------.
2056 +| yyerrlab -- here on detecting error |
2057 +`------------------------------------*/
2059 + /* Make sure we have latest lookahead translation. See comments at
2060 + user semantic actions for why this is necessary. */
2061 + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2063 + /* If not already recovering from an error, report this error. */
2067 +#if ! YYERROR_VERBOSE
2068 + yyerror (YY_("syntax error"));
2070 +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2073 + char const *yymsgp = YY_("syntax error");
2074 + int yysyntax_error_status;
2075 + yysyntax_error_status = YYSYNTAX_ERROR;
2076 + if (yysyntax_error_status == 0)
2078 + else if (yysyntax_error_status == 1)
2080 + if (yymsg != yymsgbuf)
2081 + YYSTACK_FREE (yymsg);
2082 + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2086 + yymsg_alloc = sizeof yymsgbuf;
2087 + yysyntax_error_status = 2;
2091 + yysyntax_error_status = YYSYNTAX_ERROR;
2096 + if (yysyntax_error_status == 2)
2097 + goto yyexhaustedlab;
2099 +# undef YYSYNTAX_ERROR
2105 + if (yyerrstatus == 3)
2107 + /* If just tried and failed to reuse lookahead token after an
2108 + error, discard it. */
2110 + if (yychar <= YYEOF)
2112 + /* Return failure if at end of input. */
2113 + if (yychar == YYEOF)
2118 + yydestruct ("Error: discarding",
2119 + yytoken, &yylval);
2124 + /* Else will try to reuse lookahead token after shifting the error
2129 +/*---------------------------------------------------.
2130 +| yyerrorlab -- error raised explicitly by YYERROR. |
2131 +`---------------------------------------------------*/
2134 + /* Pacify compilers like GCC when the user code never invokes
2135 + YYERROR and the label yyerrorlab therefore never appears in user
2137 + if (/*CONSTCOND*/ 0)
2140 + /* Do not reclaim the symbols of the rule which action triggered
2142 + YYPOPSTACK (yylen);
2144 + YY_STACK_PRINT (yyss, yyssp);
2149 +/*-------------------------------------------------------------.
2150 +| yyerrlab1 -- common code for both syntax error and YYERROR. |
2151 +`-------------------------------------------------------------*/
2153 + yyerrstatus = 3; /* Each real token shifted decrements this. */
2157 + yyn = yypact[yystate];
2158 + if (!yypact_value_is_default (yyn))
2161 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2163 + yyn = yytable[yyn];
2169 + /* Pop the current state because it cannot handle the error token. */
2170 + if (yyssp == yyss)
2174 + yydestruct ("Error: popping",
2175 + yystos[yystate], yyvsp);
2178 + YY_STACK_PRINT (yyss, yyssp);
2181 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2182 + *++yyvsp = yylval;
2183 + YY_IGNORE_MAYBE_UNINITIALIZED_END
2186 + /* Shift the error token. */
2187 + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2193 +/*-------------------------------------.
2194 +| yyacceptlab -- YYACCEPT comes here. |
2195 +`-------------------------------------*/
2200 +/*-----------------------------------.
2201 +| yyabortlab -- YYABORT comes here. |
2202 +`-----------------------------------*/
2207 +#if !defined yyoverflow || YYERROR_VERBOSE
2208 +/*-------------------------------------------------.
2209 +| yyexhaustedlab -- memory exhaustion comes here. |
2210 +`-------------------------------------------------*/
2212 + yyerror (YY_("memory exhausted"));
2214 + /* Fall through. */
2218 + if (yychar != YYEMPTY)
2220 + /* Make sure we have latest lookahead translation. See comments at
2221 + user semantic actions for why this is necessary. */
2222 + yytoken = YYTRANSLATE (yychar);
2223 + yydestruct ("Cleanup: discarding lookahead",
2224 + yytoken, &yylval);
2226 + /* Do not reclaim the symbols of the rule which action triggered
2227 + this YYABORT or YYACCEPT. */
2228 + YYPOPSTACK (yylen);
2229 + YY_STACK_PRINT (yyss, yyssp);
2230 + while (yyssp != yyss)
2232 + yydestruct ("Cleanup: popping",
2233 + yystos[*yyssp], yyvsp);
2237 + if (yyss != yyssa)
2238 + YYSTACK_FREE (yyss);
2240 +#if YYERROR_VERBOSE
2241 + if (yymsg != yymsgbuf)
2242 + YYSTACK_FREE (yymsg);
2244 + /* Make sure YYID is used. */
2245 + return YYID (yyresult);
2249 +/* Line 2055 of yacc.c */
2250 +#line 410 "../common/getdate.y"
2253 +/* Month and day table. */
2254 +static TABLE const MonthDayTable[] = {
2255 + { "january", tMONTH, 1 },
2256 + { "february", tMONTH, 2 },
2257 + { "march", tMONTH, 3 },
2258 + { "april", tMONTH, 4 },
2259 + { "may", tMONTH, 5 },
2260 + { "june", tMONTH, 6 },
2261 + { "july", tMONTH, 7 },
2262 + { "august", tMONTH, 8 },
2263 + { "september", tMONTH, 9 },
2264 + { "sept", tMONTH, 9 },
2265 + { "october", tMONTH, 10 },
2266 + { "november", tMONTH, 11 },
2267 + { "december", tMONTH, 12 },
2268 + { "sunday", tDAY, 0 },
2269 + { "monday", tDAY, 1 },
2270 + { "tuesday", tDAY, 2 },
2271 + { "tues", tDAY, 2 },
2272 + { "wednesday", tDAY, 3 },
2273 + { "wednes", tDAY, 3 },
2274 + { "thursday", tDAY, 4 },
2275 + { "thur", tDAY, 4 },
2276 + { "thurs", tDAY, 4 },
2277 + { "friday", tDAY, 5 },
2278 + { "saturday", tDAY, 6 },
2282 +/* Time units table. */
2283 +static TABLE const UnitsTable[] = {
2284 + { "year", tMONTH_UNIT, 12 },
2285 + { "month", tMONTH_UNIT, 1 },
2286 + { "fortnight", tMINUTE_UNIT, 14 * 24 * 60 },
2287 + { "week", tMINUTE_UNIT, 7 * 24 * 60 },
2288 + { "day", tMINUTE_UNIT, 1 * 24 * 60 },
2289 + { "hour", tMINUTE_UNIT, 60 },
2290 + { "minute", tMINUTE_UNIT, 1 },
2291 + { "min", tMINUTE_UNIT, 1 },
2292 + { "second", tSEC_UNIT, 1 },
2293 + { "sec", tSEC_UNIT, 1 },
2297 +/* Assorted relative-time words. */
2298 +static TABLE const OtherTable[] = {
2299 + { "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 },
2300 + { "yesterday", tMINUTE_UNIT, -1 * 24 * 60 },
2301 + { "today", tMINUTE_UNIT, 0 },
2302 + { "now", tMINUTE_UNIT, 0 },
2303 + { "last", tUNUMBER, -1 },
2304 + { "this", tMINUTE_UNIT, 0 },
2305 + { "next", tUNUMBER, 2 },
2306 + { "first", tUNUMBER, 1 },
2307 +/* { "second", tUNUMBER, 2 }, */
2308 + { "third", tUNUMBER, 3 },
2309 + { "fourth", tUNUMBER, 4 },
2310 + { "fifth", tUNUMBER, 5 },
2311 + { "sixth", tUNUMBER, 6 },
2312 + { "seventh", tUNUMBER, 7 },
2313 + { "eighth", tUNUMBER, 8 },
2314 + { "ninth", tUNUMBER, 9 },
2315 + { "tenth", tUNUMBER, 10 },
2316 + { "eleventh", tUNUMBER, 11 },
2317 + { "twelfth", tUNUMBER, 12 },
2318 + { "ago", tAGO, 1 },
2322 +/* The timezone table. */
2323 +/* Some of these are commented out because a time_t can't store a float. */
2324 +static TABLE const TimezoneTable[] = {
2325 + { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
2326 + { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
2327 + { "utc", tZONE, HOUR( 0) },
2328 + { "wet", tZONE, HOUR( 0) }, /* Western European */
2329 + { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */
2330 + { "wat", tZONE, HOUR( 1) }, /* West Africa */
2331 + { "at", tZONE, HOUR( 2) }, /* Azores */
2333 + /* For completeness. BST is also British Summer, and GST is
2334 + * also Guam Standard. */
2335 + { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */
2336 + { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */
2339 + { "nft", tZONE, HOUR(3.5) }, /* Newfoundland */
2340 + { "nst", tZONE, HOUR(3.5) }, /* Newfoundland Standard */
2341 + { "ndt", tDAYZONE, HOUR(3.5) }, /* Newfoundland Daylight */
2343 + { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */
2344 + { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */
2345 + { "est", tZONE, HOUR( 5) }, /* Eastern Standard */
2346 + { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */
2347 + { "cst", tZONE, HOUR( 6) }, /* Central Standard */
2348 + { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */
2349 + { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */
2350 + { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */
2351 + { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */
2352 + { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */
2353 + { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */
2354 + { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */
2355 + { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */
2356 + { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */
2357 + { "cat", tZONE, HOUR(10) }, /* Central Alaska */
2358 + { "ahst", tZONE, HOUR(10) }, /* Alaska-Hawaii Standard */
2359 + { "nt", tZONE, HOUR(11) }, /* Nome */
2360 + { "idlw", tZONE, HOUR(12) }, /* International Date Line West */
2361 + { "cet", tZONE, -HOUR(1) }, /* Central European */
2362 + { "met", tZONE, -HOUR(1) }, /* Middle European */
2363 + { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */
2364 + { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */
2365 + { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */
2366 + { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */
2367 + { "fwt", tZONE, -HOUR(1) }, /* French Winter */
2368 + { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */
2369 + { "eet", tZONE, -HOUR(2) }, /* Eastern Europe, USSR Zone 1 */
2370 + { "bt", tZONE, -HOUR(3) }, /* Baghdad, USSR Zone 2 */
2372 + { "it", tZONE, -HOUR(3.5) },/* Iran */
2374 + { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */
2375 + { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */
2377 + { "ist", tZONE, -HOUR(5.5) },/* Indian Standard */
2379 + { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */
2381 + /* For completeness. NST is also Newfoundland Stanard, and SST is
2382 + * also Swedish Summer. */
2383 + { "nst", tZONE, -HOUR(6.5) },/* North Sumatra */
2384 + { "sst", tZONE, -HOUR(7) }, /* South Sumatra, USSR Zone 6 */
2386 + { "wast", tZONE, -HOUR(7) }, /* West Australian Standard */
2387 + { "wadt", tDAYZONE, -HOUR(7) }, /* West Australian Daylight */
2389 + { "jt", tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */
2391 + { "cct", tZONE, -HOUR(8) }, /* China Coast, USSR Zone 7 */
2392 + { "jst", tZONE, -HOUR(9) }, /* Japan Standard, USSR Zone 8 */
2394 + { "cast", tZONE, -HOUR(9.5) },/* Central Australian Standard */
2395 + { "cadt", tDAYZONE, -HOUR(9.5) },/* Central Australian Daylight */
2397 + { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */
2398 + { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */
2399 + { "gst", tZONE, -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
2400 + { "nzt", tZONE, -HOUR(12) }, /* New Zealand */
2401 + { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
2402 + { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
2403 + { "idle", tZONE, -HOUR(12) }, /* International Date Line East */
2407 +/* Military timezone table. */
2408 +static TABLE const MilitaryTable[] = {
2409 + { "a", tMILZONE, HOUR( 1) },
2410 + { "b", tMILZONE, HOUR( 2) },
2411 + { "c", tMILZONE, HOUR( 3) },
2412 + { "d", tMILZONE, HOUR( 4) },
2413 + { "e", tMILZONE, HOUR( 5) },
2414 + { "f", tMILZONE, HOUR( 6) },
2415 + { "g", tMILZONE, HOUR( 7) },
2416 + { "h", tMILZONE, HOUR( 8) },
2417 + { "i", tMILZONE, HOUR( 9) },
2418 + { "k", tMILZONE, HOUR( 10) },
2419 + { "l", tMILZONE, HOUR( 11) },
2420 + { "m", tMILZONE, HOUR( 12) },
2421 + { "n", tMILZONE, HOUR(- 1) },
2422 + { "o", tMILZONE, HOUR(- 2) },
2423 + { "p", tMILZONE, HOUR(- 3) },
2424 + { "q", tMILZONE, HOUR(- 4) },
2425 + { "r", tMILZONE, HOUR(- 5) },
2426 + { "s", tMILZONE, HOUR(- 6) },
2427 + { "t", tMILZONE, HOUR(- 7) },
2428 + { "u", tMILZONE, HOUR(- 8) },
2429 + { "v", tMILZONE, HOUR(- 9) },
2430 + { "w", tMILZONE, HOUR(-10) },
2431 + { "x", tMILZONE, HOUR(-11) },
2432 + { "y", tMILZONE, HOUR(-12) },
2433 + { "z", tZONE, HOUR( 0) }, /* Deliberately tZONE */
2437 +static int LookupWord(char * buff, YYSTYPE * yylval)
2441 + register const TABLE *tp;
2445 + /* Make it lowercase. */
2446 + for (p = buff; *p != '\0'; p++)
2447 + *p = (char)tolower(*p);
2449 + if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
2450 + yylval->Meridian = MERam;
2453 + if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
2454 + yylval->Meridian = MERpm;
2458 + /* See if we have an abbreviation for a month. */
2459 + if (strlen(buff) == 3)
2461 + else if (strlen(buff) == 4 && buff[3] == '.') {
2468 + for (tp = MonthDayTable; tp->name; tp++) {
2470 + if (strncmp(buff, tp->name, 3) == 0) {
2471 + yylval->Number = tp->value;
2475 + else if (strcmp(buff, tp->name) == 0) {
2476 + yylval->Number = tp->value;
2481 + for (tp = TimezoneTable; tp->name; tp++)
2482 + if (strcmp(buff, tp->name) == 0) {
2483 + yylval->Number = tp->value;
2487 + if (strcmp(buff, "dst") == 0)
2490 + for (tp = UnitsTable; tp->name; tp++)
2491 + if (strcmp(buff, tp->name) == 0) {
2492 + yylval->Number = tp->value;
2496 + /* Strip off any plural and try the units table again. */
2497 + i = strlen(buff) - 1;
2498 + if (buff[i] == 's') {
2500 + for (tp = UnitsTable; tp->name; tp++)
2501 + if (strcmp(buff, tp->name) == 0) {
2502 + yylval->Number = tp->value;
2505 + buff[i] = 's'; /* Put back for "this" in OtherTable. */
2508 + for (tp = OtherTable; tp->name; tp++)
2509 + if (strcmp(buff, tp->name) == 0) {
2510 + yylval->Number = tp->value;
2514 + /* Military timezones. */
2515 + if (buff[1] == '\0' && isalpha(*buff)) {
2516 + for (tp = MilitaryTable; tp->name; tp++)
2517 + if (strcmp(buff, tp->name) == 0) {
2518 + yylval->Number = tp->value;
2523 + /* Drop out any periods and try the timezone table again. */
2524 + for (i = 0, p = q = buff; *q; q++)
2531 + for (tp = TimezoneTable; tp->name; tp++)
2532 + if (strcmp(buff, tp->name) == 0) {
2533 + yylval->Number = tp->value;
2537 + for (i = 1; i <= 12; i++)
2538 + for (abbrev = 0; abbrev < 2; abbrev++)
2539 + if (PTimeIsMonthName(buff, i, abbrev)) {
2540 + yylval->Number = i;
2544 + for (i = 1; i <= 7; i++)
2545 + for (abbrev = 0; abbrev < 2; abbrev++)
2546 + if (PTimeIsDayName(buff, i, abbrev)) {
2547 + yylval->Number = i;
2556 +#pragma warning(disable:4211)
2562 +int yylex(YYSTYPE * yylval, void * yyInput)
2568 + register int c = PTimeGetChar(yyInput);
2570 + while (c != EOF && c != '\0' && c != '\n') {
2571 + while (isspace(c))
2572 + c = PTimeGetChar(yyInput);
2574 + if (isdigit(c) || c == '-' || c == '+') {
2575 + if (c == '-' || c == '+') {
2576 + sign = c == '-' ? -1 : 1;
2577 + if (!isdigit(c = PTimeGetChar(yyInput)))
2578 + /* skip the '-' sign */
2583 + yylval->Number = 0;
2584 + Count = 0; /* Count number of digits */
2585 + while (isdigit(c)) {
2586 + yylval->Number = 10 * yylval->Number + c - '0';
2587 + c = PTimeGetChar(yyInput);
2590 + PTimeUngetChar(yyInput, c);
2592 + yylval->Number = -yylval->Number;
2596 + return t4DIGITNUMBER;
2598 + return t6DIGITNUMBER;
2603 + for (p = buff; isalpha(c) || c == '.'; c = PTimeGetChar(yyInput)) {
2604 + if (p < &buff[sizeof(buff)-1])
2608 + PTimeUngetChar(yyInput, c);
2609 + return LookupWord(buff, yylval);
2617 + c = PTimeGetChar(yyInput);
2618 + if (c == '\0' || c == EOF)
2622 + else if (c == ')')
2624 + } while (Count > 0);
2631 +#pragma warning(default:4211)
2635 +static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds,
2636 + MERIDIAN Meridian)
2638 + if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
2640 + switch (Meridian) {
2642 + if (Hours < 0 || Hours > 23)
2644 + return (Hours * 60L + Minutes) * 60L + Seconds;
2646 + if (Hours < 1 || Hours > 12)
2650 + return (Hours * 60L + Minutes) * 60L + Seconds;
2652 + if (Hours < 1 || Hours > 12)
2656 + return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
2663 +static time_t Convert(time_t Month, time_t Day, time_t Year,
2664 + time_t Hours, time_t Minutes, time_t Seconds,
2665 + MERIDIAN Meridian, DSTMODE DSTmode, time_t yyTimezone)
2667 + static int DaysInMonth[12] = {
2668 + 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
2678 + else if (Year < 100)
2680 + DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
2682 + /* Checking for 2038 bogusly assumes that time_t is 32 bits. But
2683 + I'm too lazy to try to check for time_t overflow in another way. */
2684 + if (Year < EPOCH || Year > 2038
2685 + || Month < 1 || Month > 12
2686 + /* Lint fluff: "conversion from long may lose accuracy" */
2687 + || Day < 1 || Day > DaysInMonth[(int)--Month])
2690 + for (Julian = Day - 1, i = 0; i < Month; i++)
2691 + Julian += DaysInMonth[i];
2692 + for (i = EPOCH; i < Year; i++)
2693 + Julian += 365 + (i % 4 == 0);
2694 + Julian *= SECSPERDAY;
2695 + Julian += yyTimezone * 60L;
2696 + if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
2699 + if (DSTmode == DSTon
2700 + || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
2701 + Julian -= 60 * 60;
2706 +static time_t DSTcorrect(time_t Start, time_t Future)
2711 + StartDay = (localtime(&Start)->tm_hour + 1) % 24;
2712 + FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
2713 + return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
2717 +static time_t RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber)
2723 + tm = localtime(&now);
2724 + now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
2725 + now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
2726 + return DSTcorrect(Start, now);
2730 +static time_t RelativeMonth(time_t Start, time_t RelMonth, time_t yyTimezone)
2736 + if (RelMonth == 0)
2738 + tm = localtime(&Start);
2739 + Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
2740 + Year = Month / 12 + 1900;
2741 + Month = Month % 12 + 1;
2742 + return DSTcorrect(Start,
2743 + Convert(Month, (time_t)tm->tm_mday, Year,
2744 + (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
2745 + MER24, DSTmaybe, yyTimezone));
2749 +static void SetPossibleDate(struct Variables * var,
2750 + time_t possible_day,
2751 + time_t possible_month,
2752 + time_t possible_year)
2756 + if (possible_day > 31) /* test for ymd */
2758 + else if (possible_day > 12) /* test for dmy */
2760 + else if (possible_month > 12) /* test for mdy */
2763 + static int default_date_order = -1;
2764 + if (default_date_order < 0)
2765 + default_date_order = PTimeGetDateOrder();
2766 + date_order = default_date_order;
2769 + switch (date_order) {
2771 + var->yyDay = possible_month;
2772 + var->yyMonth = possible_day;
2773 + var->yyYear = possible_year;
2776 + var->yyDay = possible_day;
2777 + var->yyMonth = possible_month;
2778 + var->yyYear = possible_year;
2781 + var->yyDay = possible_year;
2782 + var->yyMonth = possible_month;
2783 + var->yyYear = possible_day;
2788 +time_t STDAPICALLTYPE PTimeParse(void * inputStream, struct tm * now, int timezone)
2791 + struct Variables var;
2794 + var.yyInput = inputStream;
2795 + var.yyYear = now->tm_year + 1900;
2796 + var.yyMonth = now->tm_mon + 1;
2797 + var.yyDay = now->tm_mday;
2798 + var.yyTimezone = -timezone;
2799 + var.yyDSTmode = DSTmaybe;
2801 + var.yyMinutes = 0;
2802 + var.yySeconds = 0;
2803 + var.yyMeridian = MER24;
2804 + var.yyRelSeconds = 0;
2805 + var.yyRelMonth = 0;
2806 + var.yyHaveDate = 0;
2807 + var.yyHaveDay = 0;
2808 + var.yyHaveRel = 0;
2809 + var.yyHaveTime = 0;
2810 + var.yyHaveZone = 0;
2814 + if (var.yyHaveTime > 1 || var.yyHaveZone > 1 ||
2815 + var.yyHaveDate > 1 || var.yyHaveDay > 1)
2818 + if (var.yyHaveTime == 0 && var.yyHaveZone == 0 &&
2819 + var.yyHaveDate == 0 && var.yyHaveDay == 0 && var.yyHaveRel == 0)
2822 + if (var.yyHaveDate || var.yyHaveTime || var.yyHaveDay) {
2823 + Start = Convert(var.yyMonth, var.yyDay, var.yyYear,
2824 + var.yyHour, var.yyMinutes, var.yySeconds,
2825 + var.yyMeridian, var.yyDSTmode, var.yyTimezone);
2831 + if (!var.yyHaveRel)
2832 + Start -= ((now->tm_hour * 60L + now->tm_min) * 60L) + now->tm_sec;
2835 + Start += var.yyRelSeconds;
2836 + Start += RelativeMonth(Start, var.yyRelMonth, var.yyTimezone);
2838 + if (var.yyHaveDay && !var.yyHaveDate)
2839 + Start += RelativeDate(Start, var.yyDayOrdinal, var.yyDayNumber);
2841 + /* Have to do *something* with a legitimate -1 so it's distinguishable
2842 + * from the error return value. (Alternately could set errno on error.) */
2843 + return Start == -1 ? 0 : Start;
2848 +#pragma warning(disable:4100 4211)
2852 +int yyerror(const char * s)
2857 +static void yyerror(const char * s)
2863 +#pragma warning(default:4100 4211)
2867 +/* End of file ***************************************************************/