1 /* A Bison parser, made by GNU Bison 1.875d. */
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 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse zconfparse
51 #define yylex zconflex
52 #define yyerror zconferror
53 #define yylval zconflval
54 #define yychar zconfchar
55 #define yydebug zconfdebug
56 #define yynerrs zconfnerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
99 #define T_MAINMENU 258
101 #define T_ENDMENU 260
104 #define T_ENDCHOICE 263
105 #define T_COMMENT 264
107 #define T_MENUCONFIG 266
109 #define T_HELPTEXT 268
112 #define T_DEPENDS 271
113 #define T_REQUIRES 272
114 #define T_OPTIONAL 273
117 #define T_DEFAULT 276
122 #define T_WORD_QUOTE 281
123 #define T_UNEQUAL 282
124 #define T_CLOSE_PAREN 283
125 #define T_OPEN_PAREN 284
135 /* Copy the first part of user declarations. */
139 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
140 * Released under the terms of the GNU GPL v2.0.
150 #define LKC_DIRECT_LINK
153 #include "zconf.hash.c"
155 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
157 #define PRINTD 0x0001
158 #define DEBUG_PARSE 0x0002
162 extern int zconflex(void);
163 static void zconfprint(const char *err, ...);
164 static void zconf_error(const char *err, ...);
165 static void zconferror(const char *err);
166 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
168 struct symbol *symbol_hash[257];
170 static struct menu *current_menu, *current_entry;
174 #define YYERROR_VERBOSE
178 /* Enabling traces. */
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
188 # define YYERROR_VERBOSE 0
191 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
193 typedef union YYSTYPE {
196 struct symbol *symbol;
201 /* Line 191 of yacc.c. */
203 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
204 # define YYSTYPE_IS_DECLARED 1
205 # define YYSTYPE_IS_TRIVIAL 1
210 /* Copy the second part of user declarations. */
213 /* Line 214 of yacc.c. */
216 #if ! defined (yyoverflow) || YYERROR_VERBOSE
222 # define YYMALLOC malloc
225 /* The parser invokes alloca or malloc; define the necessary symbols. */
227 # ifdef YYSTACK_USE_ALLOCA
228 # if YYSTACK_USE_ALLOCA
229 # define YYSTACK_ALLOC alloca
232 # if defined (alloca) || defined (_ALLOCA_H)
233 # define YYSTACK_ALLOC alloca
236 # define YYSTACK_ALLOC __builtin_alloca
241 # ifdef YYSTACK_ALLOC
242 /* Pacify GCC's `empty if-body' warning. */
243 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
245 # if defined (__STDC__) || defined (__cplusplus)
246 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
247 # define YYSIZE_T size_t
249 # define YYSTACK_ALLOC YYMALLOC
250 # define YYSTACK_FREE YYFREE
252 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
255 #if (! defined (yyoverflow) \
256 && (! defined (__cplusplus) \
257 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
259 /* A type that is properly aligned for any stack member. */
266 /* The size of the maximum gap between one aligned stack and the next. */
267 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
269 /* The size of an array large to enough to hold all stacks, each with
271 # define YYSTACK_BYTES(N) \
272 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
273 + YYSTACK_GAP_MAXIMUM)
275 /* Copy COUNT objects from FROM to TO. The source and destination do
278 # if defined (__GNUC__) && 1 < __GNUC__
279 # define YYCOPY(To, From, Count) \
280 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
282 # define YYCOPY(To, From, Count) \
285 register YYSIZE_T yyi; \
286 for (yyi = 0; yyi < (Count); yyi++) \
287 (To)[yyi] = (From)[yyi]; \
293 /* Relocate STACK from its old location to the new one. The
294 local variables YYSIZE and YYSTACKSIZE give the old and new number of
295 elements in the stack, and YYPTR gives the new location of the
296 stack. Advance YYPTR to a properly aligned location for the next
298 # define YYSTACK_RELOCATE(Stack) \
301 YYSIZE_T yynewbytes; \
302 YYCOPY (&yyptr->Stack, Stack, yysize); \
303 Stack = &yyptr->Stack; \
304 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
305 yyptr += yynewbytes / sizeof (*yyptr); \
311 #if defined (__STDC__) || defined (__cplusplus)
312 typedef signed char yysigned_char;
314 typedef short int yysigned_char;
317 /* YYFINAL -- State number of the termination state. */
319 /* YYLAST -- Last index in YYTABLE. */
322 /* YYNTOKENS -- Number of terminals. */
324 /* YYNNTS -- Number of nonterminals. */
326 /* YYNRULES -- Number of rules. */
328 /* YYNRULES -- Number of states. */
329 #define YYNSTATES 175
331 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
333 #define YYMAXUTOK 289
335 #define YYTRANSLATE(YYX) \
336 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
338 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
339 static const unsigned char yytranslate[] =
341 0, 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, 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, 1, 2, 3, 4,
367 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
368 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
369 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
373 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
375 static const unsigned short int yyprhs[] =
377 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
378 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
379 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
380 81, 84, 85, 88, 91, 94, 97, 100, 104, 109,
381 114, 119, 125, 128, 131, 133, 137, 138, 141, 144,
382 147, 150, 153, 158, 162, 165, 170, 171, 174, 178,
383 180, 184, 185, 188, 191, 194, 198, 201, 203, 207,
384 208, 211, 214, 217, 221, 225, 228, 231, 234, 235,
385 238, 241, 244, 249, 253, 257, 258, 261, 263, 265,
386 268, 271, 274, 276, 279, 280, 283, 285, 289, 293,
387 297, 300, 304, 308, 310
390 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
391 static const yysigned_char yyrhs[] =
393 36, 0, -1, 37, -1, -1, 37, 39, -1, 37,
394 50, -1, 37, 61, -1, 37, 3, 71, 73, -1,
395 37, 72, -1, 37, 25, 1, 30, -1, 37, 38,
396 1, 30, -1, 37, 1, 30, -1, 16, -1, 19,
397 -1, 20, -1, 22, -1, 18, -1, 23, -1, 21,
398 -1, 30, -1, 56, -1, 65, -1, 42, -1, 44,
399 -1, 63, -1, 25, 1, 30, -1, 1, 30, -1,
400 10, 25, 30, -1, 41, 45, -1, 11, 25, 30,
401 -1, 43, 45, -1, -1, 45, 46, -1, 45, 69,
402 -1, 45, 67, -1, 45, 40, -1, 45, 30, -1,
403 20, 70, 30, -1, 19, 71, 74, 30, -1, 21,
404 75, 74, 30, -1, 22, 25, 74, 30, -1, 23,
405 76, 76, 74, 30, -1, 7, 30, -1, 47, 51,
406 -1, 72, -1, 48, 53, 49, -1, -1, 51, 52,
407 -1, 51, 69, -1, 51, 67, -1, 51, 30, -1,
408 51, 40, -1, 19, 71, 74, 30, -1, 20, 70,
409 30, -1, 18, 30, -1, 21, 25, 74, 30, -1,
410 -1, 53, 39, -1, 14, 75, 73, -1, 72, -1,
411 54, 57, 55, -1, -1, 57, 39, -1, 57, 61,
412 -1, 57, 50, -1, 4, 71, 30, -1, 58, 68,
413 -1, 72, -1, 59, 62, 60, -1, -1, 62, 39,
414 -1, 62, 61, -1, 62, 50, -1, 6, 71, 30,
415 -1, 9, 71, 30, -1, 64, 68, -1, 12, 30,
416 -1, 66, 13, -1, -1, 68, 69, -1, 68, 30,
417 -1, 68, 40, -1, 16, 24, 75, 30, -1, 16,
418 75, 30, -1, 17, 75, 30, -1, -1, 71, 74,
419 -1, 25, -1, 26, -1, 5, 30, -1, 8, 30,
420 -1, 15, 30, -1, 30, -1, 73, 30, -1, -1,
421 14, 75, -1, 76, -1, 76, 33, 76, -1, 76,
422 27, 76, -1, 29, 75, 28, -1, 34, 75, -1,
423 75, 31, 75, -1, 75, 32, 75, -1, 25, -1,
427 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
428 static const unsigned short int yyrline[] =
430 0, 103, 103, 105, 107, 108, 109, 110, 111, 112,
431 113, 117, 121, 121, 121, 121, 121, 121, 121, 125,
432 126, 127, 128, 129, 130, 134, 135, 141, 149, 155,
433 163, 173, 175, 176, 177, 178, 179, 182, 190, 196,
434 206, 212, 220, 229, 234, 242, 245, 247, 248, 249,
435 250, 251, 254, 260, 271, 277, 287, 289, 294, 302,
436 310, 313, 315, 316, 317, 322, 329, 334, 342, 345,
437 347, 348, 349, 352, 360, 367, 374, 380, 387, 389,
438 390, 391, 394, 399, 404, 412, 414, 419, 420, 423,
439 424, 425, 429, 430, 433, 434, 437, 438, 439, 440,
440 441, 442, 443, 446, 447
444 #if YYDEBUG || YYERROR_VERBOSE
445 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
446 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
447 static const char *const yytname[] =
449 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
450 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
451 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
452 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
453 "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
454 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
455 "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt",
456 "option_error", "config_entry_start", "config_stmt",
457 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
458 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
459 "choice_option_list", "choice_option", "choice_block", "if_entry",
460 "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end",
461 "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt",
462 "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
463 "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
468 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
470 static const unsigned short int yytoknum[] =
472 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
473 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
474 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
475 285, 286, 287, 288, 289
479 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
480 static const unsigned char yyr1[] =
482 0, 35, 36, 37, 37, 37, 37, 37, 37, 37,
483 37, 37, 38, 38, 38, 38, 38, 38, 38, 39,
484 39, 39, 39, 39, 39, 40, 40, 41, 42, 43,
485 44, 45, 45, 45, 45, 45, 45, 46, 46, 46,
486 46, 46, 47, 48, 49, 50, 51, 51, 51, 51,
487 51, 51, 52, 52, 52, 52, 53, 53, 54, 55,
488 56, 57, 57, 57, 57, 58, 59, 60, 61, 62,
489 62, 62, 62, 63, 64, 65, 66, 67, 68, 68,
490 68, 68, 69, 69, 69, 70, 70, 71, 71, 72,
491 72, 72, 73, 73, 74, 74, 75, 75, 75, 75,
495 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
496 static const unsigned char yyr2[] =
498 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
499 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
500 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
501 2, 0, 2, 2, 2, 2, 2, 3, 4, 4,
502 4, 5, 2, 2, 1, 3, 0, 2, 2, 2,
503 2, 2, 4, 3, 2, 4, 0, 2, 3, 1,
504 3, 0, 2, 2, 2, 3, 2, 1, 3, 0,
505 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
506 2, 2, 4, 3, 3, 0, 2, 1, 1, 2,
507 2, 2, 1, 2, 0, 2, 1, 3, 3, 3,
511 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
512 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
513 means the default is an error. */
514 static const unsigned char yydefact[] =
516 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
517 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
518 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
519 23, 46, 56, 5, 61, 20, 78, 69, 6, 24,
520 78, 21, 8, 11, 87, 88, 0, 0, 89, 0,
521 42, 90, 0, 0, 0, 103, 104, 0, 0, 0,
522 96, 91, 0, 0, 0, 0, 0, 0, 0, 0,
523 0, 0, 92, 7, 65, 73, 74, 27, 29, 0,
524 100, 0, 0, 58, 0, 0, 9, 10, 0, 0,
525 0, 0, 0, 85, 0, 0, 0, 0, 36, 35,
526 32, 0, 34, 33, 0, 0, 85, 0, 50, 51,
527 47, 49, 48, 57, 45, 44, 62, 64, 60, 63,
528 59, 80, 81, 79, 70, 72, 68, 71, 67, 93,
529 99, 101, 102, 98, 97, 26, 76, 0, 0, 0,
530 94, 0, 94, 94, 94, 0, 0, 77, 54, 94,
531 0, 94, 0, 83, 84, 0, 0, 37, 86, 0,
532 0, 94, 25, 0, 53, 0, 82, 95, 38, 39,
536 /* YYDEFGOTO[NTERM-NUM]. */
537 static const short int yydefgoto[] =
539 -1, 1, 2, 25, 26, 99, 27, 28, 29, 30,
540 64, 100, 31, 32, 114, 33, 66, 110, 67, 34,
541 118, 35, 68, 36, 37, 126, 38, 70, 39, 40,
542 41, 101, 102, 69, 103, 141, 142, 42, 73, 156,
546 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
548 #define YYPACT_NINF -78
549 static const short int yypact[] =
551 -78, 2, 159, -78, -21, 0, 0, -12, 0, 1,
552 4, 0, 27, 38, 60, 58, -78, -78, -78, -78,
553 -78, -78, -78, 100, -78, 104, -78, -78, -78, -78,
554 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
555 -78, -78, -78, -78, -78, -78, 86, 113, -78, 114,
556 -78, -78, 125, 127, 128, -78, -78, 60, 60, 210,
557 65, -78, 141, 142, 39, 103, 182, 200, 6, 66,
558 6, 131, -78, 146, -78, -78, -78, -78, -78, 196,
559 -78, 60, 60, 146, 40, 40, -78, -78, 155, 156,
560 -2, 60, 0, 0, 60, 105, 40, 194, -78, -78,
561 -78, 206, -78, -78, 183, 0, 0, 195, -78, -78,
562 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
563 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
564 -78, 197, -78, -78, -78, -78, -78, 60, 213, 216,
565 212, 203, 212, 190, 212, 40, 208, -78, -78, 212,
566 222, 212, 219, -78, -78, 60, 223, -78, -78, 224,
567 225, 212, -78, 226, -78, 227, -78, 47, -78, -78,
568 -78, 228, -78, -78, -78
571 /* YYPGOTO[NTERM-NUM]. */
572 static const short int yypgoto[] =
574 -78, -78, -78, -78, 164, -36, -78, -78, -78, -78,
575 230, -78, -78, -78, -78, 29, -78, -78, -78, -78,
576 -78, -78, -78, -78, -78, -78, 59, -78, -78, -78,
577 -78, -78, 198, 220, 24, 157, -5, 169, 202, 74,
581 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
582 positive, shift that token. If negative, reduce the rule which
583 number is the opposite. If zero, do what YYDEFACT says.
584 If YYTABLE_NINF, syntax error. */
585 #define YYTABLE_NINF -76
586 static const short int yytable[] =
588 46, 47, 3, 49, 79, 80, 52, 133, 134, 43,
589 6, 7, 8, 9, 10, 11, 12, 13, 48, 145,
590 14, 15, 137, 55, 56, 44, 45, 57, 131, 132,
591 109, 50, 58, 122, 51, 122, 24, 138, 139, -28,
592 88, 143, -28, -28, -28, -28, -28, -28, -28, -28,
593 -28, 89, 53, -28, -28, 90, 91, -28, 92, 93,
594 94, 95, 96, 54, 97, 55, 56, 88, 161, 98,
595 -66, -66, -66, -66, -66, -66, -66, -66, 81, 82,
596 -66, -66, 90, 91, 152, 55, 56, 140, 61, 57,
597 112, 97, 84, 123, 58, 123, 121, 117, 85, 125,
598 149, 62, 167, -30, 88, 63, -30, -30, -30, -30,
599 -30, -30, -30, -30, -30, 89, 72, -30, -30, 90,
600 91, -30, 92, 93, 94, 95, 96, 119, 97, 127,
601 144, -75, 88, 98, -75, -75, -75, -75, -75, -75,
602 -75, -75, -75, 74, 75, -75, -75, 90, 91, -75,
603 -75, -75, -75, -75, -75, 76, 97, 77, 78, -2,
604 4, 121, 5, 6, 7, 8, 9, 10, 11, 12,
605 13, 86, 87, 14, 15, 16, 129, 17, 18, 19,
606 20, 21, 22, 88, 23, 135, 136, -43, -43, 24,
607 -43, -43, -43, -43, 89, 146, -43, -43, 90, 91,
608 104, 105, 106, 107, 155, 7, 8, 97, 10, 11,
609 12, 13, 108, 148, 14, 15, 158, 159, 160, 147,
610 151, 81, 82, 163, 130, 165, 155, 81, 82, 82,
611 24, 113, 116, 157, 124, 171, 115, 120, 162, 128,
612 72, 81, 82, 153, 81, 82, 154, 81, 82, 166,
613 81, 82, 164, 168, 169, 170, 172, 173, 174, 65,
617 static const short int yycheck[] =
619 5, 6, 0, 8, 57, 58, 11, 84, 85, 30,
620 4, 5, 6, 7, 8, 9, 10, 11, 30, 96,
621 14, 15, 24, 25, 26, 25, 26, 29, 81, 82,
622 66, 30, 34, 69, 30, 71, 30, 90, 91, 0,
623 1, 94, 3, 4, 5, 6, 7, 8, 9, 10,
624 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
625 21, 22, 23, 25, 25, 25, 26, 1, 145, 30,
626 4, 5, 6, 7, 8, 9, 10, 11, 31, 32,
627 14, 15, 16, 17, 137, 25, 26, 92, 30, 29,
628 66, 25, 27, 69, 34, 71, 30, 68, 33, 70,
629 105, 1, 155, 0, 1, 1, 3, 4, 5, 6,
630 7, 8, 9, 10, 11, 12, 30, 14, 15, 16,
631 17, 18, 19, 20, 21, 22, 23, 68, 25, 70,
632 25, 0, 1, 30, 3, 4, 5, 6, 7, 8,
633 9, 10, 11, 30, 30, 14, 15, 16, 17, 18,
634 19, 20, 21, 22, 23, 30, 25, 30, 30, 0,
635 1, 30, 3, 4, 5, 6, 7, 8, 9, 10,
636 11, 30, 30, 14, 15, 16, 30, 18, 19, 20,
637 21, 22, 23, 1, 25, 30, 30, 5, 6, 30,
638 8, 9, 10, 11, 12, 1, 14, 15, 16, 17,
639 18, 19, 20, 21, 14, 5, 6, 25, 8, 9,
640 10, 11, 30, 30, 14, 15, 142, 143, 144, 13,
641 25, 31, 32, 149, 28, 151, 14, 31, 32, 32,
642 30, 67, 68, 30, 70, 161, 67, 68, 30, 70,
643 30, 31, 32, 30, 31, 32, 30, 31, 32, 30,
644 31, 32, 30, 30, 30, 30, 30, 30, 30, 29,
648 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
649 symbol of state STATE-NUM. */
650 static const unsigned char yystos[] =
652 0, 36, 37, 0, 1, 3, 4, 5, 6, 7,
653 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
654 21, 22, 23, 25, 30, 38, 39, 41, 42, 43,
655 44, 47, 48, 50, 54, 56, 58, 59, 61, 63,
656 64, 65, 72, 30, 25, 26, 71, 71, 30, 71,
657 30, 30, 71, 25, 25, 25, 26, 29, 34, 75,
658 76, 30, 1, 1, 45, 45, 51, 53, 57, 68,
659 62, 68, 30, 73, 30, 30, 30, 30, 30, 75,
660 75, 31, 32, 73, 27, 33, 30, 30, 1, 12,
661 16, 17, 19, 20, 21, 22, 23, 25, 30, 40,
662 46, 66, 67, 69, 18, 19, 20, 21, 30, 40,
663 52, 67, 69, 39, 49, 72, 39, 50, 55, 61,
664 72, 30, 40, 69, 39, 50, 60, 61, 72, 30,
665 28, 75, 75, 76, 76, 30, 30, 24, 75, 75,
666 71, 70, 71, 75, 25, 76, 1, 13, 30, 71,
667 70, 25, 75, 30, 30, 14, 74, 30, 74, 74,
668 74, 76, 30, 74, 30, 74, 30, 75, 30, 30,
672 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
673 # define YYSIZE_T __SIZE_TYPE__
675 #if ! defined (YYSIZE_T) && defined (size_t)
676 # define YYSIZE_T size_t
678 #if ! defined (YYSIZE_T)
679 # if defined (__STDC__) || defined (__cplusplus)
680 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
681 # define YYSIZE_T size_t
684 #if ! defined (YYSIZE_T)
685 # define YYSIZE_T unsigned int
688 #define yyerrok (yyerrstatus = 0)
689 #define yyclearin (yychar = YYEMPTY)
693 #define YYACCEPT goto yyacceptlab
694 #define YYABORT goto yyabortlab
695 #define YYERROR goto yyerrorlab
698 /* Like YYERROR except do call yyerror. This remains here temporarily
699 to ease the transition to the new meaning of YYERROR, for GCC.
700 Once GCC version 2 has supplanted version 1, this can go. */
702 #define YYFAIL goto yyerrlab
704 #define YYRECOVERING() (!!yyerrstatus)
706 #define YYBACKUP(Token, Value) \
708 if (yychar == YYEMPTY && yylen == 1) \
712 yytoken = YYTRANSLATE (yychar); \
718 yyerror ("syntax error: cannot back up");\
724 #define YYERRCODE 256
726 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
729 #ifndef YYLLOC_DEFAULT
730 # define YYLLOC_DEFAULT(Current, Rhs, N) \
731 ((Current).first_line = (Rhs)[1].first_line, \
732 (Current).first_column = (Rhs)[1].first_column, \
733 (Current).last_line = (Rhs)[N].last_line, \
734 (Current).last_column = (Rhs)[N].last_column)
737 /* YYLEX -- calling `yylex' with the right arguments. */
740 # define YYLEX yylex (YYLEX_PARAM)
742 # define YYLEX yylex ()
745 /* Enable debugging if requested. */
749 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
750 # define YYFPRINTF fprintf
753 # define YYDPRINTF(Args) \
759 # define YYDSYMPRINT(Args) \
765 # define YYDSYMPRINTF(Title, Token, Value, Location) \
769 YYFPRINTF (stderr, "%s ", Title); \
770 yysymprint (stderr, \
772 YYFPRINTF (stderr, "\n"); \
776 /*------------------------------------------------------------------.
777 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
779 `------------------------------------------------------------------*/
781 #if defined (__STDC__) || defined (__cplusplus)
783 yy_stack_print (short int *bottom, short int *top)
786 yy_stack_print (bottom, top)
791 YYFPRINTF (stderr, "Stack now");
792 for (/* Nothing. */; bottom <= top; ++bottom)
793 YYFPRINTF (stderr, " %d", *bottom);
794 YYFPRINTF (stderr, "\n");
797 # define YY_STACK_PRINT(Bottom, Top) \
800 yy_stack_print ((Bottom), (Top)); \
804 /*------------------------------------------------.
805 | Report that the YYRULE is going to be reduced. |
806 `------------------------------------------------*/
808 #if defined (__STDC__) || defined (__cplusplus)
810 yy_reduce_print (int yyrule)
813 yy_reduce_print (yyrule)
818 unsigned int yylno = yyrline[yyrule];
819 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
821 /* Print the symbols being reduced, and their result. */
822 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
823 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
824 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
827 # define YY_REDUCE_PRINT(Rule) \
830 yy_reduce_print (Rule); \
833 /* Nonzero means print parse trace. It is left uninitialized so that
834 multiple parsers can coexist. */
837 # define YYDPRINTF(Args)
838 # define YYDSYMPRINT(Args)
839 # define YYDSYMPRINTF(Title, Token, Value, Location)
840 # define YY_STACK_PRINT(Bottom, Top)
841 # define YY_REDUCE_PRINT(Rule)
842 #endif /* !YYDEBUG */
845 /* YYINITDEPTH -- initial size of the parser's stacks. */
847 # define YYINITDEPTH 200
850 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
851 if the built-in stack extension method is used).
853 Do not make this value too large; the results are undefined if
854 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
855 evaluated with infinite-precision integer arithmetic. */
857 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
862 # define YYMAXDEPTH 10000
870 # if defined (__GLIBC__) && defined (_STRING_H)
871 # define yystrlen strlen
873 /* Return the length of YYSTR. */
875 # if defined (__STDC__) || defined (__cplusplus)
876 yystrlen (const char *yystr)
882 register const char *yys = yystr;
884 while (*yys++ != '\0')
887 return yys - yystr - 1;
893 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
894 # define yystpcpy stpcpy
896 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
899 # if defined (__STDC__) || defined (__cplusplus)
900 yystpcpy (char *yydest, const char *yysrc)
902 yystpcpy (yydest, yysrc)
907 register char *yyd = yydest;
908 register const char *yys = yysrc;
910 while ((*yyd++ = *yys++) != '\0')
918 #endif /* !YYERROR_VERBOSE */
923 /*--------------------------------.
924 | Print this symbol on YYOUTPUT. |
925 `--------------------------------*/
927 #if defined (__STDC__) || defined (__cplusplus)
929 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
932 yysymprint (yyoutput, yytype, yyvaluep)
938 /* Pacify ``unused variable'' warnings. */
941 if (yytype < YYNTOKENS)
943 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
945 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
949 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
956 YYFPRINTF (yyoutput, ")");
959 #endif /* ! YYDEBUG */
960 /*-----------------------------------------------.
961 | Release the memory associated to this symbol. |
962 `-----------------------------------------------*/
964 #if defined (__STDC__) || defined (__cplusplus)
966 yydestruct (int yytype, YYSTYPE *yyvaluep)
969 yydestruct (yytype, yyvaluep)
974 /* Pacify ``unused variable'' warnings. */
979 case 48: /* choice_entry */
982 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
983 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
984 if (current_menu == yyvaluep->menu)
989 case 54: /* if_entry */
992 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
993 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
994 if (current_menu == yyvaluep->menu)
999 case 59: /* menu_entry */
1002 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1003 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
1004 if (current_menu == yyvaluep->menu)
1016 /* Prevent warnings from -Wmissing-prototypes. */
1018 #ifdef YYPARSE_PARAM
1019 # if defined (__STDC__) || defined (__cplusplus)
1020 int yyparse (void *YYPARSE_PARAM);
1024 #else /* ! YYPARSE_PARAM */
1025 #if defined (__STDC__) || defined (__cplusplus)
1030 #endif /* ! YYPARSE_PARAM */
1034 /* The lookahead symbol. */
1037 /* The semantic value of the lookahead symbol. */
1040 /* Number of syntax errors so far. */
1049 #ifdef YYPARSE_PARAM
1050 # if defined (__STDC__) || defined (__cplusplus)
1051 int yyparse (void *YYPARSE_PARAM)
1053 int yyparse (YYPARSE_PARAM)
1054 void *YYPARSE_PARAM;
1056 #else /* ! YYPARSE_PARAM */
1057 #if defined (__STDC__) || defined (__cplusplus)
1068 register int yystate;
1071 /* Number of tokens to shift before error messages enabled. */
1073 /* Lookahead token as an internal (translated) token number. */
1076 /* Three stacks and their tools:
1077 `yyss': related to states,
1078 `yyvs': related to semantic values,
1079 `yyls': related to locations.
1081 Refer to the stacks thru separate pointers, to allow yyoverflow
1082 to reallocate them elsewhere. */
1084 /* The state stack. */
1085 short int yyssa[YYINITDEPTH];
1086 short int *yyss = yyssa;
1087 register short int *yyssp;
1089 /* The semantic value stack. */
1090 YYSTYPE yyvsa[YYINITDEPTH];
1091 YYSTYPE *yyvs = yyvsa;
1092 register YYSTYPE *yyvsp;
1096 #define YYPOPSTACK (yyvsp--, yyssp--)
1098 YYSIZE_T yystacksize = YYINITDEPTH;
1100 /* The variables used to return semantic value and location from the
1105 /* When reducing, the number of symbols on the RHS of the reduced
1109 YYDPRINTF ((stderr, "Starting parse\n"));
1114 yychar = YYEMPTY; /* Cause a token to be read. */
1116 /* Initialize stack pointers.
1117 Waste one element of value and location stack
1118 so that they stay on the same level as the state stack.
1119 The wasted elements are never initialized. */
1127 /*------------------------------------------------------------.
1128 | yynewstate -- Push a new state, which is found in yystate. |
1129 `------------------------------------------------------------*/
1131 /* In all cases, when you get here, the value and location stacks
1132 have just been pushed. so pushing a state here evens the stacks.
1139 if (yyss + yystacksize - 1 <= yyssp)
1141 /* Get the current used size of the three stacks, in elements. */
1142 YYSIZE_T yysize = yyssp - yyss + 1;
1146 /* Give user a chance to reallocate the stack. Use copies of
1147 these so that the &'s don't force the real ones into
1149 YYSTYPE *yyvs1 = yyvs;
1150 short int *yyss1 = yyss;
1153 /* Each stack pointer address is followed by the size of the
1154 data in use in that stack, in bytes. This used to be a
1155 conditional around just the two extra args, but that might
1156 be undefined if yyoverflow is a macro. */
1157 yyoverflow ("parser stack overflow",
1158 &yyss1, yysize * sizeof (*yyssp),
1159 &yyvs1, yysize * sizeof (*yyvsp),
1166 #else /* no yyoverflow */
1167 # ifndef YYSTACK_RELOCATE
1170 /* Extend the stack our own way. */
1171 if (YYMAXDEPTH <= yystacksize)
1174 if (YYMAXDEPTH < yystacksize)
1175 yystacksize = YYMAXDEPTH;
1178 short int *yyss1 = yyss;
1179 union yyalloc *yyptr =
1180 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1183 YYSTACK_RELOCATE (yyss);
1184 YYSTACK_RELOCATE (yyvs);
1186 # undef YYSTACK_RELOCATE
1188 YYSTACK_FREE (yyss1);
1191 #endif /* no yyoverflow */
1193 yyssp = yyss + yysize - 1;
1194 yyvsp = yyvs + yysize - 1;
1197 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1198 (unsigned long int) yystacksize));
1200 if (yyss + yystacksize - 1 <= yyssp)
1204 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1213 /* Do appropriate processing given the current state. */
1214 /* Read a lookahead token if we need one and don't already have one. */
1217 /* First try to decide what to do without reference to lookahead token. */
1219 yyn = yypact[yystate];
1220 if (yyn == YYPACT_NINF)
1223 /* Not known => get a lookahead token if don't already have one. */
1225 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1226 if (yychar == YYEMPTY)
1228 YYDPRINTF ((stderr, "Reading a token: "));
1232 if (yychar <= YYEOF)
1234 yychar = yytoken = YYEOF;
1235 YYDPRINTF ((stderr, "Now at end of input.\n"));
1239 yytoken = YYTRANSLATE (yychar);
1240 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1243 /* If the proper action on seeing token YYTOKEN is to reduce or to
1244 detect an error, take that action. */
1246 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1251 if (yyn == 0 || yyn == YYTABLE_NINF)
1260 /* Shift the lookahead token. */
1261 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1263 /* Discard the token being shifted unless it is eof. */
1264 if (yychar != YYEOF)
1270 /* Count tokens shifted since error; after three, turn off error
1279 /*-----------------------------------------------------------.
1280 | yydefault -- do the default action for the current state. |
1281 `-----------------------------------------------------------*/
1283 yyn = yydefact[yystate];
1289 /*-----------------------------.
1290 | yyreduce -- Do a reduction. |
1291 `-----------------------------*/
1293 /* yyn is the number of a rule to reduce with. */
1296 /* If YYLEN is nonzero, implement the default value of the action:
1299 Otherwise, the following line sets YYVAL to garbage.
1300 This behavior is undocumented and Bison
1301 users should not rely upon it. Assigning to YYVAL
1302 unconditionally makes the parser a bit smaller, and it avoids a
1303 GCC warning that YYVAL may be used uninitialized. */
1304 yyval = yyvsp[1-yylen];
1307 YY_REDUCE_PRINT (yyn);
1312 { zconf_error("unexpected end statement"); ;}
1317 { zconf_error("unknown statement \"%s\"", yyvsp[-2].string); ;}
1323 zconf_error("unexpected option \"%s\"", kconf_id_strings + yyvsp[-2].id->name);
1329 { zconf_error("invalid statement"); ;}
1334 { zconf_error("unknown option \"%s\"", yyvsp[-2].string); ;}
1339 { zconf_error("invalid option"); ;}
1345 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1346 sym->flags |= SYMBOL_OPTIONAL;
1347 menu_add_entry(sym);
1348 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1356 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1363 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1364 sym->flags |= SYMBOL_OPTIONAL;
1365 menu_add_entry(sym);
1366 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1373 if (current_entry->prompt)
1374 current_entry->prompt->type = P_MENU;
1376 zconfprint("warning: menuconfig statement without prompt");
1378 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1385 menu_set_type(yyvsp[-2].id->stype);
1386 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1387 zconf_curname(), zconf_lineno(),
1388 yyvsp[-2].id->stype);
1395 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1396 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1403 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
1404 if (yyvsp[-3].id->stype != S_UNKNOWN)
1405 menu_set_type(yyvsp[-3].id->stype);
1406 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1407 zconf_curname(), zconf_lineno(),
1408 yyvsp[-3].id->stype);
1415 menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1416 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1423 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr);
1424 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1431 struct symbol *sym = sym_lookup(NULL, 0);
1432 sym->flags |= SYMBOL_CHOICE;
1433 menu_add_entry(sym);
1434 menu_add_expr(P_CHOICE, NULL, NULL);
1435 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1442 yyval.menu = menu_add_menu();
1449 if (zconf_endtoken(yyvsp[0].id, T_CHOICE, T_ENDCHOICE)) {
1451 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1459 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1460 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1467 if (yyvsp[-2].id->stype == S_BOOLEAN || yyvsp[-2].id->stype == S_TRISTATE) {
1468 menu_set_type(yyvsp[-2].id->stype);
1469 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1470 zconf_curname(), zconf_lineno(),
1471 yyvsp[-2].id->stype);
1480 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1481 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1488 if (yyvsp[-3].id->stype == S_UNKNOWN) {
1489 menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1490 printd(DEBUG_PARSE, "%s:%d:default\n",
1491 zconf_curname(), zconf_lineno());
1500 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1501 menu_add_entry(NULL);
1502 menu_add_dep(yyvsp[-1].expr);
1503 yyval.menu = menu_add_menu();
1510 if (zconf_endtoken(yyvsp[0].id, T_IF, T_ENDIF)) {
1512 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1520 menu_add_entry(NULL);
1521 menu_add_prompt(P_MENU, yyvsp[-1].string, NULL);
1522 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1529 yyval.menu = menu_add_menu();
1536 if (zconf_endtoken(yyvsp[0].id, T_MENU, T_ENDMENU)) {
1538 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1546 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1547 zconf_nextfile(yyvsp[-1].string);
1554 menu_add_entry(NULL);
1555 menu_add_prompt(P_COMMENT, yyvsp[-1].string, NULL);
1556 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1570 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1578 current_entry->sym->help = yyvsp[0].string;
1585 menu_add_dep(yyvsp[-1].expr);
1586 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1593 menu_add_dep(yyvsp[-1].expr);
1594 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1601 menu_add_dep(yyvsp[-1].expr);
1602 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1609 menu_add_prompt(P_PROMPT, yyvsp[-1].string, yyvsp[0].expr);
1615 { yyval.id = yyvsp[-1].id; ;}
1620 { yyval.id = yyvsp[-1].id; ;}
1625 { yyval.id = yyvsp[-1].id; ;}
1630 { yyval.expr = NULL; ;}
1635 { yyval.expr = yyvsp[0].expr; ;}
1640 { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;}
1645 { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1650 { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1655 { yyval.expr = yyvsp[-1].expr; ;}
1660 { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;}
1665 { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;}
1670 { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;}
1675 { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;}
1680 { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;}
1686 /* Line 1010 of yacc.c. */
1693 YY_STACK_PRINT (yyss, yyssp);
1698 /* Now `shift' the result of the reduction. Determine what state
1699 that goes to, based on the state we popped back to and the rule
1700 number reduced by. */
1704 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1705 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1706 yystate = yytable[yystate];
1708 yystate = yydefgoto[yyn - YYNTOKENS];
1713 /*------------------------------------.
1714 | yyerrlab -- here on detecting error |
1715 `------------------------------------*/
1717 /* If not already recovering from an error, report this error. */
1722 yyn = yypact[yystate];
1724 if (YYPACT_NINF < yyn && yyn < YYLAST)
1726 YYSIZE_T yysize = 0;
1727 int yytype = YYTRANSLATE (yychar);
1728 const char* yyprefix;
1732 /* Start YYX at -YYN if negative to avoid negative indexes in
1734 int yyxbegin = yyn < 0 ? -yyn : 0;
1736 /* Stay within bounds of both yycheck and yytname. */
1737 int yychecklim = YYLAST - yyn;
1738 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1741 yyprefix = ", expecting ";
1742 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1743 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1745 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1753 yysize += (sizeof ("syntax error, unexpected ")
1754 + yystrlen (yytname[yytype]));
1755 yymsg = (char *) YYSTACK_ALLOC (yysize);
1758 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1759 yyp = yystpcpy (yyp, yytname[yytype]);
1763 yyprefix = ", expecting ";
1764 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1765 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1767 yyp = yystpcpy (yyp, yyprefix);
1768 yyp = yystpcpy (yyp, yytname[yyx]);
1773 YYSTACK_FREE (yymsg);
1776 yyerror ("syntax error; also virtual memory exhausted");
1779 #endif /* YYERROR_VERBOSE */
1780 yyerror ("syntax error");
1785 if (yyerrstatus == 3)
1787 /* If just tried and failed to reuse lookahead token after an
1788 error, discard it. */
1790 if (yychar <= YYEOF)
1792 /* If at end of input, pop the error token,
1793 then the rest of the stack, then return failure. */
1794 if (yychar == YYEOF)
1800 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1801 yydestruct (yystos[*yyssp], yyvsp);
1806 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1807 yydestruct (yytoken, &yylval);
1813 /* Else will try to reuse lookahead token after shifting the error
1818 /*---------------------------------------------------.
1819 | yyerrorlab -- error raised explicitly by YYERROR. |
1820 `---------------------------------------------------*/
1824 /* Pacify GCC when the user code never invokes YYERROR and the label
1825 yyerrorlab therefore never appears in user code. */
1836 /*-------------------------------------------------------------.
1837 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1838 `-------------------------------------------------------------*/
1840 yyerrstatus = 3; /* Each real token shifted decrements this. */
1844 yyn = yypact[yystate];
1845 if (yyn != YYPACT_NINF)
1848 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1856 /* Pop the current state because it cannot handle the error token. */
1860 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1861 yydestruct (yystos[yystate], yyvsp);
1864 YY_STACK_PRINT (yyss, yyssp);
1870 YYDPRINTF ((stderr, "Shifting error token, "));
1879 /*-------------------------------------.
1880 | yyacceptlab -- YYACCEPT comes here. |
1881 `-------------------------------------*/
1886 /*-----------------------------------.
1887 | yyabortlab -- YYABORT comes here. |
1888 `-----------------------------------*/
1894 /*----------------------------------------------.
1895 | yyoverflowlab -- parser overflow comes here. |
1896 `----------------------------------------------*/
1898 yyerror ("parser stack overflow");
1906 YYSTACK_FREE (yyss);
1915 void conf_parse(const char *name)
1920 zconf_initscan(name);
1924 modules_sym = sym_lookup("MODULES", 0);
1925 rootmenu.prompt = menu_add_prompt(P_MENU, "OpenWrt Configuration", NULL);
1928 if (getenv("ZCONF_DEBUG"))
1934 menu_finalize(&rootmenu);
1935 for_all_symbols(i, sym) {
1936 sym_check_deps(sym);
1939 sym_change_count = 1;
1942 const char *zconf_tokenname(int token)
1945 case T_MENU: return "menu";
1946 case T_ENDMENU: return "endmenu";
1947 case T_CHOICE: return "choice";
1948 case T_ENDCHOICE: return "endchoice";
1949 case T_IF: return "if";
1950 case T_ENDIF: return "endif";
1951 case T_DEPENDS: return "depends";
1956 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1958 if (id->token != endtoken) {
1959 zconf_error("unexpected '%s' within %s block",
1960 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1964 if (current_menu->file != current_file) {
1965 zconf_error("'%s' in different file than '%s'",
1966 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1967 fprintf(stderr, "%s:%d: location of the '%s'\n",
1968 current_menu->file->name, current_menu->lineno,
1969 zconf_tokenname(starttoken));
1976 static void zconfprint(const char *err, ...)
1980 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
1982 vfprintf(stderr, err, ap);
1984 fprintf(stderr, "\n");
1987 static void zconf_error(const char *err, ...)
1992 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
1994 vfprintf(stderr, err, ap);
1996 fprintf(stderr, "\n");
1999 static void zconferror(const char *err)
2002 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2006 void print_quoted_string(FILE *out, const char *str)
2012 while ((p = strchr(str, '"'))) {
2015 fprintf(out, "%.*s", len, str);
2023 void print_symbol(FILE *out, struct menu *menu)
2025 struct symbol *sym = menu->sym;
2026 struct property *prop;
2028 if (sym_is_choice(sym))
2029 fprintf(out, "choice\n");
2031 fprintf(out, "config %s\n", sym->name);
2032 switch (sym->type) {
2034 fputs(" boolean\n", out);
2037 fputs(" tristate\n", out);
2040 fputs(" string\n", out);
2043 fputs(" integer\n", out);
2046 fputs(" hex\n", out);
2049 fputs(" ???\n", out);
2052 for (prop = sym->prop; prop; prop = prop->next) {
2053 if (prop->menu != menu)
2055 switch (prop->type) {
2057 fputs(" prompt ", out);
2058 print_quoted_string(out, prop->text);
2059 if (!expr_is_yes(prop->visible.expr)) {
2061 expr_fprint(prop->visible.expr, out);
2066 fputs( " default ", out);
2067 expr_fprint(prop->expr, out);
2068 if (!expr_is_yes(prop->visible.expr)) {
2070 expr_fprint(prop->visible.expr, out);
2075 fputs(" #choice value\n", out);
2078 fprintf(out, " unknown prop %d!\n", prop->type);
2083 int len = strlen(sym->help);
2084 while (sym->help[--len] == '\n')
2086 fprintf(out, " help\n%s\n", sym->help);
2091 void zconfdump(FILE *out)
2093 struct property *prop;
2097 menu = rootmenu.list;
2099 if ((sym = menu->sym))
2100 print_symbol(out, menu);
2101 else if ((prop = menu->prompt)) {
2102 switch (prop->type) {
2104 fputs("\ncomment ", out);
2105 print_quoted_string(out, prop->text);
2109 fputs("\nmenu ", out);
2110 print_quoted_string(out, prop->text);
2116 if (!expr_is_yes(prop->visible.expr)) {
2117 fputs(" depends ", out);
2118 expr_fprint(prop->visible.expr, out);
2126 else if (menu->next)
2128 else while ((menu = menu->parent)) {
2129 if (menu->prompt && menu->prompt->type == P_MENU)
2130 fputs("\nendmenu\n", out);
2139 #include "lex.zconf.c"
2141 #include "confdata.c"