1 /* A Bison parser, made by GNU Bison 2.0. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, 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 YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* Substitute the variable and function names. */
49 #define yyparse zconfparse
50 #define yylex zconflex
51 #define yyerror zconferror
52 #define yylval zconflval
53 #define yychar zconfchar
54 #define yydebug zconfdebug
55 #define yynerrs zconfnerrs
61 /* Put the tokens into the symbol table, so that GDB and other debuggers
98 #define T_MAINMENU 258
100 #define T_ENDMENU 260
103 #define T_ENDCHOICE 263
104 #define T_COMMENT 264
106 #define T_MENUCONFIG 266
108 #define T_HELPTEXT 268
111 #define T_DEPENDS 271
112 #define T_REQUIRES 272
113 #define T_OPTIONAL 273
116 #define T_DEFAULT 276
121 #define T_WORD_QUOTE 281
122 #define T_UNEQUAL 282
123 #define T_CLOSE_PAREN 283
124 #define T_OPEN_PAREN 284
134 /* Copy the first part of user declarations. */
138 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
139 * Released under the terms of the GNU GPL v2.0.
149 #define LKC_DIRECT_LINK
152 #include "zconf.hash.c"
154 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
156 #define PRINTD 0x0001
157 #define DEBUG_PARSE 0x0002
161 extern int zconflex(void);
162 static void zconfprint(const char *err, ...);
163 static void zconf_error(const char *err, ...);
164 static void zconferror(const char *err);
165 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
167 struct symbol *symbol_hash[257];
169 static struct menu *current_menu, *current_entry;
173 #define YYERROR_VERBOSE
177 /* Enabling traces. */
182 /* Enabling verbose error messages. */
183 #ifdef YYERROR_VERBOSE
184 # undef YYERROR_VERBOSE
185 # define YYERROR_VERBOSE 1
187 # define YYERROR_VERBOSE 0
190 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
192 typedef union YYSTYPE {
195 struct symbol *symbol;
200 /* Line 190 of yacc.c. */
202 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
203 # define YYSTYPE_IS_DECLARED 1
204 # define YYSTYPE_IS_TRIVIAL 1
209 /* Copy the second part of user declarations. */
212 /* Line 213 of yacc.c. */
215 #if ! defined (yyoverflow) || YYERROR_VERBOSE
221 # define YYMALLOC malloc
224 /* The parser invokes alloca or malloc; define the necessary symbols. */
226 # ifdef YYSTACK_USE_ALLOCA
227 # if YYSTACK_USE_ALLOCA
229 # define YYSTACK_ALLOC __builtin_alloca
231 # define YYSTACK_ALLOC alloca
236 # ifdef YYSTACK_ALLOC
237 /* Pacify GCC's `empty if-body' warning. */
238 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
240 # if defined (__STDC__) || defined (__cplusplus)
241 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
242 # define YYSIZE_T size_t
244 # define YYSTACK_ALLOC YYMALLOC
245 # define YYSTACK_FREE YYFREE
247 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
250 #if (! defined (yyoverflow) \
251 && (! defined (__cplusplus) \
252 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
254 /* A type that is properly aligned for any stack member. */
261 /* The size of the maximum gap between one aligned stack and the next. */
262 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
264 /* The size of an array large to enough to hold all stacks, each with
266 # define YYSTACK_BYTES(N) \
267 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
268 + YYSTACK_GAP_MAXIMUM)
270 /* Copy COUNT objects from FROM to TO. The source and destination do
273 # if defined (__GNUC__) && 1 < __GNUC__
274 # define YYCOPY(To, From, Count) \
275 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
277 # define YYCOPY(To, From, Count) \
280 register YYSIZE_T yyi; \
281 for (yyi = 0; yyi < (Count); yyi++) \
282 (To)[yyi] = (From)[yyi]; \
288 /* Relocate STACK from its old location to the new one. The
289 local variables YYSIZE and YYSTACKSIZE give the old and new number of
290 elements in the stack, and YYPTR gives the new location of the
291 stack. Advance YYPTR to a properly aligned location for the next
293 # define YYSTACK_RELOCATE(Stack) \
296 YYSIZE_T yynewbytes; \
297 YYCOPY (&yyptr->Stack, Stack, yysize); \
298 Stack = &yyptr->Stack; \
299 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
300 yyptr += yynewbytes / sizeof (*yyptr); \
306 #if defined (__STDC__) || defined (__cplusplus)
307 typedef signed char yysigned_char;
309 typedef short int yysigned_char;
312 /* YYFINAL -- State number of the termination state. */
314 /* YYLAST -- Last index in YYTABLE. */
317 /* YYNTOKENS -- Number of terminals. */
319 /* YYNNTS -- Number of nonterminals. */
321 /* YYNRULES -- Number of rules. */
323 /* YYNRULES -- Number of states. */
324 #define YYNSTATES 175
326 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
328 #define YYMAXUTOK 289
330 #define YYTRANSLATE(YYX) \
331 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
333 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
334 static const unsigned char yytranslate[] =
336 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
362 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
363 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
364 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
368 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
370 static const unsigned short int yyprhs[] =
372 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
373 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
374 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
375 81, 84, 85, 88, 91, 94, 97, 100, 104, 109,
376 114, 119, 125, 128, 131, 133, 137, 138, 141, 144,
377 147, 150, 153, 158, 162, 165, 170, 171, 174, 178,
378 180, 184, 185, 188, 191, 194, 198, 201, 203, 207,
379 208, 211, 214, 217, 221, 225, 228, 231, 234, 235,
380 238, 241, 244, 249, 253, 257, 258, 261, 263, 265,
381 268, 271, 274, 276, 279, 280, 283, 285, 289, 293,
382 297, 300, 304, 308, 310
385 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
386 static const yysigned_char yyrhs[] =
388 36, 0, -1, 37, -1, -1, 37, 39, -1, 37,
389 50, -1, 37, 61, -1, 37, 3, 71, 73, -1,
390 37, 72, -1, 37, 25, 1, 30, -1, 37, 38,
391 1, 30, -1, 37, 1, 30, -1, 16, -1, 19,
392 -1, 20, -1, 22, -1, 18, -1, 23, -1, 21,
393 -1, 30, -1, 56, -1, 65, -1, 42, -1, 44,
394 -1, 63, -1, 25, 1, 30, -1, 1, 30, -1,
395 10, 25, 30, -1, 41, 45, -1, 11, 25, 30,
396 -1, 43, 45, -1, -1, 45, 46, -1, 45, 69,
397 -1, 45, 67, -1, 45, 40, -1, 45, 30, -1,
398 20, 70, 30, -1, 19, 71, 74, 30, -1, 21,
399 75, 74, 30, -1, 22, 25, 74, 30, -1, 23,
400 76, 76, 74, 30, -1, 7, 30, -1, 47, 51,
401 -1, 72, -1, 48, 53, 49, -1, -1, 51, 52,
402 -1, 51, 69, -1, 51, 67, -1, 51, 30, -1,
403 51, 40, -1, 19, 71, 74, 30, -1, 20, 70,
404 30, -1, 18, 30, -1, 21, 25, 74, 30, -1,
405 -1, 53, 39, -1, 14, 75, 73, -1, 72, -1,
406 54, 57, 55, -1, -1, 57, 39, -1, 57, 61,
407 -1, 57, 50, -1, 4, 71, 30, -1, 58, 68,
408 -1, 72, -1, 59, 62, 60, -1, -1, 62, 39,
409 -1, 62, 61, -1, 62, 50, -1, 6, 71, 30,
410 -1, 9, 71, 30, -1, 64, 68, -1, 12, 30,
411 -1, 66, 13, -1, -1, 68, 69, -1, 68, 30,
412 -1, 68, 40, -1, 16, 24, 75, 30, -1, 16,
413 75, 30, -1, 17, 75, 30, -1, -1, 71, 74,
414 -1, 25, -1, 26, -1, 5, 30, -1, 8, 30,
415 -1, 15, 30, -1, 30, -1, 73, 30, -1, -1,
416 14, 75, -1, 76, -1, 76, 33, 76, -1, 76,
417 27, 76, -1, 29, 75, 28, -1, 34, 75, -1,
418 75, 31, 75, -1, 75, 32, 75, -1, 25, -1,
422 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
423 static const unsigned short int yyrline[] =
425 0, 103, 103, 105, 107, 108, 109, 110, 111, 112,
426 113, 117, 121, 121, 121, 121, 121, 121, 121, 125,
427 126, 127, 128, 129, 130, 134, 135, 141, 149, 155,
428 163, 173, 175, 176, 177, 178, 179, 182, 190, 196,
429 206, 212, 220, 229, 234, 242, 245, 247, 248, 249,
430 250, 251, 254, 260, 271, 277, 287, 289, 294, 302,
431 310, 313, 315, 316, 317, 322, 329, 334, 342, 345,
432 347, 348, 349, 352, 360, 367, 374, 380, 387, 389,
433 390, 391, 394, 399, 404, 412, 414, 419, 420, 423,
434 424, 425, 429, 430, 433, 434, 437, 438, 439, 440,
435 441, 442, 443, 446, 447
439 #if YYDEBUG || YYERROR_VERBOSE
440 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
441 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
442 static const char *const yytname[] =
444 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
445 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
446 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
447 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
448 "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
449 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
450 "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt",
451 "option_error", "config_entry_start", "config_stmt",
452 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
453 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
454 "choice_option_list", "choice_option", "choice_block", "if_entry",
455 "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end",
456 "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt",
457 "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
458 "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
463 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
465 static const unsigned short int yytoknum[] =
467 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
468 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
469 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
470 285, 286, 287, 288, 289
474 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
475 static const unsigned char yyr1[] =
477 0, 35, 36, 37, 37, 37, 37, 37, 37, 37,
478 37, 37, 38, 38, 38, 38, 38, 38, 38, 39,
479 39, 39, 39, 39, 39, 40, 40, 41, 42, 43,
480 44, 45, 45, 45, 45, 45, 45, 46, 46, 46,
481 46, 46, 47, 48, 49, 50, 51, 51, 51, 51,
482 51, 51, 52, 52, 52, 52, 53, 53, 54, 55,
483 56, 57, 57, 57, 57, 58, 59, 60, 61, 62,
484 62, 62, 62, 63, 64, 65, 66, 67, 68, 68,
485 68, 68, 69, 69, 69, 70, 70, 71, 71, 72,
486 72, 72, 73, 73, 74, 74, 75, 75, 75, 75,
490 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
491 static const unsigned char yyr2[] =
493 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
494 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
495 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
496 2, 0, 2, 2, 2, 2, 2, 3, 4, 4,
497 4, 5, 2, 2, 1, 3, 0, 2, 2, 2,
498 2, 2, 4, 3, 2, 4, 0, 2, 3, 1,
499 3, 0, 2, 2, 2, 3, 2, 1, 3, 0,
500 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
501 2, 2, 4, 3, 3, 0, 2, 1, 1, 2,
502 2, 2, 1, 2, 0, 2, 1, 3, 3, 3,
506 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
507 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
508 means the default is an error. */
509 static const unsigned char yydefact[] =
511 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
512 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
513 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
514 23, 46, 56, 5, 61, 20, 78, 69, 6, 24,
515 78, 21, 8, 11, 87, 88, 0, 0, 89, 0,
516 42, 90, 0, 0, 0, 103, 104, 0, 0, 0,
517 96, 91, 0, 0, 0, 0, 0, 0, 0, 0,
518 0, 0, 92, 7, 65, 73, 74, 27, 29, 0,
519 100, 0, 0, 58, 0, 0, 9, 10, 0, 0,
520 0, 0, 0, 85, 0, 0, 0, 0, 36, 35,
521 32, 0, 34, 33, 0, 0, 85, 0, 50, 51,
522 47, 49, 48, 57, 45, 44, 62, 64, 60, 63,
523 59, 80, 81, 79, 70, 72, 68, 71, 67, 93,
524 99, 101, 102, 98, 97, 26, 76, 0, 0, 0,
525 94, 0, 94, 94, 94, 0, 0, 77, 54, 94,
526 0, 94, 0, 83, 84, 0, 0, 37, 86, 0,
527 0, 94, 25, 0, 53, 0, 82, 95, 38, 39,
531 /* YYDEFGOTO[NTERM-NUM]. */
532 static const short int yydefgoto[] =
534 -1, 1, 2, 25, 26, 99, 27, 28, 29, 30,
535 64, 100, 31, 32, 114, 33, 66, 110, 67, 34,
536 118, 35, 68, 36, 37, 126, 38, 70, 39, 40,
537 41, 101, 102, 69, 103, 141, 142, 42, 73, 156,
541 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
543 #define YYPACT_NINF -78
544 static const short int yypact[] =
546 -78, 2, 159, -78, -21, 0, 0, -12, 0, 1,
547 4, 0, 27, 38, 60, 58, -78, -78, -78, -78,
548 -78, -78, -78, 100, -78, 104, -78, -78, -78, -78,
549 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
550 -78, -78, -78, -78, -78, -78, 86, 113, -78, 114,
551 -78, -78, 125, 127, 128, -78, -78, 60, 60, 210,
552 65, -78, 141, 142, 39, 103, 182, 200, 6, 66,
553 6, 131, -78, 146, -78, -78, -78, -78, -78, 196,
554 -78, 60, 60, 146, 40, 40, -78, -78, 155, 156,
555 -2, 60, 0, 0, 60, 105, 40, 194, -78, -78,
556 -78, 206, -78, -78, 183, 0, 0, 195, -78, -78,
557 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
558 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
559 -78, 197, -78, -78, -78, -78, -78, 60, 213, 216,
560 212, 203, 212, 190, 212, 40, 208, -78, -78, 212,
561 222, 212, 219, -78, -78, 60, 223, -78, -78, 224,
562 225, 212, -78, 226, -78, 227, -78, 47, -78, -78,
563 -78, 228, -78, -78, -78
566 /* YYPGOTO[NTERM-NUM]. */
567 static const short int yypgoto[] =
569 -78, -78, -78, -78, 164, -36, -78, -78, -78, -78,
570 230, -78, -78, -78, -78, 29, -78, -78, -78, -78,
571 -78, -78, -78, -78, -78, -78, 59, -78, -78, -78,
572 -78, -78, 198, 220, 24, 157, -5, 169, 202, 74,
576 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
577 positive, shift that token. If negative, reduce the rule which
578 number is the opposite. If zero, do what YYDEFACT says.
579 If YYTABLE_NINF, syntax error. */
580 #define YYTABLE_NINF -76
581 static const short int yytable[] =
583 46, 47, 3, 49, 79, 80, 52, 133, 134, 43,
584 6, 7, 8, 9, 10, 11, 12, 13, 48, 145,
585 14, 15, 137, 55, 56, 44, 45, 57, 131, 132,
586 109, 50, 58, 122, 51, 122, 24, 138, 139, -28,
587 88, 143, -28, -28, -28, -28, -28, -28, -28, -28,
588 -28, 89, 53, -28, -28, 90, 91, -28, 92, 93,
589 94, 95, 96, 54, 97, 55, 56, 88, 161, 98,
590 -66, -66, -66, -66, -66, -66, -66, -66, 81, 82,
591 -66, -66, 90, 91, 152, 55, 56, 140, 61, 57,
592 112, 97, 84, 123, 58, 123, 121, 117, 85, 125,
593 149, 62, 167, -30, 88, 63, -30, -30, -30, -30,
594 -30, -30, -30, -30, -30, 89, 72, -30, -30, 90,
595 91, -30, 92, 93, 94, 95, 96, 119, 97, 127,
596 144, -75, 88, 98, -75, -75, -75, -75, -75, -75,
597 -75, -75, -75, 74, 75, -75, -75, 90, 91, -75,
598 -75, -75, -75, -75, -75, 76, 97, 77, 78, -2,
599 4, 121, 5, 6, 7, 8, 9, 10, 11, 12,
600 13, 86, 87, 14, 15, 16, 129, 17, 18, 19,
601 20, 21, 22, 88, 23, 135, 136, -43, -43, 24,
602 -43, -43, -43, -43, 89, 146, -43, -43, 90, 91,
603 104, 105, 106, 107, 155, 7, 8, 97, 10, 11,
604 12, 13, 108, 148, 14, 15, 158, 159, 160, 147,
605 151, 81, 82, 163, 130, 165, 155, 81, 82, 82,
606 24, 113, 116, 157, 124, 171, 115, 120, 162, 128,
607 72, 81, 82, 153, 81, 82, 154, 81, 82, 166,
608 81, 82, 164, 168, 169, 170, 172, 173, 174, 65,
612 static const short int yycheck[] =
614 5, 6, 0, 8, 57, 58, 11, 84, 85, 30,
615 4, 5, 6, 7, 8, 9, 10, 11, 30, 96,
616 14, 15, 24, 25, 26, 25, 26, 29, 81, 82,
617 66, 30, 34, 69, 30, 71, 30, 90, 91, 0,
618 1, 94, 3, 4, 5, 6, 7, 8, 9, 10,
619 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
620 21, 22, 23, 25, 25, 25, 26, 1, 145, 30,
621 4, 5, 6, 7, 8, 9, 10, 11, 31, 32,
622 14, 15, 16, 17, 137, 25, 26, 92, 30, 29,
623 66, 25, 27, 69, 34, 71, 30, 68, 33, 70,
624 105, 1, 155, 0, 1, 1, 3, 4, 5, 6,
625 7, 8, 9, 10, 11, 12, 30, 14, 15, 16,
626 17, 18, 19, 20, 21, 22, 23, 68, 25, 70,
627 25, 0, 1, 30, 3, 4, 5, 6, 7, 8,
628 9, 10, 11, 30, 30, 14, 15, 16, 17, 18,
629 19, 20, 21, 22, 23, 30, 25, 30, 30, 0,
630 1, 30, 3, 4, 5, 6, 7, 8, 9, 10,
631 11, 30, 30, 14, 15, 16, 30, 18, 19, 20,
632 21, 22, 23, 1, 25, 30, 30, 5, 6, 30,
633 8, 9, 10, 11, 12, 1, 14, 15, 16, 17,
634 18, 19, 20, 21, 14, 5, 6, 25, 8, 9,
635 10, 11, 30, 30, 14, 15, 142, 143, 144, 13,
636 25, 31, 32, 149, 28, 151, 14, 31, 32, 32,
637 30, 67, 68, 30, 70, 161, 67, 68, 30, 70,
638 30, 31, 32, 30, 31, 32, 30, 31, 32, 30,
639 31, 32, 30, 30, 30, 30, 30, 30, 30, 29,
643 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
644 symbol of state STATE-NUM. */
645 static const unsigned char yystos[] =
647 0, 36, 37, 0, 1, 3, 4, 5, 6, 7,
648 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
649 21, 22, 23, 25, 30, 38, 39, 41, 42, 43,
650 44, 47, 48, 50, 54, 56, 58, 59, 61, 63,
651 64, 65, 72, 30, 25, 26, 71, 71, 30, 71,
652 30, 30, 71, 25, 25, 25, 26, 29, 34, 75,
653 76, 30, 1, 1, 45, 45, 51, 53, 57, 68,
654 62, 68, 30, 73, 30, 30, 30, 30, 30, 75,
655 75, 31, 32, 73, 27, 33, 30, 30, 1, 12,
656 16, 17, 19, 20, 21, 22, 23, 25, 30, 40,
657 46, 66, 67, 69, 18, 19, 20, 21, 30, 40,
658 52, 67, 69, 39, 49, 72, 39, 50, 55, 61,
659 72, 30, 40, 69, 39, 50, 60, 61, 72, 30,
660 28, 75, 75, 76, 76, 30, 30, 24, 75, 75,
661 71, 70, 71, 75, 25, 76, 1, 13, 30, 71,
662 70, 25, 75, 30, 30, 14, 74, 30, 74, 74,
663 74, 76, 30, 74, 30, 74, 30, 75, 30, 30,
667 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
668 # define YYSIZE_T __SIZE_TYPE__
670 #if ! defined (YYSIZE_T) && defined (size_t)
671 # define YYSIZE_T size_t
673 #if ! defined (YYSIZE_T)
674 # if defined (__STDC__) || defined (__cplusplus)
675 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
676 # define YYSIZE_T size_t
679 #if ! defined (YYSIZE_T)
680 # define YYSIZE_T unsigned int
683 #define yyerrok (yyerrstatus = 0)
684 #define yyclearin (yychar = YYEMPTY)
688 #define YYACCEPT goto yyacceptlab
689 #define YYABORT goto yyabortlab
690 #define YYERROR goto yyerrorlab
693 /* Like YYERROR except do call yyerror. This remains here temporarily
694 to ease the transition to the new meaning of YYERROR, for GCC.
695 Once GCC version 2 has supplanted version 1, this can go. */
697 #define YYFAIL goto yyerrlab
699 #define YYRECOVERING() (!!yyerrstatus)
701 #define YYBACKUP(Token, Value) \
703 if (yychar == YYEMPTY && yylen == 1) \
707 yytoken = YYTRANSLATE (yychar); \
713 yyerror ("syntax error: cannot back up");\
720 #define YYERRCODE 256
723 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
724 If N is 0, then set CURRENT to the empty location which ends
725 the previous symbol: RHS[0] (always defined). */
727 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
728 #ifndef YYLLOC_DEFAULT
729 # define YYLLOC_DEFAULT(Current, Rhs, N) \
733 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
734 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
735 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
736 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
740 (Current).first_line = (Current).last_line = \
741 YYRHSLOC (Rhs, 0).last_line; \
742 (Current).first_column = (Current).last_column = \
743 YYRHSLOC (Rhs, 0).last_column; \
749 /* YY_LOCATION_PRINT -- Print the location on the stream.
750 This macro was not mandated originally: define only if we know
751 we won't break user code: when these are the locations we know. */
753 #ifndef YY_LOCATION_PRINT
754 # if YYLTYPE_IS_TRIVIAL
755 # define YY_LOCATION_PRINT(File, Loc) \
756 fprintf (File, "%d.%d-%d.%d", \
757 (Loc).first_line, (Loc).first_column, \
758 (Loc).last_line, (Loc).last_column)
760 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
765 /* YYLEX -- calling `yylex' with the right arguments. */
768 # define YYLEX yylex (YYLEX_PARAM)
770 # define YYLEX yylex ()
773 /* Enable debugging if requested. */
777 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
778 # define YYFPRINTF fprintf
781 # define YYDPRINTF(Args) \
787 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
791 YYFPRINTF (stderr, "%s ", Title); \
792 yysymprint (stderr, \
794 YYFPRINTF (stderr, "\n"); \
798 /*------------------------------------------------------------------.
799 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
801 `------------------------------------------------------------------*/
803 #if defined (__STDC__) || defined (__cplusplus)
805 yy_stack_print (short int *bottom, short int *top)
808 yy_stack_print (bottom, top)
813 YYFPRINTF (stderr, "Stack now");
814 for (/* Nothing. */; bottom <= top; ++bottom)
815 YYFPRINTF (stderr, " %d", *bottom);
816 YYFPRINTF (stderr, "\n");
819 # define YY_STACK_PRINT(Bottom, Top) \
822 yy_stack_print ((Bottom), (Top)); \
826 /*------------------------------------------------.
827 | Report that the YYRULE is going to be reduced. |
828 `------------------------------------------------*/
830 #if defined (__STDC__) || defined (__cplusplus)
832 yy_reduce_print (int yyrule)
835 yy_reduce_print (yyrule)
840 unsigned int yylno = yyrline[yyrule];
841 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
843 /* Print the symbols being reduced, and their result. */
844 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
845 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
846 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
849 # define YY_REDUCE_PRINT(Rule) \
852 yy_reduce_print (Rule); \
855 /* Nonzero means print parse trace. It is left uninitialized so that
856 multiple parsers can coexist. */
859 # define YYDPRINTF(Args)
860 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
861 # define YY_STACK_PRINT(Bottom, Top)
862 # define YY_REDUCE_PRINT(Rule)
863 #endif /* !YYDEBUG */
866 /* YYINITDEPTH -- initial size of the parser's stacks. */
868 # define YYINITDEPTH 200
871 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
872 if the built-in stack extension method is used).
874 Do not make this value too large; the results are undefined if
875 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
876 evaluated with infinite-precision integer arithmetic. */
879 # define YYMAXDEPTH 10000
887 # if defined (__GLIBC__) && defined (_STRING_H)
888 # define yystrlen strlen
890 /* Return the length of YYSTR. */
892 # if defined (__STDC__) || defined (__cplusplus)
893 yystrlen (const char *yystr)
899 register const char *yys = yystr;
901 while (*yys++ != '\0')
904 return yys - yystr - 1;
910 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
911 # define yystpcpy stpcpy
913 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
916 # if defined (__STDC__) || defined (__cplusplus)
917 yystpcpy (char *yydest, const char *yysrc)
919 yystpcpy (yydest, yysrc)
924 register char *yyd = yydest;
925 register const char *yys = yysrc;
927 while ((*yyd++ = *yys++) != '\0')
935 #endif /* !YYERROR_VERBOSE */
940 /*--------------------------------.
941 | Print this symbol on YYOUTPUT. |
942 `--------------------------------*/
944 #if defined (__STDC__) || defined (__cplusplus)
946 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
949 yysymprint (yyoutput, yytype, yyvaluep)
955 /* Pacify ``unused variable'' warnings. */
958 if (yytype < YYNTOKENS)
959 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
961 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
965 if (yytype < YYNTOKENS)
966 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
973 YYFPRINTF (yyoutput, ")");
976 #endif /* ! YYDEBUG */
977 /*-----------------------------------------------.
978 | Release the memory associated to this symbol. |
979 `-----------------------------------------------*/
981 #if defined (__STDC__) || defined (__cplusplus)
983 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
986 yydestruct (yymsg, yytype, yyvaluep)
992 /* Pacify ``unused variable'' warnings. */
997 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1001 case 48: /* choice_entry */
1004 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1005 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1006 if (current_menu == (yyvaluep->menu))
1011 case 54: /* if_entry */
1014 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1015 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1016 if (current_menu == (yyvaluep->menu))
1021 case 59: /* menu_entry */
1024 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1025 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1026 if (current_menu == (yyvaluep->menu))
1038 /* Prevent warnings from -Wmissing-prototypes. */
1040 #ifdef YYPARSE_PARAM
1041 # if defined (__STDC__) || defined (__cplusplus)
1042 int yyparse (void *YYPARSE_PARAM);
1046 #else /* ! YYPARSE_PARAM */
1047 #if defined (__STDC__) || defined (__cplusplus)
1052 #endif /* ! YYPARSE_PARAM */
1056 /* The look-ahead symbol. */
1059 /* The semantic value of the look-ahead symbol. */
1062 /* Number of syntax errors so far. */
1071 #ifdef YYPARSE_PARAM
1072 # if defined (__STDC__) || defined (__cplusplus)
1073 int yyparse (void *YYPARSE_PARAM)
1075 int yyparse (YYPARSE_PARAM)
1076 void *YYPARSE_PARAM;
1078 #else /* ! YYPARSE_PARAM */
1079 #if defined (__STDC__) || defined (__cplusplus)
1090 register int yystate;
1093 /* Number of tokens to shift before error messages enabled. */
1095 /* Look-ahead token as an internal (translated) token number. */
1098 /* Three stacks and their tools:
1099 `yyss': related to states,
1100 `yyvs': related to semantic values,
1101 `yyls': related to locations.
1103 Refer to the stacks thru separate pointers, to allow yyoverflow
1104 to reallocate them elsewhere. */
1106 /* The state stack. */
1107 short int yyssa[YYINITDEPTH];
1108 short int *yyss = yyssa;
1109 register short int *yyssp;
1111 /* The semantic value stack. */
1112 YYSTYPE yyvsa[YYINITDEPTH];
1113 YYSTYPE *yyvs = yyvsa;
1114 register YYSTYPE *yyvsp;
1118 #define YYPOPSTACK (yyvsp--, yyssp--)
1120 YYSIZE_T yystacksize = YYINITDEPTH;
1122 /* The variables used to return semantic value and location from the
1127 /* When reducing, the number of symbols on the RHS of the reduced
1131 YYDPRINTF ((stderr, "Starting parse\n"));
1136 yychar = YYEMPTY; /* Cause a token to be read. */
1138 /* Initialize stack pointers.
1139 Waste one element of value and location stack
1140 so that they stay on the same level as the state stack.
1141 The wasted elements are never initialized. */
1151 /*------------------------------------------------------------.
1152 | yynewstate -- Push a new state, which is found in yystate. |
1153 `------------------------------------------------------------*/
1155 /* In all cases, when you get here, the value and location stacks
1156 have just been pushed. so pushing a state here evens the stacks.
1163 if (yyss + yystacksize - 1 <= yyssp)
1165 /* Get the current used size of the three stacks, in elements. */
1166 YYSIZE_T yysize = yyssp - yyss + 1;
1170 /* Give user a chance to reallocate the stack. Use copies of
1171 these so that the &'s don't force the real ones into
1173 YYSTYPE *yyvs1 = yyvs;
1174 short int *yyss1 = yyss;
1177 /* Each stack pointer address is followed by the size of the
1178 data in use in that stack, in bytes. This used to be a
1179 conditional around just the two extra args, but that might
1180 be undefined if yyoverflow is a macro. */
1181 yyoverflow ("parser stack overflow",
1182 &yyss1, yysize * sizeof (*yyssp),
1183 &yyvs1, yysize * sizeof (*yyvsp),
1190 #else /* no yyoverflow */
1191 # ifndef YYSTACK_RELOCATE
1194 /* Extend the stack our own way. */
1195 if (YYMAXDEPTH <= yystacksize)
1198 if (YYMAXDEPTH < yystacksize)
1199 yystacksize = YYMAXDEPTH;
1202 short int *yyss1 = yyss;
1203 union yyalloc *yyptr =
1204 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1207 YYSTACK_RELOCATE (yyss);
1208 YYSTACK_RELOCATE (yyvs);
1210 # undef YYSTACK_RELOCATE
1212 YYSTACK_FREE (yyss1);
1215 #endif /* no yyoverflow */
1217 yyssp = yyss + yysize - 1;
1218 yyvsp = yyvs + yysize - 1;
1221 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1222 (unsigned long int) yystacksize));
1224 if (yyss + yystacksize - 1 <= yyssp)
1228 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1237 /* Do appropriate processing given the current state. */
1238 /* Read a look-ahead token if we need one and don't already have one. */
1241 /* First try to decide what to do without reference to look-ahead token. */
1243 yyn = yypact[yystate];
1244 if (yyn == YYPACT_NINF)
1247 /* Not known => get a look-ahead token if don't already have one. */
1249 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1250 if (yychar == YYEMPTY)
1252 YYDPRINTF ((stderr, "Reading a token: "));
1256 if (yychar <= YYEOF)
1258 yychar = yytoken = YYEOF;
1259 YYDPRINTF ((stderr, "Now at end of input.\n"));
1263 yytoken = YYTRANSLATE (yychar);
1264 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1267 /* If the proper action on seeing token YYTOKEN is to reduce or to
1268 detect an error, take that action. */
1270 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1275 if (yyn == 0 || yyn == YYTABLE_NINF)
1284 /* Shift the look-ahead token. */
1285 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1287 /* Discard the token being shifted unless it is eof. */
1288 if (yychar != YYEOF)
1294 /* Count tokens shifted since error; after three, turn off error
1303 /*-----------------------------------------------------------.
1304 | yydefault -- do the default action for the current state. |
1305 `-----------------------------------------------------------*/
1307 yyn = yydefact[yystate];
1313 /*-----------------------------.
1314 | yyreduce -- Do a reduction. |
1315 `-----------------------------*/
1317 /* yyn is the number of a rule to reduce with. */
1320 /* If YYLEN is nonzero, implement the default value of the action:
1323 Otherwise, the following line sets YYVAL to garbage.
1324 This behavior is undocumented and Bison
1325 users should not rely upon it. Assigning to YYVAL
1326 unconditionally makes the parser a bit smaller, and it avoids a
1327 GCC warning that YYVAL may be used uninitialized. */
1328 yyval = yyvsp[1-yylen];
1331 YY_REDUCE_PRINT (yyn);
1336 { zconf_error("unexpected end statement"); ;}
1341 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
1347 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1353 { zconf_error("invalid statement"); ;}
1358 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1363 { zconf_error("invalid option"); ;}
1369 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1370 sym->flags |= SYMBOL_OPTIONAL;
1371 menu_add_entry(sym);
1372 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1380 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1387 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1388 sym->flags |= SYMBOL_OPTIONAL;
1389 menu_add_entry(sym);
1390 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1397 if (current_entry->prompt)
1398 current_entry->prompt->type = P_MENU;
1400 zconfprint("warning: menuconfig statement without prompt");
1402 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1409 menu_set_type((yyvsp[-2].id)->stype);
1410 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1411 zconf_curname(), zconf_lineno(),
1412 (yyvsp[-2].id)->stype);
1419 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1420 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1427 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1428 if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1429 menu_set_type((yyvsp[-3].id)->stype);
1430 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1431 zconf_curname(), zconf_lineno(),
1432 (yyvsp[-3].id)->stype);
1439 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1440 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1447 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1448 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1455 struct symbol *sym = sym_lookup(NULL, 0);
1456 sym->flags |= SYMBOL_CHOICE;
1457 menu_add_entry(sym);
1458 menu_add_expr(P_CHOICE, NULL, NULL);
1459 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1466 (yyval.menu) = menu_add_menu();
1473 if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1475 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1483 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1484 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1491 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1492 menu_set_type((yyvsp[-2].id)->stype);
1493 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1494 zconf_curname(), zconf_lineno(),
1495 (yyvsp[-2].id)->stype);
1504 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1505 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1512 if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1513 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1514 printd(DEBUG_PARSE, "%s:%d:default\n",
1515 zconf_curname(), zconf_lineno());
1524 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1525 menu_add_entry(NULL);
1526 menu_add_dep((yyvsp[-1].expr));
1527 (yyval.menu) = menu_add_menu();
1534 if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1536 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1544 menu_add_entry(NULL);
1545 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1546 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1553 (yyval.menu) = menu_add_menu();
1560 if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1562 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1570 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1571 zconf_nextfile((yyvsp[-1].string));
1578 menu_add_entry(NULL);
1579 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1580 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1594 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1602 current_entry->sym->help = (yyvsp[0].string);
1609 menu_add_dep((yyvsp[-1].expr));
1610 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1617 menu_add_dep((yyvsp[-1].expr));
1618 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1625 menu_add_dep((yyvsp[-1].expr));
1626 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1633 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1639 { (yyval.id) = (yyvsp[-1].id); ;}
1644 { (yyval.id) = (yyvsp[-1].id); ;}
1649 { (yyval.id) = (yyvsp[-1].id); ;}
1654 { (yyval.expr) = NULL; ;}
1659 { (yyval.expr) = (yyvsp[0].expr); ;}
1664 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1669 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1674 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1679 { (yyval.expr) = (yyvsp[-1].expr); ;}
1684 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1689 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1694 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1699 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1704 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1710 /* Line 1037 of yacc.c. */
1717 YY_STACK_PRINT (yyss, yyssp);
1722 /* Now `shift' the result of the reduction. Determine what state
1723 that goes to, based on the state we popped back to and the rule
1724 number reduced by. */
1728 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1729 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1730 yystate = yytable[yystate];
1732 yystate = yydefgoto[yyn - YYNTOKENS];
1737 /*------------------------------------.
1738 | yyerrlab -- here on detecting error |
1739 `------------------------------------*/
1741 /* If not already recovering from an error, report this error. */
1746 yyn = yypact[yystate];
1748 if (YYPACT_NINF < yyn && yyn < YYLAST)
1750 YYSIZE_T yysize = 0;
1751 int yytype = YYTRANSLATE (yychar);
1752 const char* yyprefix;
1756 /* Start YYX at -YYN if negative to avoid negative indexes in
1758 int yyxbegin = yyn < 0 ? -yyn : 0;
1760 /* Stay within bounds of both yycheck and yytname. */
1761 int yychecklim = YYLAST - yyn;
1762 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1765 yyprefix = ", expecting ";
1766 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1767 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1769 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1777 yysize += (sizeof ("syntax error, unexpected ")
1778 + yystrlen (yytname[yytype]));
1779 yymsg = (char *) YYSTACK_ALLOC (yysize);
1782 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1783 yyp = yystpcpy (yyp, yytname[yytype]);
1787 yyprefix = ", expecting ";
1788 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1789 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1791 yyp = yystpcpy (yyp, yyprefix);
1792 yyp = yystpcpy (yyp, yytname[yyx]);
1797 YYSTACK_FREE (yymsg);
1800 yyerror ("syntax error; also virtual memory exhausted");
1803 #endif /* YYERROR_VERBOSE */
1804 yyerror ("syntax error");
1809 if (yyerrstatus == 3)
1811 /* If just tried and failed to reuse look-ahead token after an
1812 error, discard it. */
1814 if (yychar <= YYEOF)
1816 /* If at end of input, pop the error token,
1817 then the rest of the stack, then return failure. */
1818 if (yychar == YYEOF)
1825 yydestruct ("Error: popping",
1826 yystos[*yyssp], yyvsp);
1831 yydestruct ("Error: discarding", yytoken, &yylval);
1836 /* Else will try to reuse look-ahead token after shifting the error
1841 /*---------------------------------------------------.
1842 | yyerrorlab -- error raised explicitly by YYERROR. |
1843 `---------------------------------------------------*/
1847 /* Pacify GCC when the user code never invokes YYERROR and the label
1848 yyerrorlab therefore never appears in user code. */
1859 /*-------------------------------------------------------------.
1860 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1861 `-------------------------------------------------------------*/
1863 yyerrstatus = 3; /* Each real token shifted decrements this. */
1867 yyn = yypact[yystate];
1868 if (yyn != YYPACT_NINF)
1871 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1879 /* Pop the current state because it cannot handle the error token. */
1884 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1887 YY_STACK_PRINT (yyss, yyssp);
1896 /* Shift the error token. */
1897 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1903 /*-------------------------------------.
1904 | yyacceptlab -- YYACCEPT comes here. |
1905 `-------------------------------------*/
1910 /*-----------------------------------.
1911 | yyabortlab -- YYABORT comes here. |
1912 `-----------------------------------*/
1914 yydestruct ("Error: discarding lookahead",
1921 /*----------------------------------------------.
1922 | yyoverflowlab -- parser overflow comes here. |
1923 `----------------------------------------------*/
1925 yyerror ("parser stack overflow");
1933 YYSTACK_FREE (yyss);
1942 void conf_parse(const char *name)
1947 zconf_initscan(name);
1951 modules_sym = sym_lookup("MODULES", 0);
1952 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
1955 if (getenv("ZCONF_DEBUG"))
1961 menu_finalize(&rootmenu);
1962 for_all_symbols(i, sym) {
1963 sym_check_deps(sym);
1966 sym_change_count = 1;
1969 const char *zconf_tokenname(int token)
1972 case T_MENU: return "menu";
1973 case T_ENDMENU: return "endmenu";
1974 case T_CHOICE: return "choice";
1975 case T_ENDCHOICE: return "endchoice";
1976 case T_IF: return "if";
1977 case T_ENDIF: return "endif";
1978 case T_DEPENDS: return "depends";
1983 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1985 if (id->token != endtoken) {
1986 zconf_error("unexpected '%s' within %s block",
1987 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1991 if (current_menu->file != current_file) {
1992 zconf_error("'%s' in different file than '%s'",
1993 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1994 fprintf(stderr, "%s:%d: location of the '%s'\n",
1995 current_menu->file->name, current_menu->lineno,
1996 zconf_tokenname(starttoken));
2003 static void zconfprint(const char *err, ...)
2007 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2009 vfprintf(stderr, err, ap);
2011 fprintf(stderr, "\n");
2014 static void zconf_error(const char *err, ...)
2019 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2021 vfprintf(stderr, err, ap);
2023 fprintf(stderr, "\n");
2026 static void zconferror(const char *err)
2029 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2033 void print_quoted_string(FILE *out, const char *str)
2039 while ((p = strchr(str, '"'))) {
2042 fprintf(out, "%.*s", len, str);
2050 void print_symbol(FILE *out, struct menu *menu)
2052 struct symbol *sym = menu->sym;
2053 struct property *prop;
2055 if (sym_is_choice(sym))
2056 fprintf(out, "choice\n");
2058 fprintf(out, "config %s\n", sym->name);
2059 switch (sym->type) {
2061 fputs(" boolean\n", out);
2064 fputs(" tristate\n", out);
2067 fputs(" string\n", out);
2070 fputs(" integer\n", out);
2073 fputs(" hex\n", out);
2076 fputs(" ???\n", out);
2079 for (prop = sym->prop; prop; prop = prop->next) {
2080 if (prop->menu != menu)
2082 switch (prop->type) {
2084 fputs(" prompt ", out);
2085 print_quoted_string(out, prop->text);
2086 if (!expr_is_yes(prop->visible.expr)) {
2088 expr_fprint(prop->visible.expr, out);
2093 fputs( " default ", out);
2094 expr_fprint(prop->expr, out);
2095 if (!expr_is_yes(prop->visible.expr)) {
2097 expr_fprint(prop->visible.expr, out);
2102 fputs(" #choice value\n", out);
2105 fprintf(out, " unknown prop %d!\n", prop->type);
2110 int len = strlen(sym->help);
2111 while (sym->help[--len] == '\n')
2113 fprintf(out, " help\n%s\n", sym->help);
2118 void zconfdump(FILE *out)
2120 struct property *prop;
2124 menu = rootmenu.list;
2126 if ((sym = menu->sym))
2127 print_symbol(out, menu);
2128 else if ((prop = menu->prompt)) {
2129 switch (prop->type) {
2131 fputs("\ncomment ", out);
2132 print_quoted_string(out, prop->text);
2136 fputs("\nmenu ", out);
2137 print_quoted_string(out, prop->text);
2143 if (!expr_is_yes(prop->visible.expr)) {
2144 fputs(" depends ", out);
2145 expr_fprint(prop->visible.expr, out);
2153 else if (menu->next)
2155 else while ((menu = menu->parent)) {
2156 if (menu->prompt && menu->prompt->type == P_MENU)
2157 fputs("\nendmenu\n", out);
2166 #include "lex.zconf.c"
2168 #include "confdata.c"