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