1 /* A Bison parser, made by GNU Bison 2.1. */
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.
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)
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.
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. */
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. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
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. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
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
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
103 #define T_MAINMENU 258
105 #define T_ENDMENU 260
108 #define T_ENDCHOICE 263
109 #define T_COMMENT 264
111 #define T_MENUCONFIG 266
113 #define T_HELPTEXT 268
116 #define T_DEPENDS 271
117 #define T_REQUIRES 272
118 #define T_OPTIONAL 273
121 #define T_DEFAULT 276
127 #define T_WORD_QUOTE 282
128 #define T_UNEQUAL 283
129 #define T_CLOSE_PAREN 284
130 #define T_OPEN_PAREN 285
140 /* Copy the first part of user declarations. */
144 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
145 * Released under the terms of the GNU GPL v2.0.
155 #define LKC_DIRECT_LINK
158 #include "zconf.hash.c"
160 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
162 #define PRINTD 0x0001
163 #define DEBUG_PARSE 0x0002
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);
173 struct symbol *symbol_hash[257];
175 static struct menu *current_menu, *current_entry;
179 #define YYERROR_VERBOSE
183 /* Enabling traces. */
188 /* Enabling verbose error messages. */
189 #ifdef YYERROR_VERBOSE
190 # undef YYERROR_VERBOSE
191 # define YYERROR_VERBOSE 1
193 # define YYERROR_VERBOSE 0
196 /* Enabling the token table. */
197 #ifndef YYTOKEN_TABLE
198 # define YYTOKEN_TABLE 0
201 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
203 typedef union YYSTYPE {
206 struct symbol *symbol;
211 /* Line 196 of yacc.c. */
213 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
214 # define YYSTYPE_IS_DECLARED 1
215 # define YYSTYPE_IS_TRIVIAL 1
220 /* Copy the second part of user declarations. */
223 /* Line 219 of yacc.c. */
226 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
227 # define YYSIZE_T __SIZE_TYPE__
229 #if ! defined (YYSIZE_T) && defined (size_t)
230 # define YYSIZE_T size_t
232 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
233 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
234 # define YYSIZE_T size_t
236 #if ! defined (YYSIZE_T)
237 # define YYSIZE_T unsigned int
243 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
244 # define YY_(msgid) dgettext ("bison-runtime", msgid)
248 # define YY_(msgid) msgid
252 #if ! defined (yyoverflow) || YYERROR_VERBOSE
254 /* The parser invokes alloca or malloc; define the necessary symbols. */
256 # ifdef YYSTACK_USE_ALLOCA
257 # if YYSTACK_USE_ALLOCA
259 # define YYSTACK_ALLOC __builtin_alloca
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
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 */
281 # define YYSTACK_ALLOC YYMALLOC
282 # define YYSTACK_FREE YYFREE
283 # ifndef YYSTACK_ALLOC_MAXIMUM
284 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
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 */
298 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
299 && (defined (__STDC__) || defined (__cplusplus)))
300 void free (void *); /* INFRINGES ON USER NAME SPACE */
307 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
310 #if (! defined (yyoverflow) \
311 && (! defined (__cplusplus) \
312 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
314 /* A type that is properly aligned for any stack member. */
321 /* The size of the maximum gap between one aligned stack and the next. */
322 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
324 /* The size of an array large to enough to hold all stacks, each with
326 # define YYSTACK_BYTES(N) \
327 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
328 + YYSTACK_GAP_MAXIMUM)
330 /* Copy COUNT objects from FROM to TO. The source and destination do
333 # if defined (__GNUC__) && 1 < __GNUC__
334 # define YYCOPY(To, From, Count) \
335 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
337 # define YYCOPY(To, From, Count) \
341 for (yyi = 0; yyi < (Count); yyi++) \
342 (To)[yyi] = (From)[yyi]; \
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
353 # define YYSTACK_RELOCATE(Stack) \
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); \
366 #if defined (__STDC__) || defined (__cplusplus)
367 typedef signed char yysigned_char;
369 typedef short int yysigned_char;
372 /* YYFINAL -- State number of the termination state. */
374 /* YYLAST -- Last index in YYTABLE. */
377 /* YYNTOKENS -- Number of terminals. */
379 /* YYNNTS -- Number of nonterminals. */
381 /* YYNRULES -- Number of rules. */
383 /* YYNRULES -- Number of states. */
384 #define YYNSTATES 183
386 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
388 #define YYMAXUTOK 290
390 #define YYTRANSLATE(YYX) \
391 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
393 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
394 static const unsigned char yytranslate[] =
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,
429 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
431 static const unsigned short int yyprhs[] =
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,
447 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
448 static const yysigned_char yyrhs[] =
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
485 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
486 static const unsigned short int yyrline[] =
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,
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[] =
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
528 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
530 static const unsigned short int yytoknum[] =
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
539 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
540 static const unsigned char yyr1[] =
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,
556 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
557 static const unsigned char yyr2[] =
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,
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[] =
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,
599 /* YYDEFGOTO[NTERM-NUM]. */
600 static const short int yydefgoto[] =
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,
609 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
611 #define YYPACT_NINF -135
612 static const short int yypact[] =
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,
635 /* YYPGOTO[NTERM-NUM]. */
636 static const short int yypgoto[] =
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
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[] =
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,
682 static const short int yycheck[] =
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
714 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
715 symbol of state STATE-NUM. */
716 static const unsigned char yystos[] =
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,
739 #define yyerrok (yyerrstatus = 0)
740 #define yyclearin (yychar = YYEMPTY)
744 #define YYACCEPT goto yyacceptlab
745 #define YYABORT goto yyabortlab
746 #define YYERROR goto yyerrorlab
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. */
753 #define YYFAIL goto yyerrlab
755 #define YYRECOVERING() (!!yyerrstatus)
757 #define YYBACKUP(Token, Value) \
759 if (yychar == YYEMPTY && yylen == 1) \
763 yytoken = YYTRANSLATE (yychar); \
769 yyerror (YY_("syntax error: cannot back up")); \
776 #define YYERRCODE 256
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). */
783 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
784 #ifndef YYLLOC_DEFAULT
785 # define YYLLOC_DEFAULT(Current, Rhs, N) \
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; \
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; \
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. */
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)
816 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
821 /* YYLEX -- calling `yylex' with the right arguments. */
824 # define YYLEX yylex (YYLEX_PARAM)
826 # define YYLEX yylex ()
829 /* Enable debugging if requested. */
833 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
834 # define YYFPRINTF fprintf
837 # define YYDPRINTF(Args) \
843 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
847 YYFPRINTF (stderr, "%s ", Title); \
848 yysymprint (stderr, \
850 YYFPRINTF (stderr, "\n"); \
854 /*------------------------------------------------------------------.
855 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
857 `------------------------------------------------------------------*/
859 #if defined (__STDC__) || defined (__cplusplus)
861 yy_stack_print (short int *bottom, short int *top)
864 yy_stack_print (bottom, top)
869 YYFPRINTF (stderr, "Stack now");
870 for (/* Nothing. */; bottom <= top; ++bottom)
871 YYFPRINTF (stderr, " %d", *bottom);
872 YYFPRINTF (stderr, "\n");
875 # define YY_STACK_PRINT(Bottom, Top) \
878 yy_stack_print ((Bottom), (Top)); \
882 /*------------------------------------------------.
883 | Report that the YYRULE is going to be reduced. |
884 `------------------------------------------------*/
886 #if defined (__STDC__) || defined (__cplusplus)
888 yy_reduce_print (int yyrule)
891 yy_reduce_print (yyrule)
896 unsigned long int yylno = yyrline[yyrule];
897 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
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]]);
905 # define YY_REDUCE_PRINT(Rule) \
908 yy_reduce_print (Rule); \
911 /* Nonzero means print parse trace. It is left uninitialized so that
912 multiple parsers can coexist. */
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 */
922 /* YYINITDEPTH -- initial size of the parser's stacks. */
924 # define YYINITDEPTH 200
927 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
928 if the built-in stack extension method is used).
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. */
935 # define YYMAXDEPTH 10000
943 # if defined (__GLIBC__) && defined (_STRING_H)
944 # define yystrlen strlen
946 /* Return the length of YYSTR. */
948 # if defined (__STDC__) || defined (__cplusplus)
949 yystrlen (const char *yystr)
955 const char *yys = yystr;
957 while (*yys++ != '\0')
960 return yys - yystr - 1;
966 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
967 # define yystpcpy stpcpy
969 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
972 # if defined (__STDC__) || defined (__cplusplus)
973 yystpcpy (char *yydest, const char *yysrc)
975 yystpcpy (yydest, yysrc)
981 const char *yys = yysrc;
983 while ((*yyd++ = *yys++) != '\0')
992 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
993 quotes and backslashes, so that it's suitable for yyerror. The
994 heuristic is that double-quoting is unnecessary unless the string
995 contains an apostrophe, a comma, or backslash (other than
996 backslash-backslash). YYSTR is taken from yytname. If YYRES is
997 null, do not copy; instead, return the length of what the result
1000 yytnamerr (char *yyres, const char *yystr)
1005 char const *yyp = yystr;
1012 goto do_not_strip_quotes;
1016 goto do_not_strip_quotes;
1029 do_not_strip_quotes: ;
1033 return yystrlen (yystr);
1035 return yystpcpy (yyres, yystr) - yyres;
1039 #endif /* YYERROR_VERBOSE */
1044 /*--------------------------------.
1045 | Print this symbol on YYOUTPUT. |
1046 `--------------------------------*/
1048 #if defined (__STDC__) || defined (__cplusplus)
1050 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1053 yysymprint (yyoutput, yytype, yyvaluep)
1059 /* Pacify ``unused variable'' warnings. */
1062 if (yytype < YYNTOKENS)
1063 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1065 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1069 if (yytype < YYNTOKENS)
1070 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1077 YYFPRINTF (yyoutput, ")");
1080 #endif /* ! YYDEBUG */
1081 /*-----------------------------------------------.
1082 | Release the memory associated to this symbol. |
1083 `-----------------------------------------------*/
1085 #if defined (__STDC__) || defined (__cplusplus)
1087 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1090 yydestruct (yymsg, yytype, yyvaluep)
1096 /* Pacify ``unused variable'' warnings. */
1101 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1105 case 52: /* "choice_entry" */
1108 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1109 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1110 if (current_menu == (yyvaluep->menu))
1115 case 58: /* "if_entry" */
1118 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1119 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1120 if (current_menu == (yyvaluep->menu))
1125 case 63: /* "menu_entry" */
1128 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1129 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1130 if (current_menu == (yyvaluep->menu))
1142 /* Prevent warnings from -Wmissing-prototypes. */
1144 #ifdef YYPARSE_PARAM
1145 # if defined (__STDC__) || defined (__cplusplus)
1146 int yyparse (void *YYPARSE_PARAM);
1150 #else /* ! YYPARSE_PARAM */
1151 #if defined (__STDC__) || defined (__cplusplus)
1156 #endif /* ! YYPARSE_PARAM */
1160 /* The look-ahead symbol. */
1163 /* The semantic value of the look-ahead symbol. */
1166 /* Number of syntax errors so far. */
1175 #ifdef YYPARSE_PARAM
1176 # if defined (__STDC__) || defined (__cplusplus)
1177 int yyparse (void *YYPARSE_PARAM)
1179 int yyparse (YYPARSE_PARAM)
1180 void *YYPARSE_PARAM;
1182 #else /* ! YYPARSE_PARAM */
1183 #if defined (__STDC__) || defined (__cplusplus)
1197 /* Number of tokens to shift before error messages enabled. */
1199 /* Look-ahead token as an internal (translated) token number. */
1202 /* Three stacks and their tools:
1203 `yyss': related to states,
1204 `yyvs': related to semantic values,
1205 `yyls': related to locations.
1207 Refer to the stacks thru separate pointers, to allow yyoverflow
1208 to reallocate them elsewhere. */
1210 /* The state stack. */
1211 short int yyssa[YYINITDEPTH];
1212 short int *yyss = yyssa;
1215 /* The semantic value stack. */
1216 YYSTYPE yyvsa[YYINITDEPTH];
1217 YYSTYPE *yyvs = yyvsa;
1222 #define YYPOPSTACK (yyvsp--, yyssp--)
1224 YYSIZE_T yystacksize = YYINITDEPTH;
1226 /* The variables used to return semantic value and location from the
1231 /* When reducing, the number of symbols on the RHS of the reduced
1235 YYDPRINTF ((stderr, "Starting parse\n"));
1240 yychar = YYEMPTY; /* Cause a token to be read. */
1242 /* Initialize stack pointers.
1243 Waste one element of value and location stack
1244 so that they stay on the same level as the state stack.
1245 The wasted elements are never initialized. */
1252 /*------------------------------------------------------------.
1253 | yynewstate -- Push a new state, which is found in yystate. |
1254 `------------------------------------------------------------*/
1256 /* In all cases, when you get here, the value and location stacks
1257 have just been pushed. so pushing a state here evens the stacks.
1264 if (yyss + yystacksize - 1 <= yyssp)
1266 /* Get the current used size of the three stacks, in elements. */
1267 YYSIZE_T yysize = yyssp - yyss + 1;
1271 /* Give user a chance to reallocate the stack. Use copies of
1272 these so that the &'s don't force the real ones into
1274 YYSTYPE *yyvs1 = yyvs;
1275 short int *yyss1 = yyss;
1278 /* Each stack pointer address is followed by the size of the
1279 data in use in that stack, in bytes. This used to be a
1280 conditional around just the two extra args, but that might
1281 be undefined if yyoverflow is a macro. */
1282 yyoverflow (YY_("memory exhausted"),
1283 &yyss1, yysize * sizeof (*yyssp),
1284 &yyvs1, yysize * sizeof (*yyvsp),
1291 #else /* no yyoverflow */
1292 # ifndef YYSTACK_RELOCATE
1293 goto yyexhaustedlab;
1295 /* Extend the stack our own way. */
1296 if (YYMAXDEPTH <= yystacksize)
1297 goto yyexhaustedlab;
1299 if (YYMAXDEPTH < yystacksize)
1300 yystacksize = YYMAXDEPTH;
1303 short int *yyss1 = yyss;
1304 union yyalloc *yyptr =
1305 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1307 goto yyexhaustedlab;
1308 YYSTACK_RELOCATE (yyss);
1309 YYSTACK_RELOCATE (yyvs);
1311 # undef YYSTACK_RELOCATE
1313 YYSTACK_FREE (yyss1);
1316 #endif /* no yyoverflow */
1318 yyssp = yyss + yysize - 1;
1319 yyvsp = yyvs + yysize - 1;
1322 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1323 (unsigned long int) yystacksize));
1325 if (yyss + yystacksize - 1 <= yyssp)
1329 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1338 /* Do appropriate processing given the current state. */
1339 /* Read a look-ahead token if we need one and don't already have one. */
1342 /* First try to decide what to do without reference to look-ahead token. */
1344 yyn = yypact[yystate];
1345 if (yyn == YYPACT_NINF)
1348 /* Not known => get a look-ahead token if don't already have one. */
1350 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1351 if (yychar == YYEMPTY)
1353 YYDPRINTF ((stderr, "Reading a token: "));
1357 if (yychar <= YYEOF)
1359 yychar = yytoken = YYEOF;
1360 YYDPRINTF ((stderr, "Now at end of input.\n"));
1364 yytoken = YYTRANSLATE (yychar);
1365 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1368 /* If the proper action on seeing token YYTOKEN is to reduce or to
1369 detect an error, take that action. */
1371 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1376 if (yyn == 0 || yyn == YYTABLE_NINF)
1385 /* Shift the look-ahead token. */
1386 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1388 /* Discard the token being shifted unless it is eof. */
1389 if (yychar != YYEOF)
1395 /* Count tokens shifted since error; after three, turn off error
1404 /*-----------------------------------------------------------.
1405 | yydefault -- do the default action for the current state. |
1406 `-----------------------------------------------------------*/
1408 yyn = yydefact[yystate];
1414 /*-----------------------------.
1415 | yyreduce -- Do a reduction. |
1416 `-----------------------------*/
1418 /* yyn is the number of a rule to reduce with. */
1421 /* If YYLEN is nonzero, implement the default value of the action:
1424 Otherwise, the following line sets YYVAL to garbage.
1425 This behavior is undocumented and Bison
1426 users should not rely upon it. Assigning to YYVAL
1427 unconditionally makes the parser a bit smaller, and it avoids a
1428 GCC warning that YYVAL may be used uninitialized. */
1429 yyval = yyvsp[1-yylen];
1432 YY_REDUCE_PRINT (yyn);
1437 { zconf_error("unexpected end statement"); ;}
1442 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
1448 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1454 { zconf_error("invalid statement"); ;}
1459 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1464 { zconf_error("invalid option"); ;}
1470 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1471 sym->flags |= SYMBOL_OPTIONAL;
1472 menu_add_entry(sym);
1473 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1481 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1488 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1489 sym->flags |= SYMBOL_OPTIONAL;
1490 menu_add_entry(sym);
1491 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1498 if (current_entry->prompt)
1499 current_entry->prompt->type = P_MENU;
1501 zconfprint("warning: menuconfig statement without prompt");
1503 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1510 menu_set_type((yyvsp[-2].id)->stype);
1511 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1512 zconf_curname(), zconf_lineno(),
1513 (yyvsp[-2].id)->stype);
1520 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1521 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1528 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1529 if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1530 menu_set_type((yyvsp[-3].id)->stype);
1531 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1532 zconf_curname(), zconf_lineno(),
1533 (yyvsp[-3].id)->stype);
1540 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1541 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1548 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1549 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1556 struct kconf_id *id = kconf_id_lookup((yyvsp[-1].string), strlen((yyvsp[-1].string)));
1557 if (id && id->flags & TF_OPTION)
1558 menu_add_option(id->token, (yyvsp[0].string));
1560 zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string));
1561 free((yyvsp[-1].string));
1567 { (yyval.string) = NULL; ;}
1572 { (yyval.string) = (yyvsp[0].string); ;}
1578 struct symbol *sym = sym_lookup(NULL, 0);
1579 sym->flags |= SYMBOL_CHOICE;
1580 menu_add_entry(sym);
1581 menu_add_expr(P_CHOICE, NULL, NULL);
1582 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1589 (yyval.menu) = menu_add_menu();
1596 if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1598 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1606 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1607 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1614 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1615 menu_set_type((yyvsp[-2].id)->stype);
1616 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1617 zconf_curname(), zconf_lineno(),
1618 (yyvsp[-2].id)->stype);
1627 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1628 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1635 if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1636 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1637 printd(DEBUG_PARSE, "%s:%d:default\n",
1638 zconf_curname(), zconf_lineno());
1647 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1648 menu_add_entry(NULL);
1649 menu_add_dep((yyvsp[-1].expr));
1650 (yyval.menu) = menu_add_menu();
1657 if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1659 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1667 menu_add_entry(NULL);
1668 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1669 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1676 (yyval.menu) = menu_add_menu();
1683 if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1685 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1693 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1694 zconf_nextfile((yyvsp[-1].string));
1701 menu_add_entry(NULL);
1702 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1703 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1717 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1725 current_entry->sym->help = (yyvsp[0].string);
1732 menu_add_dep((yyvsp[-1].expr));
1733 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1740 menu_add_dep((yyvsp[-1].expr));
1741 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1748 menu_add_dep((yyvsp[-1].expr));
1749 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1756 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1762 { (yyval.id) = (yyvsp[-1].id); ;}
1767 { (yyval.id) = (yyvsp[-1].id); ;}
1772 { (yyval.id) = (yyvsp[-1].id); ;}
1777 { (yyval.expr) = NULL; ;}
1782 { (yyval.expr) = (yyvsp[0].expr); ;}
1787 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1792 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1797 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1802 { (yyval.expr) = (yyvsp[-1].expr); ;}
1807 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1812 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1817 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1822 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1827 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1834 /* Line 1126 of yacc.c. */
1841 YY_STACK_PRINT (yyss, yyssp);
1846 /* Now `shift' the result of the reduction. Determine what state
1847 that goes to, based on the state we popped back to and the rule
1848 number reduced by. */
1852 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1853 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1854 yystate = yytable[yystate];
1856 yystate = yydefgoto[yyn - YYNTOKENS];
1861 /*------------------------------------.
1862 | yyerrlab -- here on detecting error |
1863 `------------------------------------*/
1865 /* If not already recovering from an error, report this error. */
1870 yyn = yypact[yystate];
1872 if (YYPACT_NINF < yyn && yyn < YYLAST)
1874 int yytype = YYTRANSLATE (yychar);
1875 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1876 YYSIZE_T yysize = yysize0;
1878 int yysize_overflow = 0;
1880 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1881 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1885 /* This is so xgettext sees the translatable formats that are
1886 constructed on the fly. */
1887 YY_("syntax error, unexpected %s");
1888 YY_("syntax error, unexpected %s, expecting %s");
1889 YY_("syntax error, unexpected %s, expecting %s or %s");
1890 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1891 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1895 static char const yyunexpected[] = "syntax error, unexpected %s";
1896 static char const yyexpecting[] = ", expecting %s";
1897 static char const yyor[] = " or %s";
1898 char yyformat[sizeof yyunexpected
1899 + sizeof yyexpecting - 1
1900 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1901 * (sizeof yyor - 1))];
1902 char const *yyprefix = yyexpecting;
1904 /* Start YYX at -YYN if negative to avoid negative indexes in
1906 int yyxbegin = yyn < 0 ? -yyn : 0;
1908 /* Stay within bounds of both yycheck and yytname. */
1909 int yychecklim = YYLAST - yyn;
1910 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1913 yyarg[0] = yytname[yytype];
1914 yyfmt = yystpcpy (yyformat, yyunexpected);
1916 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1917 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1919 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1923 yyformat[sizeof yyunexpected - 1] = '\0';
1926 yyarg[yycount++] = yytname[yyx];
1927 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1928 yysize_overflow |= yysize1 < yysize;
1930 yyfmt = yystpcpy (yyfmt, yyprefix);
1934 yyf = YY_(yyformat);
1935 yysize1 = yysize + yystrlen (yyf);
1936 yysize_overflow |= yysize1 < yysize;
1939 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1940 yymsg = (char *) YYSTACK_ALLOC (yysize);
1943 /* Avoid sprintf, as that infringes on the user's name space.
1944 Don't have undefined behavior even if the translation
1945 produced a string with the wrong number of "%s"s. */
1948 while ((*yyp = *yyf))
1950 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1952 yyp += yytnamerr (yyp, yyarg[yyi++]);
1962 YYSTACK_FREE (yymsg);
1966 yyerror (YY_("syntax error"));
1967 goto yyexhaustedlab;
1971 #endif /* YYERROR_VERBOSE */
1972 yyerror (YY_("syntax error"));
1977 if (yyerrstatus == 3)
1979 /* If just tried and failed to reuse look-ahead token after an
1980 error, discard it. */
1982 if (yychar <= YYEOF)
1984 /* Return failure if at end of input. */
1985 if (yychar == YYEOF)
1990 yydestruct ("Error: discarding", yytoken, &yylval);
1995 /* Else will try to reuse look-ahead token after shifting the error
2000 /*---------------------------------------------------.
2001 | yyerrorlab -- error raised explicitly by YYERROR. |
2002 `---------------------------------------------------*/
2005 /* Pacify compilers like GCC when the user code never invokes
2006 YYERROR and the label yyerrorlab therefore never appears in user
2017 /*-------------------------------------------------------------.
2018 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2019 `-------------------------------------------------------------*/
2021 yyerrstatus = 3; /* Each real token shifted decrements this. */
2025 yyn = yypact[yystate];
2026 if (yyn != YYPACT_NINF)
2029 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2037 /* Pop the current state because it cannot handle the error token. */
2042 yydestruct ("Error: popping", yystos[yystate], yyvsp);
2045 YY_STACK_PRINT (yyss, yyssp);
2054 /* Shift the error token. */
2055 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2061 /*-------------------------------------.
2062 | yyacceptlab -- YYACCEPT comes here. |
2063 `-------------------------------------*/
2068 /*-----------------------------------.
2069 | yyabortlab -- YYABORT comes here. |
2070 `-----------------------------------*/
2076 /*-------------------------------------------------.
2077 | yyexhaustedlab -- memory exhaustion comes here. |
2078 `-------------------------------------------------*/
2080 yyerror (YY_("memory exhausted"));
2086 if (yychar != YYEOF && yychar != YYEMPTY)
2087 yydestruct ("Cleanup: discarding lookahead",
2089 while (yyssp != yyss)
2091 yydestruct ("Cleanup: popping",
2092 yystos[*yyssp], yyvsp);
2097 YYSTACK_FREE (yyss);
2106 void conf_parse(const char *name)
2111 zconf_initscan(name);
2115 modules_sym = sym_lookup(NULL, 0);
2116 modules_sym->type = S_BOOLEAN;
2117 modules_sym->flags |= SYMBOL_AUTO;
2118 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
2121 if (getenv("ZCONF_DEBUG"))
2127 if (!modules_sym->prop) {
2128 struct property *prop;
2130 prop = prop_alloc(P_DEFAULT, modules_sym);
2131 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2133 menu_finalize(&rootmenu);
2134 for_all_symbols(i, sym) {
2135 sym_check_deps(sym);
2138 sym_change_count = 1;
2141 const char *zconf_tokenname(int token)
2144 case T_MENU: return "menu";
2145 case T_ENDMENU: return "endmenu";
2146 case T_CHOICE: return "choice";
2147 case T_ENDCHOICE: return "endchoice";
2148 case T_IF: return "if";
2149 case T_ENDIF: return "endif";
2150 case T_DEPENDS: return "depends";
2155 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
2157 if (id->token != endtoken) {
2158 zconf_error("unexpected '%s' within %s block",
2159 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2163 if (current_menu->file != current_file) {
2164 zconf_error("'%s' in different file than '%s'",
2165 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2166 fprintf(stderr, "%s:%d: location of the '%s'\n",
2167 current_menu->file->name, current_menu->lineno,
2168 zconf_tokenname(starttoken));
2175 static void zconfprint(const char *err, ...)
2179 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2181 vfprintf(stderr, err, ap);
2183 fprintf(stderr, "\n");
2186 static void zconf_error(const char *err, ...)
2191 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2193 vfprintf(stderr, err, ap);
2195 fprintf(stderr, "\n");
2198 static void zconferror(const char *err)
2201 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2205 void print_quoted_string(FILE *out, const char *str)
2211 while ((p = strchr(str, '"'))) {
2214 fprintf(out, "%.*s", len, str);
2222 void print_symbol(FILE *out, struct menu *menu)
2224 struct symbol *sym = menu->sym;
2225 struct property *prop;
2227 if (sym_is_choice(sym))
2228 fprintf(out, "choice\n");
2230 fprintf(out, "config %s\n", sym->name);
2231 switch (sym->type) {
2233 fputs(" boolean\n", out);
2236 fputs(" tristate\n", out);
2239 fputs(" string\n", out);
2242 fputs(" integer\n", out);
2245 fputs(" hex\n", out);
2248 fputs(" ???\n", out);
2251 for (prop = sym->prop; prop; prop = prop->next) {
2252 if (prop->menu != menu)
2254 switch (prop->type) {
2256 fputs(" prompt ", out);
2257 print_quoted_string(out, prop->text);
2258 if (!expr_is_yes(prop->visible.expr)) {
2260 expr_fprint(prop->visible.expr, out);
2265 fputs( " default ", out);
2266 expr_fprint(prop->expr, out);
2267 if (!expr_is_yes(prop->visible.expr)) {
2269 expr_fprint(prop->visible.expr, out);
2274 fputs(" #choice value\n", out);
2277 fprintf(out, " unknown prop %d!\n", prop->type);
2282 int len = strlen(sym->help);
2283 while (sym->help[--len] == '\n')
2285 fprintf(out, " help\n%s\n", sym->help);
2290 void zconfdump(FILE *out)
2292 struct property *prop;
2296 menu = rootmenu.list;
2298 if ((sym = menu->sym))
2299 print_symbol(out, menu);
2300 else if ((prop = menu->prompt)) {
2301 switch (prop->type) {
2303 fputs("\ncomment ", out);
2304 print_quoted_string(out, prop->text);
2308 fputs("\nmenu ", out);
2309 print_quoted_string(out, prop->text);
2315 if (!expr_is_yes(prop->visible.expr)) {
2316 fputs(" depends ", out);
2317 expr_fprint(prop->visible.expr, out);
2325 else if (menu->next)
2327 else while ((menu = menu->parent)) {
2328 if (menu->prompt && menu->prompt->type == P_MENU)
2329 fputs("\nendmenu\n", out);
2338 #include "lex.zconf.c"
2340 #include "confdata.c"