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