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