1 #pragma ident "%Z%%M% %I% %E% SMI" 2 3 /* A Bison parser, made from ../../../../asrc/lib/krb5/krb/x-deltat.y 4 by GNU Bison version 1.27 5 */ 6 7 #define YYBISON 1 /* Identify Bison output. */ 8 9 #define NUM 257 10 #define LONGNUM 258 11 #define WS 259 12 13 #line 38 "../../../../asrc/lib/krb5/krb/x-deltat.y" 14 15 16 #include <ctype.h> 17 #include <errno.h> 18 #include <k5-int.h> 19 20 #if 0 21 #define NBITS(TYPE) (8*sizeof(TYPE)) 22 #define LOG10_2 0.30103 23 #define LOG10_MAX(TYPE) (LOG10_2 * NBITS(TYPE)) 24 #define BUFFERSIZE(TYPE) (1 /* \0 */ + (int) (1 + LOG10_MAX(TYPE))) 25 #endif 26 27 struct param { 28 krb5_deltat delta; 29 char *p; 30 }; 31 32 #define YYPARSE_PARAM tmv 33 34 #define DO(D,H,M,S) \ 35 { \ 36 ((struct param *)tmv)->delta = (((D * 24) + H) * 60 + M) * 60 + S; \ 37 } 38 39 static int mylex (int *, char **); 40 #define YYLEX_PARAM (&((struct param *)tmv)->p) 41 #undef yylex 42 #define yylex(U, P) mylex (&(U)->val, (P)) 43 44 #undef yyerror 45 #define yyerror(MSG) 46 47 static int yyparse (void *); 48 49 50 #line 77 "../../../../asrc/lib/krb5/krb/x-deltat.y" 51 typedef union { int val; } YYSTYPE; 52 #include <stdio.h> 53 54 #ifndef __cplusplus 55 #ifndef __STDC__ 56 #define const 57 #endif 58 #endif 59 60 61 62 #define YYFINAL 41 63 #define YYFLAG -32768 64 #define YYNTBASE 12 65 66 #define YYTRANSLATE(x) ((unsigned)(x) <= 259 ? yytranslate[x] : 21) 67 68 static const char yytranslate[] = { 0, 69 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 70 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 72 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 73 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 74 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 75 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 76 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 77 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 78 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 79 2, 2, 2, 8, 2, 2, 2, 2, 9, 2, 80 2, 2, 2, 2, 10, 2, 2, 2, 2, 2, 81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 85 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 89 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 91 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 93 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 94 2, 2, 2, 2, 2, 1, 3, 4, 11 95 }; 96 97 #if YYDEBUG != 0 98 static const short yyprhs[] = { 0, 99 0, 2, 4, 6, 8, 11, 12, 14, 17, 21, 100 25, 29, 32, 40, 46, 50, 52, 56, 58, 62, 101 64 102 }; 103 104 static const short yyrhs[] = { 17, 105 0, 3, 0, 4, 0, 13, 0, 5, 13, 0, 106 0, 11, 0, 15, 14, 0, 16, 7, 18, 0, 107 16, 8, 19, 0, 16, 9, 20, 0, 16, 10, 108 0, 16, 5, 3, 6, 3, 6, 3, 0, 16, 109 6, 3, 6, 3, 0, 16, 6, 3, 0, 19, 110 0, 16, 8, 19, 0, 20, 0, 16, 9, 20, 111 0, 15, 0, 16, 10, 0 112 }; 113 114 #endif 115 116 #if YYDEBUG != 0 117 static const short yyrline[] = { 0, 118 88, 89, 89, 90, 90, 91, 91, 92, 93, 95, 119 96, 97, 98, 99, 100, 103, 105, 106, 108, 109, 120 111 121 }; 122 #endif 123 124 125 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 126 127 static const char * const yytname[] = { "$","error","$undefined.","NUM","LONGNUM", 128 "'-'","':'","'d'","'h'","'m'","'s'","WS","start","posnum","num","ws","wsnum", 129 "deltat","opt_hms","opt_ms","opt_s", NULL 130 }; 131 #endif 132 133 static const short yyr1[] = { 0, 134 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 135 17, 17, 17, 17, 17, 18, 18, 19, 19, 20, 136 20 137 }; 138 139 static const short yyr2[] = { 0, 140 1, 1, 1, 1, 2, 0, 1, 2, 3, 3, 141 3, 2, 7, 5, 3, 1, 3, 1, 3, 1, 142 2 143 }; 144 145 static const short yydefact[] = { 6, 146 7, 0, 0, 1, 2, 3, 0, 4, 8, 0, 147 0, 6, 6, 6, 12, 5, 0, 15, 20, 0, 148 9, 16, 18, 0, 10, 0, 11, 0, 0, 6, 149 6, 21, 0, 14, 17, 19, 0, 13, 0, 0, 150 0 151 }; 152 153 static const short yydefgoto[] = { 39, 154 8, 9, 19, 24, 4, 21, 22, 23 155 }; 156 157 static const short yypact[] = { -9, 158 -32768, 12, -1,-32768,-32768,-32768, 7,-32768,-32768, 10, 159 16, -9, -9, -9,-32768,-32768, 20, 21, 12, 13, 160 -32768,-32768,-32768, 15,-32768, 18,-32768, 26, 27, -9, 161 -9,-32768, 28,-32768,-32768,-32768, 29,-32768, 33, 35, 162 -32768 163 }; 164 165 static const short yypgoto[] = {-32768, 166 30,-32768, 36, 0,-32768,-32768, -12, -11 167 }; 168 169 170 #define YYLAST 37 171 172 173 static const short yytable[] = { 3, 174 25, 1, 27, 10, 11, 12, 13, 14, 15, 5, 175 6, 20, 17, 26, 5, 6, 7, 35, 18, 36, 176 30, 31, 32, 31, 32, 28, 29, 32, 33, 34, 177 26, 38, 40, 37, 41, 2, 16 178 }; 179 180 static const short yycheck[] = { 0, 181 13, 11, 14, 5, 6, 7, 8, 9, 10, 3, 182 4, 12, 3, 14, 3, 4, 5, 30, 3, 31, 183 8, 9, 10, 9, 10, 6, 6, 10, 3, 3, 184 31, 3, 0, 6, 0, 0, 7 185 }; 186 #define YYPURE 1 187 188 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 189 #line 3 "/mit/gnu/share/bison.simple" 190 /* This file comes from bison-1.27. */ 191 192 /* Skeleton output parser for bison, 193 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 194 195 This program is free software; you can redistribute it and/or modify 196 it under the terms of the GNU General Public License as published by 197 the Free Software Foundation; either version 2, or (at your option) 198 any later version. 199 200 This program is distributed in the hope that it will be useful, 201 but WITHOUT ANY WARRANTY; without even the implied warranty of 202 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 203 GNU General Public License for more details. 204 205 You should have received a copy of the GNU General Public License 206 along with this program; if not, write to the Free Software 207 Foundation, Inc., 59 Temple Place - Suite 330, 208 Boston, MA 02111-1307, USA. */ 209 210 /* As a special exception, when this file is copied by Bison into a 211 Bison output file, you may use that output file without restriction. 212 This special exception was added by the Free Software Foundation 213 in version 1.24 of Bison. */ 214 215 /* This is the parser code that is written into each bison parser 216 when the %semantic_parser declaration is not specified in the grammar. 217 It was written by Richard Stallman by simplifying the hairy parser 218 used when %semantic_parser is specified. */ 219 220 #ifndef YYSTACK_USE_ALLOCA 221 #ifdef alloca 222 #define YYSTACK_USE_ALLOCA 223 #else /* alloca not defined */ 224 #ifdef __GNUC__ 225 #define YYSTACK_USE_ALLOCA 226 #define alloca __builtin_alloca 227 #else /* not GNU C. */ 228 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 229 #define YYSTACK_USE_ALLOCA 230 #include <alloca.h> 231 #else /* not sparc */ 232 /* We think this test detects Watcom and Microsoft C. */ 233 /* This used to test MSDOS, but that is a bad idea 234 since that symbol is in the user namespace. */ 235 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 236 #if 0 /* No need for malloc.h, which pollutes the namespace; 237 instead, just don't use alloca. */ 238 #include <malloc.h> 239 #endif 240 #else /* not MSDOS, or __TURBOC__ */ 241 #if defined(_AIX) 242 /* I don't know what this was needed for, but it pollutes the namespace. 243 So I turned it off. rms, 2 May 1997. */ 244 /* #include <malloc.h> */ 245 #pragma alloca 246 #define YYSTACK_USE_ALLOCA 247 #else /* not MSDOS, or __TURBOC__, or _AIX */ 248 #if 0 249 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, 250 and on HPUX 10. Eventually we can turn this on. */ 251 #define YYSTACK_USE_ALLOCA 252 #define alloca __builtin_alloca 253 #endif /* __hpux */ 254 #endif 255 #endif /* not _AIX */ 256 #endif /* not MSDOS, or __TURBOC__ */ 257 #endif /* not sparc */ 258 #endif /* not GNU C */ 259 #endif /* alloca not defined */ 260 #endif /* YYSTACK_USE_ALLOCA not defined */ 261 262 #ifdef YYSTACK_USE_ALLOCA 263 #define YYSTACK_ALLOC alloca 264 #else 265 #define YYSTACK_ALLOC malloc 266 #endif 267 268 /* Note: there must be only one dollar sign in this file. 269 It is replaced by the list of actions, each action 270 as one case of the switch. */ 271 272 #define yyerrok (yyerrstatus = 0) 273 #define yyclearin (yychar = YYEMPTY) 274 #define YYEMPTY -2 275 #define YYEOF 0 276 #define YYACCEPT goto yyacceptlab 277 #define YYABORT goto yyabortlab 278 #define YYERROR goto yyerrlab1 279 /* Like YYERROR except do call yyerror. 280 This remains here temporarily to ease the 281 transition to the new meaning of YYERROR, for GCC. 282 Once GCC version 2 has supplanted version 1, this can go. */ 283 #define YYFAIL goto yyerrlab 284 #define YYRECOVERING() (!!yyerrstatus) 285 #define YYBACKUP(token, value) \ 286 do \ 287 if (yychar == YYEMPTY && yylen == 1) \ 288 { yychar = (token), yylval = (value); \ 289 yychar1 = YYTRANSLATE (yychar); \ 290 YYPOPSTACK; \ 291 goto yybackup; \ 292 } \ 293 else \ 294 { yyerror ("syntax error: cannot back up"); YYERROR; } \ 295 while (0) 296 297 #define YYTERROR 1 298 #define YYERRCODE 256 299 300 #ifndef YYPURE 301 #define YYLEX yylex() 302 #endif 303 304 #ifdef YYPURE 305 #ifdef YYLSP_NEEDED 306 #ifdef YYLEX_PARAM 307 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 308 #else 309 #define YYLEX yylex(&yylval, &yylloc) 310 #endif 311 #else /* not YYLSP_NEEDED */ 312 #ifdef YYLEX_PARAM 313 #define YYLEX yylex(&yylval, YYLEX_PARAM) 314 #else 315 #define YYLEX yylex(&yylval) 316 #endif 317 #endif /* not YYLSP_NEEDED */ 318 #endif 319 320 /* If nonreentrant, generate the variables here */ 321 322 #ifndef YYPURE 323 324 int yychar; /* the lookahead symbol */ 325 YYSTYPE yylval; /* the semantic value of the */ 326 /* lookahead symbol */ 327 328 #ifdef YYLSP_NEEDED 329 YYLTYPE yylloc; /* location data for the lookahead */ 330 /* symbol */ 331 #endif 332 333 int yynerrs; /* number of parse errors so far */ 334 #endif /* not YYPURE */ 335 336 #if YYDEBUG != 0 337 int yydebug; /* nonzero means print parse trace */ 338 /* Since this is uninitialized, it does not stop multiple parsers 339 from coexisting. */ 340 #endif 341 342 /* YYINITDEPTH indicates the initial size of the parser's stacks */ 343 344 #ifndef YYINITDEPTH 345 #define YYINITDEPTH 200 346 #endif 347 348 /* YYMAXDEPTH is the maximum size the stacks can grow to 349 (effective only if the built-in stack extension method is used). */ 350 351 #if YYMAXDEPTH == 0 352 #undef YYMAXDEPTH 353 #endif 354 355 #ifndef YYMAXDEPTH 356 #define YYMAXDEPTH 10000 357 #endif 358 359 /* Define __yy_memcpy. Note that the size argument 360 should be passed with type unsigned int, because that is what the non-GCC 361 definitions require. With GCC, __builtin_memcpy takes an arg 362 of type size_t, but it can handle unsigned int. */ 363 364 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 365 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 366 #else /* not GNU C or C++ */ 367 #ifndef __cplusplus 368 369 /* This is the most reliable way to avoid incompatibilities 370 in available built-in functions on various systems. */ 371 static void 372 __yy_memcpy (to, from, count) 373 char *to; 374 char *from; 375 unsigned int count; 376 { 377 register char *f = from; 378 register char *t = to; 379 register int i = count; 380 381 while (i-- > 0) 382 *t++ = *f++; 383 } 384 385 #else /* __cplusplus */ 386 387 /* This is the most reliable way to avoid incompatibilities 388 in available built-in functions on various systems. */ 389 static void 390 __yy_memcpy (char *to, char *from, unsigned int count) 391 { 392 register char *t = to; 393 register char *f = from; 394 register int i = count; 395 396 while (i-- > 0) 397 *t++ = *f++; 398 } 399 400 #endif 401 #endif 402 403 #line 216 "/mit/gnu/share/bison.simple" 404 405 /* The user can define YYPARSE_PARAM as the name of an argument to be passed 406 into yyparse. The argument should have type void *. 407 It should actually point to an object. 408 Grammar actions can access the variable by casting it 409 to the proper pointer type. */ 410 411 #ifdef YYPARSE_PARAM 412 #ifdef __cplusplus 413 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 414 #define YYPARSE_PARAM_DECL 415 #else /* not __cplusplus */ 416 #define YYPARSE_PARAM_ARG YYPARSE_PARAM 417 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 418 #endif /* not __cplusplus */ 419 #else /* not YYPARSE_PARAM */ 420 #define YYPARSE_PARAM_ARG 421 #define YYPARSE_PARAM_DECL 422 #endif /* not YYPARSE_PARAM */ 423 424 /* Prevent warning if -Wstrict-prototypes. */ 425 #ifdef __GNUC__ 426 #ifdef YYPARSE_PARAM 427 int yyparse (void *); 428 #else 429 int yyparse (void); 430 #endif 431 #endif 432 433 int 434 yyparse(YYPARSE_PARAM_ARG) 435 YYPARSE_PARAM_DECL 436 { 437 register int yystate; 438 register int yyn; 439 register short *yyssp; 440 register YYSTYPE *yyvsp; 441 int yyerrstatus; /* number of tokens to shift before error messages enabled */ 442 int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 443 444 short yyssa[YYINITDEPTH]; /* the state stack */ 445 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 446 447 short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 448 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 449 450 #ifdef YYLSP_NEEDED 451 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 452 YYLTYPE *yyls = yylsa; 453 YYLTYPE *yylsp; 454 455 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 456 #else 457 #define YYPOPSTACK (yyvsp--, yyssp--) 458 #endif 459 460 int yystacksize = YYINITDEPTH; 461 int yyfree_stacks = 0; 462 463 #ifdef YYPURE 464 int yychar; 465 YYSTYPE yylval; 466 int yynerrs; 467 #ifdef YYLSP_NEEDED 468 YYLTYPE yylloc; 469 #endif 470 #endif 471 472 YYSTYPE yyval; /* the variable used to return */ 473 /* semantic values from the action */ 474 /* routines */ 475 476 int yylen; 477 478 #if YYDEBUG != 0 479 if (yydebug) 480 fprintf(stderr, "Starting parse\n"); 481 #endif 482 483 yystate = 0; 484 yyerrstatus = 0; 485 yynerrs = 0; 486 yychar = YYEMPTY; /* Cause a token to be read. */ 487 488 /* Initialize stack pointers. 489 Waste one element of value and location stack 490 so that they stay on the same level as the state stack. 491 The wasted elements are never initialized. */ 492 493 yyssp = yyss - 1; 494 yyvsp = yyvs; 495 #ifdef YYLSP_NEEDED 496 yylsp = yyls; 497 #endif 498 499 /* Push a new state, which is found in yystate . */ 500 /* In all cases, when you get here, the value and location stacks 501 have just been pushed. so pushing a state here evens the stacks. */ 502 yynewstate: 503 504 *++yyssp = yystate; 505 506 if (yyssp >= yyss + yystacksize - 1) 507 { 508 /* Give user a chance to reallocate the stack */ 509 /* Use copies of these so that the &'s don't force the real ones into memory. */ 510 YYSTYPE *yyvs1 = yyvs; 511 short *yyss1 = yyss; 512 #ifdef YYLSP_NEEDED 513 YYLTYPE *yyls1 = yyls; 514 #endif 515 516 /* Get the current used size of the three stacks, in elements. */ 517 int size = yyssp - yyss + 1; 518 519 #ifdef yyoverflow 520 /* Each stack pointer address is followed by the size of 521 the data in use in that stack, in bytes. */ 522 #ifdef YYLSP_NEEDED 523 /* This used to be a conditional around just the two extra args, 524 but that might be undefined if yyoverflow is a macro. */ 525 yyoverflow("parser stack overflow", 526 &yyss1, size * sizeof (*yyssp), 527 &yyvs1, size * sizeof (*yyvsp), 528 &yyls1, size * sizeof (*yylsp), 529 &yystacksize); 530 #else 531 yyoverflow("parser stack overflow", 532 &yyss1, size * sizeof (*yyssp), 533 &yyvs1, size * sizeof (*yyvsp), 534 &yystacksize); 535 #endif 536 537 yyss = yyss1; yyvs = yyvs1; 538 #ifdef YYLSP_NEEDED 539 yyls = yyls1; 540 #endif 541 #else /* no yyoverflow */ 542 /* Extend the stack our own way. */ 543 if (yystacksize >= YYMAXDEPTH) 544 { 545 yyerror("parser stack overflow"); 546 if (yyfree_stacks) 547 { 548 free (yyss); 549 free (yyvs); 550 #ifdef YYLSP_NEEDED 551 free (yyls); 552 #endif 553 } 554 return 2; 555 } 556 yystacksize *= 2; 557 if (yystacksize > YYMAXDEPTH) 558 yystacksize = YYMAXDEPTH; 559 #ifndef YYSTACK_USE_ALLOCA 560 yyfree_stacks = 1; 561 #endif 562 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 563 __yy_memcpy ((char *)yyss, (char *)yyss1, 564 size * (unsigned int) sizeof (*yyssp)); 565 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 566 __yy_memcpy ((char *)yyvs, (char *)yyvs1, 567 size * (unsigned int) sizeof (*yyvsp)); 568 #ifdef YYLSP_NEEDED 569 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 570 __yy_memcpy ((char *)yyls, (char *)yyls1, 571 size * (unsigned int) sizeof (*yylsp)); 572 #endif 573 #endif /* no yyoverflow */ 574 575 yyssp = yyss + size - 1; 576 yyvsp = yyvs + size - 1; 577 #ifdef YYLSP_NEEDED 578 yylsp = yyls + size - 1; 579 #endif 580 581 #if YYDEBUG != 0 582 if (yydebug) 583 fprintf(stderr, "Stack size increased to %d\n", yystacksize); 584 #endif 585 586 if (yyssp >= yyss + yystacksize - 1) 587 YYABORT; 588 } 589 590 #if YYDEBUG != 0 591 if (yydebug) 592 fprintf(stderr, "Entering state %d\n", yystate); 593 #endif 594 595 goto yybackup; 596 yybackup: 597 598 /* Do appropriate processing given the current state. */ 599 /* Read a lookahead token if we need one and don't already have one. */ 600 /* yyresume: */ 601 602 /* First try to decide what to do without reference to lookahead token. */ 603 604 yyn = yypact[yystate]; 605 if (yyn == YYFLAG) 606 goto yydefault; 607 608 /* Not known => get a lookahead token if don't already have one. */ 609 610 /* yychar is either YYEMPTY or YYEOF 611 or a valid token in external form. */ 612 613 if (yychar == YYEMPTY) 614 { 615 #if YYDEBUG != 0 616 if (yydebug) 617 fprintf(stderr, "Reading a token: "); 618 #endif 619 yychar = YYLEX; 620 } 621 622 /* Convert token to internal form (in yychar1) for indexing tables with */ 623 624 if (yychar <= 0) /* This means end of input. */ 625 { 626 yychar1 = 0; 627 yychar = YYEOF; /* Don't call YYLEX any more */ 628 629 #if YYDEBUG != 0 630 if (yydebug) 631 fprintf(stderr, "Now at end of input.\n"); 632 #endif 633 } 634 else 635 { 636 yychar1 = YYTRANSLATE(yychar); 637 638 #if YYDEBUG != 0 639 if (yydebug) 640 { 641 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 642 /* Give the individual parser a way to print the precise meaning 643 of a token, for further debugging info. */ 644 #ifdef YYPRINT 645 YYPRINT (stderr, yychar, yylval); 646 #endif 647 fprintf (stderr, ")\n"); 648 } 649 #endif 650 } 651 652 yyn += yychar1; 653 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 654 goto yydefault; 655 656 yyn = yytable[yyn]; 657 658 /* yyn is what to do for this token type in this state. 659 Negative => reduce, -yyn is rule number. 660 Positive => shift, yyn is new state. 661 New state is final state => don't bother to shift, 662 just return success. 663 0, or most negative number => error. */ 664 665 if (yyn < 0) 666 { 667 if (yyn == YYFLAG) 668 goto yyerrlab; 669 yyn = -yyn; 670 goto yyreduce; 671 } 672 else if (yyn == 0) 673 goto yyerrlab; 674 675 if (yyn == YYFINAL) 676 YYACCEPT; 677 678 /* Shift the lookahead token. */ 679 680 #if YYDEBUG != 0 681 if (yydebug) 682 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 683 #endif 684 685 /* Discard the token being shifted unless it is eof. */ 686 if (yychar != YYEOF) 687 yychar = YYEMPTY; 688 689 *++yyvsp = yylval; 690 #ifdef YYLSP_NEEDED 691 *++yylsp = yylloc; 692 #endif 693 694 /* count tokens shifted since error; after three, turn off error status. */ 695 if (yyerrstatus) yyerrstatus--; 696 697 yystate = yyn; 698 goto yynewstate; 699 700 /* Do the default action for the current state. */ 701 yydefault: 702 703 yyn = yydefact[yystate]; 704 if (yyn == 0) 705 goto yyerrlab; 706 707 /* Do a reduction. yyn is the number of a rule to reduce with. */ 708 yyreduce: 709 yylen = yyr2[yyn]; 710 if (yylen > 0) 711 yyval = yyvsp[1-yylen]; /* implement default value of the action */ 712 713 #if YYDEBUG != 0 714 if (yydebug) 715 { 716 int i; 717 718 fprintf (stderr, "Reducing via rule %d (line %d), ", 719 yyn, yyrline[yyn]); 720 721 /* Print the symbols being reduced, and their result. */ 722 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 723 fprintf (stderr, "%s ", yytname[yyrhs[i]]); 724 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 725 } 726 #endif 727 728 729 switch (yyn) { 730 731 case 5: 732 #line 90 "../../../../asrc/lib/krb5/krb/x-deltat.y" 733 { yyval.val = - yyvsp[0].val; ; 734 break;} 735 case 8: 736 #line 92 "../../../../asrc/lib/krb5/krb/x-deltat.y" 737 { yyval.val = yyvsp[0].val; ; 738 break;} 739 case 9: 740 #line 94 "../../../../asrc/lib/krb5/krb/x-deltat.y" 741 { DO (yyvsp[-2].val, 0, 0, yyvsp[0].val); ; 742 break;} 743 case 10: 744 #line 95 "../../../../asrc/lib/krb5/krb/x-deltat.y" 745 { DO ( 0, yyvsp[-2].val, 0, yyvsp[0].val); ; 746 break;} 747 case 11: 748 #line 96 "../../../../asrc/lib/krb5/krb/x-deltat.y" 749 { DO ( 0, 0, yyvsp[-2].val, yyvsp[0].val); ; 750 break;} 751 case 12: 752 #line 97 "../../../../asrc/lib/krb5/krb/x-deltat.y" 753 { DO ( 0, 0, 0, yyvsp[-1].val); ; 754 break;} 755 case 13: 756 #line 98 "../../../../asrc/lib/krb5/krb/x-deltat.y" 757 { DO (yyvsp[-6].val, yyvsp[-4].val, yyvsp[-2].val, yyvsp[0].val); ; 758 break;} 759 case 14: 760 #line 99 "../../../../asrc/lib/krb5/krb/x-deltat.y" 761 { DO ( 0, yyvsp[-4].val, yyvsp[-2].val, yyvsp[0].val); ; 762 break;} 763 case 15: 764 #line 100 "../../../../asrc/lib/krb5/krb/x-deltat.y" 765 { DO ( 0, yyvsp[-2].val, yyvsp[0].val, 0); ; 766 break;} 767 case 17: 768 #line 105 "../../../../asrc/lib/krb5/krb/x-deltat.y" 769 { yyval.val = yyvsp[-2].val * 3600 + yyvsp[0].val; ; 770 break;} 771 case 19: 772 #line 108 "../../../../asrc/lib/krb5/krb/x-deltat.y" 773 { yyval.val = yyvsp[-2].val * 60 + yyvsp[0].val; ; 774 break;} 775 case 20: 776 #line 110 "../../../../asrc/lib/krb5/krb/x-deltat.y" 777 { yyval.val = 0; ; 778 break;} 779 } 780 /* the action file gets copied in in place of this dollarsign */ 781 #line 542 "/mit/gnu/share/bison.simple" 782 783 yyvsp -= yylen; 784 yyssp -= yylen; 785 #ifdef YYLSP_NEEDED 786 yylsp -= yylen; 787 #endif 788 789 #if YYDEBUG != 0 790 if (yydebug) 791 { 792 short *ssp1 = yyss - 1; 793 fprintf (stderr, "state stack now"); 794 while (ssp1 != yyssp) 795 fprintf (stderr, " %d", *++ssp1); 796 fprintf (stderr, "\n"); 797 } 798 #endif 799 800 *++yyvsp = yyval; 801 802 #ifdef YYLSP_NEEDED 803 yylsp++; 804 if (yylen == 0) 805 { 806 yylsp->first_line = yylloc.first_line; 807 yylsp->first_column = yylloc.first_column; 808 yylsp->last_line = (yylsp-1)->last_line; 809 yylsp->last_column = (yylsp-1)->last_column; 810 yylsp->text = 0; 811 } 812 else 813 { 814 yylsp->last_line = (yylsp+yylen-1)->last_line; 815 yylsp->last_column = (yylsp+yylen-1)->last_column; 816 } 817 #endif 818 819 /* Now "shift" the result of the reduction. 820 Determine what state that goes to, 821 based on the state we popped back to 822 and the rule number reduced by. */ 823 824 yyn = yyr1[yyn]; 825 826 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 827 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 828 yystate = yytable[yystate]; 829 else 830 yystate = yydefgoto[yyn - YYNTBASE]; 831 832 goto yynewstate; 833 834 yyerrlab: /* here on detecting error */ 835 836 if (! yyerrstatus) 837 /* If not already recovering from an error, report this error. */ 838 { 839 ++yynerrs; 840 841 #ifdef YYERROR_VERBOSE 842 yyn = yypact[yystate]; 843 844 if (yyn > YYFLAG && yyn < YYLAST) 845 { 846 int size = 0; 847 char *msg; 848 int x, count; 849 850 count = 0; 851 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 852 for (x = (yyn < 0 ? -yyn : 0); 853 x < (sizeof(yytname) / sizeof(char *)); x++) 854 if (yycheck[x + yyn] == x) 855 size += strlen(yytname[x]) + 15, count++; 856 msg = (char *) malloc(size + 15); 857 if (msg != 0) 858 { 859 strcpy(msg, "parse error"); 860 861 if (count < 5) 862 { 863 count = 0; 864 for (x = (yyn < 0 ? -yyn : 0); 865 x < (sizeof(yytname) / sizeof(char *)); x++) 866 if (yycheck[x + yyn] == x) 867 { 868 strcat(msg, count == 0 ? ", expecting `" : " or `"); 869 strcat(msg, yytname[x]); 870 strcat(msg, "'"); 871 count++; 872 } 873 } 874 yyerror(msg); 875 free(msg); 876 } 877 else 878 yyerror ("parse error; also virtual memory exceeded"); 879 } 880 else 881 #endif /* YYERROR_VERBOSE */ 882 yyerror("parse error"); 883 } 884 885 goto yyerrlab1; 886 yyerrlab1: /* here on error raised explicitly by an action */ 887 888 if (yyerrstatus == 3) 889 { 890 /* if just tried and failed to reuse lookahead token after an error, discard it. */ 891 892 /* return failure if at end of input */ 893 if (yychar == YYEOF) 894 YYABORT; 895 896 #if YYDEBUG != 0 897 if (yydebug) 898 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 899 #endif 900 901 yychar = YYEMPTY; 902 } 903 904 /* Else will try to reuse lookahead token 905 after shifting the error token. */ 906 907 yyerrstatus = 3; /* Each real token shifted decrements this */ 908 909 goto yyerrhandle; 910 911 yyerrdefault: /* current state does not do anything special for the error token. */ 912 913 #if 0 914 /* This is wrong; only states that explicitly want error tokens 915 should shift them. */ 916 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 917 if (yyn) goto yydefault; 918 #endif 919 920 yyerrpop: /* pop the current state because it cannot handle the error token */ 921 922 if (yyssp == yyss) YYABORT; 923 yyvsp--; 924 yystate = *--yyssp; 925 #ifdef YYLSP_NEEDED 926 yylsp--; 927 #endif 928 929 #if YYDEBUG != 0 930 if (yydebug) 931 { 932 short *ssp1 = yyss - 1; 933 fprintf (stderr, "Error: state stack now"); 934 while (ssp1 != yyssp) 935 fprintf (stderr, " %d", *++ssp1); 936 fprintf (stderr, "\n"); 937 } 938 #endif 939 940 yyerrhandle: 941 942 yyn = yypact[yystate]; 943 if (yyn == YYFLAG) 944 goto yyerrdefault; 945 946 yyn += YYTERROR; 947 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 948 goto yyerrdefault; 949 950 yyn = yytable[yyn]; 951 if (yyn < 0) 952 { 953 if (yyn == YYFLAG) 954 goto yyerrpop; 955 yyn = -yyn; 956 goto yyreduce; 957 } 958 else if (yyn == 0) 959 goto yyerrpop; 960 961 if (yyn == YYFINAL) 962 YYACCEPT; 963 964 #if YYDEBUG != 0 965 if (yydebug) 966 fprintf(stderr, "Shifting error token, "); 967 #endif 968 969 *++yyvsp = yylval; 970 #ifdef YYLSP_NEEDED 971 *++yylsp = yylloc; 972 #endif 973 974 yystate = yyn; 975 goto yynewstate; 976 977 yyacceptlab: 978 /* YYACCEPT comes here. */ 979 if (yyfree_stacks) 980 { 981 free (yyss); 982 free (yyvs); 983 #ifdef YYLSP_NEEDED 984 free (yyls); 985 #endif 986 } 987 return 0; 988 989 yyabortlab: 990 /* YYABORT comes here. */ 991 if (yyfree_stacks) 992 { 993 free (yyss); 994 free (yyvs); 995 #ifdef YYLSP_NEEDED 996 free (yyls); 997 #endif 998 } 999 return 1; 1000 } 1001 #line 113 "../../../../asrc/lib/krb5/krb/x-deltat.y" 1002 1003 1004 static int 1005 mylex (int *intp, char **pp) 1006 { 1007 int num, c; 1008 #define P (*pp) 1009 char *orig_p = P; 1010 1011 #ifdef isascii 1012 if (!isascii (*P)) 1013 return 0; 1014 #endif 1015 switch (c = *P++) { 1016 case '-': 1017 case ':': 1018 case 'd': 1019 case 'h': 1020 case 'm': 1021 case 's': 1022 return c; 1023 case '0': 1024 case '1': 1025 case '2': 1026 case '3': 1027 case '4': 1028 case '5': 1029 case '6': 1030 case '7': 1031 case '8': 1032 case '9': 1033 /* XXX assumes ASCII */ 1034 num = c - '0'; 1035 while (isdigit (*P)) { 1036 num *= 10; 1037 num += *P++ - '0'; 1038 } 1039 *intp = num; 1040 return (P - orig_p > 2) ? LONGNUM : NUM; 1041 case ' ': 1042 case '\t': 1043 case '\n': 1044 while (isspace (*P)) 1045 P++; 1046 return WS; 1047 default: 1048 return YYEOF; 1049 } 1050 } 1051 1052 KRB5_DLLIMP krb5_error_code KRB5_CALLCONV 1053 krb5_string_to_deltat(string, deltatp) 1054 char FAR * string; 1055 krb5_deltat FAR * deltatp; 1056 { 1057 struct param p; 1058 p.delta = 0; 1059 p.p = string; 1060 if (yyparse (&p)) 1061 return EINVAL; 1062 *deltatp = p.delta; 1063 return 0; 1064 } 1065