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 62 63/* Tokens. */ 64#ifndef YYTOKENTYPE 65# define YYTOKENTYPE 66 /* Put the tokens into the symbol table, so that GDB and other debuggers 67 know about them. */ 68 enum yytokentype { 69 ET = 258, 70 INDEX = 259, 71 PREFIX = 260, 72 EC = 261, 73 ID = 262, 74 END = 263, 75 STRING = 264, 76 NUMBER = 265 77 }; 78#endif 79/* Tokens. */ 80#define ET 258 81#define INDEX 259 82#define PREFIX 260 83#define EC 261 84#define ID 262 85#define END 263 86#define STRING 264 87#define NUMBER 265 88 89 90 91 92/* Copy the first part of user declarations. */ 93#line 1 "heimdal/lib/com_err/parse.y" 94 95/* 96 * Copyright (c) 1998 - 2000 Kungliga Tekniska H��gskolan 97 * (Royal Institute of Technology, Stockholm, Sweden). 98 * All rights reserved. 99 * 100 * Redistribution and use in source and binary forms, with or without 101 * modification, are permitted provided that the following conditions 102 * are met: 103 * 104 * 1. Redistributions of source code must retain the above copyright 105 * notice, this list of conditions and the following disclaimer. 106 * 107 * 2. Redistributions in binary form must reproduce the above copyright 108 * notice, this list of conditions and the following disclaimer in the 109 * documentation and/or other materials provided with the distribution. 110 * 111 * 3. Neither the name of the Institute nor the names of its contributors 112 * may be used to endorse or promote products derived from this software 113 * without specific prior written permission. 114 * 115 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 116 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 117 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 118 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 119 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 120 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 121 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 122 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 123 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 124 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 125 * SUCH DAMAGE. 126 */ 127 128#include "compile_et.h" 129#include "lex.h" 130 131void yyerror (char *s); 132static long name2number(const char *str); 133 134extern char *yytext; 135 136/* This is for bison */ 137 138#if !defined(alloca) && !defined(HAVE_ALLOCA) 139#define alloca(x) malloc(x) 140#endif 141 142 143 144/* Enabling traces. */ 145#ifndef YYDEBUG 146# define YYDEBUG 0 147#endif 148 149/* Enabling verbose error messages. */ 150#ifdef YYERROR_VERBOSE 151# undef YYERROR_VERBOSE 152# define YYERROR_VERBOSE 1 153#else 154# define YYERROR_VERBOSE 0 155#endif 156 157/* Enabling the token table. */ 158#ifndef YYTOKEN_TABLE 159# define YYTOKEN_TABLE 0 160#endif 161 162#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 163typedef union YYSTYPE 164#line 51 "heimdal/lib/com_err/parse.y" 165{ 166 char *string; 167 int number; 168} 169/* Line 187 of yacc.c. */ 170#line 171 "heimdal/lib/com_err/parse.y" 171 YYSTYPE; 172# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 173# define YYSTYPE_IS_DECLARED 1 174# define YYSTYPE_IS_TRIVIAL 1 175#endif 176 177 178 179/* Copy the second part of user declarations. */ 180 181 182/* Line 216 of yacc.c. */ 183#line 184 "heimdal/lib/com_err/parse.y" 184 185#ifdef short 186# undef short 187#endif 188 189#ifdef YYTYPE_UINT8 190typedef YYTYPE_UINT8 yytype_uint8; 191#else 192typedef unsigned char yytype_uint8; 193#endif 194 195#ifdef YYTYPE_INT8 196typedef YYTYPE_INT8 yytype_int8; 197#elif (defined __STDC__ || defined __C99__FUNC__ \ 198 || defined __cplusplus || defined _MSC_VER) 199typedef signed char yytype_int8; 200#else 201typedef short int yytype_int8; 202#endif 203 204#ifdef YYTYPE_UINT16 205typedef YYTYPE_UINT16 yytype_uint16; 206#else 207typedef unsigned short int yytype_uint16; 208#endif 209 210#ifdef YYTYPE_INT16 211typedef YYTYPE_INT16 yytype_int16; 212#else 213typedef short int yytype_int16; 214#endif 215 216#ifndef YYSIZE_T 217# ifdef __SIZE_TYPE__ 218# define YYSIZE_T __SIZE_TYPE__ 219# elif defined size_t 220# define YYSIZE_T size_t 221# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 222 || defined __cplusplus || defined _MSC_VER) 223# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 224# define YYSIZE_T size_t 225# else 226# define YYSIZE_T unsigned int 227# endif 228#endif 229 230#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 231 232#ifndef YY_ 233# if YYENABLE_NLS 234# if ENABLE_NLS 235# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 236# define YY_(msgid) dgettext ("bison-runtime", msgid) 237# endif 238# endif 239# ifndef YY_ 240# define YY_(msgid) msgid 241# endif 242#endif 243 244/* Suppress unused-variable warnings by "using" E. */ 245#if ! defined lint || defined __GNUC__ 246# define YYUSE(e) ((void) (e)) 247#else 248# define YYUSE(e) /* empty */ 249#endif 250 251/* Identity function, used to suppress warnings about constant conditions. */ 252#ifndef lint 253# define YYID(n) (n) 254#else 255#if (defined __STDC__ || defined __C99__FUNC__ \ 256 || defined __cplusplus || defined _MSC_VER) 257static int 258YYID (int i) 259#else 260static int 261YYID (i) 262 int i; 263#endif 264{ 265 return i; 266} 267#endif 268 269#if ! defined yyoverflow || YYERROR_VERBOSE 270 271/* The parser invokes alloca or malloc; define the necessary symbols. */ 272 273# ifdef YYSTACK_USE_ALLOCA 274# if YYSTACK_USE_ALLOCA 275# ifdef __GNUC__ 276# define YYSTACK_ALLOC __builtin_alloca 277# elif defined __BUILTIN_VA_ARG_INCR 278# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 279# elif defined _AIX 280# define YYSTACK_ALLOC __alloca 281# elif defined _MSC_VER 282# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 283# define alloca _alloca 284# else 285# define YYSTACK_ALLOC alloca 286# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 287 || defined __cplusplus || defined _MSC_VER) 288# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 289# ifndef _STDLIB_H 290# define _STDLIB_H 1 291# endif 292# endif 293# endif 294# endif 295# endif 296 297# ifdef YYSTACK_ALLOC 298 /* Pacify GCC's `empty if-body' warning. */ 299# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 300# ifndef YYSTACK_ALLOC_MAXIMUM 301 /* The OS might guarantee only one guard page at the bottom of the stack, 302 and a page size can be as small as 4096 bytes. So we cannot safely 303 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 304 to allow for a few compiler-allocated temporary stack slots. */ 305# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 306# endif 307# else 308# define YYSTACK_ALLOC YYMALLOC 309# define YYSTACK_FREE YYFREE 310# ifndef YYSTACK_ALLOC_MAXIMUM 311# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 312# endif 313# if (defined __cplusplus && ! defined _STDLIB_H \ 314 && ! ((defined YYMALLOC || defined malloc) \ 315 && (defined YYFREE || defined free))) 316# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 317# ifndef _STDLIB_H 318# define _STDLIB_H 1 319# endif 320# endif 321# ifndef YYMALLOC 322# define YYMALLOC malloc 323# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 324 || defined __cplusplus || defined _MSC_VER) 325void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 326# endif 327# endif 328# ifndef YYFREE 329# define YYFREE free 330# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 331 || defined __cplusplus || defined _MSC_VER) 332void free (void *); /* INFRINGES ON USER NAME SPACE */ 333# endif 334# endif 335# endif 336#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 337 338 339#if (! defined yyoverflow \ 340 && (! defined __cplusplus \ 341 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 342 343/* A type that is properly aligned for any stack member. */ 344union yyalloc 345{ 346 yytype_int16 yyss; 347 YYSTYPE yyvs; 348 }; 349 350/* The size of the maximum gap between one aligned stack and the next. */ 351# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 352 353/* The size of an array large to enough to hold all stacks, each with 354 N elements. */ 355# define YYSTACK_BYTES(N) \ 356 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 357 + YYSTACK_GAP_MAXIMUM) 358 359/* Copy COUNT objects from FROM to TO. The source and destination do 360 not overlap. */ 361# ifndef YYCOPY 362# if defined __GNUC__ && 1 < __GNUC__ 363# define YYCOPY(To, From, Count) \ 364 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 365# else 366# define YYCOPY(To, From, Count) \ 367 do \ 368 { \ 369 YYSIZE_T yyi; \ 370 for (yyi = 0; yyi < (Count); yyi++) \ 371 (To)[yyi] = (From)[yyi]; \ 372 } \ 373 while (YYID (0)) 374# endif 375# endif 376 377/* Relocate STACK from its old location to the new one. The 378 local variables YYSIZE and YYSTACKSIZE give the old and new number of 379 elements in the stack, and YYPTR gives the new location of the 380 stack. Advance YYPTR to a properly aligned location for the next 381 stack. */ 382# define YYSTACK_RELOCATE(Stack) \ 383 do \ 384 { \ 385 YYSIZE_T yynewbytes; \ 386 YYCOPY (&yyptr->Stack, Stack, yysize); \ 387 Stack = &yyptr->Stack; \ 388 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 389 yyptr += yynewbytes / sizeof (*yyptr); \ 390 } \ 391 while (YYID (0)) 392 393#endif 394 395/* YYFINAL -- State number of the termination state. */ 396#define YYFINAL 9 397/* YYLAST -- Last index in YYTABLE. */ 398#define YYLAST 23 399 400/* YYNTOKENS -- Number of terminals. */ 401#define YYNTOKENS 12 402/* YYNNTS -- Number of nonterminals. */ 403#define YYNNTS 7 404/* YYNRULES -- Number of rules. */ 405#define YYNRULES 15 406/* YYNRULES -- Number of states. */ 407#define YYNSTATES 24 408 409/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 410#define YYUNDEFTOK 2 411#define YYMAXUTOK 265 412 413#define YYTRANSLATE(YYX) \ 414 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 415 416/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 417static const yytype_uint8 yytranslate[] = 418{ 419 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 2, 2, 2, 2, 11, 2, 2, 2, 2, 2, 424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 444 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 445 5, 6, 7, 8, 9, 10 446}; 447 448#if YYDEBUG 449/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 450 YYRHS. */ 451static const yytype_uint8 yyprhs[] = 452{ 453 0, 0, 3, 4, 7, 10, 12, 15, 18, 22, 454 24, 27, 30, 33, 35, 40 455}; 456 457/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 458static const yytype_int8 yyrhs[] = 459{ 460 13, 0, -1, -1, 14, 17, -1, 15, 16, -1, 461 16, -1, 7, 9, -1, 3, 9, -1, 3, 9, 462 9, -1, 18, -1, 17, 18, -1, 4, 10, -1, 463 5, 9, -1, 5, -1, 6, 9, 11, 9, -1, 464 8, -1 465}; 466 467/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 468static const yytype_uint8 yyrline[] = 469{ 470 0, 62, 62, 63, 66, 67, 70, 76, 82, 91, 471 92, 95, 99, 107, 114, 134 472}; 473#endif 474 475#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 476/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 477 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 478static const char *const yytname[] = 479{ 480 "$end", "error", "$undefined", "ET", "INDEX", "PREFIX", "EC", "ID", 481 "END", "STRING", "NUMBER", "','", "$accept", "file", "header", "id", 482 "et", "statements", "statement", 0 483}; 484#endif 485 486# ifdef YYPRINT 487/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 488 token YYLEX-NUM. */ 489static const yytype_uint16 yytoknum[] = 490{ 491 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 492 265, 44 493}; 494# endif 495 496/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 497static const yytype_uint8 yyr1[] = 498{ 499 0, 12, 13, 13, 14, 14, 15, 16, 16, 17, 500 17, 18, 18, 18, 18, 18 501}; 502 503/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 504static const yytype_uint8 yyr2[] = 505{ 506 0, 2, 0, 2, 2, 1, 2, 2, 3, 1, 507 2, 2, 2, 1, 4, 1 508}; 509 510/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 511 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 512 means the default is an error. */ 513static const yytype_uint8 yydefact[] = 514{ 515 2, 0, 0, 0, 0, 0, 5, 7, 6, 1, 516 0, 13, 0, 15, 3, 9, 4, 8, 11, 12, 517 0, 10, 0, 14 518}; 519 520/* YYDEFGOTO[NTERM-NUM]. */ 521static const yytype_int8 yydefgoto[] = 522{ 523 -1, 3, 4, 5, 6, 14, 15 524}; 525 526/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 527 STATE-NUM. */ 528#define YYPACT_NINF -5 529static const yytype_int8 yypact[] = 530{ 531 0, -3, -1, 5, -4, 6, -5, 1, -5, -5, 532 2, 4, 7, -5, -4, -5, -5, -5, -5, -5, 533 3, -5, 8, -5 534}; 535 536/* YYPGOTO[NTERM-NUM]. */ 537static const yytype_int8 yypgoto[] = 538{ 539 -5, -5, -5, -5, 10, -5, 9 540}; 541 542/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 543 positive, shift that token. If negative, reduce the rule which 544 number is the opposite. If zero, do what YYDEFACT says. 545 If YYTABLE_NINF, syntax error. */ 546#define YYTABLE_NINF -1 547static const yytype_uint8 yytable[] = 548{ 549 10, 11, 12, 1, 13, 9, 7, 2, 8, 1, 550 17, 0, 18, 19, 22, 16, 20, 23, 0, 0, 551 0, 0, 0, 21 552}; 553 554static const yytype_int8 yycheck[] = 555{ 556 4, 5, 6, 3, 8, 0, 9, 7, 9, 3, 557 9, -1, 10, 9, 11, 5, 9, 9, -1, -1, 558 -1, -1, -1, 14 559}; 560 561/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 562 symbol of state STATE-NUM. */ 563static const yytype_uint8 yystos[] = 564{ 565 0, 3, 7, 13, 14, 15, 16, 9, 9, 0, 566 4, 5, 6, 8, 17, 18, 16, 9, 10, 9, 567 9, 18, 11, 9 568}; 569 570#define yyerrok (yyerrstatus = 0) 571#define yyclearin (yychar = YYEMPTY) 572#define YYEMPTY (-2) 573#define YYEOF 0 574 575#define YYACCEPT goto yyacceptlab 576#define YYABORT goto yyabortlab 577#define YYERROR goto yyerrorlab 578 579 580/* Like YYERROR except do call yyerror. This remains here temporarily 581 to ease the transition to the new meaning of YYERROR, for GCC. 582 Once GCC version 2 has supplanted version 1, this can go. */ 583 584#define YYFAIL goto yyerrlab 585 586#define YYRECOVERING() (!!yyerrstatus) 587 588#define YYBACKUP(Token, Value) \ 589do \ 590 if (yychar == YYEMPTY && yylen == 1) \ 591 { \ 592 yychar = (Token); \ 593 yylval = (Value); \ 594 yytoken = YYTRANSLATE (yychar); \ 595 YYPOPSTACK (1); \ 596 goto yybackup; \ 597 } \ 598 else \ 599 { \ 600 yyerror (YY_("syntax error: cannot back up")); \ 601 YYERROR; \ 602 } \ 603while (YYID (0)) 604 605 606#define YYTERROR 1 607#define YYERRCODE 256 608 609 610/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 611 If N is 0, then set CURRENT to the empty location which ends 612 the previous symbol: RHS[0] (always defined). */ 613 614#define YYRHSLOC(Rhs, K) ((Rhs)[K]) 615#ifndef YYLLOC_DEFAULT 616# define YYLLOC_DEFAULT(Current, Rhs, N) \ 617 do \ 618 if (YYID (N)) \ 619 { \ 620 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 621 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 622 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 623 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 624 } \ 625 else \ 626 { \ 627 (Current).first_line = (Current).last_line = \ 628 YYRHSLOC (Rhs, 0).last_line; \ 629 (Current).first_column = (Current).last_column = \ 630 YYRHSLOC (Rhs, 0).last_column; \ 631 } \ 632 while (YYID (0)) 633#endif 634 635 636/* YY_LOCATION_PRINT -- Print the location on the stream. 637 This macro was not mandated originally: define only if we know 638 we won't break user code: when these are the locations we know. */ 639 640#ifndef YY_LOCATION_PRINT 641# if YYLTYPE_IS_TRIVIAL 642# define YY_LOCATION_PRINT(File, Loc) \ 643 fprintf (File, "%d.%d-%d.%d", \ 644 (Loc).first_line, (Loc).first_column, \ 645 (Loc).last_line, (Loc).last_column) 646# else 647# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 648# endif 649#endif 650 651 652/* YYLEX -- calling `yylex' with the right arguments. */ 653 654#ifdef YYLEX_PARAM 655# define YYLEX yylex (YYLEX_PARAM) 656#else 657# define YYLEX yylex () 658#endif 659 660/* Enable debugging if requested. */ 661#if YYDEBUG 662 663# ifndef YYFPRINTF 664# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 665# define YYFPRINTF fprintf 666# endif 667 668# define YYDPRINTF(Args) \ 669do { \ 670 if (yydebug) \ 671 YYFPRINTF Args; \ 672} while (YYID (0)) 673 674# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 675do { \ 676 if (yydebug) \ 677 { \ 678 YYFPRINTF (stderr, "%s ", Title); \ 679 yy_symbol_print (stderr, \ 680 Type, Value); \ 681 YYFPRINTF (stderr, "\n"); \ 682 } \ 683} while (YYID (0)) 684 685 686/*--------------------------------. 687| Print this symbol on YYOUTPUT. | 688`--------------------------------*/ 689 690/*ARGSUSED*/ 691#if (defined __STDC__ || defined __C99__FUNC__ \ 692 || defined __cplusplus || defined _MSC_VER) 693static void 694yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 695#else 696static void 697yy_symbol_value_print (yyoutput, yytype, yyvaluep) 698 FILE *yyoutput; 699 int yytype; 700 YYSTYPE const * const yyvaluep; 701#endif 702{ 703 if (!yyvaluep) 704 return; 705# ifdef YYPRINT 706 if (yytype < YYNTOKENS) 707 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 708# else 709 YYUSE (yyoutput); 710# endif 711 switch (yytype) 712 { 713 default: 714 break; 715 } 716} 717 718 719/*--------------------------------. 720| Print this symbol on YYOUTPUT. | 721`--------------------------------*/ 722 723#if (defined __STDC__ || defined __C99__FUNC__ \ 724 || defined __cplusplus || defined _MSC_VER) 725static void 726yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 727#else 728static void 729yy_symbol_print (yyoutput, yytype, yyvaluep) 730 FILE *yyoutput; 731 int yytype; 732 YYSTYPE const * const yyvaluep; 733#endif 734{ 735 if (yytype < YYNTOKENS) 736 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 737 else 738 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 739 740 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 741 YYFPRINTF (yyoutput, ")"); 742} 743 744/*------------------------------------------------------------------. 745| yy_stack_print -- Print the state stack from its BOTTOM up to its | 746| TOP (included). | 747`------------------------------------------------------------------*/ 748 749#if (defined __STDC__ || defined __C99__FUNC__ \ 750 || defined __cplusplus || defined _MSC_VER) 751static void 752yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) 753#else 754static void 755yy_stack_print (bottom, top) 756 yytype_int16 *bottom; 757 yytype_int16 *top; 758#endif 759{ 760 YYFPRINTF (stderr, "Stack now"); 761 for (; bottom <= top; ++bottom) 762 YYFPRINTF (stderr, " %d", *bottom); 763 YYFPRINTF (stderr, "\n"); 764} 765 766# define YY_STACK_PRINT(Bottom, Top) \ 767do { \ 768 if (yydebug) \ 769 yy_stack_print ((Bottom), (Top)); \ 770} while (YYID (0)) 771 772 773/*------------------------------------------------. 774| Report that the YYRULE is going to be reduced. | 775`------------------------------------------------*/ 776 777#if (defined __STDC__ || defined __C99__FUNC__ \ 778 || defined __cplusplus || defined _MSC_VER) 779static void 780yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 781#else 782static void 783yy_reduce_print (yyvsp, yyrule) 784 YYSTYPE *yyvsp; 785 int yyrule; 786#endif 787{ 788 int yynrhs = yyr2[yyrule]; 789 int yyi; 790 unsigned long int yylno = yyrline[yyrule]; 791 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 792 yyrule - 1, yylno); 793 /* The symbols being reduced. */ 794 for (yyi = 0; yyi < yynrhs; yyi++) 795 { 796 fprintf (stderr, " $%d = ", yyi + 1); 797 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 798 &(yyvsp[(yyi + 1) - (yynrhs)]) 799 ); 800 fprintf (stderr, "\n"); 801 } 802} 803 804# define YY_REDUCE_PRINT(Rule) \ 805do { \ 806 if (yydebug) \ 807 yy_reduce_print (yyvsp, Rule); \ 808} while (YYID (0)) 809 810/* Nonzero means print parse trace. It is left uninitialized so that 811 multiple parsers can coexist. */ 812int yydebug; 813#else /* !YYDEBUG */ 814# define YYDPRINTF(Args) 815# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 816# define YY_STACK_PRINT(Bottom, Top) 817# define YY_REDUCE_PRINT(Rule) 818#endif /* !YYDEBUG */ 819 820 821/* YYINITDEPTH -- initial size of the parser's stacks. */ 822#ifndef YYINITDEPTH 823# define YYINITDEPTH 200 824#endif 825 826/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 827 if the built-in stack extension method is used). 828 829 Do not make this value too large; the results are undefined if 830 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 831 evaluated with infinite-precision integer arithmetic. */ 832 833#ifndef YYMAXDEPTH 834# define YYMAXDEPTH 10000 835#endif 836 837 838 839#if YYERROR_VERBOSE 840 841# ifndef yystrlen 842# if defined __GLIBC__ && defined _STRING_H 843# define yystrlen strlen 844# else 845/* Return the length of YYSTR. */ 846#if (defined __STDC__ || defined __C99__FUNC__ \ 847 || defined __cplusplus || defined _MSC_VER) 848static YYSIZE_T 849yystrlen (const char *yystr) 850#else 851static YYSIZE_T 852yystrlen (yystr) 853 const char *yystr; 854#endif 855{ 856 YYSIZE_T yylen; 857 for (yylen = 0; yystr[yylen]; yylen++) 858 continue; 859 return yylen; 860} 861# endif 862# endif 863 864# ifndef yystpcpy 865# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 866# define yystpcpy stpcpy 867# else 868/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 869 YYDEST. */ 870#if (defined __STDC__ || defined __C99__FUNC__ \ 871 || defined __cplusplus || defined _MSC_VER) 872static char * 873yystpcpy (char *yydest, const char *yysrc) 874#else 875static char * 876yystpcpy (yydest, yysrc) 877 char *yydest; 878 const char *yysrc; 879#endif 880{ 881 char *yyd = yydest; 882 const char *yys = yysrc; 883 884 while ((*yyd++ = *yys++) != '\0') 885 continue; 886 887 return yyd - 1; 888} 889# endif 890# endif 891 892# ifndef yytnamerr 893/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 894 quotes and backslashes, so that it's suitable for yyerror. The 895 heuristic is that double-quoting is unnecessary unless the string 896 contains an apostrophe, a comma, or backslash (other than 897 backslash-backslash). YYSTR is taken from yytname. If YYRES is 898 null, do not copy; instead, return the length of what the result 899 would have been. */ 900static YYSIZE_T 901yytnamerr (char *yyres, const char *yystr) 902{ 903 if (*yystr == '"') 904 { 905 YYSIZE_T yyn = 0; 906 char const *yyp = yystr; 907 908 for (;;) 909 switch (*++yyp) 910 { 911 case '\'': 912 case ',': 913 goto do_not_strip_quotes; 914 915 case '\\': 916 if (*++yyp != '\\') 917 goto do_not_strip_quotes; 918 /* Fall through. */ 919 default: 920 if (yyres) 921 yyres[yyn] = *yyp; 922 yyn++; 923 break; 924 925 case '"': 926 if (yyres) 927 yyres[yyn] = '\0'; 928 return yyn; 929 } 930 do_not_strip_quotes: ; 931 } 932 933 if (! yyres) 934 return yystrlen (yystr); 935 936 return yystpcpy (yyres, yystr) - yyres; 937} 938# endif 939 940/* Copy into YYRESULT an error message about the unexpected token 941 YYCHAR while in state YYSTATE. Return the number of bytes copied, 942 including the terminating null byte. If YYRESULT is null, do not 943 copy anything; just return the number of bytes that would be 944 copied. As a special case, return 0 if an ordinary "syntax error" 945 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 946 size calculation. */ 947static YYSIZE_T 948yysyntax_error (char *yyresult, int yystate, int yychar) 949{ 950 int yyn = yypact[yystate]; 951 952 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 953 return 0; 954 else 955 { 956 int yytype = YYTRANSLATE (yychar); 957 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 958 YYSIZE_T yysize = yysize0; 959 YYSIZE_T yysize1; 960 int yysize_overflow = 0; 961 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 962 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 963 int yyx; 964 965# if 0 966 /* This is so xgettext sees the translatable formats that are 967 constructed on the fly. */ 968 YY_("syntax error, unexpected %s"); 969 YY_("syntax error, unexpected %s, expecting %s"); 970 YY_("syntax error, unexpected %s, expecting %s or %s"); 971 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 972 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 973# endif 974 char *yyfmt; 975 char const *yyf; 976 static char const yyunexpected[] = "syntax error, unexpected %s"; 977 static char const yyexpecting[] = ", expecting %s"; 978 static char const yyor[] = " or %s"; 979 char yyformat[sizeof yyunexpected 980 + sizeof yyexpecting - 1 981 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 982 * (sizeof yyor - 1))]; 983 char const *yyprefix = yyexpecting; 984 985 /* Start YYX at -YYN if negative to avoid negative indexes in 986 YYCHECK. */ 987 int yyxbegin = yyn < 0 ? -yyn : 0; 988 989 /* Stay within bounds of both yycheck and yytname. */ 990 int yychecklim = YYLAST - yyn + 1; 991 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 992 int yycount = 1; 993 994 yyarg[0] = yytname[yytype]; 995 yyfmt = yystpcpy (yyformat, yyunexpected); 996 997 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 998 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 999 { 1000 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1001 { 1002 yycount = 1; 1003 yysize = yysize0; 1004 yyformat[sizeof yyunexpected - 1] = '\0'; 1005 break; 1006 } 1007 yyarg[yycount++] = yytname[yyx]; 1008 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1009 yysize_overflow |= (yysize1 < yysize); 1010 yysize = yysize1; 1011 yyfmt = yystpcpy (yyfmt, yyprefix); 1012 yyprefix = yyor; 1013 } 1014 1015 yyf = YY_(yyformat); 1016 yysize1 = yysize + yystrlen (yyf); 1017 yysize_overflow |= (yysize1 < yysize); 1018 yysize = yysize1; 1019 1020 if (yysize_overflow) 1021 return YYSIZE_MAXIMUM; 1022 1023 if (yyresult) 1024 { 1025 /* Avoid sprintf, as that infringes on the user's name space. 1026 Don't have undefined behavior even if the translation 1027 produced a string with the wrong number of "%s"s. */ 1028 char *yyp = yyresult; 1029 int yyi = 0; 1030 while ((*yyp = *yyf) != '\0') 1031 { 1032 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1033 { 1034 yyp += yytnamerr (yyp, yyarg[yyi++]); 1035 yyf += 2; 1036 } 1037 else 1038 { 1039 yyp++; 1040 yyf++; 1041 } 1042 } 1043 } 1044 return yysize; 1045 } 1046} 1047#endif /* YYERROR_VERBOSE */ 1048 1049 1050/*-----------------------------------------------. 1051| Release the memory associated to this symbol. | 1052`-----------------------------------------------*/ 1053 1054/*ARGSUSED*/ 1055#if (defined __STDC__ || defined __C99__FUNC__ \ 1056 || defined __cplusplus || defined _MSC_VER) 1057static void 1058yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1059#else 1060static void 1061yydestruct (yymsg, yytype, yyvaluep) 1062 const char *yymsg; 1063 int yytype; 1064 YYSTYPE *yyvaluep; 1065#endif 1066{ 1067 YYUSE (yyvaluep); 1068 1069 if (!yymsg) 1070 yymsg = "Deleting"; 1071 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1072 1073 switch (yytype) 1074 { 1075 1076 default: 1077 break; 1078 } 1079} 1080 1081 1082/* Prevent warnings from -Wmissing-prototypes. */ 1083 1084#ifdef YYPARSE_PARAM 1085#if defined __STDC__ || defined __cplusplus 1086int yyparse (void *YYPARSE_PARAM); 1087#else 1088int yyparse (); 1089#endif 1090#else /* ! YYPARSE_PARAM */ 1091#if defined __STDC__ || defined __cplusplus 1092int yyparse (void); 1093#else 1094int yyparse (); 1095#endif 1096#endif /* ! YYPARSE_PARAM */ 1097 1098 1099 1100/* The look-ahead symbol. */ 1101int yychar; 1102 1103/* The semantic value of the look-ahead symbol. */ 1104YYSTYPE yylval; 1105 1106/* Number of syntax errors so far. */ 1107int yynerrs; 1108 1109 1110 1111/*----------. 1112| yyparse. | 1113`----------*/ 1114 1115#ifdef YYPARSE_PARAM 1116#if (defined __STDC__ || defined __C99__FUNC__ \ 1117 || defined __cplusplus || defined _MSC_VER) 1118int 1119yyparse (void *YYPARSE_PARAM) 1120#else 1121int 1122yyparse (YYPARSE_PARAM) 1123 void *YYPARSE_PARAM; 1124#endif 1125#else /* ! YYPARSE_PARAM */ 1126#if (defined __STDC__ || defined __C99__FUNC__ \ 1127 || defined __cplusplus || defined _MSC_VER) 1128int 1129yyparse (void) 1130#else 1131int 1132yyparse () 1133 1134#endif 1135#endif 1136{ 1137 1138 int yystate; 1139 int yyn; 1140 int yyresult; 1141 /* Number of tokens to shift before error messages enabled. */ 1142 int yyerrstatus; 1143 /* Look-ahead token as an internal (translated) token number. */ 1144 int yytoken = 0; 1145#if YYERROR_VERBOSE 1146 /* Buffer for error messages, and its allocated size. */ 1147 char yymsgbuf[128]; 1148 char *yymsg = yymsgbuf; 1149 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1150#endif 1151 1152 /* Three stacks and their tools: 1153 `yyss': related to states, 1154 `yyvs': related to semantic values, 1155 `yyls': related to locations. 1156 1157 Refer to the stacks thru separate pointers, to allow yyoverflow 1158 to reallocate them elsewhere. */ 1159 1160 /* The state stack. */ 1161 yytype_int16 yyssa[YYINITDEPTH]; 1162 yytype_int16 *yyss = yyssa; 1163 yytype_int16 *yyssp; 1164 1165 /* The semantic value stack. */ 1166 YYSTYPE yyvsa[YYINITDEPTH]; 1167 YYSTYPE *yyvs = yyvsa; 1168 YYSTYPE *yyvsp; 1169 1170 1171 1172#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1173 1174 YYSIZE_T yystacksize = YYINITDEPTH; 1175 1176 /* The variables used to return semantic value and location from the 1177 action routines. */ 1178 YYSTYPE yyval; 1179 1180 1181 /* The number of symbols on the RHS of the reduced rule. 1182 Keep to zero when no symbol should be popped. */ 1183 int yylen = 0; 1184 1185 YYDPRINTF ((stderr, "Starting parse\n")); 1186 1187 yystate = 0; 1188 yyerrstatus = 0; 1189 yynerrs = 0; 1190 yychar = YYEMPTY; /* Cause a token to be read. */ 1191 1192 /* Initialize stack pointers. 1193 Waste one element of value and location stack 1194 so that they stay on the same level as the state stack. 1195 The wasted elements are never initialized. */ 1196 1197 yyssp = yyss; 1198 yyvsp = yyvs; 1199 1200 goto yysetstate; 1201 1202/*------------------------------------------------------------. 1203| yynewstate -- Push a new state, which is found in yystate. | 1204`------------------------------------------------------------*/ 1205 yynewstate: 1206 /* In all cases, when you get here, the value and location stacks 1207 have just been pushed. So pushing a state here evens the stacks. */ 1208 yyssp++; 1209 1210 yysetstate: 1211 *yyssp = yystate; 1212 1213 if (yyss + yystacksize - 1 <= yyssp) 1214 { 1215 /* Get the current used size of the three stacks, in elements. */ 1216 YYSIZE_T yysize = yyssp - yyss + 1; 1217 1218#ifdef yyoverflow 1219 { 1220 /* Give user a chance to reallocate the stack. Use copies of 1221 these so that the &'s don't force the real ones into 1222 memory. */ 1223 YYSTYPE *yyvs1 = yyvs; 1224 yytype_int16 *yyss1 = yyss; 1225 1226 1227 /* Each stack pointer address is followed by the size of the 1228 data in use in that stack, in bytes. This used to be a 1229 conditional around just the two extra args, but that might 1230 be undefined if yyoverflow is a macro. */ 1231 yyoverflow (YY_("memory exhausted"), 1232 &yyss1, yysize * sizeof (*yyssp), 1233 &yyvs1, yysize * sizeof (*yyvsp), 1234 1235 &yystacksize); 1236 1237 yyss = yyss1; 1238 yyvs = yyvs1; 1239 } 1240#else /* no yyoverflow */ 1241# ifndef YYSTACK_RELOCATE 1242 goto yyexhaustedlab; 1243# else 1244 /* Extend the stack our own way. */ 1245 if (YYMAXDEPTH <= yystacksize) 1246 goto yyexhaustedlab; 1247 yystacksize *= 2; 1248 if (YYMAXDEPTH < yystacksize) 1249 yystacksize = YYMAXDEPTH; 1250 1251 { 1252 yytype_int16 *yyss1 = yyss; 1253 union yyalloc *yyptr = 1254 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1255 if (! yyptr) 1256 goto yyexhaustedlab; 1257 YYSTACK_RELOCATE (yyss); 1258 YYSTACK_RELOCATE (yyvs); 1259 1260# undef YYSTACK_RELOCATE 1261 if (yyss1 != yyssa) 1262 YYSTACK_FREE (yyss1); 1263 } 1264# endif 1265#endif /* no yyoverflow */ 1266 1267 yyssp = yyss + yysize - 1; 1268 yyvsp = yyvs + yysize - 1; 1269 1270 1271 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1272 (unsigned long int) yystacksize)); 1273 1274 if (yyss + yystacksize - 1 <= yyssp) 1275 YYABORT; 1276 } 1277 1278 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1279 1280 goto yybackup; 1281 1282/*-----------. 1283| yybackup. | 1284`-----------*/ 1285yybackup: 1286 1287 /* Do appropriate processing given the current state. Read a 1288 look-ahead token if we need one and don't already have one. */ 1289 1290 /* First try to decide what to do without reference to look-ahead token. */ 1291 yyn = yypact[yystate]; 1292 if (yyn == YYPACT_NINF) 1293 goto yydefault; 1294 1295 /* Not known => get a look-ahead token if don't already have one. */ 1296 1297 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 1298 if (yychar == YYEMPTY) 1299 { 1300 YYDPRINTF ((stderr, "Reading a token: ")); 1301 yychar = YYLEX; 1302 } 1303 1304 if (yychar <= YYEOF) 1305 { 1306 yychar = yytoken = YYEOF; 1307 YYDPRINTF ((stderr, "Now at end of input.\n")); 1308 } 1309 else 1310 { 1311 yytoken = YYTRANSLATE (yychar); 1312 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1313 } 1314 1315 /* If the proper action on seeing token YYTOKEN is to reduce or to 1316 detect an error, take that action. */ 1317 yyn += yytoken; 1318 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1319 goto yydefault; 1320 yyn = yytable[yyn]; 1321 if (yyn <= 0) 1322 { 1323 if (yyn == 0 || yyn == YYTABLE_NINF) 1324 goto yyerrlab; 1325 yyn = -yyn; 1326 goto yyreduce; 1327 } 1328 1329 if (yyn == YYFINAL) 1330 YYACCEPT; 1331 1332 /* Count tokens shifted since error; after three, turn off error 1333 status. */ 1334 if (yyerrstatus) 1335 yyerrstatus--; 1336 1337 /* Shift the look-ahead token. */ 1338 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1339 1340 /* Discard the shifted token unless it is eof. */ 1341 if (yychar != YYEOF) 1342 yychar = YYEMPTY; 1343 1344 yystate = yyn; 1345 *++yyvsp = yylval; 1346 1347 goto yynewstate; 1348 1349 1350/*-----------------------------------------------------------. 1351| yydefault -- do the default action for the current state. | 1352`-----------------------------------------------------------*/ 1353yydefault: 1354 yyn = yydefact[yystate]; 1355 if (yyn == 0) 1356 goto yyerrlab; 1357 goto yyreduce; 1358 1359 1360/*-----------------------------. 1361| yyreduce -- Do a reduction. | 1362`-----------------------------*/ 1363yyreduce: 1364 /* yyn is the number of a rule to reduce with. */ 1365 yylen = yyr2[yyn]; 1366 1367 /* If YYLEN is nonzero, implement the default value of the action: 1368 `$$ = $1'. 1369 1370 Otherwise, the following line sets YYVAL to garbage. 1371 This behavior is undocumented and Bison 1372 users should not rely upon it. Assigning to YYVAL 1373 unconditionally makes the parser a bit smaller, and it avoids a 1374 GCC warning that YYVAL may be used uninitialized. */ 1375 yyval = yyvsp[1-yylen]; 1376 1377 1378 YY_REDUCE_PRINT (yyn); 1379 switch (yyn) 1380 { 1381 case 6: 1382#line 71 "heimdal/lib/com_err/parse.y" 1383 { 1384 id_str = (yyvsp[(2) - (2)].string); 1385 } 1386 break; 1387 1388 case 7: 1389#line 77 "heimdal/lib/com_err/parse.y" 1390 { 1391 base_id = name2number((yyvsp[(2) - (2)].string)); 1392 strlcpy(name, (yyvsp[(2) - (2)].string), sizeof(name)); 1393 free((yyvsp[(2) - (2)].string)); 1394 } 1395 break; 1396 1397 case 8: 1398#line 83 "heimdal/lib/com_err/parse.y" 1399 { 1400 base_id = name2number((yyvsp[(2) - (3)].string)); 1401 strlcpy(name, (yyvsp[(3) - (3)].string), sizeof(name)); 1402 free((yyvsp[(2) - (3)].string)); 1403 free((yyvsp[(3) - (3)].string)); 1404 } 1405 break; 1406 1407 case 11: 1408#line 96 "heimdal/lib/com_err/parse.y" 1409 { 1410 number = (yyvsp[(2) - (2)].number); 1411 } 1412 break; 1413 1414 case 12: 1415#line 100 "heimdal/lib/com_err/parse.y" 1416 { 1417 free(prefix); 1418 asprintf (&prefix, "%s_", (yyvsp[(2) - (2)].string)); 1419 if (prefix == NULL) 1420 errx(1, "malloc"); 1421 free((yyvsp[(2) - (2)].string)); 1422 } 1423 break; 1424 1425 case 13: 1426#line 108 "heimdal/lib/com_err/parse.y" 1427 { 1428 prefix = realloc(prefix, 1); 1429 if (prefix == NULL) 1430 errx(1, "malloc"); 1431 *prefix = '\0'; 1432 } 1433 break; 1434 1435 case 14: 1436#line 115 "heimdal/lib/com_err/parse.y" 1437 { 1438 struct error_code *ec = malloc(sizeof(*ec)); 1439 1440 if (ec == NULL) 1441 errx(1, "malloc"); 1442 1443 ec->next = NULL; 1444 ec->number = number; 1445 if(prefix && *prefix != '\0') { 1446 asprintf (&ec->name, "%s%s", prefix, (yyvsp[(2) - (4)].string)); 1447 if (ec->name == NULL) 1448 errx(1, "malloc"); 1449 free((yyvsp[(2) - (4)].string)); 1450 } else 1451 ec->name = (yyvsp[(2) - (4)].string); 1452 ec->string = (yyvsp[(4) - (4)].string); 1453 APPEND(codes, ec); 1454 number++; 1455 } 1456 break; 1457 1458 case 15: 1459#line 135 "heimdal/lib/com_err/parse.y" 1460 { 1461 YYACCEPT; 1462 } 1463 break; 1464 1465 1466/* Line 1267 of yacc.c. */ 1467#line 1468 "heimdal/lib/com_err/parse.y" 1468 default: break; 1469 } 1470 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1471 1472 YYPOPSTACK (yylen); 1473 yylen = 0; 1474 YY_STACK_PRINT (yyss, yyssp); 1475 1476 *++yyvsp = yyval; 1477 1478 1479 /* Now `shift' the result of the reduction. Determine what state 1480 that goes to, based on the state we popped back to and the rule 1481 number reduced by. */ 1482 1483 yyn = yyr1[yyn]; 1484 1485 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1486 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1487 yystate = yytable[yystate]; 1488 else 1489 yystate = yydefgoto[yyn - YYNTOKENS]; 1490 1491 goto yynewstate; 1492 1493 1494/*------------------------------------. 1495| yyerrlab -- here on detecting error | 1496`------------------------------------*/ 1497yyerrlab: 1498 /* If not already recovering from an error, report this error. */ 1499 if (!yyerrstatus) 1500 { 1501 ++yynerrs; 1502#if ! YYERROR_VERBOSE 1503 yyerror (YY_("syntax error")); 1504#else 1505 { 1506 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 1507 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 1508 { 1509 YYSIZE_T yyalloc = 2 * yysize; 1510 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 1511 yyalloc = YYSTACK_ALLOC_MAXIMUM; 1512 if (yymsg != yymsgbuf) 1513 YYSTACK_FREE (yymsg); 1514 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 1515 if (yymsg) 1516 yymsg_alloc = yyalloc; 1517 else 1518 { 1519 yymsg = yymsgbuf; 1520 yymsg_alloc = sizeof yymsgbuf; 1521 } 1522 } 1523 1524 if (0 < yysize && yysize <= yymsg_alloc) 1525 { 1526 (void) yysyntax_error (yymsg, yystate, yychar); 1527 yyerror (yymsg); 1528 } 1529 else 1530 { 1531 yyerror (YY_("syntax error")); 1532 if (yysize != 0) 1533 goto yyexhaustedlab; 1534 } 1535 } 1536#endif 1537 } 1538 1539 1540 1541 if (yyerrstatus == 3) 1542 { 1543 /* If just tried and failed to reuse look-ahead token after an 1544 error, discard it. */ 1545 1546 if (yychar <= YYEOF) 1547 { 1548 /* Return failure if at end of input. */ 1549 if (yychar == YYEOF) 1550 YYABORT; 1551 } 1552 else 1553 { 1554 yydestruct ("Error: discarding", 1555 yytoken, &yylval); 1556 yychar = YYEMPTY; 1557 } 1558 } 1559 1560 /* Else will try to reuse look-ahead token after shifting the error 1561 token. */ 1562 goto yyerrlab1; 1563 1564 1565/*---------------------------------------------------. 1566| yyerrorlab -- error raised explicitly by YYERROR. | 1567`---------------------------------------------------*/ 1568yyerrorlab: 1569 1570 /* Pacify compilers like GCC when the user code never invokes 1571 YYERROR and the label yyerrorlab therefore never appears in user 1572 code. */ 1573 if (/*CONSTCOND*/ 0) 1574 goto yyerrorlab; 1575 1576 /* Do not reclaim the symbols of the rule which action triggered 1577 this YYERROR. */ 1578 YYPOPSTACK (yylen); 1579 yylen = 0; 1580 YY_STACK_PRINT (yyss, yyssp); 1581 yystate = *yyssp; 1582 goto yyerrlab1; 1583 1584 1585/*-------------------------------------------------------------. 1586| yyerrlab1 -- common code for both syntax error and YYERROR. | 1587`-------------------------------------------------------------*/ 1588yyerrlab1: 1589 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1590 1591 for (;;) 1592 { 1593 yyn = yypact[yystate]; 1594 if (yyn != YYPACT_NINF) 1595 { 1596 yyn += YYTERROR; 1597 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1598 { 1599 yyn = yytable[yyn]; 1600 if (0 < yyn) 1601 break; 1602 } 1603 } 1604 1605 /* Pop the current state because it cannot handle the error token. */ 1606 if (yyssp == yyss) 1607 YYABORT; 1608 1609 1610 yydestruct ("Error: popping", 1611 yystos[yystate], yyvsp); 1612 YYPOPSTACK (1); 1613 yystate = *yyssp; 1614 YY_STACK_PRINT (yyss, yyssp); 1615 } 1616 1617 if (yyn == YYFINAL) 1618 YYACCEPT; 1619 1620 *++yyvsp = yylval; 1621 1622 1623 /* Shift the error token. */ 1624 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1625 1626 yystate = yyn; 1627 goto yynewstate; 1628 1629 1630/*-------------------------------------. 1631| yyacceptlab -- YYACCEPT comes here. | 1632`-------------------------------------*/ 1633yyacceptlab: 1634 yyresult = 0; 1635 goto yyreturn; 1636 1637/*-----------------------------------. 1638| yyabortlab -- YYABORT comes here. | 1639`-----------------------------------*/ 1640yyabortlab: 1641 yyresult = 1; 1642 goto yyreturn; 1643 1644#ifndef yyoverflow 1645/*-------------------------------------------------. 1646| yyexhaustedlab -- memory exhaustion comes here. | 1647`-------------------------------------------------*/ 1648yyexhaustedlab: 1649 yyerror (YY_("memory exhausted")); 1650 yyresult = 2; 1651 /* Fall through. */ 1652#endif 1653 1654yyreturn: 1655 if (yychar != YYEOF && yychar != YYEMPTY) 1656 yydestruct ("Cleanup: discarding lookahead", 1657 yytoken, &yylval); 1658 /* Do not reclaim the symbols of the rule which action triggered 1659 this YYABORT or YYACCEPT. */ 1660 YYPOPSTACK (yylen); 1661 YY_STACK_PRINT (yyss, yyssp); 1662 while (yyssp != yyss) 1663 { 1664 yydestruct ("Cleanup: popping", 1665 yystos[*yyssp], yyvsp); 1666 YYPOPSTACK (1); 1667 } 1668#ifndef yyoverflow 1669 if (yyss != yyssa) 1670 YYSTACK_FREE (yyss); 1671#endif 1672#if YYERROR_VERBOSE 1673 if (yymsg != yymsgbuf) 1674 YYSTACK_FREE (yymsg); 1675#endif 1676 /* Make sure YYID is used. */ 1677 return YYID (yyresult); 1678} 1679 1680 1681#line 140 "heimdal/lib/com_err/parse.y" 1682 1683 1684static long 1685name2number(const char *str) 1686{ 1687 const char *p; 1688 long num = 0; 1689 const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 1690 "abcdefghijklmnopqrstuvwxyz0123456789_"; 1691 if(strlen(str) > 4) { 1692 yyerror("table name too long"); 1693 return 0; 1694 } 1695 for(p = str; *p; p++){ 1696 char *q = strchr(x, *p); 1697 if(q == NULL) { 1698 yyerror("invalid character in table name"); 1699 return 0; 1700 } 1701 num = (num << 6) + (q - x) + 1; 1702 } 1703 num <<= 8; 1704 if(num > 0x7fffffff) 1705 num = -(0xffffffff - num + 1); 1706 return num; 1707} 1708 1709void 1710yyerror (char *s) 1711{ 1712 error_message ("%s\n", s); 1713} 1714 1715