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
100 #define T_MAINMENU 258
102 #define T_ENDMENU 260
105 #define T_ENDCHOICE 263
106 #define T_COMMENT 264
108 #define T_MENUCONFIG 266
110 #define T_HELPTEXT 268
113 #define T_DEPENDS 271
114 #define T_REQUIRES 272
115 #define T_OPTIONAL 273
118 #define T_DEFAULT 276
124 #define T_WORD_QUOTE 282
125 #define T_UNEQUAL 283
126 #define T_CLOSE_PAREN 284
127 #define T_OPEN_PAREN 285
137 /* Copy the first part of user declarations. */
141 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
142 * Released under the terms of the GNU GPL v2.0.
152 #define LKC_DIRECT_LINK
155 #include "zconf.hash.c"
157 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
159 #define PRINTD 0x0001
160 #define DEBUG_PARSE 0x0002
164 extern int zconflex(void);
165 static void zconfprint(const char *err, ...);
166 static void zconf_error(const char *err, ...);
167 static void zconferror(const char *err);
168 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
170 struct symbol *symbol_hash[257];
172 static struct menu *current_menu, *current_entry;
176 #define YYERROR_VERBOSE
180 /* Enabling traces. */
185 /* Enabling verbose error messages. */
186 #ifdef YYERROR_VERBOSE
187 # undef YYERROR_VERBOSE
188 # define YYERROR_VERBOSE 1
190 # define YYERROR_VERBOSE 0
193 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
195 typedef union YYSTYPE {
198 struct symbol *symbol;
203 /* Line 191 of yacc.c. */
205 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
206 # define YYSTYPE_IS_DECLARED 1
207 # define YYSTYPE_IS_TRIVIAL 1
212 /* Copy the second part of user declarations. */
215 /* Line 214 of yacc.c. */
218 #if ! defined (yyoverflow) || YYERROR_VERBOSE
224 # define YYMALLOC malloc
227 /* The parser invokes alloca or malloc; define the necessary symbols. */
229 # ifdef YYSTACK_USE_ALLOCA
230 # if YYSTACK_USE_ALLOCA
231 # define YYSTACK_ALLOC alloca
234 # if defined (alloca) || defined (_ALLOCA_H)
235 # define YYSTACK_ALLOC alloca
238 # define YYSTACK_ALLOC __builtin_alloca
243 # ifdef YYSTACK_ALLOC
244 /* Pacify GCC's `empty if-body' warning. */
245 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
247 # if defined (__STDC__) || defined (__cplusplus)
248 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
249 # define YYSIZE_T size_t
251 # define YYSTACK_ALLOC YYMALLOC
252 # define YYSTACK_FREE YYFREE
254 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
257 #if (! defined (yyoverflow) \
258 && (! defined (__cplusplus) \
259 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
261 /* A type that is properly aligned for any stack member. */
268 /* The size of the maximum gap between one aligned stack and the next. */
269 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
271 /* The size of an array large to enough to hold all stacks, each with
273 # define YYSTACK_BYTES(N) \
274 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
275 + YYSTACK_GAP_MAXIMUM)
277 /* Copy COUNT objects from FROM to TO. The source and destination do
280 # if defined (__GNUC__) && 1 < __GNUC__
281 # define YYCOPY(To, From, Count) \
282 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
284 # define YYCOPY(To, From, Count) \
287 register YYSIZE_T yyi; \
288 for (yyi = 0; yyi < (Count); yyi++) \
289 (To)[yyi] = (From)[yyi]; \
295 /* Relocate STACK from its old location to the new one. The
296 local variables YYSIZE and YYSTACKSIZE give the old and new number of
297 elements in the stack, and YYPTR gives the new location of the
298 stack. Advance YYPTR to a properly aligned location for the next
300 # define YYSTACK_RELOCATE(Stack) \
303 YYSIZE_T yynewbytes; \
304 YYCOPY (&yyptr->Stack, Stack, yysize); \
305 Stack = &yyptr->Stack; \
306 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
307 yyptr += yynewbytes / sizeof (*yyptr); \
313 #if defined (__STDC__) || defined (__cplusplus)
314 typedef signed char yysigned_char;
316 typedef short int yysigned_char;
319 /* YYFINAL -- State number of the termination state. */
321 /* YYLAST -- Last index in YYTABLE. */
324 /* YYNTOKENS -- Number of terminals. */
326 /* YYNNTS -- Number of nonterminals. */
328 /* YYNRULES -- Number of rules. */
330 /* YYNRULES -- Number of states. */
331 #define YYNSTATES 179
333 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
335 #define YYMAXUTOK 290
337 #define YYTRANSLATE(YYX) \
338 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
340 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
341 static const unsigned char yytranslate[] =
343 0, 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, 2, 2, 2, 2,
367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
369 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
370 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
371 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
376 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
378 static const unsigned short int yyprhs[] =
380 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
381 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
382 53, 55, 57, 59, 61, 63, 65, 69, 72, 76,
383 79, 83, 86, 87, 90, 93, 96, 99, 102, 106,
384 111, 116, 121, 127, 130, 133, 135, 139, 140, 143,
385 146, 149, 152, 155, 160, 164, 167, 171, 176, 177,
386 180, 184, 186, 190, 191, 194, 197, 200, 204, 207,
387 209, 213, 214, 217, 220, 223, 227, 231, 234, 237,
388 240, 241, 244, 247, 250, 255, 259, 263, 264, 267,
389 269, 271, 274, 277, 280, 282, 285, 286, 289, 291,
390 295, 299, 303, 306, 310, 314, 316
393 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
394 static const yysigned_char yyrhs[] =
396 37, 0, -1, 38, -1, -1, 38, 40, -1, 38,
397 51, -1, 38, 62, -1, 38, 3, 72, 74, -1,
398 38, 73, -1, 38, 26, 1, 31, -1, 38, 39,
399 1, 31, -1, 38, 1, 31, -1, 16, -1, 19,
400 -1, 20, -1, 22, -1, 18, -1, 23, -1, 21,
401 -1, 25, -1, 31, -1, 57, -1, 66, -1, 43,
402 -1, 45, -1, 64, -1, 26, 1, 31, -1, 1,
403 31, -1, 10, 26, 31, -1, 42, 46, -1, 11,
404 26, 31, -1, 44, 46, -1, -1, 46, 47, -1,
405 46, 70, -1, 46, 68, -1, 46, 41, -1, 46,
406 31, -1, 20, 71, 31, -1, 19, 72, 75, 31,
407 -1, 21, 76, 75, 31, -1, 22, 26, 75, 31,
408 -1, 23, 77, 77, 75, 31, -1, 7, 31, -1,
409 48, 52, -1, 73, -1, 49, 54, 50, -1, -1,
410 52, 53, -1, 52, 70, -1, 52, 68, -1, 52,
411 31, -1, 52, 41, -1, 19, 72, 75, 31, -1,
412 20, 71, 31, -1, 18, 31, -1, 25, 75, 31,
413 -1, 21, 26, 75, 31, -1, -1, 54, 40, -1,
414 14, 76, 74, -1, 73, -1, 55, 58, 56, -1,
415 -1, 58, 40, -1, 58, 62, -1, 58, 51, -1,
416 4, 72, 31, -1, 59, 69, -1, 73, -1, 60,
417 63, 61, -1, -1, 63, 40, -1, 63, 62, -1,
418 63, 51, -1, 6, 72, 31, -1, 9, 72, 31,
419 -1, 65, 69, -1, 12, 31, -1, 67, 13, -1,
420 -1, 69, 70, -1, 69, 31, -1, 69, 41, -1,
421 16, 24, 76, 31, -1, 16, 76, 31, -1, 17,
422 76, 31, -1, -1, 72, 75, -1, 26, -1, 27,
423 -1, 5, 31, -1, 8, 31, -1, 15, 31, -1,
424 31, -1, 74, 31, -1, -1, 14, 76, -1, 77,
425 -1, 77, 34, 77, -1, 77, 28, 77, -1, 30,
426 76, 29, -1, 35, 76, -1, 76, 32, 76, -1,
427 76, 33, 76, -1, 26, -1, 27, -1
430 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
431 static const unsigned short int yyrline[] =
433 0, 104, 104, 106, 108, 109, 110, 111, 112, 113,
434 114, 118, 122, 122, 122, 122, 122, 122, 122, 122,
435 126, 127, 128, 129, 130, 131, 135, 136, 142, 150,
436 156, 164, 174, 176, 177, 178, 179, 180, 183, 191,
437 197, 207, 213, 221, 230, 235, 243, 246, 248, 249,
438 250, 251, 252, 255, 261, 272, 278, 283, 293, 295,
439 300, 308, 316, 319, 321, 322, 323, 328, 335, 340,
440 348, 351, 353, 354, 355, 358, 366, 373, 380, 386,
441 393, 395, 396, 397, 400, 405, 410, 418, 420, 425,
442 426, 429, 430, 431, 435, 436, 439, 440, 443, 444,
443 445, 446, 447, 448, 449, 452, 453
447 #if YYDEBUG || YYERROR_VERBOSE
448 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
449 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
450 static const char *const yytname[] =
452 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
453 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
454 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
455 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
456 "T_SELECT", "T_RANGE", "T_ON", "T_RESET", "T_WORD", "T_WORD_QUOTE",
457 "T_UNEQUAL", "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND",
458 "T_EQUAL", "T_NOT", "$accept", "input", "stmt_list", "option_name",
459 "common_stmt", "option_error", "config_entry_start", "config_stmt",
460 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
461 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
462 "choice_option_list", "choice_option", "choice_block", "if_entry",
463 "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end",
464 "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt",
465 "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
466 "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
471 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
473 static const unsigned short int yytoknum[] =
475 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
476 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
477 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
478 285, 286, 287, 288, 289, 290
482 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
483 static const unsigned char yyr1[] =
485 0, 36, 37, 38, 38, 38, 38, 38, 38, 38,
486 38, 38, 39, 39, 39, 39, 39, 39, 39, 39,
487 40, 40, 40, 40, 40, 40, 41, 41, 42, 43,
488 44, 45, 46, 46, 46, 46, 46, 46, 47, 47,
489 47, 47, 47, 48, 49, 50, 51, 52, 52, 52,
490 52, 52, 52, 53, 53, 53, 53, 53, 54, 54,
491 55, 56, 57, 58, 58, 58, 58, 59, 60, 61,
492 62, 63, 63, 63, 63, 64, 65, 66, 67, 68,
493 69, 69, 69, 69, 70, 70, 70, 71, 71, 72,
494 72, 73, 73, 73, 74, 74, 75, 75, 76, 76,
495 76, 76, 76, 76, 76, 77, 77
498 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
499 static const unsigned char yyr2[] =
501 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
502 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
503 1, 1, 1, 1, 1, 1, 3, 2, 3, 2,
504 3, 2, 0, 2, 2, 2, 2, 2, 3, 4,
505 4, 4, 5, 2, 2, 1, 3, 0, 2, 2,
506 2, 2, 2, 4, 3, 2, 3, 4, 0, 2,
507 3, 1, 3, 0, 2, 2, 2, 3, 2, 1,
508 3, 0, 2, 2, 2, 3, 3, 2, 2, 2,
509 0, 2, 2, 2, 4, 3, 3, 0, 2, 1,
510 1, 2, 2, 2, 1, 2, 0, 2, 1, 3,
514 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
515 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
516 means the default is an error. */
517 static const unsigned char yydefact[] =
519 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
520 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
521 18, 15, 17, 19, 0, 20, 0, 4, 32, 23,
522 32, 24, 47, 58, 5, 63, 21, 80, 71, 6,
523 25, 80, 22, 8, 11, 89, 90, 0, 0, 91,
524 0, 43, 92, 0, 0, 0, 105, 106, 0, 0,
525 0, 98, 93, 0, 0, 0, 0, 0, 0, 0,
526 0, 0, 0, 94, 7, 67, 75, 76, 28, 30,
527 0, 102, 0, 0, 60, 0, 0, 9, 10, 0,
528 0, 0, 0, 0, 87, 0, 0, 0, 0, 37,
529 36, 33, 0, 35, 34, 0, 0, 87, 0, 96,
530 51, 52, 48, 50, 49, 59, 46, 45, 64, 66,
531 62, 65, 61, 82, 83, 81, 72, 74, 70, 73,
532 69, 95, 101, 103, 104, 100, 99, 27, 78, 0,
533 0, 0, 96, 0, 96, 96, 96, 0, 0, 79,
534 55, 96, 0, 96, 0, 0, 0, 85, 86, 0,
535 38, 88, 0, 0, 96, 26, 0, 54, 0, 97,
536 56, 84, 39, 40, 41, 0, 53, 57, 42
539 /* YYDEFGOTO[NTERM-NUM]. */
540 static const short int yydefgoto[] =
542 -1, 1, 2, 26, 27, 100, 28, 29, 30, 31,
543 65, 101, 32, 33, 116, 34, 67, 112, 68, 35,
544 120, 36, 69, 37, 38, 128, 39, 71, 40, 41,
545 42, 102, 103, 70, 104, 143, 144, 43, 74, 155,
549 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
551 #define YYPACT_NINF -134
552 static const short int yypact[] =
554 -134, 2, 160, -134, -16, 53, 53, -14, 53, -8,
555 -1, 53, 26, 63, 60, 73, -134, -134, -134, -134,
556 -134, -134, -134, -134, 114, -134, 125, -134, -134, -134,
557 -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
558 -134, -134, -134, -134, -134, -134, -134, 124, 127, -134,
559 128, -134, -134, 141, 142, 146, -134, -134, 60, 60,
560 3, -18, -134, 153, 159, 39, 102, 187, 226, 215,
561 67, 215, 131, -134, 163, -134, -134, -134, -134, -134,
562 34, -134, 60, 60, 163, 103, 103, -134, -134, 169,
563 186, 218, 60, 53, 53, 60, 201, 103, 227, -134,
564 -134, -134, 220, -134, -134, 207, 53, 53, 213, 229,
565 -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
566 -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
567 -134, -134, -134, 214, -134, -134, -134, -134, -134, 60,
568 178, 183, 229, 224, 229, 0, 229, 103, 228, -134,
569 -134, 229, 230, 229, 60, 231, 219, -134, -134, 232,
570 -134, -134, 233, 234, 229, -134, 235, -134, 236, 111,
571 -134, -134, -134, -134, -134, 237, -134, -134, -134
574 /* YYPGOTO[NTERM-NUM]. */
575 static const short int yypgoto[] =
577 -134, -134, -134, -134, 23, -46, -134, -134, -134, -134,
578 239, -134, -134, -134, -134, 118, -134, -134, -134, -134,
579 -134, -134, -134, -134, -134, -134, 185, -134, -134, -134,
580 -134, -134, 182, 217, -45, 164, -5, 28, 200, -133,
584 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
585 positive, shift that token. If negative, reduce the rule which
586 number is the opposite. If zero, do what YYDEFACT says.
587 If YYTABLE_NINF, syntax error. */
588 #define YYTABLE_NINF -78
589 static const short int yytable[] =
591 47, 48, 3, 50, 80, 81, 53, 135, 136, 159,
592 85, 161, 162, 163, 154, 44, 86, 49, 166, 147,
593 168, 111, 114, 51, 124, 125, 124, 125, 133, 134,
594 52, 175, 82, 83, 73, 82, 83, 140, 141, -29,
595 89, 145, -29, -29, -29, -29, -29, -29, -29, -29,
596 -29, 90, 54, -29, -29, 91, 92, -29, 93, 94,
597 95, 96, 97, 132, -29, 98, 82, 83, 89, 164,
598 99, -68, -68, -68, -68, -68, -68, -68, -68, 45,
599 46, -68, -68, 91, 92, 156, 56, 57, 142, 55,
600 58, 115, 118, 98, 126, 59, 117, 122, 123, 130,
601 169, 151, -31, 89, 62, -31, -31, -31, -31, -31,
602 -31, -31, -31, -31, 90, 63, -31, -31, 91, 92,
603 -31, 93, 94, 95, 96, 97, 64, -31, 98, 56,
604 57, -77, 89, 99, -77, -77, -77, -77, -77, -77,
605 -77, -77, -77, 82, 83, -77, -77, 91, 92, -77,
606 -77, -77, -77, -77, -77, 73, -77, 98, 75, 76,
607 -2, 4, 123, 5, 6, 7, 8, 9, 10, 11,
608 12, 13, 77, 78, 14, 15, 16, 79, 17, 18,
609 19, 20, 21, 22, 87, 23, 24, 119, 89, 127,
610 88, 25, -44, -44, 131, -44, -44, -44, -44, 90,
611 137, -44, -44, 91, 92, 105, 106, 107, 108, 157,
612 82, 83, 109, 98, 158, 82, 83, 138, 110, 6,
613 7, 8, 9, 10, 11, 12, 13, 146, 148, 14,
614 15, 7, 8, 149, 10, 11, 12, 13, 150, 153,
615 14, 15, 139, 154, 56, 57, 25, 83, 58, 113,
616 171, 82, 83, 59, 121, 160, 129, 25, 72, 165,
617 84, 167, 170, 172, 173, 174, 176, 177, 178, 66,
621 static const short int yycheck[] =
623 5, 6, 0, 8, 58, 59, 11, 85, 86, 142,
624 28, 144, 145, 146, 14, 31, 34, 31, 151, 97,
625 153, 67, 67, 31, 70, 70, 72, 72, 82, 83,
626 31, 164, 32, 33, 31, 32, 33, 91, 92, 0,
627 1, 95, 3, 4, 5, 6, 7, 8, 9, 10,
628 11, 12, 26, 14, 15, 16, 17, 18, 19, 20,
629 21, 22, 23, 29, 25, 26, 32, 33, 1, 147,
630 31, 4, 5, 6, 7, 8, 9, 10, 11, 26,
631 27, 14, 15, 16, 17, 139, 26, 27, 93, 26,
632 30, 68, 69, 26, 71, 35, 68, 69, 31, 71,
633 154, 106, 0, 1, 31, 3, 4, 5, 6, 7,
634 8, 9, 10, 11, 12, 1, 14, 15, 16, 17,
635 18, 19, 20, 21, 22, 23, 1, 25, 26, 26,
636 27, 0, 1, 31, 3, 4, 5, 6, 7, 8,
637 9, 10, 11, 32, 33, 14, 15, 16, 17, 18,
638 19, 20, 21, 22, 23, 31, 25, 26, 31, 31,
639 0, 1, 31, 3, 4, 5, 6, 7, 8, 9,
640 10, 11, 31, 31, 14, 15, 16, 31, 18, 19,
641 20, 21, 22, 23, 31, 25, 26, 69, 1, 71,
642 31, 31, 5, 6, 31, 8, 9, 10, 11, 12,
643 31, 14, 15, 16, 17, 18, 19, 20, 21, 31,
644 32, 33, 25, 26, 31, 32, 33, 31, 31, 4,
645 5, 6, 7, 8, 9, 10, 11, 26, 1, 14,
646 15, 5, 6, 13, 8, 9, 10, 11, 31, 26,
647 14, 15, 24, 14, 26, 27, 31, 33, 30, 67,
648 31, 32, 33, 35, 69, 31, 71, 31, 41, 31,
649 60, 31, 31, 31, 31, 31, 31, 31, 31, 30,
653 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
654 symbol of state STATE-NUM. */
655 static const unsigned char yystos[] =
657 0, 37, 38, 0, 1, 3, 4, 5, 6, 7,
658 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
659 21, 22, 23, 25, 26, 31, 39, 40, 42, 43,
660 44, 45, 48, 49, 51, 55, 57, 59, 60, 62,
661 64, 65, 66, 73, 31, 26, 27, 72, 72, 31,
662 72, 31, 31, 72, 26, 26, 26, 27, 30, 35,
663 76, 77, 31, 1, 1, 46, 46, 52, 54, 58,
664 69, 63, 69, 31, 74, 31, 31, 31, 31, 31,
665 76, 76, 32, 33, 74, 28, 34, 31, 31, 1,
666 12, 16, 17, 19, 20, 21, 22, 23, 26, 31,
667 41, 47, 67, 68, 70, 18, 19, 20, 21, 25,
668 31, 41, 53, 68, 70, 40, 50, 73, 40, 51,
669 56, 62, 73, 31, 41, 70, 40, 51, 61, 62,
670 73, 31, 29, 76, 76, 77, 77, 31, 31, 24,
671 76, 76, 72, 71, 72, 76, 26, 77, 1, 13,
672 31, 72, 71, 26, 14, 75, 76, 31, 31, 75,
673 31, 75, 75, 75, 77, 31, 75, 31, 75, 76,
674 31, 31, 31, 31, 31, 75, 31, 31, 31
677 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
678 # define YYSIZE_T __SIZE_TYPE__
680 #if ! defined (YYSIZE_T) && defined (size_t)
681 # define YYSIZE_T size_t
683 #if ! defined (YYSIZE_T)
684 # if defined (__STDC__) || defined (__cplusplus)
685 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
686 # define YYSIZE_T size_t
689 #if ! defined (YYSIZE_T)
690 # define YYSIZE_T unsigned int
693 #define yyerrok (yyerrstatus = 0)
694 #define yyclearin (yychar = YYEMPTY)
698 #define YYACCEPT goto yyacceptlab
699 #define YYABORT goto yyabortlab
700 #define YYERROR goto yyerrorlab
703 /* Like YYERROR except do call yyerror. This remains here temporarily
704 to ease the transition to the new meaning of YYERROR, for GCC.
705 Once GCC version 2 has supplanted version 1, this can go. */
707 #define YYFAIL goto yyerrlab
709 #define YYRECOVERING() (!!yyerrstatus)
711 #define YYBACKUP(Token, Value) \
713 if (yychar == YYEMPTY && yylen == 1) \
717 yytoken = YYTRANSLATE (yychar); \
723 yyerror ("syntax error: cannot back up");\
729 #define YYERRCODE 256
731 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
734 #ifndef YYLLOC_DEFAULT
735 # define YYLLOC_DEFAULT(Current, Rhs, N) \
736 ((Current).first_line = (Rhs)[1].first_line, \
737 (Current).first_column = (Rhs)[1].first_column, \
738 (Current).last_line = (Rhs)[N].last_line, \
739 (Current).last_column = (Rhs)[N].last_column)
742 /* YYLEX -- calling `yylex' with the right arguments. */
745 # define YYLEX yylex (YYLEX_PARAM)
747 # define YYLEX yylex ()
750 /* Enable debugging if requested. */
754 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
755 # define YYFPRINTF fprintf
758 # define YYDPRINTF(Args) \
764 # define YYDSYMPRINT(Args) \
770 # define YYDSYMPRINTF(Title, Token, Value, Location) \
774 YYFPRINTF (stderr, "%s ", Title); \
775 yysymprint (stderr, \
777 YYFPRINTF (stderr, "\n"); \
781 /*------------------------------------------------------------------.
782 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
784 `------------------------------------------------------------------*/
786 #if defined (__STDC__) || defined (__cplusplus)
788 yy_stack_print (short int *bottom, short int *top)
791 yy_stack_print (bottom, top)
796 YYFPRINTF (stderr, "Stack now");
797 for (/* Nothing. */; bottom <= top; ++bottom)
798 YYFPRINTF (stderr, " %d", *bottom);
799 YYFPRINTF (stderr, "\n");
802 # define YY_STACK_PRINT(Bottom, Top) \
805 yy_stack_print ((Bottom), (Top)); \
809 /*------------------------------------------------.
810 | Report that the YYRULE is going to be reduced. |
811 `------------------------------------------------*/
813 #if defined (__STDC__) || defined (__cplusplus)
815 yy_reduce_print (int yyrule)
818 yy_reduce_print (yyrule)
823 unsigned int yylno = yyrline[yyrule];
824 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
826 /* Print the symbols being reduced, and their result. */
827 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
828 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
829 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
832 # define YY_REDUCE_PRINT(Rule) \
835 yy_reduce_print (Rule); \
838 /* Nonzero means print parse trace. It is left uninitialized so that
839 multiple parsers can coexist. */
842 # define YYDPRINTF(Args)
843 # define YYDSYMPRINT(Args)
844 # define YYDSYMPRINTF(Title, Token, Value, Location)
845 # define YY_STACK_PRINT(Bottom, Top)
846 # define YY_REDUCE_PRINT(Rule)
847 #endif /* !YYDEBUG */
850 /* YYINITDEPTH -- initial size of the parser's stacks. */
852 # define YYINITDEPTH 200
855 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
856 if the built-in stack extension method is used).
858 Do not make this value too large; the results are undefined if
859 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
860 evaluated with infinite-precision integer arithmetic. */
862 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
867 # define YYMAXDEPTH 10000
875 # if defined (__GLIBC__) && defined (_STRING_H)
876 # define yystrlen strlen
878 /* Return the length of YYSTR. */
880 # if defined (__STDC__) || defined (__cplusplus)
881 yystrlen (const char *yystr)
887 register const char *yys = yystr;
889 while (*yys++ != '\0')
892 return yys - yystr - 1;
898 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
899 # define yystpcpy stpcpy
901 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
904 # if defined (__STDC__) || defined (__cplusplus)
905 yystpcpy (char *yydest, const char *yysrc)
907 yystpcpy (yydest, yysrc)
912 register char *yyd = yydest;
913 register const char *yys = yysrc;
915 while ((*yyd++ = *yys++) != '\0')
923 #endif /* !YYERROR_VERBOSE */
928 /*--------------------------------.
929 | Print this symbol on YYOUTPUT. |
930 `--------------------------------*/
932 #if defined (__STDC__) || defined (__cplusplus)
934 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
937 yysymprint (yyoutput, yytype, yyvaluep)
943 /* Pacify ``unused variable'' warnings. */
946 if (yytype < YYNTOKENS)
948 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
950 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
954 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
961 YYFPRINTF (yyoutput, ")");
964 #endif /* ! YYDEBUG */
965 /*-----------------------------------------------.
966 | Release the memory associated to this symbol. |
967 `-----------------------------------------------*/
969 #if defined (__STDC__) || defined (__cplusplus)
971 yydestruct (int yytype, YYSTYPE *yyvaluep)
974 yydestruct (yytype, yyvaluep)
979 /* Pacify ``unused variable'' warnings. */
984 case 49: /* choice_entry */
987 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
988 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
989 if (current_menu == yyvaluep->menu)
994 case 55: /* if_entry */
997 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
998 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
999 if (current_menu == yyvaluep->menu)
1004 case 60: /* menu_entry */
1007 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1008 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
1009 if (current_menu == yyvaluep->menu)
1021 /* Prevent warnings from -Wmissing-prototypes. */
1023 #ifdef YYPARSE_PARAM
1024 # if defined (__STDC__) || defined (__cplusplus)
1025 int yyparse (void *YYPARSE_PARAM);
1029 #else /* ! YYPARSE_PARAM */
1030 #if defined (__STDC__) || defined (__cplusplus)
1035 #endif /* ! YYPARSE_PARAM */
1039 /* The lookahead symbol. */
1042 /* The semantic value of the lookahead symbol. */
1045 /* Number of syntax errors so far. */
1054 #ifdef YYPARSE_PARAM
1055 # if defined (__STDC__) || defined (__cplusplus)
1056 int yyparse (void *YYPARSE_PARAM)
1058 int yyparse (YYPARSE_PARAM)
1059 void *YYPARSE_PARAM;
1061 #else /* ! YYPARSE_PARAM */
1062 #if defined (__STDC__) || defined (__cplusplus)
1073 register int yystate;
1076 /* Number of tokens to shift before error messages enabled. */
1078 /* Lookahead token as an internal (translated) token number. */
1081 /* Three stacks and their tools:
1082 `yyss': related to states,
1083 `yyvs': related to semantic values,
1084 `yyls': related to locations.
1086 Refer to the stacks thru separate pointers, to allow yyoverflow
1087 to reallocate them elsewhere. */
1089 /* The state stack. */
1090 short int yyssa[YYINITDEPTH];
1091 short int *yyss = yyssa;
1092 register short int *yyssp;
1094 /* The semantic value stack. */
1095 YYSTYPE yyvsa[YYINITDEPTH];
1096 YYSTYPE *yyvs = yyvsa;
1097 register YYSTYPE *yyvsp;
1101 #define YYPOPSTACK (yyvsp--, yyssp--)
1103 YYSIZE_T yystacksize = YYINITDEPTH;
1105 /* The variables used to return semantic value and location from the
1110 /* When reducing, the number of symbols on the RHS of the reduced
1114 YYDPRINTF ((stderr, "Starting parse\n"));
1119 yychar = YYEMPTY; /* Cause a token to be read. */
1121 /* Initialize stack pointers.
1122 Waste one element of value and location stack
1123 so that they stay on the same level as the state stack.
1124 The wasted elements are never initialized. */
1132 /*------------------------------------------------------------.
1133 | yynewstate -- Push a new state, which is found in yystate. |
1134 `------------------------------------------------------------*/
1136 /* In all cases, when you get here, the value and location stacks
1137 have just been pushed. so pushing a state here evens the stacks.
1144 if (yyss + yystacksize - 1 <= yyssp)
1146 /* Get the current used size of the three stacks, in elements. */
1147 YYSIZE_T yysize = yyssp - yyss + 1;
1151 /* Give user a chance to reallocate the stack. Use copies of
1152 these so that the &'s don't force the real ones into
1154 YYSTYPE *yyvs1 = yyvs;
1155 short int *yyss1 = yyss;
1158 /* Each stack pointer address is followed by the size of the
1159 data in use in that stack, in bytes. This used to be a
1160 conditional around just the two extra args, but that might
1161 be undefined if yyoverflow is a macro. */
1162 yyoverflow ("parser stack overflow",
1163 &yyss1, yysize * sizeof (*yyssp),
1164 &yyvs1, yysize * sizeof (*yyvsp),
1171 #else /* no yyoverflow */
1172 # ifndef YYSTACK_RELOCATE
1175 /* Extend the stack our own way. */
1176 if (YYMAXDEPTH <= yystacksize)
1179 if (YYMAXDEPTH < yystacksize)
1180 yystacksize = YYMAXDEPTH;
1183 short int *yyss1 = yyss;
1184 union yyalloc *yyptr =
1185 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1188 YYSTACK_RELOCATE (yyss);
1189 YYSTACK_RELOCATE (yyvs);
1191 # undef YYSTACK_RELOCATE
1193 YYSTACK_FREE (yyss1);
1196 #endif /* no yyoverflow */
1198 yyssp = yyss + yysize - 1;
1199 yyvsp = yyvs + yysize - 1;
1202 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1203 (unsigned long int) yystacksize));
1205 if (yyss + yystacksize - 1 <= yyssp)
1209 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1218 /* Do appropriate processing given the current state. */
1219 /* Read a lookahead token if we need one and don't already have one. */
1222 /* First try to decide what to do without reference to lookahead token. */
1224 yyn = yypact[yystate];
1225 if (yyn == YYPACT_NINF)
1228 /* Not known => get a lookahead token if don't already have one. */
1230 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1231 if (yychar == YYEMPTY)
1233 YYDPRINTF ((stderr, "Reading a token: "));
1237 if (yychar <= YYEOF)
1239 yychar = yytoken = YYEOF;
1240 YYDPRINTF ((stderr, "Now at end of input.\n"));
1244 yytoken = YYTRANSLATE (yychar);
1245 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1248 /* If the proper action on seeing token YYTOKEN is to reduce or to
1249 detect an error, take that action. */
1251 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1256 if (yyn == 0 || yyn == YYTABLE_NINF)
1265 /* Shift the lookahead token. */
1266 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1268 /* Discard the token being shifted unless it is eof. */
1269 if (yychar != YYEOF)
1275 /* Count tokens shifted since error; after three, turn off error
1284 /*-----------------------------------------------------------.
1285 | yydefault -- do the default action for the current state. |
1286 `-----------------------------------------------------------*/
1288 yyn = yydefact[yystate];
1294 /*-----------------------------.
1295 | yyreduce -- Do a reduction. |
1296 `-----------------------------*/
1298 /* yyn is the number of a rule to reduce with. */
1301 /* If YYLEN is nonzero, implement the default value of the action:
1304 Otherwise, the following line sets YYVAL to garbage.
1305 This behavior is undocumented and Bison
1306 users should not rely upon it. Assigning to YYVAL
1307 unconditionally makes the parser a bit smaller, and it avoids a
1308 GCC warning that YYVAL may be used uninitialized. */
1309 yyval = yyvsp[1-yylen];
1312 YY_REDUCE_PRINT (yyn);
1317 { zconf_error("unexpected end statement"); ;}
1322 { zconf_error("unknown statement \"%s\"", yyvsp[-2].string); ;}
1328 zconf_error("unexpected option \"%s\"", kconf_id_strings + yyvsp[-2].id->name);
1334 { zconf_error("invalid statement"); ;}
1339 { zconf_error("unknown option \"%s\"", yyvsp[-2].string); ;}
1344 { zconf_error("invalid option"); ;}
1350 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1351 sym->flags |= SYMBOL_OPTIONAL;
1352 menu_add_entry(sym);
1353 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1361 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1368 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1369 sym->flags |= SYMBOL_OPTIONAL;
1370 menu_add_entry(sym);
1371 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1378 if (current_entry->prompt)
1379 current_entry->prompt->type = P_MENU;
1381 zconfprint("warning: menuconfig statement without prompt");
1383 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1390 menu_set_type(yyvsp[-2].id->stype);
1391 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1392 zconf_curname(), zconf_lineno(),
1393 yyvsp[-2].id->stype);
1400 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1401 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1408 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
1409 if (yyvsp[-3].id->stype != S_UNKNOWN)
1410 menu_set_type(yyvsp[-3].id->stype);
1411 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1412 zconf_curname(), zconf_lineno(),
1413 yyvsp[-3].id->stype);
1420 menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1421 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1428 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr);
1429 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1436 struct symbol *sym = sym_lookup(NULL, 0);
1437 sym->flags |= SYMBOL_CHOICE;
1438 menu_add_entry(sym);
1439 menu_add_expr(P_CHOICE, NULL, NULL);
1440 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1447 yyval.menu = menu_add_menu();
1454 if (zconf_endtoken(yyvsp[0].id, T_CHOICE, T_ENDCHOICE)) {
1456 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1464 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1465 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1472 if (yyvsp[-2].id->stype == S_BOOLEAN || yyvsp[-2].id->stype == S_TRISTATE) {
1473 menu_set_type(yyvsp[-2].id->stype);
1474 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1475 zconf_curname(), zconf_lineno(),
1476 yyvsp[-2].id->stype);
1485 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1486 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1493 menu_add_prop(P_RESET, NULL, NULL, yyvsp[-1].expr);
1500 if (yyvsp[-3].id->stype == S_UNKNOWN) {
1501 menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1502 printd(DEBUG_PARSE, "%s:%d:default\n",
1503 zconf_curname(), zconf_lineno());
1512 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1513 menu_add_entry(NULL);
1514 menu_add_dep(yyvsp[-1].expr);
1515 yyval.menu = menu_add_menu();
1522 if (zconf_endtoken(yyvsp[0].id, T_IF, T_ENDIF)) {
1524 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1532 menu_add_entry(NULL);
1533 menu_add_prompt(P_MENU, yyvsp[-1].string, NULL);
1534 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1541 yyval.menu = menu_add_menu();
1548 if (zconf_endtoken(yyvsp[0].id, T_MENU, T_ENDMENU)) {
1550 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1558 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1559 zconf_nextfile(yyvsp[-1].string);
1566 menu_add_entry(NULL);
1567 menu_add_prompt(P_COMMENT, yyvsp[-1].string, NULL);
1568 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1582 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1590 current_entry->sym->help = yyvsp[0].string;
1597 menu_add_dep(yyvsp[-1].expr);
1598 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1605 menu_add_dep(yyvsp[-1].expr);
1606 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1613 menu_add_dep(yyvsp[-1].expr);
1614 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1621 menu_add_prompt(P_PROMPT, yyvsp[-1].string, yyvsp[0].expr);
1627 { yyval.id = yyvsp[-1].id; ;}
1632 { yyval.id = yyvsp[-1].id; ;}
1637 { yyval.id = yyvsp[-1].id; ;}
1642 { yyval.expr = NULL; ;}
1647 { yyval.expr = yyvsp[0].expr; ;}
1652 { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;}
1657 { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1662 { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1667 { yyval.expr = yyvsp[-1].expr; ;}
1672 { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;}
1677 { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;}
1682 { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;}
1687 { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;}
1692 { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;}
1698 /* Line 1010 of yacc.c. */
1705 YY_STACK_PRINT (yyss, yyssp);
1710 /* Now `shift' the result of the reduction. Determine what state
1711 that goes to, based on the state we popped back to and the rule
1712 number reduced by. */
1716 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1717 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1718 yystate = yytable[yystate];
1720 yystate = yydefgoto[yyn - YYNTOKENS];
1725 /*------------------------------------.
1726 | yyerrlab -- here on detecting error |
1727 `------------------------------------*/
1729 /* If not already recovering from an error, report this error. */
1734 yyn = yypact[yystate];
1736 if (YYPACT_NINF < yyn && yyn < YYLAST)
1738 YYSIZE_T yysize = 0;
1739 int yytype = YYTRANSLATE (yychar);
1740 const char* yyprefix;
1744 /* Start YYX at -YYN if negative to avoid negative indexes in
1746 int yyxbegin = yyn < 0 ? -yyn : 0;
1748 /* Stay within bounds of both yycheck and yytname. */
1749 int yychecklim = YYLAST - yyn;
1750 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1753 yyprefix = ", expecting ";
1754 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1755 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1757 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1765 yysize += (sizeof ("syntax error, unexpected ")
1766 + yystrlen (yytname[yytype]));
1767 yymsg = (char *) YYSTACK_ALLOC (yysize);
1770 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1771 yyp = yystpcpy (yyp, yytname[yytype]);
1775 yyprefix = ", expecting ";
1776 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1777 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1779 yyp = yystpcpy (yyp, yyprefix);
1780 yyp = yystpcpy (yyp, yytname[yyx]);
1785 YYSTACK_FREE (yymsg);
1788 yyerror ("syntax error; also virtual memory exhausted");
1791 #endif /* YYERROR_VERBOSE */
1792 yyerror ("syntax error");
1797 if (yyerrstatus == 3)
1799 /* If just tried and failed to reuse lookahead token after an
1800 error, discard it. */
1802 if (yychar <= YYEOF)
1804 /* If at end of input, pop the error token,
1805 then the rest of the stack, then return failure. */
1806 if (yychar == YYEOF)
1812 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1813 yydestruct (yystos[*yyssp], yyvsp);
1818 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1819 yydestruct (yytoken, &yylval);
1825 /* Else will try to reuse lookahead token after shifting the error
1830 /*---------------------------------------------------.
1831 | yyerrorlab -- error raised explicitly by YYERROR. |
1832 `---------------------------------------------------*/
1836 /* Pacify GCC when the user code never invokes YYERROR and the label
1837 yyerrorlab therefore never appears in user code. */
1848 /*-------------------------------------------------------------.
1849 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1850 `-------------------------------------------------------------*/
1852 yyerrstatus = 3; /* Each real token shifted decrements this. */
1856 yyn = yypact[yystate];
1857 if (yyn != YYPACT_NINF)
1860 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1868 /* Pop the current state because it cannot handle the error token. */
1872 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1873 yydestruct (yystos[yystate], yyvsp);
1876 YY_STACK_PRINT (yyss, yyssp);
1882 YYDPRINTF ((stderr, "Shifting error token, "));
1891 /*-------------------------------------.
1892 | yyacceptlab -- YYACCEPT comes here. |
1893 `-------------------------------------*/
1898 /*-----------------------------------.
1899 | yyabortlab -- YYABORT comes here. |
1900 `-----------------------------------*/
1906 /*----------------------------------------------.
1907 | yyoverflowlab -- parser overflow comes here. |
1908 `----------------------------------------------*/
1910 yyerror ("parser stack overflow");
1918 YYSTACK_FREE (yyss);
1927 void conf_parse(const char *name)
1932 zconf_initscan(name);
1936 modules_sym = sym_lookup("MODULES", 0);
1937 rootmenu.prompt = menu_add_prompt(P_MENU, "OpenWrt Configuration", NULL);
1940 if (getenv("ZCONF_DEBUG"))
1946 menu_finalize(&rootmenu);
1947 for_all_symbols(i, sym) {
1948 sym_check_deps(sym);
1951 sym_change_count = 1;
1954 const char *zconf_tokenname(int token)
1957 case T_MENU: return "menu";
1958 case T_ENDMENU: return "endmenu";
1959 case T_CHOICE: return "choice";
1960 case T_ENDCHOICE: return "endchoice";
1961 case T_IF: return "if";
1962 case T_ENDIF: return "endif";
1963 case T_DEPENDS: return "depends";
1968 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1970 if (id->token != endtoken) {
1971 zconf_error("unexpected '%s' within %s block",
1972 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1976 if (current_menu->file != current_file) {
1977 zconf_error("'%s' in different file than '%s'",
1978 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1979 fprintf(stderr, "%s:%d: location of the '%s'\n",
1980 current_menu->file->name, current_menu->lineno,
1981 zconf_tokenname(starttoken));
1988 static void zconfprint(const char *err, ...)
1992 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
1994 vfprintf(stderr, err, ap);
1996 fprintf(stderr, "\n");
1999 static void zconf_error(const char *err, ...)
2004 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2006 vfprintf(stderr, err, ap);
2008 fprintf(stderr, "\n");
2011 static void zconferror(const char *err)
2014 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2018 void print_quoted_string(FILE *out, const char *str)
2024 while ((p = strchr(str, '"'))) {
2027 fprintf(out, "%.*s", len, str);
2035 void print_symbol(FILE *out, struct menu *menu)
2037 struct symbol *sym = menu->sym;
2038 struct property *prop;
2040 if (sym_is_choice(sym))
2041 fprintf(out, "choice\n");
2043 fprintf(out, "config %s\n", sym->name);
2044 switch (sym->type) {
2046 fputs(" boolean\n", out);
2049 fputs(" tristate\n", out);
2052 fputs(" string\n", out);
2055 fputs(" integer\n", out);
2058 fputs(" hex\n", out);
2061 fputs(" ???\n", out);
2064 for (prop = sym->prop; prop; prop = prop->next) {
2065 if (prop->menu != menu)
2067 switch (prop->type) {
2069 fputs(" prompt ", out);
2070 print_quoted_string(out, prop->text);
2071 if (!expr_is_yes(prop->visible.expr)) {
2073 expr_fprint(prop->visible.expr, out);
2078 fputs( " default ", out);
2079 expr_fprint(prop->expr, out);
2080 if (!expr_is_yes(prop->visible.expr)) {
2082 expr_fprint(prop->visible.expr, out);
2087 fputs(" #choice value\n", out);
2090 fprintf(out, " unknown prop %d!\n", prop->type);
2095 int len = strlen(sym->help);
2096 while (sym->help[--len] == '\n')
2098 fprintf(out, " help\n%s\n", sym->help);
2103 void zconfdump(FILE *out)
2105 struct property *prop;
2109 menu = rootmenu.list;
2111 if ((sym = menu->sym))
2112 print_symbol(out, menu);
2113 else if ((prop = menu->prompt)) {
2114 switch (prop->type) {
2116 fputs("\ncomment ", out);
2117 print_quoted_string(out, prop->text);
2121 fputs("\nmenu ", out);
2122 print_quoted_string(out, prop->text);
2128 if (!expr_is_yes(prop->visible.expr)) {
2129 fputs(" depends ", out);
2130 expr_fprint(prop->visible.expr, out);
2138 else if (menu->next)
2140 else while ((menu = menu->parent)) {
2141 if (menu->prompt && menu->prompt->type == P_MENU)
2142 fputs("\nendmenu\n", out);
2151 #include "lex.zconf.c"
2153 #include "confdata.c"