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
105 #define T_MAINMENU 258
107 #define T_ENDMENU 260
110 #define T_ENDCHOICE 263
111 #define T_COMMENT 264
113 #define T_MENUCONFIG 266
115 #define T_HELPTEXT 268
118 #define T_DEPENDS 271
119 #define T_REQUIRES 272
120 #define T_OPTIONAL 273
122 #define T_DEFAULT 275
123 #define T_TRISTATE 276
124 #define T_DEF_TRISTATE 277
125 #define T_BOOLEAN 278
126 #define T_DEF_BOOLEAN 279
131 #define T_WORD_QUOTE 284
132 #define T_UNEQUAL 285
135 #define T_CLOSE_PAREN 288
136 #define T_OPEN_PAREN 289
148 /* Copy the first part of user declarations. */
152 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
153 * Released under the terms of the GNU GPL v2.0.
163 #define LKC_DIRECT_LINK
166 #include "zconf.hash.c"
168 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
170 #define PRINTD 0x0001
171 #define DEBUG_PARSE 0x0002
175 extern int zconflex(void);
176 static void zconfprint(const char *err, ...);
177 static void zconferror(const char *err);
178 static bool zconf_endtoken(int token, int starttoken, int endtoken);
180 struct symbol *symbol_hash[257];
182 static struct menu *current_menu, *current_entry;
184 #define YYERROR_VERBOSE
187 /* Enabling traces. */
192 /* Enabling verbose error messages. */
193 #ifdef YYERROR_VERBOSE
194 # undef YYERROR_VERBOSE
195 # define YYERROR_VERBOSE 1
197 # define YYERROR_VERBOSE 0
200 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
202 typedef union YYSTYPE {
205 struct symbol *symbol;
209 /* Line 190 of yacc.c. */
211 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
212 # define YYSTYPE_IS_DECLARED 1
213 # define YYSTYPE_IS_TRIVIAL 1
218 /* Copy the second part of user declarations. */
221 /* Line 213 of yacc.c. */
224 #if ! defined (yyoverflow) || YYERROR_VERBOSE
230 # define YYMALLOC malloc
233 /* The parser invokes alloca or malloc; define the necessary symbols. */
235 # ifdef YYSTACK_USE_ALLOCA
236 # if YYSTACK_USE_ALLOCA
238 # define YYSTACK_ALLOC __builtin_alloca
240 # define YYSTACK_ALLOC alloca
245 # ifdef YYSTACK_ALLOC
246 /* Pacify GCC's `empty if-body' warning. */
247 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
249 # if defined (__STDC__) || defined (__cplusplus)
250 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
251 # define YYSIZE_T size_t
253 # define YYSTACK_ALLOC YYMALLOC
254 # define YYSTACK_FREE YYFREE
256 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
259 #if (! defined (yyoverflow) \
260 && (! defined (__cplusplus) \
261 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
263 /* A type that is properly aligned for any stack member. */
270 /* The size of the maximum gap between one aligned stack and the next. */
271 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
273 /* The size of an array large to enough to hold all stacks, each with
275 # define YYSTACK_BYTES(N) \
276 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
277 + YYSTACK_GAP_MAXIMUM)
279 /* Copy COUNT objects from FROM to TO. The source and destination do
282 # if defined (__GNUC__) && 1 < __GNUC__
283 # define YYCOPY(To, From, Count) \
284 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
286 # define YYCOPY(To, From, Count) \
289 register YYSIZE_T yyi; \
290 for (yyi = 0; yyi < (Count); yyi++) \
291 (To)[yyi] = (From)[yyi]; \
297 /* Relocate STACK from its old location to the new one. The
298 local variables YYSIZE and YYSTACKSIZE give the old and new number of
299 elements in the stack, and YYPTR gives the new location of the
300 stack. Advance YYPTR to a properly aligned location for the next
302 # define YYSTACK_RELOCATE(Stack) \
305 YYSIZE_T yynewbytes; \
306 YYCOPY (&yyptr->Stack, Stack, yysize); \
307 Stack = &yyptr->Stack; \
308 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
309 yyptr += yynewbytes / sizeof (*yyptr); \
315 #if defined (__STDC__) || defined (__cplusplus)
316 typedef signed char yysigned_char;
318 typedef short int yysigned_char;
321 /* YYFINAL -- State number of the termination state. */
323 /* YYLAST -- Last index in YYTABLE. */
326 /* YYNTOKENS -- Number of terminals. */
328 /* YYNNTS -- Number of nonterminals. */
330 /* YYNRULES -- Number of rules. */
332 /* YYNRULES -- Number of states. */
333 #define YYNSTATES 182
335 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
337 #define YYMAXUTOK 296
339 #define YYTRANSLATE(YYX) \
340 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
342 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
343 static const unsigned char yytranslate[] =
345 0, 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, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
366 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
369 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
370 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
371 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
372 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
373 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
374 35, 36, 37, 38, 39, 40, 41
378 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
380 static const unsigned short int yyprhs[] =
382 0, 0, 3, 4, 7, 9, 11, 13, 17, 19,
383 21, 23, 26, 28, 30, 32, 34, 36, 38, 42,
384 45, 49, 52, 53, 56, 59, 62, 65, 69, 74,
385 78, 83, 87, 91, 95, 100, 105, 110, 116, 119,
386 122, 124, 128, 131, 132, 135, 138, 141, 144, 149,
387 153, 157, 160, 165, 166, 169, 173, 175, 179, 182,
388 183, 186, 189, 192, 196, 199, 201, 205, 208, 209,
389 212, 215, 218, 222, 226, 228, 232, 235, 238, 241,
390 242, 245, 248, 253, 257, 261, 262, 265, 267, 269,
391 272, 275, 278, 280, 282, 283, 286, 288, 292, 296,
392 300, 303, 307, 311, 313
395 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
396 static const yysigned_char yyrhs[] =
398 43, 0, -1, -1, 43, 44, -1, 45, -1, 55,
399 -1, 66, -1, 3, 77, 79, -1, 5, -1, 15,
400 -1, 8, -1, 1, 79, -1, 61, -1, 71, -1,
401 47, -1, 49, -1, 69, -1, 79, -1, 10, 28,
402 32, -1, 46, 50, -1, 11, 28, 32, -1, 48,
403 50, -1, -1, 50, 51, -1, 50, 75, -1, 50,
404 73, -1, 50, 32, -1, 21, 76, 32, -1, 22,
405 81, 80, 32, -1, 23, 76, 32, -1, 24, 81,
406 80, 32, -1, 26, 76, 32, -1, 27, 76, 32,
407 -1, 25, 76, 32, -1, 19, 77, 80, 32, -1,
408 20, 81, 80, 32, -1, 36, 28, 80, 32, -1,
409 37, 82, 82, 80, 32, -1, 7, 32, -1, 52,
410 56, -1, 78, -1, 53, 58, 54, -1, 53, 58,
411 -1, -1, 56, 57, -1, 56, 75, -1, 56, 73,
412 -1, 56, 32, -1, 19, 77, 80, 32, -1, 21,
413 76, 32, -1, 23, 76, 32, -1, 18, 32, -1,
414 20, 28, 80, 32, -1, -1, 58, 45, -1, 14,
415 81, 32, -1, 78, -1, 59, 62, 60, -1, 59,
416 62, -1, -1, 62, 45, -1, 62, 66, -1, 62,
417 55, -1, 4, 77, 32, -1, 63, 74, -1, 78,
418 -1, 64, 67, 65, -1, 64, 67, -1, -1, 67,
419 45, -1, 67, 66, -1, 67, 55, -1, 67, 1,
420 32, -1, 6, 77, 32, -1, 68, -1, 9, 77,
421 32, -1, 70, 74, -1, 12, 32, -1, 72, 13,
422 -1, -1, 74, 75, -1, 74, 32, -1, 16, 35,
423 81, 32, -1, 16, 81, 32, -1, 17, 81, 32,
424 -1, -1, 77, 80, -1, 28, -1, 29, -1, 5,
425 79, -1, 8, 79, -1, 15, 79, -1, 32, -1,
426 31, -1, -1, 14, 81, -1, 82, -1, 82, 40,
427 82, -1, 82, 30, 82, -1, 34, 81, 33, -1,
428 41, 81, -1, 81, 38, 81, -1, 81, 39, 81,
432 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
433 static const unsigned short int yyrline[] =
435 0, 97, 97, 98, 101, 102, 103, 104, 105, 106,
436 107, 108, 112, 113, 114, 115, 116, 117, 123, 131,
437 137, 145, 155, 157, 158, 159, 160, 163, 169, 176,
438 182, 189, 195, 201, 207, 213, 219, 225, 233, 242,
439 248, 257, 258, 264, 266, 267, 268, 269, 272, 278,
440 284, 290, 296, 302, 304, 309, 318, 327, 328, 334,
441 336, 337, 338, 343, 350, 356, 365, 366, 372, 374,
442 375, 376, 377, 380, 386, 393, 400, 407, 413, 420,
443 421, 422, 425, 430, 435, 443, 445, 450, 451, 454,
444 455, 456, 460, 460, 462, 463, 466, 467, 468, 469,
445 470, 471, 472, 475, 476
449 #if YYDEBUG || YYERROR_VERBOSE
450 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
451 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
452 static const char *const yytname[] =
454 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
455 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
456 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
457 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE",
458 "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT",
459 "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL",
460 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR",
461 "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block",
462 "config_entry_start", "config_stmt", "menuconfig_entry_start",
463 "menuconfig_stmt", "config_option_list", "config_option", "choice",
464 "choice_entry", "choice_end", "choice_stmt", "choice_option_list",
465 "choice_option", "choice_block", "if", "if_end", "if_stmt", "if_block",
466 "menu", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source",
467 "source_stmt", "comment", "comment_stmt", "help_start", "help",
468 "depends_list", "depends", "prompt_stmt_opt", "prompt", "end",
469 "nl_or_eof", "if_expr", "expr", "symbol", 0
474 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
476 static const unsigned short int yytoknum[] =
478 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
479 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
480 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
481 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
486 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
487 static const unsigned char yyr1[] =
489 0, 42, 43, 43, 44, 44, 44, 44, 44, 44,
490 44, 44, 45, 45, 45, 45, 45, 45, 46, 47,
491 48, 49, 50, 50, 50, 50, 50, 51, 51, 51,
492 51, 51, 51, 51, 51, 51, 51, 51, 52, 53,
493 54, 55, 55, 56, 56, 56, 56, 56, 57, 57,
494 57, 57, 57, 58, 58, 59, 60, 61, 61, 62,
495 62, 62, 62, 63, 64, 65, 66, 66, 67, 67,
496 67, 67, 67, 68, 69, 70, 71, 72, 73, 74,
497 74, 74, 75, 75, 75, 76, 76, 77, 77, 78,
498 78, 78, 79, 79, 80, 80, 81, 81, 81, 81,
502 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
503 static const unsigned char yyr2[] =
505 0, 2, 0, 2, 1, 1, 1, 3, 1, 1,
506 1, 2, 1, 1, 1, 1, 1, 1, 3, 2,
507 3, 2, 0, 2, 2, 2, 2, 3, 4, 3,
508 4, 3, 3, 3, 4, 4, 4, 5, 2, 2,
509 1, 3, 2, 0, 2, 2, 2, 2, 4, 3,
510 3, 2, 4, 0, 2, 3, 1, 3, 2, 0,
511 2, 2, 2, 3, 2, 1, 3, 2, 0, 2,
512 2, 2, 3, 3, 1, 3, 2, 2, 2, 0,
513 2, 2, 4, 3, 3, 0, 2, 1, 1, 2,
514 2, 2, 1, 1, 0, 2, 1, 3, 3, 3,
518 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
519 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
520 means the default is an error. */
521 static const unsigned char yydefact[] =
523 2, 0, 1, 0, 0, 0, 8, 0, 0, 10,
524 0, 0, 0, 0, 9, 93, 92, 3, 4, 22,
525 14, 22, 15, 43, 53, 5, 59, 12, 79, 68,
526 6, 74, 16, 79, 13, 17, 11, 87, 88, 0,
527 0, 0, 38, 0, 0, 0, 103, 104, 0, 0,
528 0, 96, 19, 21, 39, 42, 58, 64, 0, 76,
529 7, 63, 73, 75, 18, 20, 0, 100, 55, 0,
530 0, 0, 0, 0, 0, 0, 0, 0, 85, 0,
531 85, 0, 85, 85, 85, 26, 0, 0, 23, 0,
532 25, 24, 0, 0, 0, 85, 85, 47, 44, 46,
533 45, 0, 0, 0, 54, 41, 40, 60, 62, 57,
534 61, 56, 81, 80, 0, 69, 71, 66, 70, 65,
535 99, 101, 102, 98, 97, 77, 0, 0, 0, 94,
536 94, 0, 94, 94, 0, 94, 0, 0, 0, 94,
537 0, 78, 51, 94, 94, 0, 0, 89, 90, 91,
538 72, 0, 83, 84, 0, 0, 0, 27, 86, 0,
539 29, 0, 33, 31, 32, 0, 94, 0, 0, 49,
540 50, 82, 95, 34, 35, 28, 30, 36, 0, 48,
544 /* YYDEFGOTO[NTERM-NUM]. */
545 static const short int yydefgoto[] =
547 -1, 1, 17, 18, 19, 20, 21, 22, 52, 88,
548 23, 24, 105, 25, 54, 98, 55, 26, 109, 27,
549 56, 28, 29, 117, 30, 58, 31, 32, 33, 34,
550 89, 90, 57, 91, 131, 132, 106, 35, 155, 50,
554 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
556 #define YYPACT_NINF -99
557 static const short int yypact[] =
559 -99, 48, -99, 38, 46, 46, -99, 46, -29, -99,
560 46, -17, -3, -11, -99, -99, -99, -99, -99, -99,
561 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
562 -99, -99, -99, -99, -99, -99, -99, -99, -99, 38,
563 12, 15, -99, 18, 51, 62, -99, -99, -11, -11,
564 4, -24, 138, 138, 160, 121, 110, -4, 81, -4,
565 -99, -99, -99, -99, -99, -99, -19, -99, -99, -11,
566 -11, 70, 70, 73, 32, -11, 46, -11, 46, -11,
567 46, -11, 46, 46, 46, -99, 36, 70, -99, 95,
568 -99, -99, 96, 46, 106, 46, 46, -99, -99, -99,
569 -99, 38, 38, 38, -99, -99, -99, -99, -99, -99,
570 -99, -99, -99, -99, 112, -99, -99, -99, -99, -99,
571 -99, 117, -99, -99, -99, -99, -11, 33, 65, 131,
572 1, 119, 131, 1, 136, 1, 153, 154, 155, 131,
573 70, -99, -99, 131, 131, 156, 157, -99, -99, -99,
574 -99, 101, -99, -99, -11, 158, 159, -99, -99, 161,
575 -99, 162, -99, -99, -99, 163, 131, 164, 165, -99,
576 -99, -99, 99, -99, -99, -99, -99, -99, 166, -99,
580 /* YYPGOTO[NTERM-NUM]. */
581 static const short int yypgoto[] =
583 -99, -99, -99, 111, -99, -99, -99, -99, 178, -99,
584 -99, -99, -99, 91, -99, -99, -99, -99, -99, -99,
585 -99, -99, -99, -99, 115, -99, -99, -99, -99, -99,
586 -99, 146, 168, 89, 27, 0, 126, -1, -98, -48,
590 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
591 positive, shift that token. If negative, reduce the rule which
592 number is the opposite. If zero, do what YYDEFACT says.
593 If YYTABLE_NINF, syntax error. */
594 #define YYTABLE_NINF -68
595 static const short int yytable[] =
597 66, 67, 36, 42, 39, 40, 71, 41, 123, 124,
598 43, 44, 74, 75, 120, 154, 72, 46, 47, 69,
599 70, 121, 122, 48, 140, 45, 127, 128, 112, 130,
600 49, 133, 156, 135, 158, 159, 68, 161, 60, 69,
601 70, 165, 69, 70, 61, 167, 168, 62, 2, 3,
602 63, 4, 5, 6, 7, 8, 9, 10, 11, 12,
603 46, 47, 13, 14, 139, 152, 48, 126, 178, 15,
604 16, 69, 70, 49, 37, 38, 129, 166, 151, 15,
605 16, -67, 114, 64, -67, 5, 101, 7, 8, 102,
606 10, 11, 12, 143, 65, 13, 103, 153, 46, 47,
607 147, 148, 149, 69, 70, 125, 172, 134, 141, 136,
608 137, 138, 15, 16, 5, 101, 7, 8, 102, 10,
609 11, 12, 145, 146, 13, 103, 101, 7, 142, 102,
610 10, 11, 12, 171, 144, 13, 103, 69, 70, 69,
611 70, 15, 16, 100, 150, 154, 113, 108, 113, 116,
612 73, 157, 15, 16, 74, 75, 70, 76, 77, 78,
613 79, 80, 81, 82, 83, 84, 104, 107, 160, 115,
614 85, 110, 73, 118, 86, 87, 74, 75, 92, 93,
615 94, 95, 111, 96, 119, 162, 163, 164, 169, 170,
616 173, 174, 97, 175, 176, 177, 179, 180, 181, 53,
620 static const unsigned char yycheck[] =
622 48, 49, 3, 32, 4, 5, 30, 7, 71, 72,
623 10, 28, 16, 17, 33, 14, 40, 28, 29, 38,
624 39, 69, 70, 34, 87, 28, 74, 75, 32, 77,
625 41, 79, 130, 81, 132, 133, 32, 135, 39, 38,
626 39, 139, 38, 39, 32, 143, 144, 32, 0, 1,
627 32, 3, 4, 5, 6, 7, 8, 9, 10, 11,
628 28, 29, 14, 15, 28, 32, 34, 35, 166, 31,
629 32, 38, 39, 41, 28, 29, 76, 140, 126, 31,
630 32, 0, 1, 32, 3, 4, 5, 6, 7, 8,
631 9, 10, 11, 93, 32, 14, 15, 32, 28, 29,
632 101, 102, 103, 38, 39, 32, 154, 80, 13, 82,
633 83, 84, 31, 32, 4, 5, 6, 7, 8, 9,
634 10, 11, 95, 96, 14, 15, 5, 6, 32, 8,
635 9, 10, 11, 32, 28, 14, 15, 38, 39, 38,
636 39, 31, 32, 54, 32, 14, 57, 56, 59, 58,
637 12, 32, 31, 32, 16, 17, 39, 19, 20, 21,
638 22, 23, 24, 25, 26, 27, 55, 56, 32, 58,
639 32, 56, 12, 58, 36, 37, 16, 17, 18, 19,
640 20, 21, 56, 23, 58, 32, 32, 32, 32, 32,
641 32, 32, 32, 32, 32, 32, 32, 32, 32, 21,
645 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
646 symbol of state STATE-NUM. */
647 static const unsigned char yystos[] =
649 0, 43, 0, 1, 3, 4, 5, 6, 7, 8,
650 9, 10, 11, 14, 15, 31, 32, 44, 45, 46,
651 47, 48, 49, 52, 53, 55, 59, 61, 63, 64,
652 66, 68, 69, 70, 71, 79, 79, 28, 29, 77,
653 77, 77, 32, 77, 28, 28, 28, 29, 34, 41,
654 81, 82, 50, 50, 56, 58, 62, 74, 67, 74,
655 79, 32, 32, 32, 32, 32, 81, 81, 32, 38,
656 39, 30, 40, 12, 16, 17, 19, 20, 21, 22,
657 23, 24, 25, 26, 27, 32, 36, 37, 51, 72,
658 73, 75, 18, 19, 20, 21, 23, 32, 57, 73,
659 75, 5, 8, 15, 45, 54, 78, 45, 55, 60,
660 66, 78, 32, 75, 1, 45, 55, 65, 66, 78,
661 33, 81, 81, 82, 82, 32, 35, 81, 81, 77,
662 81, 76, 77, 81, 76, 81, 76, 76, 76, 28,
663 82, 13, 32, 77, 28, 76, 76, 79, 79, 79,
664 32, 81, 32, 32, 14, 80, 80, 32, 80, 80,
665 32, 80, 32, 32, 32, 80, 82, 80, 80, 32,
666 32, 32, 81, 32, 32, 32, 32, 32, 80, 32,
670 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
671 # define YYSIZE_T __SIZE_TYPE__
673 #if ! defined (YYSIZE_T) && defined (size_t)
674 # define YYSIZE_T size_t
676 #if ! defined (YYSIZE_T)
677 # if defined (__STDC__) || defined (__cplusplus)
678 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
679 # define YYSIZE_T size_t
682 #if ! defined (YYSIZE_T)
683 # define YYSIZE_T unsigned int
686 #define yyerrok (yyerrstatus = 0)
687 #define yyclearin (yychar = YYEMPTY)
691 #define YYACCEPT goto yyacceptlab
692 #define YYABORT goto yyabortlab
693 #define YYERROR goto yyerrorlab
696 /* Like YYERROR except do call yyerror. This remains here temporarily
697 to ease the transition to the new meaning of YYERROR, for GCC.
698 Once GCC version 2 has supplanted version 1, this can go. */
700 #define YYFAIL goto yyerrlab
702 #define YYRECOVERING() (!!yyerrstatus)
704 #define YYBACKUP(Token, Value) \
706 if (yychar == YYEMPTY && yylen == 1) \
710 yytoken = YYTRANSLATE (yychar); \
716 yyerror ("syntax error: cannot back up");\
723 #define YYERRCODE 256
726 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
727 If N is 0, then set CURRENT to the empty location which ends
728 the previous symbol: RHS[0] (always defined). */
730 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
731 #ifndef YYLLOC_DEFAULT
732 # define YYLLOC_DEFAULT(Current, Rhs, N) \
736 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
737 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
738 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
739 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
743 (Current).first_line = (Current).last_line = \
744 YYRHSLOC (Rhs, 0).last_line; \
745 (Current).first_column = (Current).last_column = \
746 YYRHSLOC (Rhs, 0).last_column; \
752 /* YY_LOCATION_PRINT -- Print the location on the stream.
753 This macro was not mandated originally: define only if we know
754 we won't break user code: when these are the locations we know. */
756 #ifndef YY_LOCATION_PRINT
757 # if YYLTYPE_IS_TRIVIAL
758 # define YY_LOCATION_PRINT(File, Loc) \
759 fprintf (File, "%d.%d-%d.%d", \
760 (Loc).first_line, (Loc).first_column, \
761 (Loc).last_line, (Loc).last_column)
763 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
768 /* YYLEX -- calling `yylex' with the right arguments. */
771 # define YYLEX yylex (YYLEX_PARAM)
773 # define YYLEX yylex ()
776 /* Enable debugging if requested. */
780 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
781 # define YYFPRINTF fprintf
784 # define YYDPRINTF(Args) \
790 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
794 YYFPRINTF (stderr, "%s ", Title); \
795 yysymprint (stderr, \
797 YYFPRINTF (stderr, "\n"); \
801 /*------------------------------------------------------------------.
802 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
804 `------------------------------------------------------------------*/
806 #if defined (__STDC__) || defined (__cplusplus)
808 yy_stack_print (short int *bottom, short int *top)
811 yy_stack_print (bottom, top)
816 YYFPRINTF (stderr, "Stack now");
817 for (/* Nothing. */; bottom <= top; ++bottom)
818 YYFPRINTF (stderr, " %d", *bottom);
819 YYFPRINTF (stderr, "\n");
822 # define YY_STACK_PRINT(Bottom, Top) \
825 yy_stack_print ((Bottom), (Top)); \
829 /*------------------------------------------------.
830 | Report that the YYRULE is going to be reduced. |
831 `------------------------------------------------*/
833 #if defined (__STDC__) || defined (__cplusplus)
835 yy_reduce_print (int yyrule)
838 yy_reduce_print (yyrule)
843 unsigned int yylno = yyrline[yyrule];
844 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
846 /* Print the symbols being reduced, and their result. */
847 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
848 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
849 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
852 # define YY_REDUCE_PRINT(Rule) \
855 yy_reduce_print (Rule); \
858 /* Nonzero means print parse trace. It is left uninitialized so that
859 multiple parsers can coexist. */
862 # define YYDPRINTF(Args)
863 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
864 # define YY_STACK_PRINT(Bottom, Top)
865 # define YY_REDUCE_PRINT(Rule)
866 #endif /* !YYDEBUG */
869 /* YYINITDEPTH -- initial size of the parser's stacks. */
871 # define YYINITDEPTH 200
874 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
875 if the built-in stack extension method is used).
877 Do not make this value too large; the results are undefined if
878 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
879 evaluated with infinite-precision integer arithmetic. */
882 # define YYMAXDEPTH 10000
890 # if defined (__GLIBC__) && defined (_STRING_H)
891 # define yystrlen strlen
893 /* Return the length of YYSTR. */
895 # if defined (__STDC__) || defined (__cplusplus)
896 yystrlen (const char *yystr)
902 register const char *yys = yystr;
904 while (*yys++ != '\0')
907 return yys - yystr - 1;
913 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
914 # define yystpcpy stpcpy
916 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
919 # if defined (__STDC__) || defined (__cplusplus)
920 yystpcpy (char *yydest, const char *yysrc)
922 yystpcpy (yydest, yysrc)
927 register char *yyd = yydest;
928 register const char *yys = yysrc;
930 while ((*yyd++ = *yys++) != '\0')
938 #endif /* !YYERROR_VERBOSE */
943 /*--------------------------------.
944 | Print this symbol on YYOUTPUT. |
945 `--------------------------------*/
947 #if defined (__STDC__) || defined (__cplusplus)
949 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
952 yysymprint (yyoutput, yytype, yyvaluep)
958 /* Pacify ``unused variable'' warnings. */
961 if (yytype < YYNTOKENS)
962 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
964 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
968 if (yytype < YYNTOKENS)
969 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
976 YYFPRINTF (yyoutput, ")");
979 #endif /* ! YYDEBUG */
980 /*-----------------------------------------------.
981 | Release the memory associated to this symbol. |
982 `-----------------------------------------------*/
984 #if defined (__STDC__) || defined (__cplusplus)
986 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
989 yydestruct (yymsg, yytype, yyvaluep)
995 /* Pacify ``unused variable'' warnings. */
1000 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1011 /* Prevent warnings from -Wmissing-prototypes. */
1013 #ifdef YYPARSE_PARAM
1014 # if defined (__STDC__) || defined (__cplusplus)
1015 int yyparse (void *YYPARSE_PARAM);
1019 #else /* ! YYPARSE_PARAM */
1020 #if defined (__STDC__) || defined (__cplusplus)
1025 #endif /* ! YYPARSE_PARAM */
1029 /* The look-ahead symbol. */
1032 /* The semantic value of the look-ahead symbol. */
1035 /* Number of syntax errors so far. */
1044 #ifdef YYPARSE_PARAM
1045 # if defined (__STDC__) || defined (__cplusplus)
1046 int yyparse (void *YYPARSE_PARAM)
1048 int yyparse (YYPARSE_PARAM)
1049 void *YYPARSE_PARAM;
1051 #else /* ! YYPARSE_PARAM */
1052 #if defined (__STDC__) || defined (__cplusplus)
1063 register int yystate;
1066 /* Number of tokens to shift before error messages enabled. */
1068 /* Look-ahead token as an internal (translated) token number. */
1071 /* Three stacks and their tools:
1072 `yyss': related to states,
1073 `yyvs': related to semantic values,
1074 `yyls': related to locations.
1076 Refer to the stacks thru separate pointers, to allow yyoverflow
1077 to reallocate them elsewhere. */
1079 /* The state stack. */
1080 short int yyssa[YYINITDEPTH];
1081 short int *yyss = yyssa;
1082 register short int *yyssp;
1084 /* The semantic value stack. */
1085 YYSTYPE yyvsa[YYINITDEPTH];
1086 YYSTYPE *yyvs = yyvsa;
1087 register YYSTYPE *yyvsp;
1091 #define YYPOPSTACK (yyvsp--, yyssp--)
1093 YYSIZE_T yystacksize = YYINITDEPTH;
1095 /* The variables used to return semantic value and location from the
1100 /* When reducing, the number of symbols on the RHS of the reduced
1104 YYDPRINTF ((stderr, "Starting parse\n"));
1109 yychar = YYEMPTY; /* Cause a token to be read. */
1111 /* Initialize stack pointers.
1112 Waste one element of value and location stack
1113 so that they stay on the same level as the state stack.
1114 The wasted elements are never initialized. */
1124 /*------------------------------------------------------------.
1125 | yynewstate -- Push a new state, which is found in yystate. |
1126 `------------------------------------------------------------*/
1128 /* In all cases, when you get here, the value and location stacks
1129 have just been pushed. so pushing a state here evens the stacks.
1136 if (yyss + yystacksize - 1 <= yyssp)
1138 /* Get the current used size of the three stacks, in elements. */
1139 YYSIZE_T yysize = yyssp - yyss + 1;
1143 /* Give user a chance to reallocate the stack. Use copies of
1144 these so that the &'s don't force the real ones into
1146 YYSTYPE *yyvs1 = yyvs;
1147 short int *yyss1 = yyss;
1150 /* Each stack pointer address is followed by the size of the
1151 data in use in that stack, in bytes. This used to be a
1152 conditional around just the two extra args, but that might
1153 be undefined if yyoverflow is a macro. */
1154 yyoverflow ("parser stack overflow",
1155 &yyss1, yysize * sizeof (*yyssp),
1156 &yyvs1, yysize * sizeof (*yyvsp),
1163 #else /* no yyoverflow */
1164 # ifndef YYSTACK_RELOCATE
1167 /* Extend the stack our own way. */
1168 if (YYMAXDEPTH <= yystacksize)
1171 if (YYMAXDEPTH < yystacksize)
1172 yystacksize = YYMAXDEPTH;
1175 short int *yyss1 = yyss;
1176 union yyalloc *yyptr =
1177 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1180 YYSTACK_RELOCATE (yyss);
1181 YYSTACK_RELOCATE (yyvs);
1183 # undef YYSTACK_RELOCATE
1185 YYSTACK_FREE (yyss1);
1188 #endif /* no yyoverflow */
1190 yyssp = yyss + yysize - 1;
1191 yyvsp = yyvs + yysize - 1;
1194 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1195 (unsigned long int) yystacksize));
1197 if (yyss + yystacksize - 1 <= yyssp)
1201 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1210 /* Do appropriate processing given the current state. */
1211 /* Read a look-ahead token if we need one and don't already have one. */
1214 /* First try to decide what to do without reference to look-ahead token. */
1216 yyn = yypact[yystate];
1217 if (yyn == YYPACT_NINF)
1220 /* Not known => get a look-ahead token if don't already have one. */
1222 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1223 if (yychar == YYEMPTY)
1225 YYDPRINTF ((stderr, "Reading a token: "));
1229 if (yychar <= YYEOF)
1231 yychar = yytoken = YYEOF;
1232 YYDPRINTF ((stderr, "Now at end of input.\n"));
1236 yytoken = YYTRANSLATE (yychar);
1237 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1240 /* If the proper action on seeing token YYTOKEN is to reduce or to
1241 detect an error, take that action. */
1243 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1248 if (yyn == 0 || yyn == YYTABLE_NINF)
1257 /* Shift the look-ahead token. */
1258 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1260 /* Discard the token being shifted unless it is eof. */
1261 if (yychar != YYEOF)
1267 /* Count tokens shifted since error; after three, turn off error
1276 /*-----------------------------------------------------------.
1277 | yydefault -- do the default action for the current state. |
1278 `-----------------------------------------------------------*/
1280 yyn = yydefact[yystate];
1286 /*-----------------------------.
1287 | yyreduce -- Do a reduction. |
1288 `-----------------------------*/
1290 /* yyn is the number of a rule to reduce with. */
1293 /* If YYLEN is nonzero, implement the default value of the action:
1296 Otherwise, the following line sets YYVAL to garbage.
1297 This behavior is undocumented and Bison
1298 users should not rely upon it. Assigning to YYVAL
1299 unconditionally makes the parser a bit smaller, and it avoids a
1300 GCC warning that YYVAL may be used uninitialized. */
1301 yyval = yyvsp[1-yylen];
1304 YY_REDUCE_PRINT (yyn);
1309 { zconfprint("unexpected 'endmenu' statement"); ;}
1314 { zconfprint("unexpected 'endif' statement"); ;}
1319 { zconfprint("unexpected 'endchoice' statement"); ;}
1324 { zconfprint("syntax error"); yyerrok; ;}
1330 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1331 sym->flags |= SYMBOL_OPTIONAL;
1332 menu_add_entry(sym);
1333 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1341 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1348 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1349 sym->flags |= SYMBOL_OPTIONAL;
1350 menu_add_entry(sym);
1351 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1358 if (current_entry->prompt)
1359 current_entry->prompt->type = P_MENU;
1361 zconfprint("warning: menuconfig statement without prompt");
1363 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1370 menu_set_type(S_TRISTATE);
1371 printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
1378 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1379 menu_set_type(S_TRISTATE);
1380 printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
1387 menu_set_type(S_BOOLEAN);
1388 printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
1395 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1396 menu_set_type(S_BOOLEAN);
1397 printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
1404 menu_set_type(S_INT);
1405 printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno());
1412 menu_set_type(S_HEX);
1413 printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno());
1420 menu_set_type(S_STRING);
1421 printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno());
1428 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1429 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1436 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1437 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
1444 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1445 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1452 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1453 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1460 struct symbol *sym = sym_lookup(NULL, 0);
1461 sym->flags |= SYMBOL_CHOICE;
1462 menu_add_entry(sym);
1463 menu_add_expr(P_CHOICE, NULL, NULL);
1464 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1479 if (zconf_endtoken((yyvsp[0].token), T_CHOICE, T_ENDCHOICE)) {
1481 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1489 printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
1497 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1498 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1505 menu_set_type(S_TRISTATE);
1506 printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
1513 menu_set_type(S_BOOLEAN);
1514 printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
1521 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1522 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1529 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1530 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
1537 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1538 menu_add_entry(NULL);
1539 menu_add_dep((yyvsp[-1].expr));
1548 if (zconf_endtoken((yyvsp[0].token), T_IF, T_ENDIF)) {
1550 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1558 printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
1566 menu_add_entry(NULL);
1567 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1568 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1583 if (zconf_endtoken((yyvsp[0].token), T_MENU, T_ENDMENU)) {
1585 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1593 printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
1600 { zconfprint("invalid menu option"); yyerrok; ;}
1606 (yyval.string) = (yyvsp[-1].string);
1607 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1614 zconf_nextfile((yyvsp[0].string));
1621 menu_add_entry(NULL);
1622 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1623 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1637 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1645 current_entry->sym->help = (yyvsp[0].string);
1652 menu_add_dep((yyvsp[-1].expr));
1653 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1660 menu_add_dep((yyvsp[-1].expr));
1661 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1668 menu_add_dep((yyvsp[-1].expr));
1669 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1676 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1682 { (yyval.token) = T_ENDMENU; ;}
1687 { (yyval.token) = T_ENDCHOICE; ;}
1692 { (yyval.token) = T_ENDIF; ;}
1697 { (yyval.expr) = NULL; ;}
1702 { (yyval.expr) = (yyvsp[0].expr); ;}
1707 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1712 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1717 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1722 { (yyval.expr) = (yyvsp[-1].expr); ;}
1727 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1732 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1737 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1742 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1747 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1753 /* Line 1037 of yacc.c. */
1760 YY_STACK_PRINT (yyss, yyssp);
1765 /* Now `shift' the result of the reduction. Determine what state
1766 that goes to, based on the state we popped back to and the rule
1767 number reduced by. */
1771 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1772 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1773 yystate = yytable[yystate];
1775 yystate = yydefgoto[yyn - YYNTOKENS];
1780 /*------------------------------------.
1781 | yyerrlab -- here on detecting error |
1782 `------------------------------------*/
1784 /* If not already recovering from an error, report this error. */
1789 yyn = yypact[yystate];
1791 if (YYPACT_NINF < yyn && yyn < YYLAST)
1793 YYSIZE_T yysize = 0;
1794 int yytype = YYTRANSLATE (yychar);
1795 const char* yyprefix;
1799 /* Start YYX at -YYN if negative to avoid negative indexes in
1801 int yyxbegin = yyn < 0 ? -yyn : 0;
1803 /* Stay within bounds of both yycheck and yytname. */
1804 int yychecklim = YYLAST - yyn;
1805 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1808 yyprefix = ", expecting ";
1809 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1810 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1812 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1820 yysize += (sizeof ("syntax error, unexpected ")
1821 + yystrlen (yytname[yytype]));
1822 yymsg = (char *) YYSTACK_ALLOC (yysize);
1825 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1826 yyp = yystpcpy (yyp, yytname[yytype]);
1830 yyprefix = ", expecting ";
1831 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1832 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1834 yyp = yystpcpy (yyp, yyprefix);
1835 yyp = yystpcpy (yyp, yytname[yyx]);
1840 YYSTACK_FREE (yymsg);
1843 yyerror ("syntax error; also virtual memory exhausted");
1846 #endif /* YYERROR_VERBOSE */
1847 yyerror ("syntax error");
1852 if (yyerrstatus == 3)
1854 /* If just tried and failed to reuse look-ahead token after an
1855 error, discard it. */
1857 if (yychar <= YYEOF)
1859 /* If at end of input, pop the error token,
1860 then the rest of the stack, then return failure. */
1861 if (yychar == YYEOF)
1868 yydestruct ("Error: popping",
1869 yystos[*yyssp], yyvsp);
1874 yydestruct ("Error: discarding", yytoken, &yylval);
1879 /* Else will try to reuse look-ahead token after shifting the error
1884 /*---------------------------------------------------.
1885 | yyerrorlab -- error raised explicitly by YYERROR. |
1886 `---------------------------------------------------*/
1890 /* Pacify GCC when the user code never invokes YYERROR and the label
1891 yyerrorlab therefore never appears in user code. */
1902 /*-------------------------------------------------------------.
1903 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1904 `-------------------------------------------------------------*/
1906 yyerrstatus = 3; /* Each real token shifted decrements this. */
1910 yyn = yypact[yystate];
1911 if (yyn != YYPACT_NINF)
1914 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1922 /* Pop the current state because it cannot handle the error token. */
1927 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1930 YY_STACK_PRINT (yyss, yyssp);
1939 /* Shift the error token. */
1940 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1946 /*-------------------------------------.
1947 | yyacceptlab -- YYACCEPT comes here. |
1948 `-------------------------------------*/
1953 /*-----------------------------------.
1954 | yyabortlab -- YYABORT comes here. |
1955 `-----------------------------------*/
1957 yydestruct ("Error: discarding lookahead",
1964 /*----------------------------------------------.
1965 | yyoverflowlab -- parser overflow comes here. |
1966 `----------------------------------------------*/
1968 yyerror ("parser stack overflow");
1976 YYSTACK_FREE (yyss);
1985 void conf_parse(const char *name)
1990 zconf_initscan(name);
1994 modules_sym = sym_lookup("MODULES", 0);
1995 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
2001 menu_finalize(&rootmenu);
2002 for_all_symbols(i, sym) {
2003 sym_check_deps(sym);
2006 sym_change_count = 1;
2009 const char *zconf_tokenname(int token)
2012 case T_MENU: return "menu";
2013 case T_ENDMENU: return "endmenu";
2014 case T_CHOICE: return "choice";
2015 case T_ENDCHOICE: return "endchoice";
2016 case T_IF: return "if";
2017 case T_ENDIF: return "endif";
2022 static bool zconf_endtoken(int token, int starttoken, int endtoken)
2024 if (token != endtoken) {
2025 zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken));
2029 if (current_menu->file != current_file) {
2030 zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken));
2031 zconfprint("location of the '%s'", zconf_tokenname(starttoken));
2038 static void zconfprint(const char *err, ...)
2042 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1);
2044 vfprintf(stderr, err, ap);
2046 fprintf(stderr, "\n");
2049 static void zconferror(const char *err)
2051 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2054 void print_quoted_string(FILE *out, const char *str)
2060 while ((p = strchr(str, '"'))) {
2063 fprintf(out, "%.*s", len, str);
2071 void print_symbol(FILE *out, struct menu *menu)
2073 struct symbol *sym = menu->sym;
2074 struct property *prop;
2076 if (sym_is_choice(sym))
2077 fprintf(out, "choice\n");
2079 fprintf(out, "config %s\n", sym->name);
2080 switch (sym->type) {
2082 fputs(" boolean\n", out);
2085 fputs(" tristate\n", out);
2088 fputs(" string\n", out);
2091 fputs(" integer\n", out);
2094 fputs(" hex\n", out);
2097 fputs(" ???\n", out);
2100 for (prop = sym->prop; prop; prop = prop->next) {
2101 if (prop->menu != menu)
2103 switch (prop->type) {
2105 fputs(" prompt ", out);
2106 print_quoted_string(out, prop->text);
2107 if (!expr_is_yes(prop->visible.expr)) {
2109 expr_fprint(prop->visible.expr, out);
2114 fputs( " default ", out);
2115 expr_fprint(prop->expr, out);
2116 if (!expr_is_yes(prop->visible.expr)) {
2118 expr_fprint(prop->visible.expr, out);
2123 fputs(" #choice value\n", out);
2126 fprintf(out, " unknown prop %d!\n", prop->type);
2131 int len = strlen(sym->help);
2132 while (sym->help[--len] == '\n')
2134 fprintf(out, " help\n%s\n", sym->help);
2139 void zconfdump(FILE *out)
2141 struct property *prop;
2145 menu = rootmenu.list;
2147 if ((sym = menu->sym))
2148 print_symbol(out, menu);
2149 else if ((prop = menu->prompt)) {
2150 switch (prop->type) {
2152 fputs("\ncomment ", out);
2153 print_quoted_string(out, prop->text);
2157 fputs("\nmenu ", out);
2158 print_quoted_string(out, prop->text);
2164 if (!expr_is_yes(prop->visible.expr)) {
2165 fputs(" depends ", out);
2166 expr_fprint(prop->visible.expr, out);
2174 else if (menu->next)
2176 else while ((menu = menu->parent)) {
2177 if (menu->prompt && menu->prompt->type == P_MENU)
2178 fputs("\nendmenu\n", out);
2187 #include "lex.zconf.c"
2189 #include "confdata.c"