1 |
/* A Bison parser, made by GNU Bison 1.875c. */ |
/* A Bison parser, made by GNU Bison 2.0. */ |
2 |
|
|
3 |
/* Skeleton parser for Yacc-like parsing with Bison, |
/* Skeleton parser for Yacc-like parsing with Bison, |
4 |
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
55 |
enum yytokentype { |
enum yytokentype { |
56 |
tAGO = 258, |
tAGO = 258, |
57 |
tDST = 259, |
tDST = 259, |
58 |
tDAY = 260, |
tYEAR_UNIT = 260, |
59 |
tDAY_UNIT = 261, |
tMONTH_UNIT = 261, |
60 |
tDAYZONE = 262, |
tHOUR_UNIT = 262, |
61 |
tHOUR_UNIT = 263, |
tMINUTE_UNIT = 263, |
62 |
tLOCAL_ZONE = 264, |
tSEC_UNIT = 264, |
63 |
tMERIDIAN = 265, |
tDAY_UNIT = 265, |
64 |
tMINUTE_UNIT = 266, |
tDAY = 266, |
65 |
tMONTH = 267, |
tDAYZONE = 267, |
66 |
tMONTH_UNIT = 268, |
tLOCAL_ZONE = 268, |
67 |
tORDINAL = 269, |
tMERIDIAN = 269, |
68 |
tSEC_UNIT = 270, |
tMONTH = 270, |
69 |
tYEAR_UNIT = 271, |
tORDINAL = 271, |
70 |
tZONE = 272, |
tZONE = 272, |
71 |
tSNUMBER = 273, |
tSNUMBER = 273, |
72 |
tUNUMBER = 274, |
tUNUMBER = 274, |
76 |
#endif |
#endif |
77 |
#define tAGO 258 |
#define tAGO 258 |
78 |
#define tDST 259 |
#define tDST 259 |
79 |
#define tDAY 260 |
#define tYEAR_UNIT 260 |
80 |
#define tDAY_UNIT 261 |
#define tMONTH_UNIT 261 |
81 |
#define tDAYZONE 262 |
#define tHOUR_UNIT 262 |
82 |
#define tHOUR_UNIT 263 |
#define tMINUTE_UNIT 263 |
83 |
#define tLOCAL_ZONE 264 |
#define tSEC_UNIT 264 |
84 |
#define tMERIDIAN 265 |
#define tDAY_UNIT 265 |
85 |
#define tMINUTE_UNIT 266 |
#define tDAY 266 |
86 |
#define tMONTH 267 |
#define tDAYZONE 267 |
87 |
#define tMONTH_UNIT 268 |
#define tLOCAL_ZONE 268 |
88 |
#define tORDINAL 269 |
#define tMERIDIAN 269 |
89 |
#define tSEC_UNIT 270 |
#define tMONTH 270 |
90 |
#define tYEAR_UNIT 271 |
#define tORDINAL 271 |
91 |
#define tZONE 272 |
#define tZONE 272 |
92 |
#define tSNUMBER 273 |
#define tSNUMBER 273 |
93 |
#define tUNUMBER 274 |
#define tUNUMBER 274 |
238 |
|
|
239 |
enum { BILLION = 1000000000, LOG10_BILLION = 9 }; |
enum { BILLION = 1000000000, LOG10_BILLION = 9 }; |
240 |
|
|
241 |
|
/* Relative times. */ |
242 |
|
typedef struct |
243 |
|
{ |
244 |
|
/* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */ |
245 |
|
long int year; |
246 |
|
long int month; |
247 |
|
long int day; |
248 |
|
long int hour; |
249 |
|
long int minutes; |
250 |
|
long int seconds; |
251 |
|
long int ns; |
252 |
|
} relative_time; |
253 |
|
|
254 |
|
#if HAVE_COMPOUND_LITERALS |
255 |
|
# define RELATIVE_TIME_0 ((relative_time) { 0, 0, 0, 0, 0, 0, 0 }) |
256 |
|
#else |
257 |
|
static relative_time const RELATIVE_TIME_0; |
258 |
|
#endif |
259 |
|
|
260 |
/* Information passed to and from the parser. */ |
/* Information passed to and from the parser. */ |
261 |
typedef struct |
typedef struct |
262 |
{ |
{ |
287 |
struct timespec seconds; /* includes nanoseconds */ |
struct timespec seconds; /* includes nanoseconds */ |
288 |
|
|
289 |
/* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */ |
/* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */ |
290 |
long int rel_year; |
relative_time rel; |
|
long int rel_month; |
|
|
long int rel_day; |
|
|
long int rel_hour; |
|
|
long int rel_minutes; |
|
|
long int rel_seconds; |
|
|
long int rel_ns; |
|
291 |
|
|
292 |
/* Presence or counts of nonterminals of various flavors parsed so far. */ |
/* Presence or counts of nonterminals of various flavors parsed so far. */ |
293 |
bool timespec_seen; |
bool timespec_seen; |
324 |
#endif |
#endif |
325 |
|
|
326 |
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
327 |
#line 209 "getdate.y" |
#line 222 "getdate.y" |
328 |
typedef union YYSTYPE { |
typedef union YYSTYPE { |
329 |
long int intval; |
long int intval; |
330 |
textint textintval; |
textint textintval; |
331 |
struct timespec timespec; |
struct timespec timespec; |
332 |
|
relative_time rel; |
333 |
} YYSTYPE; |
} YYSTYPE; |
334 |
/* Line 191 of yacc.c. */ |
/* Line 190 of yacc.c. */ |
335 |
#line 322 "getdate.c" |
#line 336 "getdate.c" |
336 |
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
337 |
# define YYSTYPE_IS_DECLARED 1 |
# define YYSTYPE_IS_DECLARED 1 |
338 |
# define YYSTYPE_IS_TRIVIAL 1 |
# define YYSTYPE_IS_TRIVIAL 1 |
343 |
/* Copy the second part of user declarations. */ |
/* Copy the second part of user declarations. */ |
344 |
|
|
345 |
|
|
346 |
/* Line 214 of yacc.c. */ |
/* Line 213 of yacc.c. */ |
347 |
#line 334 "getdate.c" |
#line 348 "getdate.c" |
348 |
|
|
349 |
#if ! defined (yyoverflow) || YYERROR_VERBOSE |
#if ! defined (yyoverflow) || YYERROR_VERBOSE |
350 |
|
|
359 |
|
|
360 |
# ifdef YYSTACK_USE_ALLOCA |
# ifdef YYSTACK_USE_ALLOCA |
361 |
# if YYSTACK_USE_ALLOCA |
# if YYSTACK_USE_ALLOCA |
|
# define YYSTACK_ALLOC alloca |
|
|
# endif |
|
|
# else |
|
|
# if defined (alloca) || defined (_ALLOCA_H) |
|
|
# define YYSTACK_ALLOC alloca |
|
|
# else |
|
362 |
# ifdef __GNUC__ |
# ifdef __GNUC__ |
363 |
# define YYSTACK_ALLOC __builtin_alloca |
# define YYSTACK_ALLOC __builtin_alloca |
364 |
|
# else |
365 |
|
# define YYSTACK_ALLOC alloca |
366 |
# endif |
# endif |
367 |
# endif |
# endif |
368 |
# endif |
# endif |
388 |
/* A type that is properly aligned for any stack member. */ |
/* A type that is properly aligned for any stack member. */ |
389 |
union yyalloc |
union yyalloc |
390 |
{ |
{ |
391 |
short yyss; |
short int yyss; |
392 |
YYSTYPE yyvs; |
YYSTYPE yyvs; |
393 |
}; |
}; |
394 |
|
|
398 |
/* The size of an array large to enough to hold all stacks, each with |
/* The size of an array large to enough to hold all stacks, each with |
399 |
N elements. */ |
N elements. */ |
400 |
# define YYSTACK_BYTES(N) \ |
# define YYSTACK_BYTES(N) \ |
401 |
((N) * (sizeof (short) + sizeof (YYSTYPE)) \ |
((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
402 |
+ YYSTACK_GAP_MAXIMUM) |
+ YYSTACK_GAP_MAXIMUM) |
403 |
|
|
404 |
/* Copy COUNT objects from FROM to TO. The source and destination do |
/* Copy COUNT objects from FROM to TO. The source and destination do |
440 |
#if defined (__STDC__) || defined (__cplusplus) |
#if defined (__STDC__) || defined (__cplusplus) |
441 |
typedef signed char yysigned_char; |
typedef signed char yysigned_char; |
442 |
#else |
#else |
443 |
typedef short yysigned_char; |
typedef short int yysigned_char; |
444 |
#endif |
#endif |
445 |
|
|
446 |
/* YYFINAL -- State number of the termination state. */ |
/* YYFINAL -- State number of the termination state. */ |
447 |
#define YYFINAL 12 |
#define YYFINAL 12 |
448 |
/* YYLAST -- Last index in YYTABLE. */ |
/* YYLAST -- Last index in YYTABLE. */ |
449 |
#define YYLAST 88 |
#define YYLAST 91 |
450 |
|
|
451 |
/* YYNTOKENS -- Number of terminals. */ |
/* YYNTOKENS -- Number of terminals. */ |
452 |
#define YYNTOKENS 26 |
#define YYNTOKENS 26 |
517 |
{ |
{ |
518 |
27, 0, -1, 28, -1, 29, -1, 22, 39, -1, |
27, 0, -1, 28, -1, 29, -1, 22, 39, -1, |
519 |
-1, 29, 30, -1, 31, -1, 32, -1, 33, -1, |
-1, 29, 30, -1, 31, -1, 32, -1, 33, -1, |
520 |
35, -1, 34, -1, 36, -1, 42, -1, 19, 10, |
35, -1, 34, -1, 36, -1, 42, -1, 19, 14, |
521 |
-1, 19, 23, 19, 44, -1, 19, 23, 19, 18, |
-1, 19, 23, 19, 44, -1, 19, 23, 19, 18, |
522 |
43, -1, 19, 23, 19, 23, 41, 44, -1, 19, |
43, -1, 19, 23, 19, 23, 41, 44, -1, 19, |
523 |
23, 19, 23, 41, 18, 43, -1, 9, -1, 9, |
23, 19, 23, 41, 18, 43, -1, 13, -1, 13, |
524 |
4, -1, 17, -1, 17, 38, -1, 17, 18, 43, |
4, -1, 17, -1, 17, 38, -1, 17, 18, 43, |
525 |
-1, 7, -1, 17, 4, -1, 5, -1, 5, 24, |
-1, 12, -1, 17, 4, -1, 11, -1, 11, 24, |
526 |
-1, 14, 5, -1, 19, 5, -1, 19, 25, 19, |
-1, 16, 11, -1, 19, 11, -1, 19, 25, 19, |
527 |
-1, 19, 25, 19, 25, 19, -1, 19, 18, 18, |
-1, 19, 25, 19, 25, 19, -1, 19, 18, 18, |
528 |
-1, 19, 12, 18, -1, 12, 18, 18, -1, 12, |
-1, 19, 15, 18, -1, 15, 18, 18, -1, 15, |
529 |
19, -1, 12, 19, 24, 19, -1, 19, 12, -1, |
19, -1, 15, 19, 24, 19, -1, 19, 15, -1, |
530 |
19, 12, 19, -1, 37, 3, -1, 37, -1, 14, |
19, 15, 19, -1, 37, 3, -1, 37, -1, 16, |
531 |
16, -1, 19, 16, -1, 16, -1, 14, 13, -1, |
5, -1, 19, 5, -1, 5, -1, 16, 6, -1, |
532 |
19, 13, -1, 13, -1, 14, 6, -1, 19, 6, |
19, 6, -1, 6, -1, 16, 10, -1, 19, 10, |
533 |
-1, 6, -1, 14, 8, -1, 19, 8, -1, 8, |
-1, 10, -1, 16, 7, -1, 19, 7, -1, 7, |
534 |
-1, 14, 11, -1, 19, 11, -1, 11, -1, 14, |
-1, 16, 8, -1, 19, 8, -1, 8, -1, 16, |
535 |
15, -1, 19, 15, -1, 20, 15, -1, 21, 15, |
9, -1, 19, 9, -1, 20, 9, -1, 21, 9, |
536 |
-1, 15, -1, 38, -1, 18, 16, -1, 18, 13, |
-1, 9, -1, 38, -1, 18, 5, -1, 18, 6, |
537 |
-1, 18, 6, -1, 18, 8, -1, 18, 11, -1, |
-1, 18, 10, -1, 18, 7, -1, 18, 8, -1, |
538 |
18, 15, -1, 40, -1, 41, -1, 20, -1, 18, |
18, 9, -1, 40, -1, 41, -1, 20, -1, 18, |
539 |
-1, 21, -1, 19, -1, 19, -1, -1, 23, 19, |
-1, 21, -1, 19, -1, 19, -1, -1, 23, 19, |
540 |
-1, -1, 10, -1 |
-1, -1, 14, -1 |
541 |
}; |
}; |
542 |
|
|
543 |
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
544 |
static const unsigned short yyrline[] = |
static const unsigned short int yyrline[] = |
545 |
{ |
{ |
546 |
0, 230, 230, 231, 235, 242, 244, 248, 250, 252, |
0, 248, 248, 249, 253, 260, 262, 266, 268, 270, |
547 |
254, 256, 258, 260, 264, 272, 280, 290, 297, 309, |
272, 274, 276, 278, 282, 290, 298, 308, 315, 327, |
548 |
314, 322, 324, 326, 328, 330, 335, 340, 345, 350, |
332, 340, 342, 352, 354, 356, 361, 366, 371, 376, |
549 |
358, 363, 383, 390, 398, 406, 411, 417, 422, 431, |
384, 389, 409, 416, 424, 432, 437, 443, 448, 457, |
550 |
441, 445, 447, 449, 451, 453, 455, 457, 459, 461, |
467, 480, 482, 484, 486, 488, 490, 492, 494, 496, |
551 |
463, 465, 467, 469, 471, 473, 475, 477, 479, 481, |
498, 500, 502, 504, 506, 508, 510, 512, 514, 516, |
552 |
483, 485, 489, 491, 493, 495, 497, 499, 503, 503, |
518, 520, 524, 526, 528, 530, 532, 534, 538, 538, |
553 |
506, 507, 512, 513, 518, 556, 557, 563, 564 |
541, 542, 547, 548, 553, 591, 592, 598, 599 |
554 |
}; |
}; |
555 |
#endif |
#endif |
556 |
|
|
559 |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
560 |
static const char *const yytname[] = |
static const char *const yytname[] = |
561 |
{ |
{ |
562 |
"$end", "error", "$undefined", "tAGO", "tDST", "tDAY", "tDAY_UNIT", |
"$end", "error", "$undefined", "tAGO", "tDST", "tYEAR_UNIT", |
563 |
"tDAYZONE", "tHOUR_UNIT", "tLOCAL_ZONE", "tMERIDIAN", "tMINUTE_UNIT", |
"tMONTH_UNIT", "tHOUR_UNIT", "tMINUTE_UNIT", "tSEC_UNIT", "tDAY_UNIT", |
564 |
"tMONTH", "tMONTH_UNIT", "tORDINAL", "tSEC_UNIT", "tYEAR_UNIT", "tZONE", |
"tDAY", "tDAYZONE", "tLOCAL_ZONE", "tMERIDIAN", "tMONTH", "tORDINAL", |
565 |
"tSNUMBER", "tUNUMBER", "tSDECIMAL_NUMBER", "tUDECIMAL_NUMBER", "'@'", |
"tZONE", "tSNUMBER", "tUNUMBER", "tSDECIMAL_NUMBER", "tUDECIMAL_NUMBER", |
566 |
"':'", "','", "'/'", "$accept", "spec", "timespec", "items", "item", |
"'@'", "':'", "','", "'/'", "$accept", "spec", "timespec", "items", |
567 |
"time", "local_zone", "zone", "day", "date", "rel", "relunit", |
"item", "time", "local_zone", "zone", "day", "date", "rel", "relunit", |
568 |
"relunit_snumber", "seconds", "signed_seconds", "unsigned_seconds", |
"relunit_snumber", "seconds", "signed_seconds", "unsigned_seconds", |
569 |
"number", "o_colon_minutes", "o_merid", 0 |
"number", "o_colon_minutes", "o_merid", 0 |
570 |
}; |
}; |
573 |
# ifdef YYPRINT |
# ifdef YYPRINT |
574 |
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
575 |
token YYLEX-NUM. */ |
token YYLEX-NUM. */ |
576 |
static const unsigned short yytoknum[] = |
static const unsigned short int yytoknum[] = |
577 |
{ |
{ |
578 |
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
579 |
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
613 |
static const unsigned char yydefact[] = |
static const unsigned char yydefact[] = |
614 |
{ |
{ |
615 |
5, 0, 0, 2, 3, 71, 73, 70, 72, 4, |
5, 0, 0, 2, 3, 71, 73, 70, 72, 4, |
616 |
68, 69, 1, 26, 49, 24, 52, 19, 55, 0, |
68, 69, 1, 43, 46, 52, 55, 60, 49, 26, |
617 |
46, 0, 60, 43, 21, 0, 74, 0, 0, 6, |
24, 19, 0, 0, 21, 0, 74, 0, 0, 6, |
618 |
7, 8, 9, 11, 10, 12, 40, 61, 13, 27, |
7, 8, 9, 11, 10, 12, 40, 61, 13, 27, |
619 |
20, 0, 35, 28, 47, 50, 53, 44, 56, 41, |
20, 0, 35, 41, 44, 50, 53, 56, 47, 28, |
620 |
25, 75, 22, 64, 65, 66, 63, 67, 62, 29, |
25, 75, 22, 62, 63, 65, 66, 67, 64, 42, |
621 |
48, 51, 14, 54, 37, 45, 57, 42, 0, 0, |
45, 51, 54, 57, 48, 29, 14, 37, 0, 0, |
622 |
0, 58, 59, 39, 34, 0, 0, 23, 33, 38, |
0, 58, 59, 39, 34, 0, 0, 23, 33, 38, |
623 |
32, 77, 30, 36, 76, 78, 75, 0, 15, 0, |
32, 77, 30, 36, 76, 78, 75, 0, 15, 0, |
624 |
16, 77, 31, 75, 17, 18 |
16, 77, 31, 75, 17, 18 |
633 |
|
|
634 |
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
635 |
STATE-NUM. */ |
STATE-NUM. */ |
636 |
#define YYPACT_NINF -43 |
#define YYPACT_NINF -79 |
637 |
static const yysigned_char yypact[] = |
static const yysigned_char yypact[] = |
638 |
{ |
{ |
639 |
-18, 48, 9, -43, 19, -43, -43, -43, -43, -43, |
-10, 47, 27, -79, 25, -79, -79, -79, -79, -79, |
640 |
-43, -43, -43, 32, -43, -43, -43, 54, -43, 28, |
-79, -79, -79, -79, -79, -79, -79, -79, -79, 5, |
641 |
-43, 37, -43, -43, -2, 49, -5, 57, 58, -43, |
-79, 59, 43, 42, 10, 49, -5, 62, 63, -79, |
642 |
-43, -43, -43, -43, -43, -43, 60, -43, -43, -43, |
-79, -79, -79, -79, -79, -79, 70, -79, -79, -79, |
643 |
-43, 56, 51, -43, -43, -43, -43, -43, -43, -43, |
-79, 56, 52, -79, -79, -79, -79, -79, -79, -79, |
644 |
-43, 6, -43, -43, -43, -43, -43, -43, -43, -43, |
-79, 16, -79, -79, -79, -79, -79, -79, -79, -79, |
645 |
-43, -43, -43, -43, 52, -43, -43, -43, 59, 61, |
-79, -79, -79, -79, -79, -79, -79, 51, 57, 58, |
646 |
62, -43, -43, -43, -43, 63, 64, -43, -43, -43, |
60, -79, -79, -79, -79, 61, 64, -79, -79, -79, |
647 |
-43, 31, 53, -43, -43, -43, 65, 40, -43, 66, |
-79, -7, 53, -79, -79, -79, 65, -2, -79, 66, |
648 |
-43, 5, -43, 65, -43, -43 |
-79, 46, -79, 65, -79, -79 |
649 |
}; |
}; |
650 |
|
|
651 |
/* YYPGOTO[NTERM-NUM]. */ |
/* YYPGOTO[NTERM-NUM]. */ |
652 |
static const yysigned_char yypgoto[] = |
static const yysigned_char yypgoto[] = |
653 |
{ |
{ |
654 |
-43, -43, -43, -43, -43, -43, -43, -43, -43, -43, |
-79, -79, -79, -79, -79, -79, -79, -79, -79, -79, |
655 |
-43, -43, 55, -43, -43, -11, -43, -42, -7 |
-79, -79, 67, -79, -79, -6, -79, -78, -9 |
656 |
}; |
}; |
657 |
|
|
658 |
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
662 |
#define YYTABLE_NINF -1 |
#define YYTABLE_NINF -1 |
663 |
static const unsigned char yytable[] = |
static const unsigned char yytable[] = |
664 |
{ |
{ |
665 |
59, 60, 50, 61, 1, 62, 63, 64, 65, 12, |
59, 60, 61, 62, 63, 64, 65, 85, 90, 66, |
666 |
66, 67, 53, 68, 54, 85, 51, 55, 69, 56, |
67, 86, 1, 68, 50, 95, 87, 6, 69, 8, |
667 |
70, 57, 58, 93, 13, 14, 15, 16, 17, 76, |
70, 53, 54, 55, 56, 57, 58, 12, 51, 39, |
668 |
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, |
13, 14, 15, 16, 17, 18, 19, 20, 21, 76, |
669 |
28, 85, 43, 44, 90, 45, 41, 42, 46, 86, |
22, 23, 24, 25, 26, 27, 28, 43, 44, 45, |
670 |
47, 95, 48, 49, 87, 53, 39, 54, 40, 6, |
46, 47, 48, 49, 53, 54, 55, 56, 57, 58, |
671 |
55, 8, 56, 73, 57, 58, 5, 6, 7, 8, |
85, 41, 42, 40, 93, 5, 6, 7, 8, 78, |
672 |
78, 79, 71, 72, 74, 75, 91, 80, 89, 52, |
79, 71, 72, 73, 74, 80, 75, 81, 89, 82, |
673 |
81, 82, 83, 84, 94, 92, 0, 0, 76 |
83, 91, 94, 84, 0, 92, 0, 0, 76, 0, |
674 |
|
0, 52 |
675 |
}; |
}; |
676 |
|
|
677 |
static const yysigned_char yycheck[] = |
static const yysigned_char yycheck[] = |
678 |
{ |
{ |
679 |
5, 6, 4, 8, 22, 10, 11, 12, 13, 0, |
5, 6, 7, 8, 9, 10, 11, 14, 86, 14, |
680 |
15, 16, 6, 18, 8, 10, 18, 11, 23, 13, |
15, 18, 22, 18, 4, 93, 23, 19, 23, 21, |
681 |
25, 15, 16, 18, 5, 6, 7, 8, 9, 23, |
25, 5, 6, 7, 8, 9, 10, 0, 18, 24, |
682 |
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
5, 6, 7, 8, 9, 10, 11, 12, 13, 23, |
683 |
21, 10, 5, 6, 86, 8, 18, 19, 11, 18, |
15, 16, 17, 18, 19, 20, 21, 5, 6, 7, |
684 |
13, 93, 15, 16, 23, 6, 24, 8, 4, 19, |
8, 9, 10, 11, 5, 6, 7, 8, 9, 10, |
685 |
11, 21, 13, 3, 15, 16, 18, 19, 20, 21, |
14, 18, 19, 4, 18, 18, 19, 20, 21, 18, |
686 |
18, 19, 15, 15, 18, 24, 87, 18, 25, 24, |
19, 9, 9, 3, 18, 18, 24, 19, 25, 19, |
687 |
19, 19, 19, 19, 91, 19, -1, -1, 23 |
19, 87, 91, 19, -1, 19, -1, -1, 23, -1, |
688 |
|
-1, 24 |
689 |
}; |
}; |
690 |
|
|
691 |
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
693 |
static const unsigned char yystos[] = |
static const unsigned char yystos[] = |
694 |
{ |
{ |
695 |
0, 22, 27, 28, 29, 18, 19, 20, 21, 39, |
0, 22, 27, 28, 29, 18, 19, 20, 21, 39, |
696 |
40, 41, 0, 5, 6, 7, 8, 9, 11, 12, |
40, 41, 0, 5, 6, 7, 8, 9, 10, 11, |
697 |
13, 14, 15, 16, 17, 18, 19, 20, 21, 30, |
12, 13, 15, 16, 17, 18, 19, 20, 21, 30, |
698 |
31, 32, 33, 34, 35, 36, 37, 38, 42, 24, |
31, 32, 33, 34, 35, 36, 37, 38, 42, 24, |
699 |
4, 18, 19, 5, 6, 8, 11, 13, 15, 16, |
4, 18, 19, 5, 6, 7, 8, 9, 10, 11, |
700 |
4, 18, 38, 6, 8, 11, 13, 15, 16, 5, |
4, 18, 38, 5, 6, 7, 8, 9, 10, 5, |
701 |
6, 8, 10, 11, 12, 13, 15, 16, 18, 23, |
6, 7, 8, 9, 10, 11, 14, 15, 18, 23, |
702 |
25, 15, 15, 3, 18, 24, 23, 43, 18, 19, |
25, 9, 9, 3, 18, 24, 23, 43, 18, 19, |
703 |
18, 19, 19, 19, 19, 10, 18, 23, 44, 25, |
18, 19, 19, 19, 19, 14, 18, 23, 44, 25, |
704 |
43, 41, 19, 18, 44, 43 |
43, 41, 19, 18, 44, 43 |
705 |
}; |
}; |
706 |
|
|
755 |
} \ |
} \ |
756 |
while (0) |
while (0) |
757 |
|
|
758 |
|
|
759 |
#define YYTERROR 1 |
#define YYTERROR 1 |
760 |
#define YYERRCODE 256 |
#define YYERRCODE 256 |
761 |
|
|
|
/* YYLLOC_DEFAULT -- Compute the default location (before the actions |
|
|
are run). */ |
|
762 |
|
|
763 |
|
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
764 |
|
If N is 0, then set CURRENT to the empty location which ends |
765 |
|
the previous symbol: RHS[0] (always defined). */ |
766 |
|
|
767 |
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
768 |
#ifndef YYLLOC_DEFAULT |
#ifndef YYLLOC_DEFAULT |
769 |
# define YYLLOC_DEFAULT(Current, Rhs, N) \ |
# define YYLLOC_DEFAULT(Current, Rhs, N) \ |
770 |
((Current).first_line = (Rhs)[1].first_line, \ |
do \ |
771 |
(Current).first_column = (Rhs)[1].first_column, \ |
if (N) \ |
772 |
(Current).last_line = (Rhs)[N].last_line, \ |
{ \ |
773 |
(Current).last_column = (Rhs)[N].last_column) |
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
774 |
|
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
775 |
|
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
776 |
|
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
777 |
|
} \ |
778 |
|
else \ |
779 |
|
{ \ |
780 |
|
(Current).first_line = (Current).last_line = \ |
781 |
|
YYRHSLOC (Rhs, 0).last_line; \ |
782 |
|
(Current).first_column = (Current).last_column = \ |
783 |
|
YYRHSLOC (Rhs, 0).last_column; \ |
784 |
|
} \ |
785 |
|
while (0) |
786 |
|
#endif |
787 |
|
|
788 |
|
|
789 |
|
/* YY_LOCATION_PRINT -- Print the location on the stream. |
790 |
|
This macro was not mandated originally: define only if we know |
791 |
|
we won't break user code: when these are the locations we know. */ |
792 |
|
|
793 |
|
#ifndef YY_LOCATION_PRINT |
794 |
|
# if YYLTYPE_IS_TRIVIAL |
795 |
|
# define YY_LOCATION_PRINT(File, Loc) \ |
796 |
|
fprintf (File, "%d.%d-%d.%d", \ |
797 |
|
(Loc).first_line, (Loc).first_column, \ |
798 |
|
(Loc).last_line, (Loc).last_column) |
799 |
|
# else |
800 |
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
801 |
|
# endif |
802 |
#endif |
#endif |
803 |
|
|
804 |
|
|
805 |
/* YYLEX -- calling `yylex' with the right arguments. */ |
/* YYLEX -- calling `yylex' with the right arguments. */ |
806 |
|
|
807 |
#ifdef YYLEX_PARAM |
#ifdef YYLEX_PARAM |
824 |
YYFPRINTF Args; \ |
YYFPRINTF Args; \ |
825 |
} while (0) |
} while (0) |
826 |
|
|
827 |
# define YYDSYMPRINT(Args) \ |
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
|
do { \ |
|
|
if (yydebug) \ |
|
|
yysymprint Args; \ |
|
|
} while (0) |
|
|
|
|
|
# define YYDSYMPRINTF(Title, Token, Value, Location) \ |
|
828 |
do { \ |
do { \ |
829 |
if (yydebug) \ |
if (yydebug) \ |
830 |
{ \ |
{ \ |
831 |
YYFPRINTF (stderr, "%s ", Title); \ |
YYFPRINTF (stderr, "%s ", Title); \ |
832 |
yysymprint (stderr, \ |
yysymprint (stderr, \ |
833 |
Token, Value); \ |
Type, Value); \ |
834 |
YYFPRINTF (stderr, "\n"); \ |
YYFPRINTF (stderr, "\n"); \ |
835 |
} \ |
} \ |
836 |
} while (0) |
} while (0) |
842 |
|
|
843 |
#if defined (__STDC__) || defined (__cplusplus) |
#if defined (__STDC__) || defined (__cplusplus) |
844 |
static void |
static void |
845 |
yy_stack_print (short *bottom, short *top) |
yy_stack_print (short int *bottom, short int *top) |
846 |
#else |
#else |
847 |
static void |
static void |
848 |
yy_stack_print (bottom, top) |
yy_stack_print (bottom, top) |
849 |
short *bottom; |
short int *bottom; |
850 |
short *top; |
short int *top; |
851 |
#endif |
#endif |
852 |
{ |
{ |
853 |
YYFPRINTF (stderr, "Stack now"); |
YYFPRINTF (stderr, "Stack now"); |
897 |
int yydebug; |
int yydebug; |
898 |
#else /* !YYDEBUG */ |
#else /* !YYDEBUG */ |
899 |
# define YYDPRINTF(Args) |
# define YYDPRINTF(Args) |
900 |
# define YYDSYMPRINT(Args) |
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
|
# define YYDSYMPRINTF(Title, Token, Value, Location) |
|
901 |
# define YY_STACK_PRINT(Bottom, Top) |
# define YY_STACK_PRINT(Bottom, Top) |
902 |
# define YY_REDUCE_PRINT(Rule) |
# define YY_REDUCE_PRINT(Rule) |
903 |
#endif /* !YYDEBUG */ |
#endif /* !YYDEBUG */ |
915 |
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
916 |
evaluated with infinite-precision integer arithmetic. */ |
evaluated with infinite-precision integer arithmetic. */ |
917 |
|
|
|
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 |
|
|
# undef YYMAXDEPTH |
|
|
#endif |
|
|
|
|
918 |
#ifndef YYMAXDEPTH |
#ifndef YYMAXDEPTH |
919 |
# define YYMAXDEPTH 10000 |
# define YYMAXDEPTH 10000 |
920 |
#endif |
#endif |
996 |
(void) yyvaluep; |
(void) yyvaluep; |
997 |
|
|
998 |
if (yytype < YYNTOKENS) |
if (yytype < YYNTOKENS) |
999 |
{ |
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
|
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
|
|
# ifdef YYPRINT |
|
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
|
|
# endif |
|
|
} |
|
1000 |
else |
else |
1001 |
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
1002 |
|
|
1003 |
|
|
1004 |
|
# ifdef YYPRINT |
1005 |
|
if (yytype < YYNTOKENS) |
1006 |
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
1007 |
|
# endif |
1008 |
switch (yytype) |
switch (yytype) |
1009 |
{ |
{ |
1010 |
default: |
default: |
1020 |
|
|
1021 |
#if defined (__STDC__) || defined (__cplusplus) |
#if defined (__STDC__) || defined (__cplusplus) |
1022 |
static void |
static void |
1023 |
yydestruct (int yytype, YYSTYPE *yyvaluep) |
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
1024 |
#else |
#else |
1025 |
static void |
static void |
1026 |
yydestruct (yytype, yyvaluep) |
yydestruct (yymsg, yytype, yyvaluep) |
1027 |
|
const char *yymsg; |
1028 |
int yytype; |
int yytype; |
1029 |
YYSTYPE *yyvaluep; |
YYSTYPE *yyvaluep; |
1030 |
#endif |
#endif |
1032 |
/* Pacify ``unused variable'' warnings. */ |
/* Pacify ``unused variable'' warnings. */ |
1033 |
(void) yyvaluep; |
(void) yyvaluep; |
1034 |
|
|
1035 |
|
if (!yymsg) |
1036 |
|
yymsg = "Deleting"; |
1037 |
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1038 |
|
|
1039 |
switch (yytype) |
switch (yytype) |
1040 |
{ |
{ |
1041 |
|
|
1055 |
# endif |
# endif |
1056 |
#else /* ! YYPARSE_PARAM */ |
#else /* ! YYPARSE_PARAM */ |
1057 |
#if defined (__STDC__) || defined (__cplusplus) |
#if defined (__STDC__) || defined (__cplusplus) |
1058 |
int yyparse ( parser_control *pc ); |
int yyparse (parser_control *pc); |
1059 |
#else |
#else |
1060 |
int yyparse (); |
int yyparse (); |
1061 |
#endif |
#endif |
1080 |
#else /* ! YYPARSE_PARAM */ |
#else /* ! YYPARSE_PARAM */ |
1081 |
#if defined (__STDC__) || defined (__cplusplus) |
#if defined (__STDC__) || defined (__cplusplus) |
1082 |
int |
int |
1083 |
yyparse ( parser_control *pc ) |
yyparse (parser_control *pc) |
1084 |
#else |
#else |
1085 |
int |
int |
1086 |
yyparse (pc) |
yyparse (pc) |
1087 |
parser_control *pc ; |
parser_control *pc; |
1088 |
#endif |
#endif |
1089 |
#endif |
#endif |
1090 |
{ |
{ |
1091 |
/* The lookahead symbol. */ |
/* The look-ahead symbol. */ |
1092 |
int yychar; |
int yychar; |
1093 |
|
|
1094 |
/* The semantic value of the lookahead symbol. */ |
/* The semantic value of the look-ahead symbol. */ |
1095 |
YYSTYPE yylval; |
YYSTYPE yylval; |
1096 |
|
|
1097 |
/* Number of syntax errors so far. */ |
/* Number of syntax errors so far. */ |
1102 |
int yyresult; |
int yyresult; |
1103 |
/* Number of tokens to shift before error messages enabled. */ |
/* Number of tokens to shift before error messages enabled. */ |
1104 |
int yyerrstatus; |
int yyerrstatus; |
1105 |
/* Lookahead token as an internal (translated) token number. */ |
/* Look-ahead token as an internal (translated) token number. */ |
1106 |
int yytoken = 0; |
int yytoken = 0; |
1107 |
|
|
1108 |
/* Three stacks and their tools: |
/* Three stacks and their tools: |
1114 |
to reallocate them elsewhere. */ |
to reallocate them elsewhere. */ |
1115 |
|
|
1116 |
/* The state stack. */ |
/* The state stack. */ |
1117 |
short yyssa[YYINITDEPTH]; |
short int yyssa[YYINITDEPTH]; |
1118 |
short *yyss = yyssa; |
short int *yyss = yyssa; |
1119 |
register short *yyssp; |
register short int *yyssp; |
1120 |
|
|
1121 |
/* The semantic value stack. */ |
/* The semantic value stack. */ |
1122 |
YYSTYPE yyvsa[YYINITDEPTH]; |
YYSTYPE yyvsa[YYINITDEPTH]; |
1153 |
yyssp = yyss; |
yyssp = yyss; |
1154 |
yyvsp = yyvs; |
yyvsp = yyvs; |
1155 |
|
|
1156 |
|
|
1157 |
|
yyvsp[0] = yylval; |
1158 |
|
|
1159 |
goto yysetstate; |
goto yysetstate; |
1160 |
|
|
1161 |
/*------------------------------------------------------------. |
/*------------------------------------------------------------. |
1181 |
these so that the &'s don't force the real ones into |
these so that the &'s don't force the real ones into |
1182 |
memory. */ |
memory. */ |
1183 |
YYSTYPE *yyvs1 = yyvs; |
YYSTYPE *yyvs1 = yyvs; |
1184 |
short *yyss1 = yyss; |
short int *yyss1 = yyss; |
1185 |
|
|
1186 |
|
|
1187 |
/* Each stack pointer address is followed by the size of the |
/* Each stack pointer address is followed by the size of the |
1209 |
yystacksize = YYMAXDEPTH; |
yystacksize = YYMAXDEPTH; |
1210 |
|
|
1211 |
{ |
{ |
1212 |
short *yyss1 = yyss; |
short int *yyss1 = yyss; |
1213 |
union yyalloc *yyptr = |
union yyalloc *yyptr = |
1214 |
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1215 |
if (! yyptr) |
if (! yyptr) |
1245 |
yybackup: |
yybackup: |
1246 |
|
|
1247 |
/* Do appropriate processing given the current state. */ |
/* Do appropriate processing given the current state. */ |
1248 |
/* Read a lookahead token if we need one and don't already have one. */ |
/* Read a look-ahead token if we need one and don't already have one. */ |
1249 |
/* yyresume: */ |
/* yyresume: */ |
1250 |
|
|
1251 |
/* First try to decide what to do without reference to lookahead token. */ |
/* First try to decide what to do without reference to look-ahead token. */ |
1252 |
|
|
1253 |
yyn = yypact[yystate]; |
yyn = yypact[yystate]; |
1254 |
if (yyn == YYPACT_NINF) |
if (yyn == YYPACT_NINF) |
1255 |
goto yydefault; |
goto yydefault; |
1256 |
|
|
1257 |
/* Not known => get a lookahead token if don't already have one. */ |
/* Not known => get a look-ahead token if don't already have one. */ |
1258 |
|
|
1259 |
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
1260 |
if (yychar == YYEMPTY) |
if (yychar == YYEMPTY) |
1261 |
{ |
{ |
1262 |
YYDPRINTF ((stderr, "Reading a token: ")); |
YYDPRINTF ((stderr, "Reading a token: ")); |
1271 |
else |
else |
1272 |
{ |
{ |
1273 |
yytoken = YYTRANSLATE (yychar); |
yytoken = YYTRANSLATE (yychar); |
1274 |
YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); |
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1275 |
} |
} |
1276 |
|
|
1277 |
/* If the proper action on seeing token YYTOKEN is to reduce or to |
/* If the proper action on seeing token YYTOKEN is to reduce or to |
1291 |
if (yyn == YYFINAL) |
if (yyn == YYFINAL) |
1292 |
YYACCEPT; |
YYACCEPT; |
1293 |
|
|
1294 |
/* Shift the lookahead token. */ |
/* Shift the look-ahead token. */ |
1295 |
YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); |
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1296 |
|
|
1297 |
/* Discard the token being shifted unless it is eof. */ |
/* Discard the token being shifted unless it is eof. */ |
1298 |
if (yychar != YYEOF) |
if (yychar != YYEOF) |
1342 |
switch (yyn) |
switch (yyn) |
1343 |
{ |
{ |
1344 |
case 4: |
case 4: |
1345 |
#line 236 "getdate.y" |
#line 254 "getdate.y" |
1346 |
{ |
{ |
1347 |
pc->seconds = yyvsp[0].timespec; |
pc->seconds = (yyvsp[0].timespec); |
1348 |
pc->timespec_seen = true; |
pc->timespec_seen = true; |
1349 |
} |
} |
1350 |
break; |
break; |
1351 |
|
|
1352 |
case 7: |
case 7: |
1353 |
#line 249 "getdate.y" |
#line 267 "getdate.y" |
1354 |
{ pc->times_seen++; } |
{ pc->times_seen++; } |
1355 |
break; |
break; |
1356 |
|
|
1357 |
case 8: |
case 8: |
1358 |
#line 251 "getdate.y" |
#line 269 "getdate.y" |
1359 |
{ pc->local_zones_seen++; } |
{ pc->local_zones_seen++; } |
1360 |
break; |
break; |
1361 |
|
|
1362 |
case 9: |
case 9: |
1363 |
#line 253 "getdate.y" |
#line 271 "getdate.y" |
1364 |
{ pc->zones_seen++; } |
{ pc->zones_seen++; } |
1365 |
break; |
break; |
1366 |
|
|
1367 |
case 10: |
case 10: |
1368 |
#line 255 "getdate.y" |
#line 273 "getdate.y" |
1369 |
{ pc->dates_seen++; } |
{ pc->dates_seen++; } |
1370 |
break; |
break; |
1371 |
|
|
1372 |
case 11: |
case 11: |
1373 |
#line 257 "getdate.y" |
#line 275 "getdate.y" |
1374 |
{ pc->days_seen++; } |
{ pc->days_seen++; } |
1375 |
break; |
break; |
1376 |
|
|
1377 |
case 12: |
case 12: |
1378 |
#line 259 "getdate.y" |
#line 277 "getdate.y" |
1379 |
{ pc->rels_seen = true; } |
{ pc->rels_seen = true; } |
1380 |
break; |
break; |
1381 |
|
|
1382 |
case 14: |
case 14: |
1383 |
#line 265 "getdate.y" |
#line 283 "getdate.y" |
1384 |
{ |
{ |
1385 |
pc->hour = yyvsp[-1].textintval.value; |
pc->hour = (yyvsp[-1].textintval).value; |
1386 |
pc->minutes = 0; |
pc->minutes = 0; |
1387 |
pc->seconds.tv_sec = 0; |
pc->seconds.tv_sec = 0; |
1388 |
pc->seconds.tv_nsec = 0; |
pc->seconds.tv_nsec = 0; |
1389 |
pc->meridian = yyvsp[0].intval; |
pc->meridian = (yyvsp[0].intval); |
1390 |
} |
} |
1391 |
break; |
break; |
1392 |
|
|
1393 |
case 15: |
case 15: |
1394 |
#line 273 "getdate.y" |
#line 291 "getdate.y" |
1395 |
{ |
{ |
1396 |
pc->hour = yyvsp[-3].textintval.value; |
pc->hour = (yyvsp[-3].textintval).value; |
1397 |
pc->minutes = yyvsp[-1].textintval.value; |
pc->minutes = (yyvsp[-1].textintval).value; |
1398 |
pc->seconds.tv_sec = 0; |
pc->seconds.tv_sec = 0; |
1399 |
pc->seconds.tv_nsec = 0; |
pc->seconds.tv_nsec = 0; |
1400 |
pc->meridian = yyvsp[0].intval; |
pc->meridian = (yyvsp[0].intval); |
1401 |
} |
} |
1402 |
break; |
break; |
1403 |
|
|
1404 |
case 16: |
case 16: |
1405 |
#line 281 "getdate.y" |
#line 299 "getdate.y" |
1406 |
{ |
{ |
1407 |
pc->hour = yyvsp[-4].textintval.value; |
pc->hour = (yyvsp[-4].textintval).value; |
1408 |
pc->minutes = yyvsp[-2].textintval.value; |
pc->minutes = (yyvsp[-2].textintval).value; |
1409 |
pc->seconds.tv_sec = 0; |
pc->seconds.tv_sec = 0; |
1410 |
pc->seconds.tv_nsec = 0; |
pc->seconds.tv_nsec = 0; |
1411 |
pc->meridian = MER24; |
pc->meridian = MER24; |
1412 |
pc->zones_seen++; |
pc->zones_seen++; |
1413 |
pc->time_zone = time_zone_hhmm (yyvsp[-1].textintval, yyvsp[0].intval); |
pc->time_zone = time_zone_hhmm ((yyvsp[-1].textintval), (yyvsp[0].intval)); |
1414 |
} |
} |
1415 |
break; |
break; |
1416 |
|
|
1417 |
case 17: |
case 17: |
1418 |
#line 291 "getdate.y" |
#line 309 "getdate.y" |
1419 |
{ |
{ |
1420 |
pc->hour = yyvsp[-5].textintval.value; |
pc->hour = (yyvsp[-5].textintval).value; |
1421 |
pc->minutes = yyvsp[-3].textintval.value; |
pc->minutes = (yyvsp[-3].textintval).value; |
1422 |
pc->seconds = yyvsp[-1].timespec; |
pc->seconds = (yyvsp[-1].timespec); |
1423 |
pc->meridian = yyvsp[0].intval; |
pc->meridian = (yyvsp[0].intval); |
1424 |
} |
} |
1425 |
break; |
break; |
1426 |
|
|
1427 |
case 18: |
case 18: |
1428 |
#line 298 "getdate.y" |
#line 316 "getdate.y" |
1429 |
{ |
{ |
1430 |
pc->hour = yyvsp[-6].textintval.value; |
pc->hour = (yyvsp[-6].textintval).value; |
1431 |
pc->minutes = yyvsp[-4].textintval.value; |
pc->minutes = (yyvsp[-4].textintval).value; |
1432 |
pc->seconds = yyvsp[-2].timespec; |
pc->seconds = (yyvsp[-2].timespec); |
1433 |
pc->meridian = MER24; |
pc->meridian = MER24; |
1434 |
pc->zones_seen++; |
pc->zones_seen++; |
1435 |
pc->time_zone = time_zone_hhmm (yyvsp[-1].textintval, yyvsp[0].intval); |
pc->time_zone = time_zone_hhmm ((yyvsp[-1].textintval), (yyvsp[0].intval)); |
1436 |
} |
} |
1437 |
break; |
break; |
1438 |
|
|
1439 |
case 19: |
case 19: |
1440 |
#line 310 "getdate.y" |
#line 328 "getdate.y" |
1441 |
{ |
{ |
1442 |
pc->local_isdst = yyvsp[0].intval; |
pc->local_isdst = (yyvsp[0].intval); |
1443 |
pc->dsts_seen += (0 < yyvsp[0].intval); |
pc->dsts_seen += (0 < (yyvsp[0].intval)); |
1444 |
} |
} |
1445 |
break; |
break; |
1446 |
|
|
1447 |
case 20: |
case 20: |
1448 |
#line 315 "getdate.y" |
#line 333 "getdate.y" |
1449 |
{ |
{ |
1450 |
pc->local_isdst = 1; |
pc->local_isdst = 1; |
1451 |
pc->dsts_seen += (0 < yyvsp[-1].intval) + 1; |
pc->dsts_seen += (0 < (yyvsp[-1].intval)) + 1; |
1452 |
} |
} |
1453 |
break; |
break; |
1454 |
|
|
1455 |
case 21: |
case 21: |
1456 |
#line 323 "getdate.y" |
#line 341 "getdate.y" |
1457 |
{ pc->time_zone = yyvsp[0].intval; } |
{ pc->time_zone = (yyvsp[0].intval); } |
1458 |
break; |
break; |
1459 |
|
|
1460 |
case 22: |
case 22: |
1461 |
#line 325 "getdate.y" |
#line 343 "getdate.y" |
1462 |
{ pc->time_zone = yyvsp[-1].intval; pc->rels_seen = true; } |
{ pc->time_zone = (yyvsp[-1].intval); |
1463 |
|
pc->rel.ns += (yyvsp[0].rel).ns; |
1464 |
|
pc->rel.seconds += (yyvsp[0].rel).seconds; |
1465 |
|
pc->rel.minutes += (yyvsp[0].rel).minutes; |
1466 |
|
pc->rel.hour += (yyvsp[0].rel).hour; |
1467 |
|
pc->rel.day += (yyvsp[0].rel).day; |
1468 |
|
pc->rel.month += (yyvsp[0].rel).month; |
1469 |
|
pc->rel.year += (yyvsp[0].rel).year; |
1470 |
|
pc->rels_seen = true; } |
1471 |
break; |
break; |
1472 |
|
|
1473 |
case 23: |
case 23: |
1474 |
#line 327 "getdate.y" |
#line 353 "getdate.y" |
1475 |
{ pc->time_zone = yyvsp[-2].intval + time_zone_hhmm (yyvsp[-1].textintval, yyvsp[0].intval); } |
{ pc->time_zone = (yyvsp[-2].intval) + time_zone_hhmm ((yyvsp[-1].textintval), (yyvsp[0].intval)); } |
1476 |
break; |
break; |
1477 |
|
|
1478 |
case 24: |
case 24: |
1479 |
#line 329 "getdate.y" |
#line 355 "getdate.y" |
1480 |
{ pc->time_zone = yyvsp[0].intval + 60; } |
{ pc->time_zone = (yyvsp[0].intval) + 60; } |
1481 |
break; |
break; |
1482 |
|
|
1483 |
case 25: |
case 25: |
1484 |
#line 331 "getdate.y" |
#line 357 "getdate.y" |
1485 |
{ pc->time_zone = yyvsp[-1].intval + 60; } |
{ pc->time_zone = (yyvsp[-1].intval) + 60; } |
1486 |
break; |
break; |
1487 |
|
|
1488 |
case 26: |
case 26: |
1489 |
#line 336 "getdate.y" |
#line 362 "getdate.y" |
1490 |
{ |
{ |
1491 |
pc->day_ordinal = 1; |
pc->day_ordinal = 1; |
1492 |
pc->day_number = yyvsp[0].intval; |
pc->day_number = (yyvsp[0].intval); |
1493 |
} |
} |
1494 |
break; |
break; |
1495 |
|
|
1496 |
case 27: |
case 27: |
1497 |
#line 341 "getdate.y" |
#line 367 "getdate.y" |
1498 |
{ |
{ |
1499 |
pc->day_ordinal = 1; |
pc->day_ordinal = 1; |
1500 |
pc->day_number = yyvsp[-1].intval; |
pc->day_number = (yyvsp[-1].intval); |
1501 |
} |
} |
1502 |
break; |
break; |
1503 |
|
|
1504 |
case 28: |
case 28: |
1505 |
#line 346 "getdate.y" |
#line 372 "getdate.y" |
1506 |
{ |
{ |
1507 |
pc->day_ordinal = yyvsp[-1].intval; |
pc->day_ordinal = (yyvsp[-1].intval); |
1508 |
pc->day_number = yyvsp[0].intval; |
pc->day_number = (yyvsp[0].intval); |
1509 |
} |
} |
1510 |
break; |
break; |
1511 |
|
|
1512 |
case 29: |
case 29: |
1513 |
#line 351 "getdate.y" |
#line 377 "getdate.y" |
1514 |
{ |
{ |
1515 |
pc->day_ordinal = yyvsp[-1].textintval.value; |
pc->day_ordinal = (yyvsp[-1].textintval).value; |
1516 |
pc->day_number = yyvsp[0].intval; |
pc->day_number = (yyvsp[0].intval); |
1517 |
} |
} |
1518 |
break; |
break; |
1519 |
|
|
1520 |
case 30: |
case 30: |
1521 |
#line 359 "getdate.y" |
#line 385 "getdate.y" |
1522 |
{ |
{ |
1523 |
pc->month = yyvsp[-2].textintval.value; |
pc->month = (yyvsp[-2].textintval).value; |
1524 |
pc->day = yyvsp[0].textintval.value; |
pc->day = (yyvsp[0].textintval).value; |
1525 |
} |
} |
1526 |
break; |
break; |
1527 |
|
|
1528 |
case 31: |
case 31: |
1529 |
#line 364 "getdate.y" |
#line 390 "getdate.y" |
1530 |
{ |
{ |
1531 |
/* Interpret as YYYY/MM/DD if the first value has 4 or more digits, |
/* Interpret as YYYY/MM/DD if the first value has 4 or more digits, |
1532 |
otherwise as MM/DD/YY. |
otherwise as MM/DD/YY. |
1533 |
The goal in recognizing YYYY/MM/DD is solely to support legacy |
The goal in recognizing YYYY/MM/DD is solely to support legacy |
1534 |
machine-generated dates like those in an RCS log listing. If |
machine-generated dates like those in an RCS log listing. If |
1535 |
you want portability, use the ISO 8601 format. */ |
you want portability, use the ISO 8601 format. */ |
1536 |
if (4 <= yyvsp[-4].textintval.digits) |
if (4 <= (yyvsp[-4].textintval).digits) |
1537 |
{ |
{ |
1538 |
pc->year = yyvsp[-4].textintval; |
pc->year = (yyvsp[-4].textintval); |
1539 |
pc->month = yyvsp[-2].textintval.value; |
pc->month = (yyvsp[-2].textintval).value; |
1540 |
pc->day = yyvsp[0].textintval.value; |
pc->day = (yyvsp[0].textintval).value; |
1541 |
} |
} |
1542 |
else |
else |
1543 |
{ |
{ |
1544 |
pc->month = yyvsp[-4].textintval.value; |
pc->month = (yyvsp[-4].textintval).value; |
1545 |
pc->day = yyvsp[-2].textintval.value; |
pc->day = (yyvsp[-2].textintval).value; |
1546 |
pc->year = yyvsp[0].textintval; |
pc->year = (yyvsp[0].textintval); |
1547 |
} |
} |
1548 |
} |
} |
1549 |
break; |
break; |
1550 |
|
|
1551 |
case 32: |
case 32: |
1552 |
#line 384 "getdate.y" |
#line 410 "getdate.y" |
1553 |
{ |
{ |
1554 |
/* ISO 8601 format. YYYY-MM-DD. */ |
/* ISO 8601 format. YYYY-MM-DD. */ |
1555 |
pc->year = yyvsp[-2].textintval; |
pc->year = (yyvsp[-2].textintval); |
1556 |
pc->month = -yyvsp[-1].textintval.value; |
pc->month = -(yyvsp[-1].textintval).value; |
1557 |
pc->day = -yyvsp[0].textintval.value; |
pc->day = -(yyvsp[0].textintval).value; |
1558 |
} |
} |
1559 |
break; |
break; |
1560 |
|
|
1561 |
case 33: |
case 33: |
1562 |
#line 391 "getdate.y" |
#line 417 "getdate.y" |
1563 |
{ |
{ |
1564 |
/* e.g. 17-JUN-1992. */ |
/* e.g. 17-JUN-1992. */ |
1565 |
pc->day = yyvsp[-2].textintval.value; |
pc->day = (yyvsp[-2].textintval).value; |
1566 |
pc->month = yyvsp[-1].intval; |
pc->month = (yyvsp[-1].intval); |
1567 |
pc->year.value = -yyvsp[0].textintval.value; |
pc->year.value = -(yyvsp[0].textintval).value; |
1568 |
pc->year.digits = yyvsp[0].textintval.digits; |
pc->year.digits = (yyvsp[0].textintval).digits; |
1569 |
} |
} |
1570 |
break; |
break; |
1571 |
|
|
1572 |
case 34: |
case 34: |
1573 |
#line 399 "getdate.y" |
#line 425 "getdate.y" |
1574 |
{ |
{ |
1575 |
/* e.g. JUN-17-1992. */ |
/* e.g. JUN-17-1992. */ |
1576 |
pc->month = yyvsp[-2].intval; |
pc->month = (yyvsp[-2].intval); |
1577 |
pc->day = -yyvsp[-1].textintval.value; |
pc->day = -(yyvsp[-1].textintval).value; |
1578 |
pc->year.value = -yyvsp[0].textintval.value; |
pc->year.value = -(yyvsp[0].textintval).value; |
1579 |
pc->year.digits = yyvsp[0].textintval.digits; |
pc->year.digits = (yyvsp[0].textintval).digits; |
1580 |
} |
} |
1581 |
break; |
break; |
1582 |
|
|
1583 |
case 35: |
case 35: |
1584 |
#line 407 "getdate.y" |
#line 433 "getdate.y" |
1585 |
{ |
{ |
1586 |
pc->month = yyvsp[-1].intval; |
pc->month = (yyvsp[-1].intval); |
1587 |
pc->day = yyvsp[0].textintval.value; |
pc->day = (yyvsp[0].textintval).value; |
1588 |
} |
} |
1589 |
break; |
break; |
1590 |
|
|
1591 |
case 36: |
case 36: |
1592 |
#line 412 "getdate.y" |
#line 438 "getdate.y" |
1593 |
{ |
{ |
1594 |
pc->month = yyvsp[-3].intval; |
pc->month = (yyvsp[-3].intval); |
1595 |
pc->day = yyvsp[-2].textintval.value; |
pc->day = (yyvsp[-2].textintval).value; |
1596 |
pc->year = yyvsp[0].textintval; |
pc->year = (yyvsp[0].textintval); |
1597 |
} |
} |
1598 |
break; |
break; |
1599 |
|
|
1600 |
case 37: |
case 37: |
1601 |
#line 418 "getdate.y" |
#line 444 "getdate.y" |
1602 |
{ |
{ |
1603 |
pc->day = yyvsp[-1].textintval.value; |
pc->day = (yyvsp[-1].textintval).value; |
1604 |
pc->month = yyvsp[0].intval; |
pc->month = (yyvsp[0].intval); |
1605 |
} |
} |
1606 |
break; |
break; |
1607 |
|
|
1608 |
case 38: |
case 38: |
1609 |
#line 423 "getdate.y" |
#line 449 "getdate.y" |
1610 |
{ |
{ |
1611 |
pc->day = yyvsp[-2].textintval.value; |
pc->day = (yyvsp[-2].textintval).value; |
1612 |
pc->month = yyvsp[-1].intval; |
pc->month = (yyvsp[-1].intval); |
1613 |
pc->year = yyvsp[0].textintval; |
pc->year = (yyvsp[0].textintval); |
1614 |
} |
} |
1615 |
break; |
break; |
1616 |
|
|
1617 |
case 39: |
case 39: |
1618 |
#line 432 "getdate.y" |
#line 458 "getdate.y" |
1619 |
|
{ |
1620 |
|
pc->rel.ns -= (yyvsp[-1].rel).ns; |
1621 |
|
pc->rel.seconds -= (yyvsp[-1].rel).seconds; |
1622 |
|
pc->rel.minutes -= (yyvsp[-1].rel).minutes; |
1623 |
|
pc->rel.hour -= (yyvsp[-1].rel).hour; |
1624 |
|
pc->rel.day -= (yyvsp[-1].rel).day; |
1625 |
|
pc->rel.month -= (yyvsp[-1].rel).month; |
1626 |
|
pc->rel.year -= (yyvsp[-1].rel).year; |
1627 |
|
} |
1628 |
|
break; |
1629 |
|
|
1630 |
|
case 40: |
1631 |
|
#line 468 "getdate.y" |
1632 |
{ |
{ |
1633 |
pc->rel_ns = -pc->rel_ns; |
pc->rel.ns += (yyvsp[0].rel).ns; |
1634 |
pc->rel_seconds = -pc->rel_seconds; |
pc->rel.seconds += (yyvsp[0].rel).seconds; |
1635 |
pc->rel_minutes = -pc->rel_minutes; |
pc->rel.minutes += (yyvsp[0].rel).minutes; |
1636 |
pc->rel_hour = -pc->rel_hour; |
pc->rel.hour += (yyvsp[0].rel).hour; |
1637 |
pc->rel_day = -pc->rel_day; |
pc->rel.day += (yyvsp[0].rel).day; |
1638 |
pc->rel_month = -pc->rel_month; |
pc->rel.month += (yyvsp[0].rel).month; |
1639 |
pc->rel_year = -pc->rel_year; |
pc->rel.year += (yyvsp[0].rel).year; |
1640 |
} |
} |
1641 |
break; |
break; |
1642 |
|
|
1643 |
case 41: |
case 41: |
1644 |
#line 446 "getdate.y" |
#line 481 "getdate.y" |
1645 |
{ pc->rel_year += yyvsp[-1].intval * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].intval); } |
1646 |
break; |
break; |
1647 |
|
|
1648 |
case 42: |
case 42: |
1649 |
#line 448 "getdate.y" |
#line 483 "getdate.y" |
1650 |
{ pc->rel_year += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; } |
1651 |
break; |
break; |
1652 |
|
|
1653 |
case 43: |
case 43: |
1654 |
#line 450 "getdate.y" |
#line 485 "getdate.y" |
1655 |
{ pc->rel_year += yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; } |
1656 |
break; |
break; |
1657 |
|
|
1658 |
case 44: |
case 44: |
1659 |
#line 452 "getdate.y" |
#line 487 "getdate.y" |
1660 |
{ pc->rel_month += yyvsp[-1].intval * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].intval); } |
1661 |
break; |
break; |
1662 |
|
|
1663 |
case 45: |
case 45: |
1664 |
#line 454 "getdate.y" |
#line 489 "getdate.y" |
1665 |
{ pc->rel_month += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; } |
1666 |
break; |
break; |
1667 |
|
|
1668 |
case 46: |
case 46: |
1669 |
#line 456 "getdate.y" |
#line 491 "getdate.y" |
1670 |
{ pc->rel_month += yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; } |
1671 |
break; |
break; |
1672 |
|
|
1673 |
case 47: |
case 47: |
1674 |
#line 458 "getdate.y" |
#line 493 "getdate.y" |
1675 |
{ pc->rel_day += yyvsp[-1].intval * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].intval) * (yyvsp[0].intval); } |
1676 |
break; |
break; |
1677 |
|
|
1678 |
case 48: |
case 48: |
1679 |
#line 460 "getdate.y" |
#line 495 "getdate.y" |
1680 |
{ pc->rel_day += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); } |
1681 |
break; |
break; |
1682 |
|
|
1683 |
case 49: |
case 49: |
1684 |
#line 462 "getdate.y" |
#line 497 "getdate.y" |
1685 |
{ pc->rel_day += yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); } |
1686 |
break; |
break; |
1687 |
|
|
1688 |
case 50: |
case 50: |
1689 |
#line 464 "getdate.y" |
#line 499 "getdate.y" |
1690 |
{ pc->rel_hour += yyvsp[-1].intval * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].intval); } |
1691 |
break; |
break; |
1692 |
|
|
1693 |
case 51: |
case 51: |
1694 |
#line 466 "getdate.y" |
#line 501 "getdate.y" |
1695 |
{ pc->rel_hour += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; } |
1696 |
break; |
break; |
1697 |
|
|
1698 |
case 52: |
case 52: |
1699 |
#line 468 "getdate.y" |
#line 503 "getdate.y" |
1700 |
{ pc->rel_hour += yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; } |
1701 |
break; |
break; |
1702 |
|
|
1703 |
case 53: |
case 53: |
1704 |
#line 470 "getdate.y" |
#line 505 "getdate.y" |
1705 |
{ pc->rel_minutes += yyvsp[-1].intval * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].intval); } |
1706 |
break; |
break; |
1707 |
|
|
1708 |
case 54: |
case 54: |
1709 |
#line 472 "getdate.y" |
#line 507 "getdate.y" |
1710 |
{ pc->rel_minutes += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; } |
1711 |
break; |
break; |
1712 |
|
|
1713 |
case 55: |
case 55: |
1714 |
#line 474 "getdate.y" |
#line 509 "getdate.y" |
1715 |
{ pc->rel_minutes += yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; } |
1716 |
break; |
break; |
1717 |
|
|
1718 |
case 56: |
case 56: |
1719 |
#line 476 "getdate.y" |
#line 511 "getdate.y" |
1720 |
{ pc->rel_seconds += yyvsp[-1].intval * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].intval); } |
1721 |
break; |
break; |
1722 |
|
|
1723 |
case 57: |
case 57: |
1724 |
#line 478 "getdate.y" |
#line 513 "getdate.y" |
1725 |
{ pc->rel_seconds += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; } |
1726 |
break; |
break; |
1727 |
|
|
1728 |
case 58: |
case 58: |
1729 |
#line 480 "getdate.y" |
#line 515 "getdate.y" |
1730 |
{ pc->rel_seconds += yyvsp[-1].timespec.tv_sec * yyvsp[0].intval; pc->rel_ns += yyvsp[-1].timespec.tv_nsec * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; } |
1731 |
break; |
break; |
1732 |
|
|
1733 |
case 59: |
case 59: |
1734 |
#line 482 "getdate.y" |
#line 517 "getdate.y" |
1735 |
{ pc->rel_seconds += yyvsp[-1].timespec.tv_sec * yyvsp[0].intval; pc->rel_ns += yyvsp[-1].timespec.tv_nsec * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; } |
1736 |
break; |
break; |
1737 |
|
|
1738 |
case 60: |
case 60: |
1739 |
#line 484 "getdate.y" |
#line 519 "getdate.y" |
1740 |
{ pc->rel_seconds += yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; } |
1741 |
break; |
break; |
1742 |
|
|
1743 |
case 62: |
case 62: |
1744 |
#line 490 "getdate.y" |
#line 525 "getdate.y" |
1745 |
{ pc->rel_year += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; } |
1746 |
break; |
break; |
1747 |
|
|
1748 |
case 63: |
case 63: |
1749 |
#line 492 "getdate.y" |
#line 527 "getdate.y" |
1750 |
{ pc->rel_month += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; } |
1751 |
break; |
break; |
1752 |
|
|
1753 |
case 64: |
case 64: |
1754 |
#line 494 "getdate.y" |
#line 529 "getdate.y" |
1755 |
{ pc->rel_day += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); } |
1756 |
break; |
break; |
1757 |
|
|
1758 |
case 65: |
case 65: |
1759 |
#line 496 "getdate.y" |
#line 531 "getdate.y" |
1760 |
{ pc->rel_hour += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; } |
1761 |
break; |
break; |
1762 |
|
|
1763 |
case 66: |
case 66: |
1764 |
#line 498 "getdate.y" |
#line 533 "getdate.y" |
1765 |
{ pc->rel_minutes += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; } |
1766 |
break; |
break; |
1767 |
|
|
1768 |
case 67: |
case 67: |
1769 |
#line 500 "getdate.y" |
#line 535 "getdate.y" |
1770 |
{ pc->rel_seconds += yyvsp[-1].textintval.value * yyvsp[0].intval; } |
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; } |
1771 |
break; |
break; |
1772 |
|
|
1773 |
case 71: |
case 71: |
1774 |
#line 508 "getdate.y" |
#line 543 "getdate.y" |
1775 |
{ yyval.timespec.tv_sec = yyvsp[0].textintval.value; yyval.timespec.tv_nsec = 0; } |
{ (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; } |
1776 |
break; |
break; |
1777 |
|
|
1778 |
case 73: |
case 73: |
1779 |
#line 514 "getdate.y" |
#line 549 "getdate.y" |
1780 |
{ yyval.timespec.tv_sec = yyvsp[0].textintval.value; yyval.timespec.tv_nsec = 0; } |
{ (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; } |
1781 |
break; |
break; |
1782 |
|
|
1783 |
case 74: |
case 74: |
1784 |
#line 519 "getdate.y" |
#line 554 "getdate.y" |
1785 |
{ |
{ |
1786 |
if (pc->dates_seen && ! pc->year.digits |
if (pc->dates_seen && ! pc->year.digits |
1787 |
&& ! pc->rels_seen && (pc->times_seen || 2 < yyvsp[0].textintval.digits)) |
&& ! pc->rels_seen && (pc->times_seen || 2 < (yyvsp[0].textintval).digits)) |
1788 |
pc->year = yyvsp[0].textintval; |
pc->year = (yyvsp[0].textintval); |
1789 |
else |
else |
1790 |
{ |
{ |
1791 |
if (4 < yyvsp[0].textintval.digits) |
if (4 < (yyvsp[0].textintval).digits) |
1792 |
{ |
{ |
1793 |
pc->dates_seen++; |
pc->dates_seen++; |
1794 |
pc->day = yyvsp[0].textintval.value % 100; |
pc->day = (yyvsp[0].textintval).value % 100; |
1795 |
pc->month = (yyvsp[0].textintval.value / 100) % 100; |
pc->month = ((yyvsp[0].textintval).value / 100) % 100; |
1796 |
pc->year.value = yyvsp[0].textintval.value / 10000; |
pc->year.value = (yyvsp[0].textintval).value / 10000; |
1797 |
pc->year.digits = yyvsp[0].textintval.digits - 4; |
pc->year.digits = (yyvsp[0].textintval).digits - 4; |
1798 |
} |
} |
1799 |
else |
else |
1800 |
{ |
{ |
1801 |
pc->times_seen++; |
pc->times_seen++; |
1802 |
if (yyvsp[0].textintval.digits <= 2) |
if ((yyvsp[0].textintval).digits <= 2) |
1803 |
{ |
{ |
1804 |
pc->hour = yyvsp[0].textintval.value; |
pc->hour = (yyvsp[0].textintval).value; |
1805 |
pc->minutes = 0; |
pc->minutes = 0; |
1806 |
} |
} |
1807 |
else |
else |
1808 |
{ |
{ |
1809 |
pc->hour = yyvsp[0].textintval.value / 100; |
pc->hour = (yyvsp[0].textintval).value / 100; |
1810 |
pc->minutes = yyvsp[0].textintval.value % 100; |
pc->minutes = (yyvsp[0].textintval).value % 100; |
1811 |
} |
} |
1812 |
pc->seconds.tv_sec = 0; |
pc->seconds.tv_sec = 0; |
1813 |
pc->seconds.tv_nsec = 0; |
pc->seconds.tv_nsec = 0; |
1818 |
break; |
break; |
1819 |
|
|
1820 |
case 75: |
case 75: |
1821 |
#line 556 "getdate.y" |
#line 591 "getdate.y" |
1822 |
{ yyval.intval = -1; } |
{ (yyval.intval) = -1; } |
1823 |
break; |
break; |
1824 |
|
|
1825 |
case 76: |
case 76: |
1826 |
#line 558 "getdate.y" |
#line 593 "getdate.y" |
1827 |
{ yyval.intval = yyvsp[0].textintval.value; } |
{ (yyval.intval) = (yyvsp[0].textintval).value; } |
1828 |
break; |
break; |
1829 |
|
|
1830 |
case 77: |
case 77: |
1831 |
#line 563 "getdate.y" |
#line 598 "getdate.y" |
1832 |
{ yyval.intval = MER24; } |
{ (yyval.intval) = MER24; } |
1833 |
break; |
break; |
1834 |
|
|
1835 |
case 78: |
case 78: |
1836 |
#line 565 "getdate.y" |
#line 600 "getdate.y" |
1837 |
{ yyval.intval = yyvsp[0].intval; } |
{ (yyval.intval) = (yyvsp[0].intval); } |
1838 |
break; |
break; |
1839 |
|
|
1840 |
|
|
1841 |
} |
} |
1842 |
|
|
1843 |
/* Line 1000 of yacc.c. */ |
/* Line 1037 of yacc.c. */ |
1844 |
#line 1782 "getdate.c" |
#line 1845 "getdate.c" |
1845 |
|
|
1846 |
yyvsp -= yylen; |
yyvsp -= yylen; |
1847 |
yyssp -= yylen; |
yyssp -= yylen; |
1941 |
|
|
1942 |
if (yyerrstatus == 3) |
if (yyerrstatus == 3) |
1943 |
{ |
{ |
1944 |
/* If just tried and failed to reuse lookahead token after an |
/* If just tried and failed to reuse look-ahead token after an |
1945 |
error, discard it. */ |
error, discard it. */ |
1946 |
|
|
1947 |
if (yychar <= YYEOF) |
if (yychar <= YYEOF) |
1951 |
if (yychar == YYEOF) |
if (yychar == YYEOF) |
1952 |
for (;;) |
for (;;) |
1953 |
{ |
{ |
1954 |
|
|
1955 |
YYPOPSTACK; |
YYPOPSTACK; |
1956 |
if (yyssp == yyss) |
if (yyssp == yyss) |
1957 |
YYABORT; |
YYABORT; |
1958 |
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); |
yydestruct ("Error: popping", |
1959 |
yydestruct (yystos[*yyssp], yyvsp); |
yystos[*yyssp], yyvsp); |
1960 |
} |
} |
1961 |
} |
} |
1962 |
else |
else |
1963 |
{ |
{ |
1964 |
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); |
yydestruct ("Error: discarding", yytoken, &yylval); |
|
yydestruct (yytoken, &yylval); |
|
1965 |
yychar = YYEMPTY; |
yychar = YYEMPTY; |
|
|
|
1966 |
} |
} |
1967 |
} |
} |
1968 |
|
|
1969 |
/* Else will try to reuse lookahead token after shifting the error |
/* Else will try to reuse look-ahead token after shifting the error |
1970 |
token. */ |
token. */ |
1971 |
goto yyerrlab1; |
goto yyerrlab1; |
1972 |
|
|
1983 |
goto yyerrorlab; |
goto yyerrorlab; |
1984 |
#endif |
#endif |
1985 |
|
|
1986 |
yyvsp -= yylen; |
yyvsp -= yylen; |
1987 |
yyssp -= yylen; |
yyssp -= yylen; |
1988 |
yystate = *yyssp; |
yystate = *yyssp; |
1989 |
goto yyerrlab1; |
goto yyerrlab1; |
2013 |
if (yyssp == yyss) |
if (yyssp == yyss) |
2014 |
YYABORT; |
YYABORT; |
2015 |
|
|
2016 |
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); |
|
2017 |
yydestruct (yystos[yystate], yyvsp); |
yydestruct ("Error: popping", yystos[yystate], yyvsp); |
2018 |
YYPOPSTACK; |
YYPOPSTACK; |
2019 |
yystate = *yyssp; |
yystate = *yyssp; |
2020 |
YY_STACK_PRINT (yyss, yyssp); |
YY_STACK_PRINT (yyss, yyssp); |
2023 |
if (yyn == YYFINAL) |
if (yyn == YYFINAL) |
2024 |
YYACCEPT; |
YYACCEPT; |
2025 |
|
|
|
YYDPRINTF ((stderr, "Shifting error token, ")); |
|
|
|
|
2026 |
*++yyvsp = yylval; |
*++yyvsp = yylval; |
2027 |
|
|
2028 |
|
|
2029 |
|
/* Shift the error token. */ |
2030 |
|
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
2031 |
|
|
2032 |
yystate = yyn; |
yystate = yyn; |
2033 |
goto yynewstate; |
goto yynewstate; |
2034 |
|
|
2044 |
| yyabortlab -- YYABORT comes here. | |
| yyabortlab -- YYABORT comes here. | |
2045 |
`-----------------------------------*/ |
`-----------------------------------*/ |
2046 |
yyabortlab: |
yyabortlab: |
2047 |
|
yydestruct ("Error: discarding lookahead", |
2048 |
|
yytoken, &yylval); |
2049 |
|
yychar = YYEMPTY; |
2050 |
yyresult = 1; |
yyresult = 1; |
2051 |
goto yyreturn; |
goto yyreturn; |
2052 |
|
|
2069 |
} |
} |
2070 |
|
|
2071 |
|
|
2072 |
#line 568 "getdate.y" |
#line 603 "getdate.y" |
2073 |
|
|
2074 |
|
|
2075 |
static table const meridian_table[] = |
static table const meridian_table[] = |
2720 |
tm.tm_isdst = tmp->tm_isdst; |
tm.tm_isdst = tmp->tm_isdst; |
2721 |
|
|
2722 |
pc.meridian = MER24; |
pc.meridian = MER24; |
2723 |
pc.rel_ns = 0; |
pc.rel = RELATIVE_TIME_0; |
|
pc.rel_seconds = 0; |
|
|
pc.rel_minutes = 0; |
|
|
pc.rel_hour = 0; |
|
|
pc.rel_day = 0; |
|
|
pc.rel_month = 0; |
|
|
pc.rel_year = 0; |
|
2724 |
pc.timespec_seen = false; |
pc.timespec_seen = false; |
2725 |
pc.rels_seen = false; |
pc.rels_seen = false; |
2726 |
pc.dates_seen = 0; |
pc.dates_seen = 0; |
2817 |
} |
} |
2818 |
|
|
2819 |
/* Let mktime deduce tm_isdst if we have an absolute time stamp. */ |
/* Let mktime deduce tm_isdst if we have an absolute time stamp. */ |
2820 |
if (!pc.rels_seen) |
if (pc.dates_seen | pc.days_seen | pc.times_seen) |
2821 |
tm.tm_isdst = -1; |
tm.tm_isdst = -1; |
2822 |
|
|
2823 |
/* But if the input explicitly specifies local time with or without |
/* But if the input explicitly specifies local time with or without |
2895 |
} |
} |
2896 |
|
|
2897 |
/* Add relative date. */ |
/* Add relative date. */ |
2898 |
if (pc.rel_year | pc.rel_month | pc.rel_day) |
if (pc.rel.year | pc.rel.month | pc.rel.day) |
2899 |
{ |
{ |
2900 |
int year = tm.tm_year + pc.rel_year; |
int year = tm.tm_year + pc.rel.year; |
2901 |
int month = tm.tm_mon + pc.rel_month; |
int month = tm.tm_mon + pc.rel.month; |
2902 |
int day = tm.tm_mday + pc.rel_day; |
int day = tm.tm_mday + pc.rel.day; |
2903 |
if (((year < tm.tm_year) ^ (pc.rel_year < 0)) |
if (((year < tm.tm_year) ^ (pc.rel.year < 0)) |
2904 |
| ((month < tm.tm_mon) ^ (pc.rel_month < 0)) |
| ((month < tm.tm_mon) ^ (pc.rel.month < 0)) |
2905 |
| ((day < tm.tm_mday) ^ (pc.rel_day < 0))) |
| ((day < tm.tm_mday) ^ (pc.rel.day < 0))) |
2906 |
goto fail; |
goto fail; |
2907 |
tm.tm_year = year; |
tm.tm_year = year; |
2908 |
tm.tm_mon = month; |
tm.tm_mon = month; |
2920 |
must be applied before relative times, and if mktime is applied |
must be applied before relative times, and if mktime is applied |
2921 |
again the time zone will be lost. */ |
again the time zone will be lost. */ |
2922 |
{ |
{ |
2923 |
long int sum_ns = pc.seconds.tv_nsec + pc.rel_ns; |
long int sum_ns = pc.seconds.tv_nsec + pc.rel.ns; |
2924 |
long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION; |
long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION; |
2925 |
time_t t0 = Start; |
time_t t0 = Start; |
2926 |
long int d1 = 60 * 60 * pc.rel_hour; |
long int d1 = 60 * 60 * pc.rel.hour; |
2927 |
time_t t1 = t0 + d1; |
time_t t1 = t0 + d1; |
2928 |
long int d2 = 60 * pc.rel_minutes; |
long int d2 = 60 * pc.rel.minutes; |
2929 |
time_t t2 = t1 + d2; |
time_t t2 = t1 + d2; |
2930 |
long int d3 = pc.rel_seconds; |
long int d3 = pc.rel.seconds; |
2931 |
time_t t3 = t2 + d3; |
time_t t3 = t2 + d3; |
2932 |
long int d4 = (sum_ns - normalized_ns) / BILLION; |
long int d4 = (sum_ns - normalized_ns) / BILLION; |
2933 |
time_t t4 = t3 + d4; |
time_t t4 = t3 + d4; |
2934 |
|
|
2935 |
if ((d1 / (60 * 60) ^ pc.rel_hour) |
if ((d1 / (60 * 60) ^ pc.rel.hour) |
2936 |
| (d2 / 60 ^ pc.rel_minutes) |
| (d2 / 60 ^ pc.rel.minutes) |
2937 |
| ((t1 < t0) ^ (d1 < 0)) |
| ((t1 < t0) ^ (d1 < 0)) |
2938 |
| ((t2 < t1) ^ (d2 < 0)) |
| ((t2 < t1) ^ (d2 < 0)) |
2939 |
| ((t3 < t2) ^ (d3 < 0)) |
| ((t3 < t2) ^ (d3 < 0)) |