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