1 /* A Bison parser, made by GNU Bison 3.0.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 1
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations. */
65 #line 38 "x-deltat.y" /* yacc.c:339 */
66
67
68 /*
69 * GCC optimizer will detect a variable used without being set in a YYERROR
70 * path. As this is generated code, suppress the complaint.
71 */
72 #ifdef __GNUC__
73 #pragma GCC diagnostic push
74 #pragma GCC diagnostic ignored "-Wuninitialized"
75 #endif
76
77 #include "k5-int.h"
78 #include <ctype.h>
79
80 struct param {
81 krb5_int32 delta;
82 char *p;
83 };
84
85 #define MAX_TIME KRB5_INT32_MAX
86 #define MIN_TIME KRB5_INT32_MIN
87
88 #define DAY (24 * 3600)
89 #define HOUR 3600
90
91 #define MAX_DAY (MAX_TIME / DAY)
92 #define MIN_DAY (MIN_TIME / DAY)
93 #define MAX_HOUR (MAX_TIME / HOUR)
94 #define MIN_HOUR (MIN_TIME / HOUR)
95 #define MAX_MIN (MAX_TIME / 60)
96 #define MIN_MIN (MIN_TIME / 60)
97
98 /* An explanation of the tests being performed.
99 We do not want to overflow a 32 bit integer with out manipulations,
100 even for testing for overflow. Therefore we rely on the following:
101
102 The lex parser will not return a number > MAX_TIME (which is out 32
103 bit limit).
104
105 Therefore, seconds (s) will require
106 MIN_TIME < s < MAX_TIME
107
108 For subsequent tests, the logic is as follows:
109
110 If A < MAX_TIME and B < MAX_TIME
111
112 If we want to test if A+B < MAX_TIME, there are two cases
113 if (A > 0)
114 then A + B < MAX_TIME if B < MAX_TIME - A
115 else A + B < MAX_TIME always.
116
117 if we want to test if MIN_TIME < A + B
118 if A > 0 - then nothing to test
119 otherwise, we test if MIN_TIME - A < B.
120
121 We of course are testing for:
122 MIN_TIME < A + B < MAX_TIME
123 */
124
125
126 #define DAY_NOT_OK(d) (d) > MAX_DAY || (d) < MIN_DAY
127 #define HOUR_NOT_OK(h) (h) > MAX_HOUR || (h) < MIN_HOUR
128 #define MIN_NOT_OK(m) (m) > MAX_MIN || (m) < MIN_MIN
129 #define SUM_OK(a, b) (((a) > 0) ? ( (b) <= MAX_TIME - (a)) : (MIN_TIME - (a) <= (b)))
130 #define DO_SUM(res, a, b) if (!SUM_OK((a), (b))) YYERROR; \
131 res = (a) + (b)
132
133
134 #define OUT_D tmv->delta
135 #define DO(D,H,M,S) \
136 { \
137 /* Overflow testing - this does not handle negative values well.. */ \
138 if (DAY_NOT_OK(D) || HOUR_NOT_OK(H) || MIN_NOT_OK(M)) YYERROR; \
139 OUT_D = D * DAY; \
140 DO_SUM(OUT_D, OUT_D, H * HOUR); \
141 DO_SUM(OUT_D, OUT_D, M * 60); \
142 DO_SUM(OUT_D, OUT_D, S); \
143 }
144
145 static int mylex(int *intp, struct param *tmv);
146 #undef yylex
147 #define yylex(U, P) mylex (&(U)->val, (P))
148
149 #undef yyerror
150 #define yyerror(tmv, msg)
151
152 static int yyparse(struct param *);
153
154
155 #line 156 "deltat.c" /* yacc.c:339 */
156
157 # ifndef YY_NULLPTR
158 # if defined __cplusplus && 201103L <= __cplusplus
159 # define YY_NULLPTR nullptr
160 # else
161 # define YY_NULLPTR 0
162 # endif
163 # endif
164
165 /* Enabling verbose error messages. */
166 #ifdef YYERROR_VERBOSE
167 # undef YYERROR_VERBOSE
168 # define YYERROR_VERBOSE 1
169 #else
170 # define YYERROR_VERBOSE 0
171 #endif
172
173
174 /* Debug traces. */
175 #ifndef YYDEBUG
176 # define YYDEBUG 0
177 #endif
178 #if YYDEBUG
179 extern int yydebug;
180 #endif
181
182 /* Token type. */
183 #ifndef YYTOKENTYPE
184 # define YYTOKENTYPE
185 enum yytokentype
186 {
187 tok_NUM = 258,
188 tok_LONGNUM = 259,
189 tok_OVERFLOW = 260,
190 tok_WS = 261
191 };
192 #endif
193
194 /* Value type. */
195 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
196
197 union YYSTYPE
198 {
199 #line 128 "x-deltat.y" /* yacc.c:355 */
200 int val;
201
202 #line 203 "deltat.c" /* yacc.c:355 */
203 };
204
205 typedef union YYSTYPE YYSTYPE;
206 # define YYSTYPE_IS_TRIVIAL 1
207 # define YYSTYPE_IS_DECLARED 1
208 #endif
209
210
211
212 int yyparse (struct param *tmv);
213
214
215
216 /* Copy the second part of user declarations. */
217
218 #line 219 "deltat.c" /* yacc.c:358 */
219
220 #ifdef short
221 # undef short
222 #endif
223
224 #ifdef YYTYPE_UINT8
225 typedef YYTYPE_UINT8 yytype_uint8;
226 #else
227 typedef unsigned char yytype_uint8;
228 #endif
229
230 #ifdef YYTYPE_INT8
231 typedef YYTYPE_INT8 yytype_int8;
232 #else
233 typedef signed char yytype_int8;
234 #endif
235
236 #ifdef YYTYPE_UINT16
237 typedef YYTYPE_UINT16 yytype_uint16;
238 #else
239 typedef unsigned short int yytype_uint16;
240 #endif
241
242 #ifdef YYTYPE_INT16
243 typedef YYTYPE_INT16 yytype_int16;
244 #else
245 typedef short int yytype_int16;
246 #endif
247
248 #ifndef YYSIZE_T
249 # ifdef __SIZE_TYPE__
250 # define YYSIZE_T __SIZE_TYPE__
251 # elif defined size_t
252 # define YYSIZE_T size_t
253 # elif ! defined YYSIZE_T
254 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
255 # define YYSIZE_T size_t
256 # else
257 # define YYSIZE_T unsigned int
258 # endif
259 #endif
260
261 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
262
263 #ifndef YY_
264 # if defined YYENABLE_NLS && YYENABLE_NLS
265 # if ENABLE_NLS
266 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
267 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
268 # endif
269 # endif
270 # ifndef YY_
271 # define YY_(Msgid) Msgid
272 # endif
273 #endif
274
275 #ifndef YY_ATTRIBUTE
276 # if (defined __GNUC__ \
277 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
278 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
279 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
280 # else
281 # define YY_ATTRIBUTE(Spec) /* empty */
282 # endif
283 #endif
284
285 #ifndef YY_ATTRIBUTE_PURE
286 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
287 #endif
288
289 #ifndef YY_ATTRIBUTE_UNUSED
290 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
291 #endif
292
293 #if !defined _Noreturn \
294 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
295 # if defined _MSC_VER && 1200 <= _MSC_VER
296 # define _Noreturn __declspec (noreturn)
297 # else
298 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
299 # endif
300 #endif
301
302 /* Suppress unused-variable warnings by "using" E. */
303 #if ! defined lint || defined __GNUC__
304 # define YYUSE(E) ((void) (E))
305 #else
306 # define YYUSE(E) /* empty */
307 #endif
308
309 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
310 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
311 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
312 _Pragma ("GCC diagnostic push") \
313 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
314 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
315 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
316 _Pragma ("GCC diagnostic pop")
317 #else
318 # define YY_INITIAL_VALUE(Value) Value
319 #endif
320 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
321 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
322 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
323 #endif
324 #ifndef YY_INITIAL_VALUE
325 # define YY_INITIAL_VALUE(Value) /* Nothing. */
326 #endif
327
328
329 #if ! defined yyoverflow || YYERROR_VERBOSE
330
331 /* The parser invokes alloca or malloc; define the necessary symbols. */
332
333 # ifdef YYSTACK_USE_ALLOCA
334 # if YYSTACK_USE_ALLOCA
335 # ifdef __GNUC__
336 # define YYSTACK_ALLOC __builtin_alloca
337 # elif defined __BUILTIN_VA_ARG_INCR
338 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
339 # elif defined _AIX
340 # define YYSTACK_ALLOC __alloca
341 # elif defined _MSC_VER
342 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
343 # define alloca _alloca
344 # else
345 # define YYSTACK_ALLOC alloca
346 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
347 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
348 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
349 # ifndef EXIT_SUCCESS
350 # define EXIT_SUCCESS 0
351 # endif
352 # endif
353 # endif
354 # endif
355 # endif
356
357 # ifdef YYSTACK_ALLOC
358 /* Pacify GCC's 'empty if-body' warning. */
359 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
360 # ifndef YYSTACK_ALLOC_MAXIMUM
361 /* The OS might guarantee only one guard page at the bottom of the stack,
362 and a page size can be as small as 4096 bytes. So we cannot safely
363 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
364 to allow for a few compiler-allocated temporary stack slots. */
365 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
366 # endif
367 # else
368 # define YYSTACK_ALLOC YYMALLOC
369 # define YYSTACK_FREE YYFREE
370 # ifndef YYSTACK_ALLOC_MAXIMUM
371 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
372 # endif
373 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
374 && ! ((defined YYMALLOC || defined malloc) \
375 && (defined YYFREE || defined free)))
376 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
377 # ifndef EXIT_SUCCESS
378 # define EXIT_SUCCESS 0
379 # endif
380 # endif
381 # ifndef YYMALLOC
382 # define YYMALLOC malloc
383 # if ! defined malloc && ! defined EXIT_SUCCESS
384 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
385 # endif
386 # endif
387 # ifndef YYFREE
388 # define YYFREE free
389 # if ! defined free && ! defined EXIT_SUCCESS
390 void free (void *); /* INFRINGES ON USER NAME SPACE */
391 # endif
392 # endif
393 # endif
394 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
395
396
397 #if (! defined yyoverflow \
398 && (! defined __cplusplus \
399 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
400
401 /* A type that is properly aligned for any stack member. */
402 union yyalloc
403 {
404 yytype_int16 yyss_alloc;
405 YYSTYPE yyvs_alloc;
406 };
407
408 /* The size of the maximum gap between one aligned stack and the next. */
409 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
410
411 /* The size of an array large to enough to hold all stacks, each with
412 N elements. */
413 # define YYSTACK_BYTES(N) \
414 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
415 + YYSTACK_GAP_MAXIMUM)
416
417 # define YYCOPY_NEEDED 1
418
419 /* Relocate STACK from its old location to the new one. The
420 local variables YYSIZE and YYSTACKSIZE give the old and new number of
421 elements in the stack, and YYPTR gives the new location of the
422 stack. Advance YYPTR to a properly aligned location for the next
423 stack. */
424 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
425 do \
426 { \
427 YYSIZE_T yynewbytes; \
428 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
429 Stack = &yyptr->Stack_alloc; \
430 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
431 yyptr += yynewbytes / sizeof (*yyptr); \
432 } \
433 while (0)
434
435 #endif
436
437 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
438 /* Copy COUNT objects from SRC to DST. The source and destination do
439 not overlap. */
440 # ifndef YYCOPY
441 # if defined __GNUC__ && 1 < __GNUC__
442 # define YYCOPY(Dst, Src, Count) \
443 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
444 # else
445 # define YYCOPY(Dst, Src, Count) \
446 do \
447 { \
448 YYSIZE_T yyi; \
449 for (yyi = 0; yyi < (Count); yyi++) \
450 (Dst)[yyi] = (Src)[yyi]; \
451 } \
452 while (0)
453 # endif
454 # endif
455 #endif /* !YYCOPY_NEEDED */
456
457 /* YYFINAL -- State number of the termination state. */
458 #define YYFINAL 6
459 /* YYLAST -- Last index in YYTABLE. */
460 #define YYLAST 37
461
462 /* YYNTOKENS -- Number of terminals. */
463 #define YYNTOKENS 13
464 /* YYNNTS -- Number of nonterminals. */
465 #define YYNNTS 10
466 /* YYNRULES -- Number of rules. */
467 #define YYNRULES 24
468 /* YYNSTATES -- Number of states. */
469 #define YYNSTATES 42
470
471 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
472 by yylex, with out-of-bounds checking. */
473 #define YYUNDEFTOK 2
474 #define YYMAXUTOK 261
475
476 #define YYTRANSLATE(YYX) \
477 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
478
479 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
480 as returned by yylex, without out-of-bounds checking. */
481 static const yytype_uint8 yytranslate[] =
482 {
483 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 6, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 7, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 8, 2, 2, 2, 9, 2, 2, 2, 2, 10,
494 2, 2, 2, 2, 2, 11, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
509 5, 12
510 };
511
512 #if YYDEBUG
513 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
514 static const yytype_uint8 yyrline[] =
515 {
516 0, 142, 142, 143, 143, 144, 144, 145, 145, 146,
517 147, 149, 150, 151, 152, 153, 154, 155, 156, 161,
518 162, 165, 166, 169, 170
519 };
520 #endif
521
522 #if YYDEBUG || YYERROR_VERBOSE || 0
523 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
524 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
525 static const char *const yytname[] =
526 {
527 "$end", "error", "$undefined", "tok_NUM", "tok_LONGNUM", "tok_OVERFLOW",
528 "'-'", "':'", "'d'", "'h'", "'m'", "'s'", "tok_WS", "$accept", "start",
529 "posnum", "num", "ws", "wsnum", "deltat", "opt_hms", "opt_ms", "opt_s", YY_NULLPTR
530 };
531 #endif
532
533 # ifdef YYPRINT
534 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
535 (internal) symbol number NUM (which must be that of a token). */
536 static const yytype_uint16 yytoknum[] =
537 {
538 0, 256, 257, 258, 259, 260, 45, 58, 100, 104,
539 109, 115, 261
540 };
541 # endif
542
543 #define YYPACT_NINF -16
544
545 #define yypact_value_is_default(Yystate) \
546 (!!((Yystate) == (-16)))
547
548 #define YYTABLE_NINF -1
549
550 #define yytable_value_is_error(Yytable_value) \
551 0
552
553 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
554 STATE-NUM. */
555 static const yytype_int8 yypact[] =
556 {
557 -10, -16, 14, 7, -2, -16, -16, -16, -16, -16,
558 21, -16, -16, 13, 25, -10, -10, -10, -16, -16,
559 22, 23, 7, 12, -16, -16, -16, 16, -16, 8,
560 -16, 28, 29, -10, -10, -16, 26, -16, -16, -16,
561 32, -16
562 };
563
564 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
565 Performed when YYTABLE does not specify something else to do. Zero
566 means the default is an error. */
567 static const yytype_uint8 yydefact[] =
568 {
569 7, 8, 0, 0, 18, 2, 1, 3, 4, 10,
570 0, 5, 9, 0, 0, 7, 7, 7, 14, 6,
571 0, 17, 23, 0, 11, 19, 21, 0, 12, 0,
572 13, 0, 0, 7, 7, 24, 0, 16, 20, 22,
573 0, 15
574 };
575
576 /* YYPGOTO[NTERM-NUM]. */
577 static const yytype_int8 yypgoto[] =
578 {
579 -16, -16, 27, -16, 36, 0, -16, -16, -15, -14
580 };
581
582 /* YYDEFGOTO[NTERM-NUM]. */
583 static const yytype_int8 yydefgoto[] =
584 {
585 -1, 2, 11, 12, 22, 27, 5, 24, 25, 26
586 };
587
588 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
589 positive, shift that token. If negative, reduce the rule whose
590 number is the opposite. If YYTABLE_NINF, syntax error. */
591 static const yytype_uint8 yytable[] =
592 {
593 4, 28, 1, 30, 13, 14, 15, 16, 17, 18,
594 7, 8, 9, 10, 6, 23, 20, 29, 38, 35,
595 39, 33, 34, 35, 7, 8, 34, 35, 21, 31,
596 32, 36, 37, 40, 29, 41, 3, 19
597 };
598
599 static const yytype_uint8 yycheck[] =
600 {
601 0, 16, 12, 17, 6, 7, 8, 9, 10, 11,
602 3, 4, 5, 6, 0, 15, 3, 17, 33, 11,
603 34, 9, 10, 11, 3, 4, 10, 11, 3, 7,
604 7, 3, 3, 7, 34, 3, 0, 10
605 };
606
607 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
608 symbol of state STATE-NUM. */
609 static const yytype_uint8 yystos[] =
610 {
611 0, 12, 14, 17, 18, 19, 0, 3, 4, 5,
612 6, 15, 16, 6, 7, 8, 9, 10, 11, 15,
613 3, 3, 17, 18, 20, 21, 22, 18, 21, 18,
614 22, 7, 7, 9, 10, 11, 3, 3, 21, 22,
615 7, 3
616 };
617
618 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
619 static const yytype_uint8 yyr1[] =
620 {
621 0, 13, 14, 15, 15, 16, 16, 17, 17, 18,
622 18, 19, 19, 19, 19, 19, 19, 19, 19, 20,
623 20, 21, 21, 22, 22
624 };
625
626 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
627 static const yytype_uint8 yyr2[] =
628 {
629 0, 2, 1, 1, 1, 1, 2, 0, 1, 2,
630 2, 3, 3, 3, 2, 7, 5, 3, 1, 1,
631 3, 1, 3, 1, 2
632 };
633
634
635 #define yyerrok (yyerrstatus = 0)
636 #define yyclearin (yychar = YYEMPTY)
637 #define YYEMPTY (-2)
638 #define YYEOF 0
639
640 #define YYACCEPT goto yyacceptlab
641 #define YYABORT goto yyabortlab
642 #define YYERROR goto yyerrorlab
643
644
645 #define YYRECOVERING() (!!yyerrstatus)
646
647 #define YYBACKUP(Token, Value) \
648 do \
649 if (yychar == YYEMPTY) \
650 { \
651 yychar = (Token); \
652 yylval = (Value); \
653 YYPOPSTACK (yylen); \
654 yystate = *yyssp; \
655 goto yybackup; \
656 } \
657 else \
658 { \
659 yyerror (tmv, YY_("syntax error: cannot back up")); \
660 YYERROR; \
661 } \
662 while (0)
663
664 /* Error token number */
665 #define YYTERROR 1
666 #define YYERRCODE 256
667
668
669
670 /* Enable debugging if requested. */
671 #if YYDEBUG
672
673 # ifndef YYFPRINTF
674 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
675 # define YYFPRINTF fprintf
676 # endif
677
678 # define YYDPRINTF(Args) \
679 do { \
680 if (yydebug) \
681 YYFPRINTF Args; \
682 } while (0)
683
684 /* This macro is provided for backward compatibility. */
685 #ifndef YY_LOCATION_PRINT
686 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
687 #endif
688
689
690 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
691 do { \
692 if (yydebug) \
693 { \
694 YYFPRINTF (stderr, "%s ", Title); \
695 yy_symbol_print (stderr, \
696 Type, Value, tmv); \
697 YYFPRINTF (stderr, "\n"); \
698 } \
699 } while (0)
700
701
702 /*----------------------------------------.
703 | Print this symbol's value on YYOUTPUT. |
704 `----------------------------------------*/
705
706 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,struct param * tmv)707 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct param *tmv)
708 {
709 FILE *yyo = yyoutput;
710 YYUSE (yyo);
711 YYUSE (tmv);
712 if (!yyvaluep)
713 return;
714 # ifdef YYPRINT
715 if (yytype < YYNTOKENS)
716 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
717 # endif
718 YYUSE (yytype);
719 }
720
721
722 /*--------------------------------.
723 | Print this symbol on YYOUTPUT. |
724 `--------------------------------*/
725
726 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,struct param * tmv)727 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct param *tmv)
728 {
729 YYFPRINTF (yyoutput, "%s %s (",
730 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
731
732 yy_symbol_value_print (yyoutput, yytype, yyvaluep, tmv);
733 YYFPRINTF (yyoutput, ")");
734 }
735
736 /*------------------------------------------------------------------.
737 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
738 | TOP (included). |
739 `------------------------------------------------------------------*/
740
741 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)742 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
743 {
744 YYFPRINTF (stderr, "Stack now");
745 for (; yybottom <= yytop; yybottom++)
746 {
747 int yybot = *yybottom;
748 YYFPRINTF (stderr, " %d", yybot);
749 }
750 YYFPRINTF (stderr, "\n");
751 }
752
753 # define YY_STACK_PRINT(Bottom, Top) \
754 do { \
755 if (yydebug) \
756 yy_stack_print ((Bottom), (Top)); \
757 } while (0)
758
759
760 /*------------------------------------------------.
761 | Report that the YYRULE is going to be reduced. |
762 `------------------------------------------------*/
763
764 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule,struct param * tmv)765 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct param *tmv)
766 {
767 unsigned long int yylno = yyrline[yyrule];
768 int yynrhs = yyr2[yyrule];
769 int yyi;
770 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
771 yyrule - 1, yylno);
772 /* The symbols being reduced. */
773 for (yyi = 0; yyi < yynrhs; yyi++)
774 {
775 YYFPRINTF (stderr, " $%d = ", yyi + 1);
776 yy_symbol_print (stderr,
777 yystos[yyssp[yyi + 1 - yynrhs]],
778 &(yyvsp[(yyi + 1) - (yynrhs)])
779 , tmv);
780 YYFPRINTF (stderr, "\n");
781 }
782 }
783
784 # define YY_REDUCE_PRINT(Rule) \
785 do { \
786 if (yydebug) \
787 yy_reduce_print (yyssp, yyvsp, Rule, tmv); \
788 } while (0)
789
790 /* Nonzero means print parse trace. It is left uninitialized so that
791 multiple parsers can coexist. */
792 int yydebug;
793 #else /* !YYDEBUG */
794 # define YYDPRINTF(Args)
795 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
796 # define YY_STACK_PRINT(Bottom, Top)
797 # define YY_REDUCE_PRINT(Rule)
798 #endif /* !YYDEBUG */
799
800
801 /* YYINITDEPTH -- initial size of the parser's stacks. */
802 #ifndef YYINITDEPTH
803 # define YYINITDEPTH 200
804 #endif
805
806 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
807 if the built-in stack extension method is used).
808
809 Do not make this value too large; the results are undefined if
810 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
811 evaluated with infinite-precision integer arithmetic. */
812
813 #ifndef YYMAXDEPTH
814 # define YYMAXDEPTH 10000
815 #endif
816
817
818 #if YYERROR_VERBOSE
819
820 # ifndef yystrlen
821 # if defined __GLIBC__ && defined _STRING_H
822 # define yystrlen strlen
823 # else
824 /* Return the length of YYSTR. */
825 static YYSIZE_T
yystrlen(const char * yystr)826 yystrlen (const char *yystr)
827 {
828 YYSIZE_T yylen;
829 for (yylen = 0; yystr[yylen]; yylen++)
830 continue;
831 return yylen;
832 }
833 # endif
834 # endif
835
836 # ifndef yystpcpy
837 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
838 # define yystpcpy stpcpy
839 # else
840 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
841 YYDEST. */
842 static char *
yystpcpy(char * yydest,const char * yysrc)843 yystpcpy (char *yydest, const char *yysrc)
844 {
845 char *yyd = yydest;
846 const char *yys = yysrc;
847
848 while ((*yyd++ = *yys++) != '\0')
849 continue;
850
851 return yyd - 1;
852 }
853 # endif
854 # endif
855
856 # ifndef yytnamerr
857 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
858 quotes and backslashes, so that it's suitable for yyerror. The
859 heuristic is that double-quoting is unnecessary unless the string
860 contains an apostrophe, a comma, or backslash (other than
861 backslash-backslash). YYSTR is taken from yytname. If YYRES is
862 null, do not copy; instead, return the length of what the result
863 would have been. */
864 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)865 yytnamerr (char *yyres, const char *yystr)
866 {
867 if (*yystr == '"')
868 {
869 YYSIZE_T yyn = 0;
870 char const *yyp = yystr;
871
872 for (;;)
873 switch (*++yyp)
874 {
875 case '\'':
876 case ',':
877 goto do_not_strip_quotes;
878
879 case '\\':
880 if (*++yyp != '\\')
881 goto do_not_strip_quotes;
882 /* Fall through. */
883 default:
884 if (yyres)
885 yyres[yyn] = *yyp;
886 yyn++;
887 break;
888
889 case '"':
890 if (yyres)
891 yyres[yyn] = '\0';
892 return yyn;
893 }
894 do_not_strip_quotes: ;
895 }
896
897 if (! yyres)
898 return yystrlen (yystr);
899
900 return yystpcpy (yyres, yystr) - yyres;
901 }
902 # endif
903
904 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
905 about the unexpected token YYTOKEN for the state stack whose top is
906 YYSSP.
907
908 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
909 not large enough to hold the message. In that case, also set
910 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
911 required number of bytes is too large to store. */
912 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)913 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
914 yytype_int16 *yyssp, int yytoken)
915 {
916 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
917 YYSIZE_T yysize = yysize0;
918 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
919 /* Internationalized format string. */
920 const char *yyformat = YY_NULLPTR;
921 /* Arguments of yyformat. */
922 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
923 /* Number of reported tokens (one for the "unexpected", one per
924 "expected"). */
925 int yycount = 0;
926
927 /* There are many possibilities here to consider:
928 - If this state is a consistent state with a default action, then
929 the only way this function was invoked is if the default action
930 is an error action. In that case, don't check for expected
931 tokens because there are none.
932 - The only way there can be no lookahead present (in yychar) is if
933 this state is a consistent state with a default action. Thus,
934 detecting the absence of a lookahead is sufficient to determine
935 that there is no unexpected or expected token to report. In that
936 case, just report a simple "syntax error".
937 - Don't assume there isn't a lookahead just because this state is a
938 consistent state with a default action. There might have been a
939 previous inconsistent state, consistent state with a non-default
940 action, or user semantic action that manipulated yychar.
941 - Of course, the expected token list depends on states to have
942 correct lookahead information, and it depends on the parser not
943 to perform extra reductions after fetching a lookahead from the
944 scanner and before detecting a syntax error. Thus, state merging
945 (from LALR or IELR) and default reductions corrupt the expected
946 token list. However, the list is correct for canonical LR with
947 one exception: it will still contain any token that will not be
948 accepted due to an error action in a later state.
949 */
950 if (yytoken != YYEMPTY)
951 {
952 int yyn = yypact[*yyssp];
953 yyarg[yycount++] = yytname[yytoken];
954 if (!yypact_value_is_default (yyn))
955 {
956 /* Start YYX at -YYN if negative to avoid negative indexes in
957 YYCHECK. In other words, skip the first -YYN actions for
958 this state because they are default actions. */
959 int yyxbegin = yyn < 0 ? -yyn : 0;
960 /* Stay within bounds of both yycheck and yytname. */
961 int yychecklim = YYLAST - yyn + 1;
962 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
963 int yyx;
964
965 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
966 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
967 && !yytable_value_is_error (yytable[yyx + yyn]))
968 {
969 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
970 {
971 yycount = 1;
972 yysize = yysize0;
973 break;
974 }
975 yyarg[yycount++] = yytname[yyx];
976 {
977 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
978 if (! (yysize <= yysize1
979 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
980 return 2;
981 yysize = yysize1;
982 }
983 }
984 }
985 }
986
987 switch (yycount)
988 {
989 # define YYCASE_(N, S) \
990 case N: \
991 yyformat = S; \
992 break
993 YYCASE_(0, YY_("syntax error"));
994 YYCASE_(1, YY_("syntax error, unexpected %s"));
995 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
996 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
997 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
998 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
999 # undef YYCASE_
1000 }
1001
1002 {
1003 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1004 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1005 return 2;
1006 yysize = yysize1;
1007 }
1008
1009 if (*yymsg_alloc < yysize)
1010 {
1011 *yymsg_alloc = 2 * yysize;
1012 if (! (yysize <= *yymsg_alloc
1013 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1014 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1015 return 1;
1016 }
1017
1018 /* Avoid sprintf, as that infringes on the user's name space.
1019 Don't have undefined behavior even if the translation
1020 produced a string with the wrong number of "%s"s. */
1021 {
1022 char *yyp = *yymsg;
1023 int yyi = 0;
1024 while ((*yyp = *yyformat) != '\0')
1025 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1026 {
1027 yyp += yytnamerr (yyp, yyarg[yyi++]);
1028 yyformat += 2;
1029 }
1030 else
1031 {
1032 yyp++;
1033 yyformat++;
1034 }
1035 }
1036 return 0;
1037 }
1038 #endif /* YYERROR_VERBOSE */
1039
1040 /*-----------------------------------------------.
1041 | Release the memory associated to this symbol. |
1042 `-----------------------------------------------*/
1043
1044 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,struct param * tmv)1045 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct param *tmv)
1046 {
1047 YYUSE (yyvaluep);
1048 YYUSE (tmv);
1049 if (!yymsg)
1050 yymsg = "Deleting";
1051 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1052
1053 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1054 YYUSE (yytype);
1055 YY_IGNORE_MAYBE_UNINITIALIZED_END
1056 }
1057
1058
1059
1060
1061 /*----------.
1062 | yyparse. |
1063 `----------*/
1064
1065 int
yyparse(struct param * tmv)1066 yyparse (struct param *tmv)
1067 {
1068 /* The lookahead symbol. */
1069 int yychar;
1070
1071
1072 /* The semantic value of the lookahead symbol. */
1073 /* Default value used for initialization, for pacifying older GCCs
1074 or non-GCC compilers. */
1075 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1076 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1077
1078 /* Number of syntax errors so far. */
1079 int yynerrs;
1080
1081 int yystate;
1082 /* Number of tokens to shift before error messages enabled. */
1083 int yyerrstatus;
1084
1085 /* The stacks and their tools:
1086 'yyss': related to states.
1087 'yyvs': related to semantic values.
1088
1089 Refer to the stacks through separate pointers, to allow yyoverflow
1090 to reallocate them elsewhere. */
1091
1092 /* The state stack. */
1093 yytype_int16 yyssa[YYINITDEPTH];
1094 yytype_int16 *yyss;
1095 yytype_int16 *yyssp;
1096
1097 /* The semantic value stack. */
1098 YYSTYPE yyvsa[YYINITDEPTH];
1099 YYSTYPE *yyvs;
1100 YYSTYPE *yyvsp;
1101
1102 YYSIZE_T yystacksize;
1103
1104 int yyn;
1105 int yyresult;
1106 /* Lookahead token as an internal (translated) token number. */
1107 int yytoken = 0;
1108 /* The variables used to return semantic value and location from the
1109 action routines. */
1110 YYSTYPE yyval;
1111
1112 #if YYERROR_VERBOSE
1113 /* Buffer for error messages, and its allocated size. */
1114 char yymsgbuf[128];
1115 char *yymsg = yymsgbuf;
1116 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1117 #endif
1118
1119 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1120
1121 /* The number of symbols on the RHS of the reduced rule.
1122 Keep to zero when no symbol should be popped. */
1123 int yylen = 0;
1124
1125 yyssp = yyss = yyssa;
1126 yyvsp = yyvs = yyvsa;
1127 yystacksize = YYINITDEPTH;
1128
1129 YYDPRINTF ((stderr, "Starting parse\n"));
1130
1131 yystate = 0;
1132 yyerrstatus = 0;
1133 yynerrs = 0;
1134 yychar = YYEMPTY; /* Cause a token to be read. */
1135 goto yysetstate;
1136
1137 /*------------------------------------------------------------.
1138 | yynewstate -- Push a new state, which is found in yystate. |
1139 `------------------------------------------------------------*/
1140 yynewstate:
1141 /* In all cases, when you get here, the value and location stacks
1142 have just been pushed. So pushing a state here evens the stacks. */
1143 yyssp++;
1144
1145 yysetstate:
1146 *yyssp = yystate;
1147
1148 if (yyss + yystacksize - 1 <= yyssp)
1149 {
1150 /* Get the current used size of the three stacks, in elements. */
1151 YYSIZE_T yysize = yyssp - yyss + 1;
1152
1153 #ifdef yyoverflow
1154 {
1155 /* Give user a chance to reallocate the stack. Use copies of
1156 these so that the &'s don't force the real ones into
1157 memory. */
1158 YYSTYPE *yyvs1 = yyvs;
1159 yytype_int16 *yyss1 = yyss;
1160
1161 /* Each stack pointer address is followed by the size of the
1162 data in use in that stack, in bytes. This used to be a
1163 conditional around just the two extra args, but that might
1164 be undefined if yyoverflow is a macro. */
1165 yyoverflow (YY_("memory exhausted"),
1166 &yyss1, yysize * sizeof (*yyssp),
1167 &yyvs1, yysize * sizeof (*yyvsp),
1168 &yystacksize);
1169
1170 yyss = yyss1;
1171 yyvs = yyvs1;
1172 }
1173 #else /* no yyoverflow */
1174 # ifndef YYSTACK_RELOCATE
1175 goto yyexhaustedlab;
1176 # else
1177 /* Extend the stack our own way. */
1178 if (YYMAXDEPTH <= yystacksize)
1179 goto yyexhaustedlab;
1180 yystacksize *= 2;
1181 if (YYMAXDEPTH < yystacksize)
1182 yystacksize = YYMAXDEPTH;
1183
1184 {
1185 yytype_int16 *yyss1 = yyss;
1186 union yyalloc *yyptr =
1187 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1188 if (! yyptr)
1189 goto yyexhaustedlab;
1190 YYSTACK_RELOCATE (yyss_alloc, yyss);
1191 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1192 # undef YYSTACK_RELOCATE
1193 if (yyss1 != yyssa)
1194 YYSTACK_FREE (yyss1);
1195 }
1196 # endif
1197 #endif /* no yyoverflow */
1198
1199 yyssp = yyss + yysize - 1;
1200 yyvsp = yyvs + yysize - 1;
1201
1202 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1203 (unsigned long int) yystacksize));
1204
1205 if (yyss + yystacksize - 1 <= yyssp)
1206 YYABORT;
1207 }
1208
1209 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1210
1211 if (yystate == YYFINAL)
1212 YYACCEPT;
1213
1214 goto yybackup;
1215
1216 /*-----------.
1217 | yybackup. |
1218 `-----------*/
1219 yybackup:
1220
1221 /* Do appropriate processing given the current state. Read a
1222 lookahead token if we need one and don't already have one. */
1223
1224 /* First try to decide what to do without reference to lookahead token. */
1225 yyn = yypact[yystate];
1226 if (yypact_value_is_default (yyn))
1227 goto yydefault;
1228
1229 /* Not known => get a lookahead token if don't already have one. */
1230
1231 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1232 if (yychar == YYEMPTY)
1233 {
1234 YYDPRINTF ((stderr, "Reading a token: "));
1235 yychar = yylex (&yylval, tmv);
1236 }
1237
1238 if (yychar <= YYEOF)
1239 {
1240 yychar = yytoken = YYEOF;
1241 YYDPRINTF ((stderr, "Now at end of input.\n"));
1242 }
1243 else
1244 {
1245 yytoken = YYTRANSLATE (yychar);
1246 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1247 }
1248
1249 /* If the proper action on seeing token YYTOKEN is to reduce or to
1250 detect an error, take that action. */
1251 yyn += yytoken;
1252 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1253 goto yydefault;
1254 yyn = yytable[yyn];
1255 if (yyn <= 0)
1256 {
1257 if (yytable_value_is_error (yyn))
1258 goto yyerrlab;
1259 yyn = -yyn;
1260 goto yyreduce;
1261 }
1262
1263 /* Count tokens shifted since error; after three, turn off error
1264 status. */
1265 if (yyerrstatus)
1266 yyerrstatus--;
1267
1268 /* Shift the lookahead token. */
1269 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1270
1271 /* Discard the shifted token. */
1272 yychar = YYEMPTY;
1273
1274 yystate = yyn;
1275 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1276 *++yyvsp = yylval;
1277 YY_IGNORE_MAYBE_UNINITIALIZED_END
1278
1279 goto yynewstate;
1280
1281
1282 /*-----------------------------------------------------------.
1283 | yydefault -- do the default action for the current state. |
1284 `-----------------------------------------------------------*/
1285 yydefault:
1286 yyn = yydefact[yystate];
1287 if (yyn == 0)
1288 goto yyerrlab;
1289 goto yyreduce;
1290
1291
1292 /*-----------------------------.
1293 | yyreduce -- Do a reduction. |
1294 `-----------------------------*/
1295 yyreduce:
1296 /* yyn is the number of a rule to reduce with. */
1297 yylen = yyr2[yyn];
1298
1299 /* If YYLEN is nonzero, implement the default value of the action:
1300 '$$ = $1'.
1301
1302 Otherwise, the following line sets YYVAL to garbage.
1303 This behavior is undocumented and Bison
1304 users should not rely upon it. Assigning to YYVAL
1305 unconditionally makes the parser a bit smaller, and it avoids a
1306 GCC warning that YYVAL may be used uninitialized. */
1307 yyval = yyvsp[1-yylen];
1308
1309
1310 YY_REDUCE_PRINT (yyn);
1311 switch (yyn)
1312 {
1313 case 6:
1314 #line 144 "x-deltat.y" /* yacc.c:1646 */
1315 { (yyval.val) = - (yyvsp[0].val); }
1316 #line 1317 "deltat.c" /* yacc.c:1646 */
1317 break;
1318
1319 case 9:
1320 #line 146 "x-deltat.y" /* yacc.c:1646 */
1321 { (yyval.val) = (yyvsp[0].val); }
1322 #line 1323 "deltat.c" /* yacc.c:1646 */
1323 break;
1324
1325 case 10:
1326 #line 147 "x-deltat.y" /* yacc.c:1646 */
1327 { YYERROR; }
1328 #line 1329 "deltat.c" /* yacc.c:1646 */
1329 break;
1330
1331 case 11:
1332 #line 149 "x-deltat.y" /* yacc.c:1646 */
1333 { DO ((yyvsp[-2].val), 0, 0, (yyvsp[0].val)); }
1334 #line 1335 "deltat.c" /* yacc.c:1646 */
1335 break;
1336
1337 case 12:
1338 #line 150 "x-deltat.y" /* yacc.c:1646 */
1339 { DO ( 0, (yyvsp[-2].val), 0, (yyvsp[0].val)); }
1340 #line 1341 "deltat.c" /* yacc.c:1646 */
1341 break;
1342
1343 case 13:
1344 #line 151 "x-deltat.y" /* yacc.c:1646 */
1345 { DO ( 0, 0, (yyvsp[-2].val), (yyvsp[0].val)); }
1346 #line 1347 "deltat.c" /* yacc.c:1646 */
1347 break;
1348
1349 case 14:
1350 #line 152 "x-deltat.y" /* yacc.c:1646 */
1351 { DO ( 0, 0, 0, (yyvsp[-1].val)); }
1352 #line 1353 "deltat.c" /* yacc.c:1646 */
1353 break;
1354
1355 case 15:
1356 #line 153 "x-deltat.y" /* yacc.c:1646 */
1357 { DO ((yyvsp[-6].val), (yyvsp[-4].val), (yyvsp[-2].val), (yyvsp[0].val)); }
1358 #line 1359 "deltat.c" /* yacc.c:1646 */
1359 break;
1360
1361 case 16:
1362 #line 154 "x-deltat.y" /* yacc.c:1646 */
1363 { DO ( 0, (yyvsp[-4].val), (yyvsp[-2].val), (yyvsp[0].val)); }
1364 #line 1365 "deltat.c" /* yacc.c:1646 */
1365 break;
1366
1367 case 17:
1368 #line 155 "x-deltat.y" /* yacc.c:1646 */
1369 { DO ( 0, (yyvsp[-2].val), (yyvsp[0].val), 0); }
1370 #line 1371 "deltat.c" /* yacc.c:1646 */
1371 break;
1372
1373 case 18:
1374 #line 156 "x-deltat.y" /* yacc.c:1646 */
1375 { DO ( 0, 0, 0, (yyvsp[0].val)); }
1376 #line 1377 "deltat.c" /* yacc.c:1646 */
1377 break;
1378
1379 case 20:
1380 #line 162 "x-deltat.y" /* yacc.c:1646 */
1381 { if (HOUR_NOT_OK((yyvsp[-2].val))) YYERROR;
1382 DO_SUM((yyval.val), (yyvsp[-2].val) * 3600, (yyvsp[0].val)); }
1383 #line 1384 "deltat.c" /* yacc.c:1646 */
1384 break;
1385
1386 case 22:
1387 #line 166 "x-deltat.y" /* yacc.c:1646 */
1388 { if (MIN_NOT_OK((yyvsp[-2].val))) YYERROR;
1389 DO_SUM((yyval.val), (yyvsp[-2].val) * 60, (yyvsp[0].val)); }
1390 #line 1391 "deltat.c" /* yacc.c:1646 */
1391 break;
1392
1393 case 23:
1394 #line 169 "x-deltat.y" /* yacc.c:1646 */
1395 { (yyval.val) = 0; }
1396 #line 1397 "deltat.c" /* yacc.c:1646 */
1397 break;
1398
1399
1400 #line 1401 "deltat.c" /* yacc.c:1646 */
1401 default: break;
1402 }
1403 /* User semantic actions sometimes alter yychar, and that requires
1404 that yytoken be updated with the new translation. We take the
1405 approach of translating immediately before every use of yytoken.
1406 One alternative is translating here after every semantic action,
1407 but that translation would be missed if the semantic action invokes
1408 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1409 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1410 incorrect destructor might then be invoked immediately. In the
1411 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1412 to an incorrect destructor call or verbose syntax error message
1413 before the lookahead is translated. */
1414 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1415
1416 YYPOPSTACK (yylen);
1417 yylen = 0;
1418 YY_STACK_PRINT (yyss, yyssp);
1419
1420 *++yyvsp = yyval;
1421
1422 /* Now 'shift' the result of the reduction. Determine what state
1423 that goes to, based on the state we popped back to and the rule
1424 number reduced by. */
1425
1426 yyn = yyr1[yyn];
1427
1428 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1429 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1430 yystate = yytable[yystate];
1431 else
1432 yystate = yydefgoto[yyn - YYNTOKENS];
1433
1434 goto yynewstate;
1435
1436
1437 /*--------------------------------------.
1438 | yyerrlab -- here on detecting error. |
1439 `--------------------------------------*/
1440 yyerrlab:
1441 /* Make sure we have latest lookahead translation. See comments at
1442 user semantic actions for why this is necessary. */
1443 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1444
1445 /* If not already recovering from an error, report this error. */
1446 if (!yyerrstatus)
1447 {
1448 ++yynerrs;
1449 #if ! YYERROR_VERBOSE
1450 yyerror (tmv, YY_("syntax error"));
1451 #else
1452 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1453 yyssp, yytoken)
1454 {
1455 char const *yymsgp = YY_("syntax error");
1456 int yysyntax_error_status;
1457 yysyntax_error_status = YYSYNTAX_ERROR;
1458 if (yysyntax_error_status == 0)
1459 yymsgp = yymsg;
1460 else if (yysyntax_error_status == 1)
1461 {
1462 if (yymsg != yymsgbuf)
1463 YYSTACK_FREE (yymsg);
1464 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1465 if (!yymsg)
1466 {
1467 yymsg = yymsgbuf;
1468 yymsg_alloc = sizeof yymsgbuf;
1469 yysyntax_error_status = 2;
1470 }
1471 else
1472 {
1473 yysyntax_error_status = YYSYNTAX_ERROR;
1474 yymsgp = yymsg;
1475 }
1476 }
1477 yyerror (tmv, yymsgp);
1478 if (yysyntax_error_status == 2)
1479 goto yyexhaustedlab;
1480 }
1481 # undef YYSYNTAX_ERROR
1482 #endif
1483 }
1484
1485
1486
1487 if (yyerrstatus == 3)
1488 {
1489 /* If just tried and failed to reuse lookahead token after an
1490 error, discard it. */
1491
1492 if (yychar <= YYEOF)
1493 {
1494 /* Return failure if at end of input. */
1495 if (yychar == YYEOF)
1496 YYABORT;
1497 }
1498 else
1499 {
1500 yydestruct ("Error: discarding",
1501 yytoken, &yylval, tmv);
1502 yychar = YYEMPTY;
1503 }
1504 }
1505
1506 /* Else will try to reuse lookahead token after shifting the error
1507 token. */
1508 goto yyerrlab1;
1509
1510
1511 /*---------------------------------------------------.
1512 | yyerrorlab -- error raised explicitly by YYERROR. |
1513 `---------------------------------------------------*/
1514 yyerrorlab:
1515
1516 /* Pacify compilers like GCC when the user code never invokes
1517 YYERROR and the label yyerrorlab therefore never appears in user
1518 code. */
1519 if (/*CONSTCOND*/ 0)
1520 goto yyerrorlab;
1521
1522 /* Do not reclaim the symbols of the rule whose action triggered
1523 this YYERROR. */
1524 YYPOPSTACK (yylen);
1525 yylen = 0;
1526 YY_STACK_PRINT (yyss, yyssp);
1527 yystate = *yyssp;
1528 goto yyerrlab1;
1529
1530
1531 /*-------------------------------------------------------------.
1532 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1533 `-------------------------------------------------------------*/
1534 yyerrlab1:
1535 yyerrstatus = 3; /* Each real token shifted decrements this. */
1536
1537 for (;;)
1538 {
1539 yyn = yypact[yystate];
1540 if (!yypact_value_is_default (yyn))
1541 {
1542 yyn += YYTERROR;
1543 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1544 {
1545 yyn = yytable[yyn];
1546 if (0 < yyn)
1547 break;
1548 }
1549 }
1550
1551 /* Pop the current state because it cannot handle the error token. */
1552 if (yyssp == yyss)
1553 YYABORT;
1554
1555
1556 yydestruct ("Error: popping",
1557 yystos[yystate], yyvsp, tmv);
1558 YYPOPSTACK (1);
1559 yystate = *yyssp;
1560 YY_STACK_PRINT (yyss, yyssp);
1561 }
1562
1563 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1564 *++yyvsp = yylval;
1565 YY_IGNORE_MAYBE_UNINITIALIZED_END
1566
1567
1568 /* Shift the error token. */
1569 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1570
1571 yystate = yyn;
1572 goto yynewstate;
1573
1574
1575 /*-------------------------------------.
1576 | yyacceptlab -- YYACCEPT comes here. |
1577 `-------------------------------------*/
1578 yyacceptlab:
1579 yyresult = 0;
1580 goto yyreturn;
1581
1582 /*-----------------------------------.
1583 | yyabortlab -- YYABORT comes here. |
1584 `-----------------------------------*/
1585 yyabortlab:
1586 yyresult = 1;
1587 goto yyreturn;
1588
1589 #if !defined yyoverflow || YYERROR_VERBOSE
1590 /*-------------------------------------------------.
1591 | yyexhaustedlab -- memory exhaustion comes here. |
1592 `-------------------------------------------------*/
1593 yyexhaustedlab:
1594 yyerror (tmv, YY_("memory exhausted"));
1595 yyresult = 2;
1596 /* Fall through. */
1597 #endif
1598
1599 yyreturn:
1600 if (yychar != YYEMPTY)
1601 {
1602 /* Make sure we have latest lookahead translation. See comments at
1603 user semantic actions for why this is necessary. */
1604 yytoken = YYTRANSLATE (yychar);
1605 yydestruct ("Cleanup: discarding lookahead",
1606 yytoken, &yylval, tmv);
1607 }
1608 /* Do not reclaim the symbols of the rule whose action triggered
1609 this YYABORT or YYACCEPT. */
1610 YYPOPSTACK (yylen);
1611 YY_STACK_PRINT (yyss, yyssp);
1612 while (yyssp != yyss)
1613 {
1614 yydestruct ("Cleanup: popping",
1615 yystos[*yyssp], yyvsp, tmv);
1616 YYPOPSTACK (1);
1617 }
1618 #ifndef yyoverflow
1619 if (yyss != yyssa)
1620 YYSTACK_FREE (yyss);
1621 #endif
1622 #if YYERROR_VERBOSE
1623 if (yymsg != yymsgbuf)
1624 YYSTACK_FREE (yymsg);
1625 #endif
1626 return yyresult;
1627 }
1628 #line 172 "x-deltat.y" /* yacc.c:1906 */
1629
1630
1631 #ifdef __GNUC__
1632 #pragma GCC diagnostic pop
1633 #endif
1634
1635 static int
mylex(int * intp,struct param * tmv)1636 mylex(int *intp, struct param *tmv)
1637 {
1638 int num, c;
1639 #define P (tmv->p)
1640 char *orig_p = P;
1641
1642 #ifdef isascii
1643 if (!isascii (*P))
1644 return 0;
1645 #endif
1646 switch (c = *P++) {
1647 case '-':
1648 case ':':
1649 case 'd':
1650 case 'h':
1651 case 'm':
1652 case 's':
1653 return c;
1654 case '0':
1655 case '1':
1656 case '2':
1657 case '3':
1658 case '4':
1659 case '5':
1660 case '6':
1661 case '7':
1662 case '8':
1663 case '9':
1664 /* XXX assumes ASCII */
1665 num = c - '0';
1666 while (isdigit ((int) *P)) {
1667 if (num > MAX_TIME / 10)
1668 return tok_OVERFLOW;
1669 num *= 10;
1670 if (num > MAX_TIME - (*P - '0'))
1671 return tok_OVERFLOW;
1672 num += *P++ - '0';
1673 }
1674 *intp = num;
1675 return (P - orig_p > 2) ? tok_LONGNUM : tok_NUM;
1676 case ' ':
1677 case '\t':
1678 case '\n':
1679 while (isspace ((int) *P))
1680 P++;
1681 return tok_WS;
1682 default:
1683 return YYEOF;
1684 }
1685 }
1686
1687 krb5_error_code KRB5_CALLCONV
krb5_string_to_deltat(char * string,krb5_deltat * deltatp)1688 krb5_string_to_deltat(char *string, krb5_deltat *deltatp)
1689 {
1690 struct param p;
1691 p.delta = 0;
1692 p.p = string;
1693 if (yyparse (&p))
1694 return KRB5_DELTAT_BADFORMAT;
1695 *deltatp = p.delta;
1696 return 0;
1697 }
1698