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