Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.37-rc4 2487 lines 71 kB view raw
1 2/* A Bison parser, made by GNU Bison 2.4.1. */ 3 4/* Skeleton implementation for Bison's Yacc-like parsers in C 5 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 7 Free Software Foundation, Inc. 8 9 This program is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22/* As a special exception, you may create a larger work that contains 23 part or all of the Bison parser skeleton and distribute that work 24 under terms of your choice, so long as that work isn't itself a 25 parser generator using the skeleton or a modified version thereof 26 as a parser skeleton. Alternatively, if you modify or redistribute 27 the parser skeleton itself, you may (at your option) remove this 28 special exception, which will cause the skeleton and the resulting 29 Bison output files to be licensed under the GNU General Public 30 License without this special exception. 31 32 This special exception was added by the Free Software Foundation in 33 version 2.2 of Bison. */ 34 35/* C LALR(1) parser skeleton written by Richard Stallman, by 36 simplifying the original so-called "semantic" parser. */ 37 38/* All symbols defined below should begin with yy or YY, to avoid 39 infringing on user name space. This should be done even for local 40 variables, as they might otherwise be expanded by user macros. 41 There are some unavoidable exceptions within include files to 42 define necessary library symbols; they are noted "INFRINGES ON 43 USER NAME SPACE" below. */ 44 45/* Identify Bison output. */ 46#define YYBISON 1 47 48/* Bison version. */ 49#define YYBISON_VERSION "2.4.1" 50 51/* Skeleton name. */ 52#define YYSKELETON_NAME "yacc.c" 53 54/* Pure parsers. */ 55#define YYPURE 0 56 57/* Push parsers. */ 58#define YYPUSH 0 59 60/* Pull parsers. */ 61#define YYPULL 1 62 63/* Using locations. */ 64#define YYLSP_NEEDED 0 65 66/* Substitute the variable and function names. */ 67#define yyparse zconfparse 68#define yylex zconflex 69#define yyerror zconferror 70#define yylval zconflval 71#define yychar zconfchar 72#define yydebug zconfdebug 73#define yynerrs zconfnerrs 74 75 76/* Copy the first part of user declarations. */ 77 78 79/* 80 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 81 * Released under the terms of the GNU GPL v2.0. 82 */ 83 84#include <ctype.h> 85#include <stdarg.h> 86#include <stdio.h> 87#include <stdlib.h> 88#include <string.h> 89#include <stdbool.h> 90 91#define LKC_DIRECT_LINK 92#include "lkc.h" 93 94#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) 95 96#define PRINTD 0x0001 97#define DEBUG_PARSE 0x0002 98 99int cdebug = PRINTD; 100 101extern int zconflex(void); 102static void zconfprint(const char *err, ...); 103static void zconf_error(const char *err, ...); 104static void zconferror(const char *err); 105static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); 106 107struct symbol *symbol_hash[SYMBOL_HASHSIZE]; 108 109static struct menu *current_menu, *current_entry; 110 111#define YYDEBUG 0 112#if YYDEBUG 113#define YYERROR_VERBOSE 114#endif 115 116 117 118/* Enabling traces. */ 119#ifndef YYDEBUG 120# define YYDEBUG 0 121#endif 122 123/* Enabling verbose error messages. */ 124#ifdef YYERROR_VERBOSE 125# undef YYERROR_VERBOSE 126# define YYERROR_VERBOSE 1 127#else 128# define YYERROR_VERBOSE 0 129#endif 130 131/* Enabling the token table. */ 132#ifndef YYTOKEN_TABLE 133# define YYTOKEN_TABLE 0 134#endif 135 136 137/* Tokens. */ 138#ifndef YYTOKENTYPE 139# define YYTOKENTYPE 140 /* Put the tokens into the symbol table, so that GDB and other debuggers 141 know about them. */ 142 enum yytokentype { 143 T_MAINMENU = 258, 144 T_MENU = 259, 145 T_ENDMENU = 260, 146 T_SOURCE = 261, 147 T_CHOICE = 262, 148 T_ENDCHOICE = 263, 149 T_COMMENT = 264, 150 T_CONFIG = 265, 151 T_MENUCONFIG = 266, 152 T_HELP = 267, 153 T_HELPTEXT = 268, 154 T_IF = 269, 155 T_ENDIF = 270, 156 T_DEPENDS = 271, 157 T_OPTIONAL = 272, 158 T_PROMPT = 273, 159 T_TYPE = 274, 160 T_DEFAULT = 275, 161 T_SELECT = 276, 162 T_RANGE = 277, 163 T_OPTION = 278, 164 T_ON = 279, 165 T_WORD = 280, 166 T_WORD_QUOTE = 281, 167 T_UNEQUAL = 282, 168 T_CLOSE_PAREN = 283, 169 T_OPEN_PAREN = 284, 170 T_EOL = 285, 171 T_OR = 286, 172 T_AND = 287, 173 T_EQUAL = 288, 174 T_NOT = 289 175 }; 176#endif 177 178 179 180#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 181typedef union YYSTYPE 182{ 183 184 185 char *string; 186 struct file *file; 187 struct symbol *symbol; 188 struct expr *expr; 189 struct menu *menu; 190 struct kconf_id *id; 191 192 193 194} YYSTYPE; 195# define YYSTYPE_IS_TRIVIAL 1 196# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 197# define YYSTYPE_IS_DECLARED 1 198#endif 199 200 201/* Copy the second part of user declarations. */ 202 203 204/* Include zconf.hash.c here so it can see the token constants. */ 205#include "zconf.hash.c" 206 207 208 209#ifdef short 210# undef short 211#endif 212 213#ifdef YYTYPE_UINT8 214typedef YYTYPE_UINT8 yytype_uint8; 215#else 216typedef unsigned char yytype_uint8; 217#endif 218 219#ifdef YYTYPE_INT8 220typedef YYTYPE_INT8 yytype_int8; 221#elif (defined __STDC__ || defined __C99__FUNC__ \ 222 || defined __cplusplus || defined _MSC_VER) 223typedef signed char yytype_int8; 224#else 225typedef short int yytype_int8; 226#endif 227 228#ifdef YYTYPE_UINT16 229typedef YYTYPE_UINT16 yytype_uint16; 230#else 231typedef unsigned short int yytype_uint16; 232#endif 233 234#ifdef YYTYPE_INT16 235typedef YYTYPE_INT16 yytype_int16; 236#else 237typedef short int yytype_int16; 238#endif 239 240#ifndef YYSIZE_T 241# ifdef __SIZE_TYPE__ 242# define YYSIZE_T __SIZE_TYPE__ 243# elif defined size_t 244# define YYSIZE_T size_t 245# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 246 || defined __cplusplus || defined _MSC_VER) 247# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 248# define YYSIZE_T size_t 249# else 250# define YYSIZE_T unsigned int 251# endif 252#endif 253 254#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 255 256#ifndef YY_ 257# if YYENABLE_NLS 258# if ENABLE_NLS 259# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 260# define YY_(msgid) dgettext ("bison-runtime", msgid) 261# endif 262# endif 263# ifndef YY_ 264# define YY_(msgid) msgid 265# endif 266#endif 267 268/* Suppress unused-variable warnings by "using" E. */ 269#if ! defined lint || defined __GNUC__ 270# define YYUSE(e) ((void) (e)) 271#else 272# define YYUSE(e) /* empty */ 273#endif 274 275/* Identity function, used to suppress warnings about constant conditions. */ 276#ifndef lint 277# define YYID(n) (n) 278#else 279#if (defined __STDC__ || defined __C99__FUNC__ \ 280 || defined __cplusplus || defined _MSC_VER) 281static int 282YYID (int yyi) 283#else 284static int 285YYID (yyi) 286 int yyi; 287#endif 288{ 289 return yyi; 290} 291#endif 292 293#if ! defined yyoverflow || YYERROR_VERBOSE 294 295/* The parser invokes alloca or malloc; define the necessary symbols. */ 296 297# ifdef YYSTACK_USE_ALLOCA 298# if YYSTACK_USE_ALLOCA 299# ifdef __GNUC__ 300# define YYSTACK_ALLOC __builtin_alloca 301# elif defined __BUILTIN_VA_ARG_INCR 302# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 303# elif defined _AIX 304# define YYSTACK_ALLOC __alloca 305# elif defined _MSC_VER 306# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 307# define alloca _alloca 308# else 309# define YYSTACK_ALLOC alloca 310# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 311 || defined __cplusplus || defined _MSC_VER) 312# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 313# ifndef _STDLIB_H 314# define _STDLIB_H 1 315# endif 316# endif 317# endif 318# endif 319# endif 320 321# ifdef YYSTACK_ALLOC 322 /* Pacify GCC's `empty if-body' warning. */ 323# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 324# ifndef YYSTACK_ALLOC_MAXIMUM 325 /* The OS might guarantee only one guard page at the bottom of the stack, 326 and a page size can be as small as 4096 bytes. So we cannot safely 327 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 328 to allow for a few compiler-allocated temporary stack slots. */ 329# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 330# endif 331# else 332# define YYSTACK_ALLOC YYMALLOC 333# define YYSTACK_FREE YYFREE 334# ifndef YYSTACK_ALLOC_MAXIMUM 335# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 336# endif 337# if (defined __cplusplus && ! defined _STDLIB_H \ 338 && ! ((defined YYMALLOC || defined malloc) \ 339 && (defined YYFREE || defined free))) 340# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 341# ifndef _STDLIB_H 342# define _STDLIB_H 1 343# endif 344# endif 345# ifndef YYMALLOC 346# define YYMALLOC malloc 347# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 348 || defined __cplusplus || defined _MSC_VER) 349void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 350# endif 351# endif 352# ifndef YYFREE 353# define YYFREE free 354# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 355 || defined __cplusplus || defined _MSC_VER) 356void free (void *); /* INFRINGES ON USER NAME SPACE */ 357# endif 358# endif 359# endif 360#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 361 362 363#if (! defined yyoverflow \ 364 && (! defined __cplusplus \ 365 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 366 367/* A type that is properly aligned for any stack member. */ 368union yyalloc 369{ 370 yytype_int16 yyss_alloc; 371 YYSTYPE yyvs_alloc; 372}; 373 374/* The size of the maximum gap between one aligned stack and the next. */ 375# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 376 377/* The size of an array large to enough to hold all stacks, each with 378 N elements. */ 379# define YYSTACK_BYTES(N) \ 380 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 381 + YYSTACK_GAP_MAXIMUM) 382 383/* Copy COUNT objects from FROM to TO. The source and destination do 384 not overlap. */ 385# ifndef YYCOPY 386# if defined __GNUC__ && 1 < __GNUC__ 387# define YYCOPY(To, From, Count) \ 388 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 389# else 390# define YYCOPY(To, From, Count) \ 391 do \ 392 { \ 393 YYSIZE_T yyi; \ 394 for (yyi = 0; yyi < (Count); yyi++) \ 395 (To)[yyi] = (From)[yyi]; \ 396 } \ 397 while (YYID (0)) 398# endif 399# endif 400 401/* Relocate STACK from its old location to the new one. The 402 local variables YYSIZE and YYSTACKSIZE give the old and new number of 403 elements in the stack, and YYPTR gives the new location of the 404 stack. Advance YYPTR to a properly aligned location for the next 405 stack. */ 406# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 407 do \ 408 { \ 409 YYSIZE_T yynewbytes; \ 410 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 411 Stack = &yyptr->Stack_alloc; \ 412 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 413 yyptr += yynewbytes / sizeof (*yyptr); \ 414 } \ 415 while (YYID (0)) 416 417#endif 418 419/* YYFINAL -- State number of the termination state. */ 420#define YYFINAL 11 421/* YYLAST -- Last index in YYTABLE. */ 422#define YYLAST 277 423 424/* YYNTOKENS -- Number of terminals. */ 425#define YYNTOKENS 35 426/* YYNNTS -- Number of nonterminals. */ 427#define YYNNTS 48 428/* YYNRULES -- Number of rules. */ 429#define YYNRULES 113 430/* YYNRULES -- Number of states. */ 431#define YYNSTATES 185 432 433/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 434#define YYUNDEFTOK 2 435#define YYMAXUTOK 289 436 437#define YYTRANSLATE(YYX) \ 438 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 439 440/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 441static const yytype_uint8 yytranslate[] = 442{ 443 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 468 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 469 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 470 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 471 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 472}; 473 474#if YYDEBUG 475/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 476 YYRHS. */ 477static const yytype_uint16 yyprhs[] = 478{ 479 0, 0, 3, 6, 8, 11, 13, 14, 17, 20, 480 23, 26, 31, 36, 40, 42, 44, 46, 48, 50, 481 52, 54, 56, 58, 60, 62, 64, 66, 70, 73, 482 77, 80, 84, 87, 88, 91, 94, 97, 100, 103, 483 106, 110, 115, 120, 125, 131, 135, 136, 140, 141, 484 144, 148, 151, 153, 157, 158, 161, 164, 167, 170, 485 173, 178, 182, 185, 190, 191, 194, 198, 200, 204, 486 205, 208, 211, 214, 218, 222, 225, 227, 231, 232, 487 235, 238, 241, 245, 249, 252, 255, 258, 259, 262, 488 265, 268, 273, 274, 277, 279, 281, 284, 287, 290, 489 292, 295, 296, 299, 301, 305, 309, 313, 316, 320, 490 324, 326, 328, 329 491}; 492 493/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 494static const yytype_int8 yyrhs[] = 495{ 496 36, 0, -1, 78, 37, -1, 37, -1, 62, 38, 497 -1, 38, -1, -1, 38, 40, -1, 38, 54, -1, 498 38, 66, -1, 38, 77, -1, 38, 25, 1, 30, 499 -1, 38, 39, 1, 30, -1, 38, 1, 30, -1, 500 16, -1, 18, -1, 19, -1, 21, -1, 17, -1, 501 22, -1, 20, -1, 30, -1, 60, -1, 70, -1, 502 43, -1, 45, -1, 68, -1, 25, 1, 30, -1, 503 1, 30, -1, 10, 25, 30, -1, 42, 46, -1, 504 11, 25, 30, -1, 44, 46, -1, -1, 46, 47, 505 -1, 46, 48, -1, 46, 74, -1, 46, 72, -1, 506 46, 41, -1, 46, 30, -1, 19, 75, 30, -1, 507 18, 76, 79, 30, -1, 20, 80, 79, 30, -1, 508 21, 25, 79, 30, -1, 22, 81, 81, 79, 30, 509 -1, 23, 49, 30, -1, -1, 49, 25, 50, -1, 510 -1, 33, 76, -1, 7, 82, 30, -1, 51, 55, 511 -1, 77, -1, 52, 57, 53, -1, -1, 55, 56, 512 -1, 55, 74, -1, 55, 72, -1, 55, 30, -1, 513 55, 41, -1, 18, 76, 79, 30, -1, 19, 75, 514 30, -1, 17, 30, -1, 20, 25, 79, 30, -1, 515 -1, 57, 40, -1, 14, 80, 78, -1, 77, -1, 516 58, 61, 59, -1, -1, 61, 40, -1, 61, 66, 517 -1, 61, 54, -1, 3, 76, 78, -1, 4, 76, 518 30, -1, 63, 73, -1, 77, -1, 64, 67, 65, 519 -1, -1, 67, 40, -1, 67, 66, -1, 67, 54, 520 -1, 6, 76, 30, -1, 9, 76, 30, -1, 69, 521 73, -1, 12, 30, -1, 71, 13, -1, -1, 73, 522 74, -1, 73, 30, -1, 73, 41, -1, 16, 24, 523 80, 30, -1, -1, 76, 79, -1, 25, -1, 26, 524 -1, 5, 30, -1, 8, 30, -1, 15, 30, -1, 525 30, -1, 78, 30, -1, -1, 14, 80, -1, 81, 526 -1, 81, 33, 81, -1, 81, 27, 81, -1, 29, 527 80, 28, -1, 34, 80, -1, 80, 31, 80, -1, 528 80, 32, 80, -1, 25, -1, 26, -1, -1, 25, 529 -1 530}; 531 532/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 533static const yytype_uint16 yyrline[] = 534{ 535 0, 107, 107, 107, 109, 109, 111, 113, 114, 115, 536 116, 117, 118, 122, 126, 126, 126, 126, 126, 126, 537 126, 130, 131, 132, 133, 134, 135, 139, 140, 146, 538 154, 160, 168, 178, 180, 181, 182, 183, 184, 185, 539 188, 196, 202, 212, 218, 224, 227, 229, 240, 241, 540 246, 255, 260, 268, 271, 273, 274, 275, 276, 277, 541 280, 286, 297, 303, 313, 315, 320, 328, 336, 339, 542 341, 342, 343, 348, 355, 362, 367, 375, 378, 380, 543 381, 382, 385, 393, 400, 407, 413, 420, 422, 423, 544 424, 427, 435, 437, 442, 443, 446, 447, 448, 452, 545 453, 456, 457, 460, 461, 462, 463, 464, 465, 466, 546 469, 470, 473, 474 547}; 548#endif 549 550#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 551/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 552 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 553static const char *const yytname[] = 554{ 555 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", 556 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", 557 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", 558 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", 559 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", 560 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", 561 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name", 562 "common_stmt", "option_error", "config_entry_start", "config_stmt", 563 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", 564 "config_option", "symbol_option", "symbol_option_list", 565 "symbol_option_arg", "choice", "choice_entry", "choice_end", 566 "choice_stmt", "choice_option_list", "choice_option", "choice_block", 567 "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu", 568 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", 569 "comment", "comment_stmt", "help_start", "help", "depends_list", 570 "depends", "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", 571 "symbol", "word_opt", 0 572}; 573#endif 574 575# ifdef YYPRINT 576/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 577 token YYLEX-NUM. */ 578static const yytype_uint16 yytoknum[] = 579{ 580 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 581 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 582 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 583 285, 286, 287, 288, 289 584}; 585# endif 586 587/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 588static const yytype_uint8 yyr1[] = 589{ 590 0, 35, 36, 36, 37, 37, 38, 38, 38, 38, 591 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 592 39, 40, 40, 40, 40, 40, 40, 41, 41, 42, 593 43, 44, 45, 46, 46, 46, 46, 46, 46, 46, 594 47, 47, 47, 47, 47, 48, 49, 49, 50, 50, 595 51, 52, 53, 54, 55, 55, 55, 55, 55, 55, 596 56, 56, 56, 56, 57, 57, 58, 59, 60, 61, 597 61, 61, 61, 62, 63, 64, 65, 66, 67, 67, 598 67, 67, 68, 69, 70, 71, 72, 73, 73, 73, 599 73, 74, 75, 75, 76, 76, 77, 77, 77, 78, 600 78, 79, 79, 80, 80, 80, 80, 80, 80, 80, 601 81, 81, 82, 82 602}; 603 604/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 605static const yytype_uint8 yyr2[] = 606{ 607 0, 2, 2, 1, 2, 1, 0, 2, 2, 2, 608 2, 4, 4, 3, 1, 1, 1, 1, 1, 1, 609 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, 610 2, 3, 2, 0, 2, 2, 2, 2, 2, 2, 611 3, 4, 4, 4, 5, 3, 0, 3, 0, 2, 612 3, 2, 1, 3, 0, 2, 2, 2, 2, 2, 613 4, 3, 2, 4, 0, 2, 3, 1, 3, 0, 614 2, 2, 2, 3, 3, 2, 1, 3, 0, 2, 615 2, 2, 3, 3, 2, 2, 2, 0, 2, 2, 616 2, 4, 0, 2, 1, 1, 2, 2, 2, 1, 617 2, 0, 2, 1, 3, 3, 3, 2, 3, 3, 618 1, 1, 0, 1 619}; 620 621/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 622 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 623 means the default is an error. */ 624static const yytype_uint8 yydefact[] = 625{ 626 6, 0, 99, 0, 3, 0, 6, 6, 94, 95, 627 0, 1, 0, 0, 0, 0, 112, 0, 0, 0, 628 0, 0, 0, 14, 18, 15, 16, 20, 17, 19, 629 0, 21, 0, 7, 33, 24, 33, 25, 54, 64, 630 8, 69, 22, 87, 78, 9, 26, 87, 23, 10, 631 0, 100, 2, 73, 13, 0, 96, 0, 113, 0, 632 97, 0, 0, 0, 110, 111, 0, 0, 0, 103, 633 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 634 0, 74, 82, 50, 83, 29, 31, 0, 107, 0, 635 0, 66, 0, 0, 11, 12, 0, 0, 0, 0, 636 92, 0, 0, 0, 46, 0, 39, 38, 34, 35, 637 0, 37, 36, 0, 0, 92, 0, 58, 59, 55, 638 57, 56, 65, 53, 52, 70, 72, 68, 71, 67, 639 89, 90, 88, 79, 81, 77, 80, 76, 106, 108, 640 109, 105, 104, 28, 85, 0, 101, 0, 101, 101, 641 101, 0, 0, 0, 86, 62, 101, 0, 101, 0, 642 0, 0, 40, 93, 0, 0, 101, 48, 45, 27, 643 0, 61, 0, 91, 102, 41, 42, 43, 0, 0, 644 47, 60, 63, 44, 49 645}; 646 647/* YYDEFGOTO[NTERM-NUM]. */ 648static const yytype_int16 yydefgoto[] = 649{ 650 -1, 3, 4, 5, 32, 33, 107, 34, 35, 36, 651 37, 73, 108, 109, 152, 180, 38, 39, 123, 40, 652 75, 119, 76, 41, 127, 42, 77, 6, 43, 44, 653 135, 45, 79, 46, 47, 48, 110, 111, 78, 112, 654 147, 148, 49, 7, 161, 68, 69, 59 655}; 656 657/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 658 STATE-NUM. */ 659#define YYPACT_NINF -89 660static const yytype_int16 yypact[] = 661{ 662 3, 4, -89, 20, -89, 100, -89, 7, -89, -89, 663 -8, -89, 17, 4, 28, 4, 37, 36, 4, 68, 664 87, -18, 69, -89, -89, -89, -89, -89, -89, -89, 665 128, -89, 138, -89, -89, -89, -89, -89, -89, -89, 666 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 667 127, -89, -89, 110, -89, 126, -89, 136, -89, 137, 668 -89, 147, 150, 152, -89, -89, -18, -18, 171, -14, 669 -89, 153, 157, 34, 67, 180, 233, 220, 207, 220, 670 154, -89, -89, -89, -89, -89, -89, 0, -89, -18, 671 -18, 110, 44, 44, -89, -89, 163, 174, 182, 4, 672 4, -18, 194, 44, -89, 219, -89, -89, -89, -89, 673 223, -89, -89, 203, 4, 4, 215, -89, -89, -89, 674 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 675 -89, -89, -89, -89, -89, -89, -89, -89, -89, 213, 676 -89, -89, -89, -89, -89, -18, 232, 227, 232, -5, 677 232, 44, 35, 234, -89, -89, 232, 235, 232, 224, 678 -18, 236, -89, -89, 237, 238, 232, 216, -89, -89, 679 240, -89, 241, -89, 71, -89, -89, -89, 242, 4, 680 -89, -89, -89, -89, -89 681}; 682 683/* YYPGOTO[NTERM-NUM]. */ 684static const yytype_int16 yypgoto[] = 685{ 686 -89, -89, 255, 267, -89, 47, -57, -89, -89, -89, 687 -89, 239, -89, -89, -89, -89, -89, -89, -89, 130, 688 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 689 -89, 181, -89, -89, -89, -89, -89, 199, 229, 16, 690 162, -1, 74, -7, 103, -65, -88, -89 691}; 692 693/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 694 positive, shift that token. If negative, reduce the rule which 695 number is the opposite. If zero, do what YYDEFACT says. 696 If YYTABLE_NINF, syntax error. */ 697#define YYTABLE_NINF -85 698static const yytype_int16 yytable[] = 699{ 700 10, 87, 88, 53, 141, 142, 1, 64, 65, 160, 701 1, 66, 55, 92, 57, 151, 67, 61, 118, 93, 702 11, 131, 2, 131, 139, 140, 89, 90, 138, 8, 703 9, 89, 90, 2, -30, 96, 149, 51, -30, -30, 704 -30, -30, -30, -30, -30, -30, 97, 54, -30, -30, 705 98, -30, 99, 100, 101, 102, 103, 104, 56, 105, 706 167, 91, 58, 166, 106, 168, 60, -32, 96, 64, 707 65, -32, -32, -32, -32, -32, -32, -32, -32, 97, 708 159, -32, -32, 98, -32, 99, 100, 101, 102, 103, 709 104, 121, 105, 62, 132, 174, 132, 106, 146, 70, 710 -5, 12, 89, 90, 13, 14, 15, 16, 17, 18, 711 19, 20, 63, 156, 21, 22, 23, 24, 25, 26, 712 27, 28, 29, 122, 125, 30, 133, -4, 12, 71, 713 31, 13, 14, 15, 16, 17, 18, 19, 20, 72, 714 51, 21, 22, 23, 24, 25, 26, 27, 28, 29, 715 124, 129, 30, 137, -84, 96, 81, 31, -84, -84, 716 -84, -84, -84, -84, -84, -84, 82, 83, -84, -84, 717 98, -84, -84, -84, -84, -84, -84, 84, 184, 105, 718 85, 96, 86, 94, 130, -51, -51, 95, -51, -51, 719 -51, -51, 97, 143, -51, -51, 98, 113, 114, 115, 720 116, 2, 89, 90, 144, 105, 145, 126, 96, 134, 721 117, -75, -75, -75, -75, -75, -75, -75, -75, 150, 722 153, -75, -75, 98, 13, 14, 15, 16, 17, 18, 723 19, 20, 105, 155, 21, 22, 154, 130, 14, 15, 724 158, 17, 18, 19, 20, 90, 160, 21, 22, 179, 725 31, 163, 164, 165, 173, 89, 90, 162, 128, 170, 726 136, 172, 52, 31, 169, 171, 175, 176, 177, 178, 727 181, 182, 183, 50, 120, 74, 80, 157 728}; 729 730static const yytype_uint8 yycheck[] = 731{ 732 1, 66, 67, 10, 92, 93, 3, 25, 26, 14, 733 3, 29, 13, 27, 15, 103, 34, 18, 75, 33, 734 0, 78, 30, 80, 89, 90, 31, 32, 28, 25, 735 26, 31, 32, 30, 0, 1, 101, 30, 4, 5, 736 6, 7, 8, 9, 10, 11, 12, 30, 14, 15, 737 16, 17, 18, 19, 20, 21, 22, 23, 30, 25, 738 25, 68, 25, 151, 30, 30, 30, 0, 1, 25, 739 26, 4, 5, 6, 7, 8, 9, 10, 11, 12, 740 145, 14, 15, 16, 17, 18, 19, 20, 21, 22, 741 23, 75, 25, 25, 78, 160, 80, 30, 99, 30, 742 0, 1, 31, 32, 4, 5, 6, 7, 8, 9, 743 10, 11, 25, 114, 14, 15, 16, 17, 18, 19, 744 20, 21, 22, 76, 77, 25, 79, 0, 1, 1, 745 30, 4, 5, 6, 7, 8, 9, 10, 11, 1, 746 30, 14, 15, 16, 17, 18, 19, 20, 21, 22, 747 76, 77, 25, 79, 0, 1, 30, 30, 4, 5, 748 6, 7, 8, 9, 10, 11, 30, 30, 14, 15, 749 16, 17, 18, 19, 20, 21, 22, 30, 179, 25, 750 30, 1, 30, 30, 30, 5, 6, 30, 8, 9, 751 10, 11, 12, 30, 14, 15, 16, 17, 18, 19, 752 20, 30, 31, 32, 30, 25, 24, 77, 1, 79, 753 30, 4, 5, 6, 7, 8, 9, 10, 11, 25, 754 1, 14, 15, 16, 4, 5, 6, 7, 8, 9, 755 10, 11, 25, 30, 14, 15, 13, 30, 5, 6, 756 25, 8, 9, 10, 11, 32, 14, 14, 15, 33, 757 30, 148, 149, 150, 30, 31, 32, 30, 77, 156, 758 79, 158, 7, 30, 30, 30, 30, 30, 30, 166, 759 30, 30, 30, 6, 75, 36, 47, 115 760}; 761 762/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 763 symbol of state STATE-NUM. */ 764static const yytype_uint8 yystos[] = 765{ 766 0, 3, 30, 36, 37, 38, 62, 78, 25, 26, 767 76, 0, 1, 4, 5, 6, 7, 8, 9, 10, 768 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 769 25, 30, 39, 40, 42, 43, 44, 45, 51, 52, 770 54, 58, 60, 63, 64, 66, 68, 69, 70, 77, 771 38, 30, 37, 78, 30, 76, 30, 76, 25, 82, 772 30, 76, 25, 25, 25, 26, 29, 34, 80, 81, 773 30, 1, 1, 46, 46, 55, 57, 61, 73, 67, 774 73, 30, 30, 30, 30, 30, 30, 80, 80, 31, 775 32, 78, 27, 33, 30, 30, 1, 12, 16, 18, 776 19, 20, 21, 22, 23, 25, 30, 41, 47, 48, 777 71, 72, 74, 17, 18, 19, 20, 30, 41, 56, 778 72, 74, 40, 53, 77, 40, 54, 59, 66, 77, 779 30, 41, 74, 40, 54, 65, 66, 77, 28, 80, 780 80, 81, 81, 30, 30, 24, 76, 75, 76, 80, 781 25, 81, 49, 1, 13, 30, 76, 75, 25, 80, 782 14, 79, 30, 79, 79, 79, 81, 25, 30, 30, 783 79, 30, 79, 30, 80, 30, 30, 30, 79, 33, 784 50, 30, 30, 30, 76 785}; 786 787#define yyerrok (yyerrstatus = 0) 788#define yyclearin (yychar = YYEMPTY) 789#define YYEMPTY (-2) 790#define YYEOF 0 791 792#define YYACCEPT goto yyacceptlab 793#define YYABORT goto yyabortlab 794#define YYERROR goto yyerrorlab 795 796 797/* Like YYERROR except do call yyerror. This remains here temporarily 798 to ease the transition to the new meaning of YYERROR, for GCC. 799 Once GCC version 2 has supplanted version 1, this can go. */ 800 801#define YYFAIL goto yyerrlab 802 803#define YYRECOVERING() (!!yyerrstatus) 804 805#define YYBACKUP(Token, Value) \ 806do \ 807 if (yychar == YYEMPTY && yylen == 1) \ 808 { \ 809 yychar = (Token); \ 810 yylval = (Value); \ 811 yytoken = YYTRANSLATE (yychar); \ 812 YYPOPSTACK (1); \ 813 goto yybackup; \ 814 } \ 815 else \ 816 { \ 817 yyerror (YY_("syntax error: cannot back up")); \ 818 YYERROR; \ 819 } \ 820while (YYID (0)) 821 822 823#define YYTERROR 1 824#define YYERRCODE 256 825 826 827/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 828 If N is 0, then set CURRENT to the empty location which ends 829 the previous symbol: RHS[0] (always defined). */ 830 831#define YYRHSLOC(Rhs, K) ((Rhs)[K]) 832#ifndef YYLLOC_DEFAULT 833# define YYLLOC_DEFAULT(Current, Rhs, N) \ 834 do \ 835 if (YYID (N)) \ 836 { \ 837 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 838 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 839 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 840 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 841 } \ 842 else \ 843 { \ 844 (Current).first_line = (Current).last_line = \ 845 YYRHSLOC (Rhs, 0).last_line; \ 846 (Current).first_column = (Current).last_column = \ 847 YYRHSLOC (Rhs, 0).last_column; \ 848 } \ 849 while (YYID (0)) 850#endif 851 852 853/* YY_LOCATION_PRINT -- Print the location on the stream. 854 This macro was not mandated originally: define only if we know 855 we won't break user code: when these are the locations we know. */ 856 857#ifndef YY_LOCATION_PRINT 858# if YYLTYPE_IS_TRIVIAL 859# define YY_LOCATION_PRINT(File, Loc) \ 860 fprintf (File, "%d.%d-%d.%d", \ 861 (Loc).first_line, (Loc).first_column, \ 862 (Loc).last_line, (Loc).last_column) 863# else 864# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 865# endif 866#endif 867 868 869/* YYLEX -- calling `yylex' with the right arguments. */ 870 871#ifdef YYLEX_PARAM 872# define YYLEX yylex (YYLEX_PARAM) 873#else 874# define YYLEX yylex () 875#endif 876 877/* Enable debugging if requested. */ 878#if YYDEBUG 879 880# ifndef YYFPRINTF 881# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 882# define YYFPRINTF fprintf 883# endif 884 885# define YYDPRINTF(Args) \ 886do { \ 887 if (yydebug) \ 888 YYFPRINTF Args; \ 889} while (YYID (0)) 890 891# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 892do { \ 893 if (yydebug) \ 894 { \ 895 YYFPRINTF (stderr, "%s ", Title); \ 896 yy_symbol_print (stderr, \ 897 Type, Value); \ 898 YYFPRINTF (stderr, "\n"); \ 899 } \ 900} while (YYID (0)) 901 902 903/*--------------------------------. 904| Print this symbol on YYOUTPUT. | 905`--------------------------------*/ 906 907/*ARGSUSED*/ 908#if (defined __STDC__ || defined __C99__FUNC__ \ 909 || defined __cplusplus || defined _MSC_VER) 910static void 911yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 912#else 913static void 914yy_symbol_value_print (yyoutput, yytype, yyvaluep) 915 FILE *yyoutput; 916 int yytype; 917 YYSTYPE const * const yyvaluep; 918#endif 919{ 920 if (!yyvaluep) 921 return; 922# ifdef YYPRINT 923 if (yytype < YYNTOKENS) 924 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 925# else 926 YYUSE (yyoutput); 927# endif 928 switch (yytype) 929 { 930 default: 931 break; 932 } 933} 934 935 936/*--------------------------------. 937| Print this symbol on YYOUTPUT. | 938`--------------------------------*/ 939 940#if (defined __STDC__ || defined __C99__FUNC__ \ 941 || defined __cplusplus || defined _MSC_VER) 942static void 943yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 944#else 945static void 946yy_symbol_print (yyoutput, yytype, yyvaluep) 947 FILE *yyoutput; 948 int yytype; 949 YYSTYPE const * const yyvaluep; 950#endif 951{ 952 if (yytype < YYNTOKENS) 953 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 954 else 955 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 956 957 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 958 YYFPRINTF (yyoutput, ")"); 959} 960 961/*------------------------------------------------------------------. 962| yy_stack_print -- Print the state stack from its BOTTOM up to its | 963| TOP (included). | 964`------------------------------------------------------------------*/ 965 966#if (defined __STDC__ || defined __C99__FUNC__ \ 967 || defined __cplusplus || defined _MSC_VER) 968static void 969yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 970#else 971static void 972yy_stack_print (yybottom, yytop) 973 yytype_int16 *yybottom; 974 yytype_int16 *yytop; 975#endif 976{ 977 YYFPRINTF (stderr, "Stack now"); 978 for (; yybottom <= yytop; yybottom++) 979 { 980 int yybot = *yybottom; 981 YYFPRINTF (stderr, " %d", yybot); 982 } 983 YYFPRINTF (stderr, "\n"); 984} 985 986# define YY_STACK_PRINT(Bottom, Top) \ 987do { \ 988 if (yydebug) \ 989 yy_stack_print ((Bottom), (Top)); \ 990} while (YYID (0)) 991 992 993/*------------------------------------------------. 994| Report that the YYRULE is going to be reduced. | 995`------------------------------------------------*/ 996 997#if (defined __STDC__ || defined __C99__FUNC__ \ 998 || defined __cplusplus || defined _MSC_VER) 999static void 1000yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 1001#else 1002static void 1003yy_reduce_print (yyvsp, yyrule) 1004 YYSTYPE *yyvsp; 1005 int yyrule; 1006#endif 1007{ 1008 int yynrhs = yyr2[yyrule]; 1009 int yyi; 1010 unsigned long int yylno = yyrline[yyrule]; 1011 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 1012 yyrule - 1, yylno); 1013 /* The symbols being reduced. */ 1014 for (yyi = 0; yyi < yynrhs; yyi++) 1015 { 1016 YYFPRINTF (stderr, " $%d = ", yyi + 1); 1017 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 1018 &(yyvsp[(yyi + 1) - (yynrhs)]) 1019 ); 1020 YYFPRINTF (stderr, "\n"); 1021 } 1022} 1023 1024# define YY_REDUCE_PRINT(Rule) \ 1025do { \ 1026 if (yydebug) \ 1027 yy_reduce_print (yyvsp, Rule); \ 1028} while (YYID (0)) 1029 1030/* Nonzero means print parse trace. It is left uninitialized so that 1031 multiple parsers can coexist. */ 1032int yydebug; 1033#else /* !YYDEBUG */ 1034# define YYDPRINTF(Args) 1035# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1036# define YY_STACK_PRINT(Bottom, Top) 1037# define YY_REDUCE_PRINT(Rule) 1038#endif /* !YYDEBUG */ 1039 1040 1041/* YYINITDEPTH -- initial size of the parser's stacks. */ 1042#ifndef YYINITDEPTH 1043# define YYINITDEPTH 200 1044#endif 1045 1046/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1047 if the built-in stack extension method is used). 1048 1049 Do not make this value too large; the results are undefined if 1050 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1051 evaluated with infinite-precision integer arithmetic. */ 1052 1053#ifndef YYMAXDEPTH 1054# define YYMAXDEPTH 10000 1055#endif 1056 1057 1058 1059#if YYERROR_VERBOSE 1060 1061# ifndef yystrlen 1062# if defined __GLIBC__ && defined _STRING_H 1063# define yystrlen strlen 1064# else 1065/* Return the length of YYSTR. */ 1066#if (defined __STDC__ || defined __C99__FUNC__ \ 1067 || defined __cplusplus || defined _MSC_VER) 1068static YYSIZE_T 1069yystrlen (const char *yystr) 1070#else 1071static YYSIZE_T 1072yystrlen (yystr) 1073 const char *yystr; 1074#endif 1075{ 1076 YYSIZE_T yylen; 1077 for (yylen = 0; yystr[yylen]; yylen++) 1078 continue; 1079 return yylen; 1080} 1081# endif 1082# endif 1083 1084# ifndef yystpcpy 1085# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1086# define yystpcpy stpcpy 1087# else 1088/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1089 YYDEST. */ 1090#if (defined __STDC__ || defined __C99__FUNC__ \ 1091 || defined __cplusplus || defined _MSC_VER) 1092static char * 1093yystpcpy (char *yydest, const char *yysrc) 1094#else 1095static char * 1096yystpcpy (yydest, yysrc) 1097 char *yydest; 1098 const char *yysrc; 1099#endif 1100{ 1101 char *yyd = yydest; 1102 const char *yys = yysrc; 1103 1104 while ((*yyd++ = *yys++) != '\0') 1105 continue; 1106 1107 return yyd - 1; 1108} 1109# endif 1110# endif 1111 1112# ifndef yytnamerr 1113/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1114 quotes and backslashes, so that it's suitable for yyerror. The 1115 heuristic is that double-quoting is unnecessary unless the string 1116 contains an apostrophe, a comma, or backslash (other than 1117 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1118 null, do not copy; instead, return the length of what the result 1119 would have been. */ 1120static YYSIZE_T 1121yytnamerr (char *yyres, const char *yystr) 1122{ 1123 if (*yystr == '"') 1124 { 1125 YYSIZE_T yyn = 0; 1126 char const *yyp = yystr; 1127 1128 for (;;) 1129 switch (*++yyp) 1130 { 1131 case '\'': 1132 case ',': 1133 goto do_not_strip_quotes; 1134 1135 case '\\': 1136 if (*++yyp != '\\') 1137 goto do_not_strip_quotes; 1138 /* Fall through. */ 1139 default: 1140 if (yyres) 1141 yyres[yyn] = *yyp; 1142 yyn++; 1143 break; 1144 1145 case '"': 1146 if (yyres) 1147 yyres[yyn] = '\0'; 1148 return yyn; 1149 } 1150 do_not_strip_quotes: ; 1151 } 1152 1153 if (! yyres) 1154 return yystrlen (yystr); 1155 1156 return yystpcpy (yyres, yystr) - yyres; 1157} 1158# endif 1159 1160/* Copy into YYRESULT an error message about the unexpected token 1161 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1162 including the terminating null byte. If YYRESULT is null, do not 1163 copy anything; just return the number of bytes that would be 1164 copied. As a special case, return 0 if an ordinary "syntax error" 1165 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 1166 size calculation. */ 1167static YYSIZE_T 1168yysyntax_error (char *yyresult, int yystate, int yychar) 1169{ 1170 int yyn = yypact[yystate]; 1171 1172 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1173 return 0; 1174 else 1175 { 1176 int yytype = YYTRANSLATE (yychar); 1177 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1178 YYSIZE_T yysize = yysize0; 1179 YYSIZE_T yysize1; 1180 int yysize_overflow = 0; 1181 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1182 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1183 int yyx; 1184 1185# if 0 1186 /* This is so xgettext sees the translatable formats that are 1187 constructed on the fly. */ 1188 YY_("syntax error, unexpected %s"); 1189 YY_("syntax error, unexpected %s, expecting %s"); 1190 YY_("syntax error, unexpected %s, expecting %s or %s"); 1191 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1192 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1193# endif 1194 char *yyfmt; 1195 char const *yyf; 1196 static char const yyunexpected[] = "syntax error, unexpected %s"; 1197 static char const yyexpecting[] = ", expecting %s"; 1198 static char const yyor[] = " or %s"; 1199 char yyformat[sizeof yyunexpected 1200 + sizeof yyexpecting - 1 1201 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1202 * (sizeof yyor - 1))]; 1203 char const *yyprefix = yyexpecting; 1204 1205 /* Start YYX at -YYN if negative to avoid negative indexes in 1206 YYCHECK. */ 1207 int yyxbegin = yyn < 0 ? -yyn : 0; 1208 1209 /* Stay within bounds of both yycheck and yytname. */ 1210 int yychecklim = YYLAST - yyn + 1; 1211 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1212 int yycount = 1; 1213 1214 yyarg[0] = yytname[yytype]; 1215 yyfmt = yystpcpy (yyformat, yyunexpected); 1216 1217 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1218 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1219 { 1220 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1221 { 1222 yycount = 1; 1223 yysize = yysize0; 1224 yyformat[sizeof yyunexpected - 1] = '\0'; 1225 break; 1226 } 1227 yyarg[yycount++] = yytname[yyx]; 1228 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1229 yysize_overflow |= (yysize1 < yysize); 1230 yysize = yysize1; 1231 yyfmt = yystpcpy (yyfmt, yyprefix); 1232 yyprefix = yyor; 1233 } 1234 1235 yyf = YY_(yyformat); 1236 yysize1 = yysize + yystrlen (yyf); 1237 yysize_overflow |= (yysize1 < yysize); 1238 yysize = yysize1; 1239 1240 if (yysize_overflow) 1241 return YYSIZE_MAXIMUM; 1242 1243 if (yyresult) 1244 { 1245 /* Avoid sprintf, as that infringes on the user's name space. 1246 Don't have undefined behavior even if the translation 1247 produced a string with the wrong number of "%s"s. */ 1248 char *yyp = yyresult; 1249 int yyi = 0; 1250 while ((*yyp = *yyf) != '\0') 1251 { 1252 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1253 { 1254 yyp += yytnamerr (yyp, yyarg[yyi++]); 1255 yyf += 2; 1256 } 1257 else 1258 { 1259 yyp++; 1260 yyf++; 1261 } 1262 } 1263 } 1264 return yysize; 1265 } 1266} 1267#endif /* YYERROR_VERBOSE */ 1268 1269 1270/*-----------------------------------------------. 1271| Release the memory associated to this symbol. | 1272`-----------------------------------------------*/ 1273 1274/*ARGSUSED*/ 1275#if (defined __STDC__ || defined __C99__FUNC__ \ 1276 || defined __cplusplus || defined _MSC_VER) 1277static void 1278yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1279#else 1280static void 1281yydestruct (yymsg, yytype, yyvaluep) 1282 const char *yymsg; 1283 int yytype; 1284 YYSTYPE *yyvaluep; 1285#endif 1286{ 1287 YYUSE (yyvaluep); 1288 1289 if (!yymsg) 1290 yymsg = "Deleting"; 1291 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1292 1293 switch (yytype) 1294 { 1295 case 52: /* "choice_entry" */ 1296 1297 { 1298 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1299 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); 1300 if (current_menu == (yyvaluep->menu)) 1301 menu_end_menu(); 1302}; 1303 1304 break; 1305 case 58: /* "if_entry" */ 1306 1307 { 1308 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1309 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); 1310 if (current_menu == (yyvaluep->menu)) 1311 menu_end_menu(); 1312}; 1313 1314 break; 1315 case 64: /* "menu_entry" */ 1316 1317 { 1318 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1319 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); 1320 if (current_menu == (yyvaluep->menu)) 1321 menu_end_menu(); 1322}; 1323 1324 break; 1325 1326 default: 1327 break; 1328 } 1329} 1330 1331/* Prevent warnings from -Wmissing-prototypes. */ 1332#ifdef YYPARSE_PARAM 1333#if defined __STDC__ || defined __cplusplus 1334int yyparse (void *YYPARSE_PARAM); 1335#else 1336int yyparse (); 1337#endif 1338#else /* ! YYPARSE_PARAM */ 1339#if defined __STDC__ || defined __cplusplus 1340int yyparse (void); 1341#else 1342int yyparse (); 1343#endif 1344#endif /* ! YYPARSE_PARAM */ 1345 1346 1347/* The lookahead symbol. */ 1348int yychar; 1349 1350/* The semantic value of the lookahead symbol. */ 1351YYSTYPE yylval; 1352 1353/* Number of syntax errors so far. */ 1354int yynerrs; 1355 1356 1357 1358/*-------------------------. 1359| yyparse or yypush_parse. | 1360`-------------------------*/ 1361 1362#ifdef YYPARSE_PARAM 1363#if (defined __STDC__ || defined __C99__FUNC__ \ 1364 || defined __cplusplus || defined _MSC_VER) 1365int 1366yyparse (void *YYPARSE_PARAM) 1367#else 1368int 1369yyparse (YYPARSE_PARAM) 1370 void *YYPARSE_PARAM; 1371#endif 1372#else /* ! YYPARSE_PARAM */ 1373#if (defined __STDC__ || defined __C99__FUNC__ \ 1374 || defined __cplusplus || defined _MSC_VER) 1375int 1376yyparse (void) 1377#else 1378int 1379yyparse () 1380 1381#endif 1382#endif 1383{ 1384 1385 1386 int yystate; 1387 /* Number of tokens to shift before error messages enabled. */ 1388 int yyerrstatus; 1389 1390 /* The stacks and their tools: 1391 `yyss': related to states. 1392 `yyvs': related to semantic values. 1393 1394 Refer to the stacks thru separate pointers, to allow yyoverflow 1395 to reallocate them elsewhere. */ 1396 1397 /* The state stack. */ 1398 yytype_int16 yyssa[YYINITDEPTH]; 1399 yytype_int16 *yyss; 1400 yytype_int16 *yyssp; 1401 1402 /* The semantic value stack. */ 1403 YYSTYPE yyvsa[YYINITDEPTH]; 1404 YYSTYPE *yyvs; 1405 YYSTYPE *yyvsp; 1406 1407 YYSIZE_T yystacksize; 1408 1409 int yyn; 1410 int yyresult; 1411 /* Lookahead token as an internal (translated) token number. */ 1412 int yytoken; 1413 /* The variables used to return semantic value and location from the 1414 action routines. */ 1415 YYSTYPE yyval; 1416 1417#if YYERROR_VERBOSE 1418 /* Buffer for error messages, and its allocated size. */ 1419 char yymsgbuf[128]; 1420 char *yymsg = yymsgbuf; 1421 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1422#endif 1423 1424#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1425 1426 /* The number of symbols on the RHS of the reduced rule. 1427 Keep to zero when no symbol should be popped. */ 1428 int yylen = 0; 1429 1430 yytoken = 0; 1431 yyss = yyssa; 1432 yyvs = yyvsa; 1433 yystacksize = YYINITDEPTH; 1434 1435 YYDPRINTF ((stderr, "Starting parse\n")); 1436 1437 yystate = 0; 1438 yyerrstatus = 0; 1439 yynerrs = 0; 1440 yychar = YYEMPTY; /* Cause a token to be read. */ 1441 1442 /* Initialize stack pointers. 1443 Waste one element of value and location stack 1444 so that they stay on the same level as the state stack. 1445 The wasted elements are never initialized. */ 1446 yyssp = yyss; 1447 yyvsp = yyvs; 1448 1449 goto yysetstate; 1450 1451/*------------------------------------------------------------. 1452| yynewstate -- Push a new state, which is found in yystate. | 1453`------------------------------------------------------------*/ 1454 yynewstate: 1455 /* In all cases, when you get here, the value and location stacks 1456 have just been pushed. So pushing a state here evens the stacks. */ 1457 yyssp++; 1458 1459 yysetstate: 1460 *yyssp = yystate; 1461 1462 if (yyss + yystacksize - 1 <= yyssp) 1463 { 1464 /* Get the current used size of the three stacks, in elements. */ 1465 YYSIZE_T yysize = yyssp - yyss + 1; 1466 1467#ifdef yyoverflow 1468 { 1469 /* Give user a chance to reallocate the stack. Use copies of 1470 these so that the &'s don't force the real ones into 1471 memory. */ 1472 YYSTYPE *yyvs1 = yyvs; 1473 yytype_int16 *yyss1 = yyss; 1474 1475 /* Each stack pointer address is followed by the size of the 1476 data in use in that stack, in bytes. This used to be a 1477 conditional around just the two extra args, but that might 1478 be undefined if yyoverflow is a macro. */ 1479 yyoverflow (YY_("memory exhausted"), 1480 &yyss1, yysize * sizeof (*yyssp), 1481 &yyvs1, yysize * sizeof (*yyvsp), 1482 &yystacksize); 1483 1484 yyss = yyss1; 1485 yyvs = yyvs1; 1486 } 1487#else /* no yyoverflow */ 1488# ifndef YYSTACK_RELOCATE 1489 goto yyexhaustedlab; 1490# else 1491 /* Extend the stack our own way. */ 1492 if (YYMAXDEPTH <= yystacksize) 1493 goto yyexhaustedlab; 1494 yystacksize *= 2; 1495 if (YYMAXDEPTH < yystacksize) 1496 yystacksize = YYMAXDEPTH; 1497 1498 { 1499 yytype_int16 *yyss1 = yyss; 1500 union yyalloc *yyptr = 1501 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1502 if (! yyptr) 1503 goto yyexhaustedlab; 1504 YYSTACK_RELOCATE (yyss_alloc, yyss); 1505 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1506# undef YYSTACK_RELOCATE 1507 if (yyss1 != yyssa) 1508 YYSTACK_FREE (yyss1); 1509 } 1510# endif 1511#endif /* no yyoverflow */ 1512 1513 yyssp = yyss + yysize - 1; 1514 yyvsp = yyvs + yysize - 1; 1515 1516 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1517 (unsigned long int) yystacksize)); 1518 1519 if (yyss + yystacksize - 1 <= yyssp) 1520 YYABORT; 1521 } 1522 1523 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1524 1525 if (yystate == YYFINAL) 1526 YYACCEPT; 1527 1528 goto yybackup; 1529 1530/*-----------. 1531| yybackup. | 1532`-----------*/ 1533yybackup: 1534 1535 /* Do appropriate processing given the current state. Read a 1536 lookahead token if we need one and don't already have one. */ 1537 1538 /* First try to decide what to do without reference to lookahead token. */ 1539 yyn = yypact[yystate]; 1540 if (yyn == YYPACT_NINF) 1541 goto yydefault; 1542 1543 /* Not known => get a lookahead token if don't already have one. */ 1544 1545 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1546 if (yychar == YYEMPTY) 1547 { 1548 YYDPRINTF ((stderr, "Reading a token: ")); 1549 yychar = YYLEX; 1550 } 1551 1552 if (yychar <= YYEOF) 1553 { 1554 yychar = yytoken = YYEOF; 1555 YYDPRINTF ((stderr, "Now at end of input.\n")); 1556 } 1557 else 1558 { 1559 yytoken = YYTRANSLATE (yychar); 1560 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1561 } 1562 1563 /* If the proper action on seeing token YYTOKEN is to reduce or to 1564 detect an error, take that action. */ 1565 yyn += yytoken; 1566 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1567 goto yydefault; 1568 yyn = yytable[yyn]; 1569 if (yyn <= 0) 1570 { 1571 if (yyn == 0 || yyn == YYTABLE_NINF) 1572 goto yyerrlab; 1573 yyn = -yyn; 1574 goto yyreduce; 1575 } 1576 1577 /* Count tokens shifted since error; after three, turn off error 1578 status. */ 1579 if (yyerrstatus) 1580 yyerrstatus--; 1581 1582 /* Shift the lookahead token. */ 1583 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1584 1585 /* Discard the shifted token. */ 1586 yychar = YYEMPTY; 1587 1588 yystate = yyn; 1589 *++yyvsp = yylval; 1590 1591 goto yynewstate; 1592 1593 1594/*-----------------------------------------------------------. 1595| yydefault -- do the default action for the current state. | 1596`-----------------------------------------------------------*/ 1597yydefault: 1598 yyn = yydefact[yystate]; 1599 if (yyn == 0) 1600 goto yyerrlab; 1601 goto yyreduce; 1602 1603 1604/*-----------------------------. 1605| yyreduce -- Do a reduction. | 1606`-----------------------------*/ 1607yyreduce: 1608 /* yyn is the number of a rule to reduce with. */ 1609 yylen = yyr2[yyn]; 1610 1611 /* If YYLEN is nonzero, implement the default value of the action: 1612 `$$ = $1'. 1613 1614 Otherwise, the following line sets YYVAL to garbage. 1615 This behavior is undocumented and Bison 1616 users should not rely upon it. Assigning to YYVAL 1617 unconditionally makes the parser a bit smaller, and it avoids a 1618 GCC warning that YYVAL may be used uninitialized. */ 1619 yyval = yyvsp[1-yylen]; 1620 1621 1622 YY_REDUCE_PRINT (yyn); 1623 switch (yyn) 1624 { 1625 case 10: 1626 1627 { zconf_error("unexpected end statement"); ;} 1628 break; 1629 1630 case 11: 1631 1632 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} 1633 break; 1634 1635 case 12: 1636 1637 { 1638 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); 1639;} 1640 break; 1641 1642 case 13: 1643 1644 { zconf_error("invalid statement"); ;} 1645 break; 1646 1647 case 27: 1648 1649 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} 1650 break; 1651 1652 case 28: 1653 1654 { zconf_error("invalid option"); ;} 1655 break; 1656 1657 case 29: 1658 1659 { 1660 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1661 sym->flags |= SYMBOL_OPTIONAL; 1662 menu_add_entry(sym); 1663 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1664;} 1665 break; 1666 1667 case 30: 1668 1669 { 1670 menu_end_entry(); 1671 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); 1672;} 1673 break; 1674 1675 case 31: 1676 1677 { 1678 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1679 sym->flags |= SYMBOL_OPTIONAL; 1680 menu_add_entry(sym); 1681 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1682;} 1683 break; 1684 1685 case 32: 1686 1687 { 1688 if (current_entry->prompt) 1689 current_entry->prompt->type = P_MENU; 1690 else 1691 zconfprint("warning: menuconfig statement without prompt"); 1692 menu_end_entry(); 1693 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); 1694;} 1695 break; 1696 1697 case 40: 1698 1699 { 1700 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1701 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 1702 zconf_curname(), zconf_lineno(), 1703 (yyvsp[(1) - (3)].id)->stype); 1704;} 1705 break; 1706 1707 case 41: 1708 1709 { 1710 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1711 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 1712;} 1713 break; 1714 1715 case 42: 1716 1717 { 1718 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); 1719 if ((yyvsp[(1) - (4)].id)->stype != S_UNKNOWN) 1720 menu_set_type((yyvsp[(1) - (4)].id)->stype); 1721 printd(DEBUG_PARSE, "%s:%d:default(%u)\n", 1722 zconf_curname(), zconf_lineno(), 1723 (yyvsp[(1) - (4)].id)->stype); 1724;} 1725 break; 1726 1727 case 43: 1728 1729 { 1730 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1731 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); 1732;} 1733 break; 1734 1735 case 44: 1736 1737 { 1738 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); 1739 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); 1740;} 1741 break; 1742 1743 case 47: 1744 1745 { 1746 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); 1747 if (id && id->flags & TF_OPTION) 1748 menu_add_option(id->token, (yyvsp[(3) - (3)].string)); 1749 else 1750 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string)); 1751 free((yyvsp[(2) - (3)].string)); 1752;} 1753 break; 1754 1755 case 48: 1756 1757 { (yyval.string) = NULL; ;} 1758 break; 1759 1760 case 49: 1761 1762 { (yyval.string) = (yyvsp[(2) - (2)].string); ;} 1763 break; 1764 1765 case 50: 1766 1767 { 1768 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); 1769 sym->flags |= SYMBOL_AUTO; 1770 menu_add_entry(sym); 1771 menu_add_expr(P_CHOICE, NULL, NULL); 1772 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); 1773;} 1774 break; 1775 1776 case 51: 1777 1778 { 1779 (yyval.menu) = menu_add_menu(); 1780;} 1781 break; 1782 1783 case 52: 1784 1785 { 1786 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { 1787 menu_end_menu(); 1788 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); 1789 } 1790;} 1791 break; 1792 1793 case 60: 1794 1795 { 1796 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1797 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 1798;} 1799 break; 1800 1801 case 61: 1802 1803 { 1804 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { 1805 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1806 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 1807 zconf_curname(), zconf_lineno(), 1808 (yyvsp[(1) - (3)].id)->stype); 1809 } else 1810 YYERROR; 1811;} 1812 break; 1813 1814 case 62: 1815 1816 { 1817 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1818 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); 1819;} 1820 break; 1821 1822 case 63: 1823 1824 { 1825 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { 1826 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1827 printd(DEBUG_PARSE, "%s:%d:default\n", 1828 zconf_curname(), zconf_lineno()); 1829 } else 1830 YYERROR; 1831;} 1832 break; 1833 1834 case 66: 1835 1836 { 1837 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 1838 menu_add_entry(NULL); 1839 menu_add_dep((yyvsp[(2) - (3)].expr)); 1840 (yyval.menu) = menu_add_menu(); 1841;} 1842 break; 1843 1844 case 67: 1845 1846 { 1847 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { 1848 menu_end_menu(); 1849 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); 1850 } 1851;} 1852 break; 1853 1854 case 73: 1855 1856 { 1857 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1858;} 1859 break; 1860 1861 case 74: 1862 1863 { 1864 menu_add_entry(NULL); 1865 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1866 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 1867;} 1868 break; 1869 1870 case 75: 1871 1872 { 1873 (yyval.menu) = menu_add_menu(); 1874;} 1875 break; 1876 1877 case 76: 1878 1879 { 1880 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { 1881 menu_end_menu(); 1882 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); 1883 } 1884;} 1885 break; 1886 1887 case 82: 1888 1889 { 1890 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1891 zconf_nextfile((yyvsp[(2) - (3)].string)); 1892;} 1893 break; 1894 1895 case 83: 1896 1897 { 1898 menu_add_entry(NULL); 1899 menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL); 1900 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); 1901;} 1902 break; 1903 1904 case 84: 1905 1906 { 1907 menu_end_entry(); 1908;} 1909 break; 1910 1911 case 85: 1912 1913 { 1914 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1915 zconf_starthelp(); 1916;} 1917 break; 1918 1919 case 86: 1920 1921 { 1922 current_entry->help = (yyvsp[(2) - (2)].string); 1923;} 1924 break; 1925 1926 case 91: 1927 1928 { 1929 menu_add_dep((yyvsp[(3) - (4)].expr)); 1930 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); 1931;} 1932 break; 1933 1934 case 93: 1935 1936 { 1937 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); 1938;} 1939 break; 1940 1941 case 96: 1942 1943 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1944 break; 1945 1946 case 97: 1947 1948 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1949 break; 1950 1951 case 98: 1952 1953 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1954 break; 1955 1956 case 101: 1957 1958 { (yyval.expr) = NULL; ;} 1959 break; 1960 1961 case 102: 1962 1963 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} 1964 break; 1965 1966 case 103: 1967 1968 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} 1969 break; 1970 1971 case 104: 1972 1973 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1974 break; 1975 1976 case 105: 1977 1978 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1979 break; 1980 1981 case 106: 1982 1983 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} 1984 break; 1985 1986 case 107: 1987 1988 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} 1989 break; 1990 1991 case 108: 1992 1993 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 1994 break; 1995 1996 case 109: 1997 1998 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 1999 break; 2000 2001 case 110: 2002 2003 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} 2004 break; 2005 2006 case 111: 2007 2008 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} 2009 break; 2010 2011 case 112: 2012 2013 { (yyval.string) = NULL; ;} 2014 break; 2015 2016 2017 2018 default: break; 2019 } 2020 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2021 2022 YYPOPSTACK (yylen); 2023 yylen = 0; 2024 YY_STACK_PRINT (yyss, yyssp); 2025 2026 *++yyvsp = yyval; 2027 2028 /* Now `shift' the result of the reduction. Determine what state 2029 that goes to, based on the state we popped back to and the rule 2030 number reduced by. */ 2031 2032 yyn = yyr1[yyn]; 2033 2034 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2035 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2036 yystate = yytable[yystate]; 2037 else 2038 yystate = yydefgoto[yyn - YYNTOKENS]; 2039 2040 goto yynewstate; 2041 2042 2043/*------------------------------------. 2044| yyerrlab -- here on detecting error | 2045`------------------------------------*/ 2046yyerrlab: 2047 /* If not already recovering from an error, report this error. */ 2048 if (!yyerrstatus) 2049 { 2050 ++yynerrs; 2051#if ! YYERROR_VERBOSE 2052 yyerror (YY_("syntax error")); 2053#else 2054 { 2055 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 2056 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 2057 { 2058 YYSIZE_T yyalloc = 2 * yysize; 2059 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 2060 yyalloc = YYSTACK_ALLOC_MAXIMUM; 2061 if (yymsg != yymsgbuf) 2062 YYSTACK_FREE (yymsg); 2063 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 2064 if (yymsg) 2065 yymsg_alloc = yyalloc; 2066 else 2067 { 2068 yymsg = yymsgbuf; 2069 yymsg_alloc = sizeof yymsgbuf; 2070 } 2071 } 2072 2073 if (0 < yysize && yysize <= yymsg_alloc) 2074 { 2075 (void) yysyntax_error (yymsg, yystate, yychar); 2076 yyerror (yymsg); 2077 } 2078 else 2079 { 2080 yyerror (YY_("syntax error")); 2081 if (yysize != 0) 2082 goto yyexhaustedlab; 2083 } 2084 } 2085#endif 2086 } 2087 2088 2089 2090 if (yyerrstatus == 3) 2091 { 2092 /* If just tried and failed to reuse lookahead token after an 2093 error, discard it. */ 2094 2095 if (yychar <= YYEOF) 2096 { 2097 /* Return failure if at end of input. */ 2098 if (yychar == YYEOF) 2099 YYABORT; 2100 } 2101 else 2102 { 2103 yydestruct ("Error: discarding", 2104 yytoken, &yylval); 2105 yychar = YYEMPTY; 2106 } 2107 } 2108 2109 /* Else will try to reuse lookahead token after shifting the error 2110 token. */ 2111 goto yyerrlab1; 2112 2113 2114/*---------------------------------------------------. 2115| yyerrorlab -- error raised explicitly by YYERROR. | 2116`---------------------------------------------------*/ 2117yyerrorlab: 2118 2119 /* Pacify compilers like GCC when the user code never invokes 2120 YYERROR and the label yyerrorlab therefore never appears in user 2121 code. */ 2122 if (/*CONSTCOND*/ 0) 2123 goto yyerrorlab; 2124 2125 /* Do not reclaim the symbols of the rule which action triggered 2126 this YYERROR. */ 2127 YYPOPSTACK (yylen); 2128 yylen = 0; 2129 YY_STACK_PRINT (yyss, yyssp); 2130 yystate = *yyssp; 2131 goto yyerrlab1; 2132 2133 2134/*-------------------------------------------------------------. 2135| yyerrlab1 -- common code for both syntax error and YYERROR. | 2136`-------------------------------------------------------------*/ 2137yyerrlab1: 2138 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2139 2140 for (;;) 2141 { 2142 yyn = yypact[yystate]; 2143 if (yyn != YYPACT_NINF) 2144 { 2145 yyn += YYTERROR; 2146 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2147 { 2148 yyn = yytable[yyn]; 2149 if (0 < yyn) 2150 break; 2151 } 2152 } 2153 2154 /* Pop the current state because it cannot handle the error token. */ 2155 if (yyssp == yyss) 2156 YYABORT; 2157 2158 2159 yydestruct ("Error: popping", 2160 yystos[yystate], yyvsp); 2161 YYPOPSTACK (1); 2162 yystate = *yyssp; 2163 YY_STACK_PRINT (yyss, yyssp); 2164 } 2165 2166 *++yyvsp = yylval; 2167 2168 2169 /* Shift the error token. */ 2170 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2171 2172 yystate = yyn; 2173 goto yynewstate; 2174 2175 2176/*-------------------------------------. 2177| yyacceptlab -- YYACCEPT comes here. | 2178`-------------------------------------*/ 2179yyacceptlab: 2180 yyresult = 0; 2181 goto yyreturn; 2182 2183/*-----------------------------------. 2184| yyabortlab -- YYABORT comes here. | 2185`-----------------------------------*/ 2186yyabortlab: 2187 yyresult = 1; 2188 goto yyreturn; 2189 2190#if !defined(yyoverflow) || YYERROR_VERBOSE 2191/*-------------------------------------------------. 2192| yyexhaustedlab -- memory exhaustion comes here. | 2193`-------------------------------------------------*/ 2194yyexhaustedlab: 2195 yyerror (YY_("memory exhausted")); 2196 yyresult = 2; 2197 /* Fall through. */ 2198#endif 2199 2200yyreturn: 2201 if (yychar != YYEMPTY) 2202 yydestruct ("Cleanup: discarding lookahead", 2203 yytoken, &yylval); 2204 /* Do not reclaim the symbols of the rule which action triggered 2205 this YYABORT or YYACCEPT. */ 2206 YYPOPSTACK (yylen); 2207 YY_STACK_PRINT (yyss, yyssp); 2208 while (yyssp != yyss) 2209 { 2210 yydestruct ("Cleanup: popping", 2211 yystos[*yyssp], yyvsp); 2212 YYPOPSTACK (1); 2213 } 2214#ifndef yyoverflow 2215 if (yyss != yyssa) 2216 YYSTACK_FREE (yyss); 2217#endif 2218#if YYERROR_VERBOSE 2219 if (yymsg != yymsgbuf) 2220 YYSTACK_FREE (yymsg); 2221#endif 2222 /* Make sure YYID is used. */ 2223 return YYID (yyresult); 2224} 2225 2226 2227 2228 2229 2230void conf_parse(const char *name) 2231{ 2232 struct symbol *sym; 2233 int i; 2234 2235 zconf_initscan(name); 2236 2237 sym_init(); 2238 _menu_init(); 2239 modules_sym = sym_lookup(NULL, 0); 2240 modules_sym->type = S_BOOLEAN; 2241 modules_sym->flags |= SYMBOL_AUTO; 2242 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 2243 2244#if YYDEBUG 2245 if (getenv("ZCONF_DEBUG")) 2246 zconfdebug = 1; 2247#endif 2248 zconfparse(); 2249 if (zconfnerrs) 2250 exit(1); 2251 if (!modules_sym->prop) { 2252 struct property *prop; 2253 2254 prop = prop_alloc(P_DEFAULT, modules_sym); 2255 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); 2256 } 2257 2258 rootmenu.prompt->text = _(rootmenu.prompt->text); 2259 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); 2260 2261 menu_finalize(&rootmenu); 2262 for_all_symbols(i, sym) { 2263 if (sym_check_deps(sym)) 2264 zconfnerrs++; 2265 } 2266 if (zconfnerrs) 2267 exit(1); 2268 sym_set_change_count(1); 2269} 2270 2271static const char *zconf_tokenname(int token) 2272{ 2273 switch (token) { 2274 case T_MENU: return "menu"; 2275 case T_ENDMENU: return "endmenu"; 2276 case T_CHOICE: return "choice"; 2277 case T_ENDCHOICE: return "endchoice"; 2278 case T_IF: return "if"; 2279 case T_ENDIF: return "endif"; 2280 case T_DEPENDS: return "depends"; 2281 } 2282 return "<token>"; 2283} 2284 2285static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) 2286{ 2287 if (id->token != endtoken) { 2288 zconf_error("unexpected '%s' within %s block", 2289 kconf_id_strings + id->name, zconf_tokenname(starttoken)); 2290 zconfnerrs++; 2291 return false; 2292 } 2293 if (current_menu->file != current_file) { 2294 zconf_error("'%s' in different file than '%s'", 2295 kconf_id_strings + id->name, zconf_tokenname(starttoken)); 2296 fprintf(stderr, "%s:%d: location of the '%s'\n", 2297 current_menu->file->name, current_menu->lineno, 2298 zconf_tokenname(starttoken)); 2299 zconfnerrs++; 2300 return false; 2301 } 2302 return true; 2303} 2304 2305static void zconfprint(const char *err, ...) 2306{ 2307 va_list ap; 2308 2309 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); 2310 va_start(ap, err); 2311 vfprintf(stderr, err, ap); 2312 va_end(ap); 2313 fprintf(stderr, "\n"); 2314} 2315 2316static void zconf_error(const char *err, ...) 2317{ 2318 va_list ap; 2319 2320 zconfnerrs++; 2321 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); 2322 va_start(ap, err); 2323 vfprintf(stderr, err, ap); 2324 va_end(ap); 2325 fprintf(stderr, "\n"); 2326} 2327 2328static void zconferror(const char *err) 2329{ 2330#if YYDEBUG 2331 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); 2332#endif 2333} 2334 2335static void print_quoted_string(FILE *out, const char *str) 2336{ 2337 const char *p; 2338 int len; 2339 2340 putc('"', out); 2341 while ((p = strchr(str, '"'))) { 2342 len = p - str; 2343 if (len) 2344 fprintf(out, "%.*s", len, str); 2345 fputs("\\\"", out); 2346 str = p + 1; 2347 } 2348 fputs(str, out); 2349 putc('"', out); 2350} 2351 2352static void print_symbol(FILE *out, struct menu *menu) 2353{ 2354 struct symbol *sym = menu->sym; 2355 struct property *prop; 2356 2357 if (sym_is_choice(sym)) 2358 fprintf(out, "\nchoice\n"); 2359 else 2360 fprintf(out, "\nconfig %s\n", sym->name); 2361 switch (sym->type) { 2362 case S_BOOLEAN: 2363 fputs(" boolean\n", out); 2364 break; 2365 case S_TRISTATE: 2366 fputs(" tristate\n", out); 2367 break; 2368 case S_STRING: 2369 fputs(" string\n", out); 2370 break; 2371 case S_INT: 2372 fputs(" integer\n", out); 2373 break; 2374 case S_HEX: 2375 fputs(" hex\n", out); 2376 break; 2377 default: 2378 fputs(" ???\n", out); 2379 break; 2380 } 2381 for (prop = sym->prop; prop; prop = prop->next) { 2382 if (prop->menu != menu) 2383 continue; 2384 switch (prop->type) { 2385 case P_PROMPT: 2386 fputs(" prompt ", out); 2387 print_quoted_string(out, prop->text); 2388 if (!expr_is_yes(prop->visible.expr)) { 2389 fputs(" if ", out); 2390 expr_fprint(prop->visible.expr, out); 2391 } 2392 fputc('\n', out); 2393 break; 2394 case P_DEFAULT: 2395 fputs( " default ", out); 2396 expr_fprint(prop->expr, out); 2397 if (!expr_is_yes(prop->visible.expr)) { 2398 fputs(" if ", out); 2399 expr_fprint(prop->visible.expr, out); 2400 } 2401 fputc('\n', out); 2402 break; 2403 case P_CHOICE: 2404 fputs(" #choice value\n", out); 2405 break; 2406 case P_SELECT: 2407 fputs( " select ", out); 2408 expr_fprint(prop->expr, out); 2409 fputc('\n', out); 2410 break; 2411 case P_RANGE: 2412 fputs( " range ", out); 2413 expr_fprint(prop->expr, out); 2414 fputc('\n', out); 2415 break; 2416 case P_MENU: 2417 fputs( " menu ", out); 2418 print_quoted_string(out, prop->text); 2419 fputc('\n', out); 2420 break; 2421 default: 2422 fprintf(out, " unknown prop %d!\n", prop->type); 2423 break; 2424 } 2425 } 2426 if (menu->help) { 2427 int len = strlen(menu->help); 2428 while (menu->help[--len] == '\n') 2429 menu->help[len] = 0; 2430 fprintf(out, " help\n%s\n", menu->help); 2431 } 2432} 2433 2434void zconfdump(FILE *out) 2435{ 2436 struct property *prop; 2437 struct symbol *sym; 2438 struct menu *menu; 2439 2440 menu = rootmenu.list; 2441 while (menu) { 2442 if ((sym = menu->sym)) 2443 print_symbol(out, menu); 2444 else if ((prop = menu->prompt)) { 2445 switch (prop->type) { 2446 case P_COMMENT: 2447 fputs("\ncomment ", out); 2448 print_quoted_string(out, prop->text); 2449 fputs("\n", out); 2450 break; 2451 case P_MENU: 2452 fputs("\nmenu ", out); 2453 print_quoted_string(out, prop->text); 2454 fputs("\n", out); 2455 break; 2456 default: 2457 ; 2458 } 2459 if (!expr_is_yes(prop->visible.expr)) { 2460 fputs(" depends ", out); 2461 expr_fprint(prop->visible.expr, out); 2462 fputc('\n', out); 2463 } 2464 } 2465 2466 if (menu->list) 2467 menu = menu->list; 2468 else if (menu->next) 2469 menu = menu->next; 2470 else while ((menu = menu->parent)) { 2471 if (menu->prompt && menu->prompt->type == P_MENU) 2472 fputs("\nendmenu\n", out); 2473 if (menu->next) { 2474 menu = menu->next; 2475 break; 2476 } 2477 } 2478 } 2479} 2480 2481#include "lex.zconf.c" 2482#include "util.c" 2483#include "confdata.c" 2484#include "expr.c" 2485#include "symbol.c" 2486#include "menu.c" 2487