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
101 #define T_MAINMENU 258
103 #define T_ENDMENU 260
106 #define T_ENDCHOICE 263
107 #define T_COMMENT 264
109 #define T_MENUCONFIG 266
111 #define T_HELPTEXT 268
114 #define T_DEPENDS 271
115 #define T_REQUIRES 272
116 #define T_OPTIONAL 273
119 #define T_DEFAULT 276
120 #define T_DESELECT 277
126 #define T_WORD_QUOTE 283
127 #define T_UNEQUAL 284
128 #define T_CLOSE_PAREN 285
129 #define T_OPEN_PAREN 286
139 /* Copy the first part of user declarations. */
143 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
144 * Released under the terms of the GNU GPL v2.0.
154 #define LKC_DIRECT_LINK
157 #include "zconf.hash.c"
159 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
161 #define PRINTD 0x0001
162 #define DEBUG_PARSE 0x0002
166 extern int zconflex(void);
167 static void zconfprint(const char *err, ...);
168 static void zconf_error(const char *err, ...);
169 static void zconferror(const char *err);
170 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
172 struct symbol *symbol_hash[257];
174 static struct menu *current_menu, *current_entry;
178 #define YYERROR_VERBOSE
182 /* Enabling traces. */
187 /* Enabling verbose error messages. */
188 #ifdef YYERROR_VERBOSE
189 # undef YYERROR_VERBOSE
190 # define YYERROR_VERBOSE 1
192 # define YYERROR_VERBOSE 0
195 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
197 typedef union YYSTYPE {
200 struct symbol *symbol;
205 /* Line 191 of yacc.c. */
207 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
208 # define YYSTYPE_IS_DECLARED 1
209 # define YYSTYPE_IS_TRIVIAL 1
214 /* Copy the second part of user declarations. */
217 /* Line 214 of yacc.c. */
220 #if ! defined (yyoverflow) || YYERROR_VERBOSE
226 # define YYMALLOC malloc
229 /* The parser invokes alloca or malloc; define the necessary symbols. */
231 # ifdef YYSTACK_USE_ALLOCA
232 # if YYSTACK_USE_ALLOCA
233 # define YYSTACK_ALLOC alloca
236 # if defined (alloca) || defined (_ALLOCA_H)
237 # define YYSTACK_ALLOC alloca
240 # define YYSTACK_ALLOC __builtin_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 184
335 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
337 #define YYMAXUTOK 291
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,
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, 5, 6, 9, 12, 15, 20, 23,
383 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
384 53, 55, 57, 59, 61, 63, 65, 67, 71, 74,
385 78, 81, 85, 88, 89, 92, 95, 98, 101, 104,
386 108, 113, 118, 123, 128, 134, 137, 140, 142, 146,
387 147, 150, 153, 156, 159, 162, 167, 171, 174, 178,
388 183, 184, 187, 191, 193, 197, 198, 201, 204, 207,
389 211, 214, 216, 220, 221, 224, 227, 230, 234, 238,
390 241, 244, 247, 248, 251, 254, 257, 262, 266, 270,
391 271, 274, 276, 278, 281, 284, 287, 289, 292, 293,
392 296, 298, 302, 306, 310, 313, 317, 321, 323
395 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
396 static const yysigned_char yyrhs[] =
398 38, 0, -1, 39, -1, -1, 39, 41, -1, 39,
399 52, -1, 39, 63, -1, 39, 3, 73, 75, -1,
400 39, 74, -1, 39, 27, 1, 32, -1, 39, 40,
401 1, 32, -1, 39, 1, 32, -1, 16, -1, 19,
402 -1, 20, -1, 22, -1, 23, -1, 18, -1, 24,
403 -1, 21, -1, 26, -1, 32, -1, 58, -1, 67,
404 -1, 44, -1, 46, -1, 65, -1, 27, 1, 32,
405 -1, 1, 32, -1, 10, 27, 32, -1, 43, 47,
406 -1, 11, 27, 32, -1, 45, 47, -1, -1, 47,
407 48, -1, 47, 71, -1, 47, 69, -1, 47, 42,
408 -1, 47, 32, -1, 20, 72, 32, -1, 19, 73,
409 76, 32, -1, 21, 77, 76, 32, -1, 22, 27,
410 76, 32, -1, 23, 27, 76, 32, -1, 24, 78,
411 78, 76, 32, -1, 7, 32, -1, 49, 53, -1,
412 74, -1, 50, 55, 51, -1, -1, 53, 54, -1,
413 53, 71, -1, 53, 69, -1, 53, 32, -1, 53,
414 42, -1, 19, 73, 76, 32, -1, 20, 72, 32,
415 -1, 18, 32, -1, 26, 76, 32, -1, 21, 27,
416 76, 32, -1, -1, 55, 41, -1, 14, 77, 75,
417 -1, 74, -1, 56, 59, 57, -1, -1, 59, 41,
418 -1, 59, 63, -1, 59, 52, -1, 4, 73, 32,
419 -1, 60, 70, -1, 74, -1, 61, 64, 62, -1,
420 -1, 64, 41, -1, 64, 63, -1, 64, 52, -1,
421 6, 73, 32, -1, 9, 73, 32, -1, 66, 70,
422 -1, 12, 32, -1, 68, 13, -1, -1, 70, 71,
423 -1, 70, 32, -1, 70, 42, -1, 16, 25, 77,
424 32, -1, 16, 77, 32, -1, 17, 77, 32, -1,
425 -1, 73, 76, -1, 27, -1, 28, -1, 5, 32,
426 -1, 8, 32, -1, 15, 32, -1, 32, -1, 75,
427 32, -1, -1, 14, 77, -1, 78, -1, 78, 35,
428 78, -1, 78, 29, 78, -1, 31, 77, 30, -1,
429 36, 77, -1, 77, 33, 77, -1, 77, 34, 77,
433 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
434 static const unsigned short int yyrline[] =
436 0, 105, 105, 107, 109, 110, 111, 112, 113, 114,
437 115, 119, 123, 123, 123, 123, 123, 123, 123, 123,
438 123, 127, 128, 129, 130, 131, 132, 136, 137, 143,
439 151, 157, 165, 175, 177, 178, 179, 180, 181, 184,
440 192, 198, 208, 214, 220, 228, 237, 242, 250, 253,
441 255, 256, 257, 258, 259, 262, 268, 279, 285, 290,
442 300, 302, 307, 315, 323, 326, 328, 329, 330, 335,
443 342, 347, 355, 358, 360, 361, 362, 365, 373, 380,
444 387, 393, 400, 402, 403, 404, 407, 412, 417, 425,
445 427, 432, 433, 436, 437, 438, 442, 443, 446, 447,
446 450, 451, 452, 453, 454, 455, 456, 459, 460
450 #if YYDEBUG || YYERROR_VERBOSE
451 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
452 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
453 static const char *const yytname[] =
455 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
456 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
457 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
458 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
459 "T_DESELECT", "T_SELECT", "T_RANGE", "T_ON", "T_RESET", "T_WORD",
460 "T_WORD_QUOTE", "T_UNEQUAL", "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL",
461 "T_OR", "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "stmt_list",
462 "option_name", "common_stmt", "option_error", "config_entry_start",
463 "config_stmt", "menuconfig_entry_start", "menuconfig_stmt",
464 "config_option_list", "config_option", "choice", "choice_entry",
465 "choice_end", "choice_stmt", "choice_option_list", "choice_option",
466 "choice_block", "if_entry", "if_end", "if_stmt", "if_block", "menu",
467 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
468 "comment", "comment_stmt", "help_start", "help", "depends_list",
469 "depends", "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr",
475 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
477 static const unsigned short int yytoknum[] =
479 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
480 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
481 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
482 285, 286, 287, 288, 289, 290, 291
486 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
487 static const unsigned char yyr1[] =
489 0, 37, 38, 39, 39, 39, 39, 39, 39, 39,
490 39, 39, 40, 40, 40, 40, 40, 40, 40, 40,
491 40, 41, 41, 41, 41, 41, 41, 42, 42, 43,
492 44, 45, 46, 47, 47, 47, 47, 47, 47, 48,
493 48, 48, 48, 48, 48, 49, 50, 51, 52, 53,
494 53, 53, 53, 53, 53, 54, 54, 54, 54, 54,
495 55, 55, 56, 57, 58, 59, 59, 59, 59, 60,
496 61, 62, 63, 64, 64, 64, 64, 65, 66, 67,
497 68, 69, 70, 70, 70, 70, 71, 71, 71, 72,
498 72, 73, 73, 74, 74, 74, 75, 75, 76, 76,
499 77, 77, 77, 77, 77, 77, 77, 78, 78
502 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
503 static const unsigned char yyr2[] =
505 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
506 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 3, 2, 3,
508 2, 3, 2, 0, 2, 2, 2, 2, 2, 3,
509 4, 4, 4, 4, 5, 2, 2, 1, 3, 0,
510 2, 2, 2, 2, 2, 4, 3, 2, 3, 4,
511 0, 2, 3, 1, 3, 0, 2, 2, 2, 3,
512 2, 1, 3, 0, 2, 2, 2, 3, 3, 2,
513 2, 2, 0, 2, 2, 2, 4, 3, 3, 0,
514 2, 1, 1, 2, 2, 2, 1, 2, 0, 2,
515 1, 3, 3, 3, 2, 3, 3, 1, 1
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 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
524 0, 0, 0, 0, 0, 0, 12, 17, 13, 14,
525 19, 15, 16, 18, 20, 0, 21, 0, 4, 33,
526 24, 33, 25, 49, 60, 5, 65, 22, 82, 73,
527 6, 26, 82, 23, 8, 11, 91, 92, 0, 0,
528 93, 0, 45, 94, 0, 0, 0, 107, 108, 0,
529 0, 0, 100, 95, 0, 0, 0, 0, 0, 0,
530 0, 0, 0, 0, 96, 7, 69, 77, 78, 29,
531 31, 0, 104, 0, 0, 62, 0, 0, 9, 10,
532 0, 0, 0, 0, 0, 89, 0, 0, 0, 0,
533 0, 38, 37, 34, 0, 36, 35, 0, 0, 89,
534 0, 98, 53, 54, 50, 52, 51, 61, 48, 47,
535 66, 68, 64, 67, 63, 84, 85, 83, 74, 76,
536 72, 75, 71, 97, 103, 105, 106, 102, 101, 28,
537 80, 0, 0, 0, 98, 0, 98, 98, 98, 98,
538 0, 0, 81, 57, 98, 0, 98, 0, 0, 0,
539 87, 88, 0, 39, 90, 0, 0, 0, 98, 27,
540 0, 56, 0, 99, 58, 86, 40, 41, 42, 43,
544 /* YYDEFGOTO[NTERM-NUM]. */
545 static const short int yydefgoto[] =
547 -1, 1, 2, 27, 28, 102, 29, 30, 31, 32,
548 66, 103, 33, 34, 118, 35, 68, 114, 69, 36,
549 122, 37, 70, 38, 39, 130, 40, 72, 41, 42,
550 43, 104, 105, 71, 106, 145, 146, 44, 75, 158,
554 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
556 #define YYPACT_NINF -80
557 static const short int yypact[] =
559 -80, 2, 164, -80, -22, 105, 105, -6, 105, 0,
560 7, 105, 17, 28, 70, 35, -80, -80, -80, -80,
561 -80, -80, -80, -80, -80, 69, -80, 78, -80, -80,
562 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
563 -80, -80, -80, -80, -80, -80, -80, -80, 62, 68,
564 -80, 85, -80, -80, 97, 127, 144, -80, -80, 70,
565 70, 188, -8, -80, 149, 163, 42, 104, 192, 67,
566 221, 8, 221, 134, -80, 167, -80, -80, -80, -80,
567 -80, 50, -80, 70, 70, 167, 119, 119, -80, -80,
568 173, 184, 60, 70, 105, 105, 70, 65, 150, 119,
569 232, -80, -80, -80, 210, -80, -80, 202, 105, 105,
570 231, 224, -80, -80, -80, -80, -80, -80, -80, -80,
571 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
572 -80, -80, -80, -80, -80, 226, -80, -80, -80, -80,
573 -80, 70, 211, 218, 224, 230, 224, -3, 224, 224,
574 119, 233, -80, -80, 224, 234, 224, 70, 235, 222,
575 -80, -80, 236, -80, -80, 237, 238, 239, 224, -80,
576 240, -80, 241, 129, -80, -80, -80, -80, -80, -80,
580 /* YYPGOTO[NTERM-NUM]. */
581 static const short int yypgoto[] =
583 -80, -80, -80, -80, -36, 22, -80, -80, -80, -80,
584 244, -80, -80, -80, -80, 176, -80, -80, -80, -80,
585 -80, -80, -80, -80, -80, -80, 187, -80, -80, -80,
586 -80, -80, 195, 243, 121, 155, -5, 145, 215, 93,
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 -80
595 static const short int yytable[] =
597 48, 49, 3, 51, 81, 82, 54, 137, 138, 90,
598 45, 157, -70, -70, -70, -70, -70, -70, -70, -70,
599 150, 86, -70, -70, 92, 93, 50, 87, 135, 136,
600 83, 84, 52, 117, 120, 100, 128, 142, 143, 53,
601 125, 147, -30, 90, 55, -30, -30, -30, -30, -30,
602 -30, -30, -30, -30, 91, 56, -30, -30, 92, 93,
603 -30, 94, 95, 96, 97, 98, 99, 63, -30, 100,
604 64, 168, 7, 8, 101, 10, 11, 12, 13, 65,
605 134, 14, 15, 83, 84, 141, 159, 57, 58, 144,
606 113, 59, 148, 126, 74, 126, 60, 57, 58, 26,
607 76, 59, 173, 154, -32, 90, 60, -32, -32, -32,
608 -32, -32, -32, -32, -32, -32, 91, 77, -32, -32,
609 92, 93, -32, 94, 95, 96, 97, 98, 99, 78,
610 -32, 100, 46, 47, -79, 90, 101, -79, -79, -79,
611 -79, -79, -79, -79, -79, -79, 57, 58, -79, -79,
612 92, 93, -79, -79, -79, -79, -79, -79, -79, 79,
613 -79, 100, 83, 84, -2, 4, 125, 5, 6, 7,
614 8, 9, 10, 11, 12, 13, 80, 149, 14, 15,
615 16, 88, 17, 18, 19, 20, 21, 22, 23, 116,
616 24, 25, 127, 90, 127, 89, 26, -46, -46, 133,
617 -46, -46, -46, -46, 91, 139, -46, -46, 92, 93,
618 107, 108, 109, 110, 119, 124, 140, 132, 111, 100,
619 74, 83, 84, 152, 112, 6, 7, 8, 9, 10,
620 11, 12, 13, 151, 153, 14, 15, 162, 157, 164,
621 165, 166, 167, 160, 83, 84, 121, 170, 129, 172,
622 161, 83, 84, 26, 175, 83, 84, 123, 156, 131,
623 84, 180, 163, 115, 155, 169, 171, 174, 176, 177,
624 178, 179, 181, 182, 183, 67, 85, 0, 0, 0,
628 static const short int yycheck[] =
630 5, 6, 0, 8, 59, 60, 11, 86, 87, 1,
631 32, 14, 4, 5, 6, 7, 8, 9, 10, 11,
632 99, 29, 14, 15, 16, 17, 32, 35, 83, 84,
633 33, 34, 32, 69, 70, 27, 72, 92, 93, 32,
634 32, 96, 0, 1, 27, 3, 4, 5, 6, 7,
635 8, 9, 10, 11, 12, 27, 14, 15, 16, 17,
636 18, 19, 20, 21, 22, 23, 24, 32, 26, 27,
637 1, 150, 5, 6, 32, 8, 9, 10, 11, 1,
638 30, 14, 15, 33, 34, 25, 141, 27, 28, 94,
639 68, 31, 27, 71, 32, 73, 36, 27, 28, 32,
640 32, 31, 157, 108, 0, 1, 36, 3, 4, 5,
641 6, 7, 8, 9, 10, 11, 12, 32, 14, 15,
642 16, 17, 18, 19, 20, 21, 22, 23, 24, 32,
643 26, 27, 27, 28, 0, 1, 32, 3, 4, 5,
644 6, 7, 8, 9, 10, 11, 27, 28, 14, 15,
645 16, 17, 18, 19, 20, 21, 22, 23, 24, 32,
646 26, 27, 33, 34, 0, 1, 32, 3, 4, 5,
647 6, 7, 8, 9, 10, 11, 32, 27, 14, 15,
648 16, 32, 18, 19, 20, 21, 22, 23, 24, 68,
649 26, 27, 71, 1, 73, 32, 32, 5, 6, 32,
650 8, 9, 10, 11, 12, 32, 14, 15, 16, 17,
651 18, 19, 20, 21, 69, 70, 32, 72, 26, 27,
652 32, 33, 34, 13, 32, 4, 5, 6, 7, 8,
653 9, 10, 11, 1, 32, 14, 15, 144, 14, 146,
654 147, 148, 149, 32, 33, 34, 70, 154, 72, 156,
655 32, 33, 34, 32, 32, 33, 34, 70, 27, 72,
656 34, 168, 32, 68, 109, 32, 32, 32, 32, 32,
657 32, 32, 32, 32, 32, 31, 61, -1, -1, -1,
658 -1, -1, -1, -1, -1, 42
661 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
662 symbol of state STATE-NUM. */
663 static const unsigned char yystos[] =
665 0, 38, 39, 0, 1, 3, 4, 5, 6, 7,
666 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
667 21, 22, 23, 24, 26, 27, 32, 40, 41, 43,
668 44, 45, 46, 49, 50, 52, 56, 58, 60, 61,
669 63, 65, 66, 67, 74, 32, 27, 28, 73, 73,
670 32, 73, 32, 32, 73, 27, 27, 27, 28, 31,
671 36, 77, 78, 32, 1, 1, 47, 47, 53, 55,
672 59, 70, 64, 70, 32, 75, 32, 32, 32, 32,
673 32, 77, 77, 33, 34, 75, 29, 35, 32, 32,
674 1, 12, 16, 17, 19, 20, 21, 22, 23, 24,
675 27, 32, 42, 48, 68, 69, 71, 18, 19, 20,
676 21, 26, 32, 42, 54, 69, 71, 41, 51, 74,
677 41, 52, 57, 63, 74, 32, 42, 71, 41, 52,
678 62, 63, 74, 32, 30, 77, 77, 78, 78, 32,
679 32, 25, 77, 77, 73, 72, 73, 77, 27, 27,
680 78, 1, 13, 32, 73, 72, 27, 14, 76, 77,
681 32, 32, 76, 32, 76, 76, 76, 76, 78, 32,
682 76, 32, 76, 77, 32, 32, 32, 32, 32, 32,
686 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
687 # define YYSIZE_T __SIZE_TYPE__
689 #if ! defined (YYSIZE_T) && defined (size_t)
690 # define YYSIZE_T size_t
692 #if ! defined (YYSIZE_T)
693 # if defined (__STDC__) || defined (__cplusplus)
694 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
695 # define YYSIZE_T size_t
698 #if ! defined (YYSIZE_T)
699 # define YYSIZE_T unsigned int
702 #define yyerrok (yyerrstatus = 0)
703 #define yyclearin (yychar = YYEMPTY)
707 #define YYACCEPT goto yyacceptlab
708 #define YYABORT goto yyabortlab
709 #define YYERROR goto yyerrorlab
712 /* Like YYERROR except do call yyerror. This remains here temporarily
713 to ease the transition to the new meaning of YYERROR, for GCC.
714 Once GCC version 2 has supplanted version 1, this can go. */
716 #define YYFAIL goto yyerrlab
718 #define YYRECOVERING() (!!yyerrstatus)
720 #define YYBACKUP(Token, Value) \
722 if (yychar == YYEMPTY && yylen == 1) \
726 yytoken = YYTRANSLATE (yychar); \
732 yyerror ("syntax error: cannot back up");\
738 #define YYERRCODE 256
740 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
743 #ifndef YYLLOC_DEFAULT
744 # define YYLLOC_DEFAULT(Current, Rhs, N) \
745 ((Current).first_line = (Rhs)[1].first_line, \
746 (Current).first_column = (Rhs)[1].first_column, \
747 (Current).last_line = (Rhs)[N].last_line, \
748 (Current).last_column = (Rhs)[N].last_column)
751 /* YYLEX -- calling `yylex' with the right arguments. */
754 # define YYLEX yylex (YYLEX_PARAM)
756 # define YYLEX yylex ()
759 /* Enable debugging if requested. */
763 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
764 # define YYFPRINTF fprintf
767 # define YYDPRINTF(Args) \
773 # define YYDSYMPRINT(Args) \
779 # define YYDSYMPRINTF(Title, Token, Value, Location) \
783 YYFPRINTF (stderr, "%s ", Title); \
784 yysymprint (stderr, \
786 YYFPRINTF (stderr, "\n"); \
790 /*------------------------------------------------------------------.
791 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
793 `------------------------------------------------------------------*/
795 #if defined (__STDC__) || defined (__cplusplus)
797 yy_stack_print (short int *bottom, short int *top)
800 yy_stack_print (bottom, top)
805 YYFPRINTF (stderr, "Stack now");
806 for (/* Nothing. */; bottom <= top; ++bottom)
807 YYFPRINTF (stderr, " %d", *bottom);
808 YYFPRINTF (stderr, "\n");
811 # define YY_STACK_PRINT(Bottom, Top) \
814 yy_stack_print ((Bottom), (Top)); \
818 /*------------------------------------------------.
819 | Report that the YYRULE is going to be reduced. |
820 `------------------------------------------------*/
822 #if defined (__STDC__) || defined (__cplusplus)
824 yy_reduce_print (int yyrule)
827 yy_reduce_print (yyrule)
832 unsigned int yylno = yyrline[yyrule];
833 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
835 /* Print the symbols being reduced, and their result. */
836 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
837 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
838 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
841 # define YY_REDUCE_PRINT(Rule) \
844 yy_reduce_print (Rule); \
847 /* Nonzero means print parse trace. It is left uninitialized so that
848 multiple parsers can coexist. */
851 # define YYDPRINTF(Args)
852 # define YYDSYMPRINT(Args)
853 # define YYDSYMPRINTF(Title, Token, Value, Location)
854 # define YY_STACK_PRINT(Bottom, Top)
855 # define YY_REDUCE_PRINT(Rule)
856 #endif /* !YYDEBUG */
859 /* YYINITDEPTH -- initial size of the parser's stacks. */
861 # define YYINITDEPTH 200
864 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
865 if the built-in stack extension method is used).
867 Do not make this value too large; the results are undefined if
868 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
869 evaluated with infinite-precision integer arithmetic. */
871 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
876 # define YYMAXDEPTH 10000
884 # if defined (__GLIBC__) && defined (_STRING_H)
885 # define yystrlen strlen
887 /* Return the length of YYSTR. */
889 # if defined (__STDC__) || defined (__cplusplus)
890 yystrlen (const char *yystr)
896 register const char *yys = yystr;
898 while (*yys++ != '\0')
901 return yys - yystr - 1;
907 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
908 # define yystpcpy stpcpy
910 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
913 # if defined (__STDC__) || defined (__cplusplus)
914 yystpcpy (char *yydest, const char *yysrc)
916 yystpcpy (yydest, yysrc)
921 register char *yyd = yydest;
922 register const char *yys = yysrc;
924 while ((*yyd++ = *yys++) != '\0')
932 #endif /* !YYERROR_VERBOSE */
937 /*--------------------------------.
938 | Print this symbol on YYOUTPUT. |
939 `--------------------------------*/
941 #if defined (__STDC__) || defined (__cplusplus)
943 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
946 yysymprint (yyoutput, yytype, yyvaluep)
952 /* Pacify ``unused variable'' warnings. */
955 if (yytype < YYNTOKENS)
957 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
959 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
963 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
970 YYFPRINTF (yyoutput, ")");
973 #endif /* ! YYDEBUG */
974 /*-----------------------------------------------.
975 | Release the memory associated to this symbol. |
976 `-----------------------------------------------*/
978 #if defined (__STDC__) || defined (__cplusplus)
980 yydestruct (int yytype, YYSTYPE *yyvaluep)
983 yydestruct (yytype, yyvaluep)
988 /* Pacify ``unused variable'' warnings. */
993 case 50: /* choice_entry */
996 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
997 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
998 if (current_menu == yyvaluep->menu)
1003 case 56: /* if_entry */
1006 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1007 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
1008 if (current_menu == yyvaluep->menu)
1013 case 61: /* menu_entry */
1016 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1017 yyvaluep->menu->file->name, yyvaluep->menu->lineno);
1018 if (current_menu == yyvaluep->menu)
1030 /* Prevent warnings from -Wmissing-prototypes. */
1032 #ifdef YYPARSE_PARAM
1033 # if defined (__STDC__) || defined (__cplusplus)
1034 int yyparse (void *YYPARSE_PARAM);
1038 #else /* ! YYPARSE_PARAM */
1039 #if defined (__STDC__) || defined (__cplusplus)
1044 #endif /* ! YYPARSE_PARAM */
1048 /* The lookahead symbol. */
1051 /* The semantic value of the lookahead symbol. */
1054 /* Number of syntax errors so far. */
1063 #ifdef YYPARSE_PARAM
1064 # if defined (__STDC__) || defined (__cplusplus)
1065 int yyparse (void *YYPARSE_PARAM)
1067 int yyparse (YYPARSE_PARAM)
1068 void *YYPARSE_PARAM;
1070 #else /* ! YYPARSE_PARAM */
1071 #if defined (__STDC__) || defined (__cplusplus)
1082 register int yystate;
1085 /* Number of tokens to shift before error messages enabled. */
1087 /* Lookahead token as an internal (translated) token number. */
1090 /* Three stacks and their tools:
1091 `yyss': related to states,
1092 `yyvs': related to semantic values,
1093 `yyls': related to locations.
1095 Refer to the stacks thru separate pointers, to allow yyoverflow
1096 to reallocate them elsewhere. */
1098 /* The state stack. */
1099 short int yyssa[YYINITDEPTH];
1100 short int *yyss = yyssa;
1101 register short int *yyssp;
1103 /* The semantic value stack. */
1104 YYSTYPE yyvsa[YYINITDEPTH];
1105 YYSTYPE *yyvs = yyvsa;
1106 register YYSTYPE *yyvsp;
1110 #define YYPOPSTACK (yyvsp--, yyssp--)
1112 YYSIZE_T yystacksize = YYINITDEPTH;
1114 /* The variables used to return semantic value and location from the
1119 /* When reducing, the number of symbols on the RHS of the reduced
1123 YYDPRINTF ((stderr, "Starting parse\n"));
1128 yychar = YYEMPTY; /* Cause a token to be read. */
1130 /* Initialize stack pointers.
1131 Waste one element of value and location stack
1132 so that they stay on the same level as the state stack.
1133 The wasted elements are never initialized. */
1141 /*------------------------------------------------------------.
1142 | yynewstate -- Push a new state, which is found in yystate. |
1143 `------------------------------------------------------------*/
1145 /* In all cases, when you get here, the value and location stacks
1146 have just been pushed. so pushing a state here evens the stacks.
1153 if (yyss + yystacksize - 1 <= yyssp)
1155 /* Get the current used size of the three stacks, in elements. */
1156 YYSIZE_T yysize = yyssp - yyss + 1;
1160 /* Give user a chance to reallocate the stack. Use copies of
1161 these so that the &'s don't force the real ones into
1163 YYSTYPE *yyvs1 = yyvs;
1164 short int *yyss1 = yyss;
1167 /* Each stack pointer address is followed by the size of the
1168 data in use in that stack, in bytes. This used to be a
1169 conditional around just the two extra args, but that might
1170 be undefined if yyoverflow is a macro. */
1171 yyoverflow ("parser stack overflow",
1172 &yyss1, yysize * sizeof (*yyssp),
1173 &yyvs1, yysize * sizeof (*yyvsp),
1180 #else /* no yyoverflow */
1181 # ifndef YYSTACK_RELOCATE
1184 /* Extend the stack our own way. */
1185 if (YYMAXDEPTH <= yystacksize)
1188 if (YYMAXDEPTH < yystacksize)
1189 yystacksize = YYMAXDEPTH;
1192 short int *yyss1 = yyss;
1193 union yyalloc *yyptr =
1194 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1197 YYSTACK_RELOCATE (yyss);
1198 YYSTACK_RELOCATE (yyvs);
1200 # undef YYSTACK_RELOCATE
1202 YYSTACK_FREE (yyss1);
1205 #endif /* no yyoverflow */
1207 yyssp = yyss + yysize - 1;
1208 yyvsp = yyvs + yysize - 1;
1211 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1212 (unsigned long int) yystacksize));
1214 if (yyss + yystacksize - 1 <= yyssp)
1218 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1227 /* Do appropriate processing given the current state. */
1228 /* Read a lookahead token if we need one and don't already have one. */
1231 /* First try to decide what to do without reference to lookahead token. */
1233 yyn = yypact[yystate];
1234 if (yyn == YYPACT_NINF)
1237 /* Not known => get a lookahead token if don't already have one. */
1239 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1240 if (yychar == YYEMPTY)
1242 YYDPRINTF ((stderr, "Reading a token: "));
1246 if (yychar <= YYEOF)
1248 yychar = yytoken = YYEOF;
1249 YYDPRINTF ((stderr, "Now at end of input.\n"));
1253 yytoken = YYTRANSLATE (yychar);
1254 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1257 /* If the proper action on seeing token YYTOKEN is to reduce or to
1258 detect an error, take that action. */
1260 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1265 if (yyn == 0 || yyn == YYTABLE_NINF)
1274 /* Shift the lookahead token. */
1275 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1277 /* Discard the token being shifted unless it is eof. */
1278 if (yychar != YYEOF)
1284 /* Count tokens shifted since error; after three, turn off error
1293 /*-----------------------------------------------------------.
1294 | yydefault -- do the default action for the current state. |
1295 `-----------------------------------------------------------*/
1297 yyn = yydefact[yystate];
1303 /*-----------------------------.
1304 | yyreduce -- Do a reduction. |
1305 `-----------------------------*/
1307 /* yyn is the number of a rule to reduce with. */
1310 /* If YYLEN is nonzero, implement the default value of the action:
1313 Otherwise, the following line sets YYVAL to garbage.
1314 This behavior is undocumented and Bison
1315 users should not rely upon it. Assigning to YYVAL
1316 unconditionally makes the parser a bit smaller, and it avoids a
1317 GCC warning that YYVAL may be used uninitialized. */
1318 yyval = yyvsp[1-yylen];
1321 YY_REDUCE_PRINT (yyn);
1326 { zconf_error("unexpected end statement"); ;}
1331 { zconf_error("unknown statement \"%s\"", yyvsp[-2].string); ;}
1337 zconf_error("unexpected option \"%s\"", kconf_id_strings + yyvsp[-2].id->name);
1343 { zconf_error("invalid statement"); ;}
1348 { zconf_error("unknown option \"%s\"", yyvsp[-2].string); ;}
1353 { zconf_error("invalid option"); ;}
1359 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1360 sym->flags |= SYMBOL_OPTIONAL;
1361 menu_add_entry(sym);
1362 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1370 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1377 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1378 sym->flags |= SYMBOL_OPTIONAL;
1379 menu_add_entry(sym);
1380 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1387 if (current_entry->prompt)
1388 current_entry->prompt->type = P_MENU;
1390 zconfprint("warning: menuconfig statement without prompt");
1392 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1399 menu_set_type(yyvsp[-2].id->stype);
1400 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1401 zconf_curname(), zconf_lineno(),
1402 yyvsp[-2].id->stype);
1409 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1410 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1417 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
1418 if (yyvsp[-3].id->stype != S_UNKNOWN)
1419 menu_set_type(yyvsp[-3].id->stype);
1420 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1421 zconf_curname(), zconf_lineno(),
1422 yyvsp[-3].id->stype);
1429 menu_add_symbol(P_DESELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1430 printd(DEBUG_PARSE, "%s:%d:deselect\n", zconf_curname(), zconf_lineno());
1437 menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1438 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1445 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr);
1446 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1453 struct symbol *sym = sym_lookup(NULL, 0);
1454 sym->flags |= SYMBOL_CHOICE;
1455 menu_add_entry(sym);
1456 menu_add_expr(P_CHOICE, NULL, NULL);
1457 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1464 yyval.menu = menu_add_menu();
1471 if (zconf_endtoken(yyvsp[0].id, T_CHOICE, T_ENDCHOICE)) {
1473 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1481 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1482 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1489 if (yyvsp[-2].id->stype == S_BOOLEAN || yyvsp[-2].id->stype == S_TRISTATE) {
1490 menu_set_type(yyvsp[-2].id->stype);
1491 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1492 zconf_curname(), zconf_lineno(),
1493 yyvsp[-2].id->stype);
1502 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1503 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1510 menu_add_prop(P_RESET, NULL, NULL, yyvsp[-1].expr);
1517 if (yyvsp[-3].id->stype == S_UNKNOWN) {
1518 menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1519 printd(DEBUG_PARSE, "%s:%d:default\n",
1520 zconf_curname(), zconf_lineno());
1529 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1530 menu_add_entry(NULL);
1531 menu_add_dep(yyvsp[-1].expr);
1532 yyval.menu = menu_add_menu();
1539 if (zconf_endtoken(yyvsp[0].id, T_IF, T_ENDIF)) {
1541 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1549 menu_add_entry(NULL);
1550 menu_add_prompt(P_MENU, yyvsp[-1].string, NULL);
1551 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1558 yyval.menu = menu_add_menu();
1565 if (zconf_endtoken(yyvsp[0].id, T_MENU, T_ENDMENU)) {
1567 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1575 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1576 zconf_nextfile(yyvsp[-1].string);
1583 menu_add_entry(NULL);
1584 menu_add_prompt(P_COMMENT, yyvsp[-1].string, NULL);
1585 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1599 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1607 current_entry->sym->help = yyvsp[0].string;
1614 menu_add_dep(yyvsp[-1].expr);
1615 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1622 menu_add_dep(yyvsp[-1].expr);
1623 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1630 menu_add_dep(yyvsp[-1].expr);
1631 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1638 menu_add_prompt(P_PROMPT, yyvsp[-1].string, yyvsp[0].expr);
1644 { yyval.id = yyvsp[-1].id; ;}
1649 { yyval.id = yyvsp[-1].id; ;}
1654 { yyval.id = yyvsp[-1].id; ;}
1659 { yyval.expr = NULL; ;}
1664 { yyval.expr = yyvsp[0].expr; ;}
1669 { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;}
1674 { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1679 { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1684 { yyval.expr = yyvsp[-1].expr; ;}
1689 { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;}
1694 { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;}
1699 { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;}
1704 { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;}
1709 { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;}
1715 /* Line 1010 of yacc.c. */
1722 YY_STACK_PRINT (yyss, yyssp);
1727 /* Now `shift' the result of the reduction. Determine what state
1728 that goes to, based on the state we popped back to and the rule
1729 number reduced by. */
1733 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1734 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1735 yystate = yytable[yystate];
1737 yystate = yydefgoto[yyn - YYNTOKENS];
1742 /*------------------------------------.
1743 | yyerrlab -- here on detecting error |
1744 `------------------------------------*/
1746 /* If not already recovering from an error, report this error. */
1751 yyn = yypact[yystate];
1753 if (YYPACT_NINF < yyn && yyn < YYLAST)
1755 YYSIZE_T yysize = 0;
1756 int yytype = YYTRANSLATE (yychar);
1757 const char* yyprefix;
1761 /* Start YYX at -YYN if negative to avoid negative indexes in
1763 int yyxbegin = yyn < 0 ? -yyn : 0;
1765 /* Stay within bounds of both yycheck and yytname. */
1766 int yychecklim = YYLAST - yyn;
1767 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1770 yyprefix = ", expecting ";
1771 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1772 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1774 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1782 yysize += (sizeof ("syntax error, unexpected ")
1783 + yystrlen (yytname[yytype]));
1784 yymsg = (char *) YYSTACK_ALLOC (yysize);
1787 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1788 yyp = yystpcpy (yyp, yytname[yytype]);
1792 yyprefix = ", expecting ";
1793 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1794 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1796 yyp = yystpcpy (yyp, yyprefix);
1797 yyp = yystpcpy (yyp, yytname[yyx]);
1802 YYSTACK_FREE (yymsg);
1805 yyerror ("syntax error; also virtual memory exhausted");
1808 #endif /* YYERROR_VERBOSE */
1809 yyerror ("syntax error");
1814 if (yyerrstatus == 3)
1816 /* If just tried and failed to reuse lookahead token after an
1817 error, discard it. */
1819 if (yychar <= YYEOF)
1821 /* If at end of input, pop the error token,
1822 then the rest of the stack, then return failure. */
1823 if (yychar == YYEOF)
1829 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1830 yydestruct (yystos[*yyssp], yyvsp);
1835 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1836 yydestruct (yytoken, &yylval);
1842 /* Else will try to reuse lookahead token after shifting the error
1847 /*---------------------------------------------------.
1848 | yyerrorlab -- error raised explicitly by YYERROR. |
1849 `---------------------------------------------------*/
1853 /* Pacify GCC when the user code never invokes YYERROR and the label
1854 yyerrorlab therefore never appears in user code. */
1865 /*-------------------------------------------------------------.
1866 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1867 `-------------------------------------------------------------*/
1869 yyerrstatus = 3; /* Each real token shifted decrements this. */
1873 yyn = yypact[yystate];
1874 if (yyn != YYPACT_NINF)
1877 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1885 /* Pop the current state because it cannot handle the error token. */
1889 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1890 yydestruct (yystos[yystate], yyvsp);
1893 YY_STACK_PRINT (yyss, yyssp);
1899 YYDPRINTF ((stderr, "Shifting error token, "));
1908 /*-------------------------------------.
1909 | yyacceptlab -- YYACCEPT comes here. |
1910 `-------------------------------------*/
1915 /*-----------------------------------.
1916 | yyabortlab -- YYABORT comes here. |
1917 `-----------------------------------*/
1923 /*----------------------------------------------.
1924 | yyoverflowlab -- parser overflow comes here. |
1925 `----------------------------------------------*/
1927 yyerror ("parser stack overflow");
1935 YYSTACK_FREE (yyss);
1944 void conf_parse(const char *name)
1949 zconf_initscan(name);
1953 modules_sym = sym_lookup("MODULES", 0);
1954 rootmenu.prompt = menu_add_prompt(P_MENU, "OpenWrt Configuration", NULL);
1957 if (getenv("ZCONF_DEBUG"))
1963 menu_finalize(&rootmenu);
1964 for_all_symbols(i, sym) {
1965 sym_check_deps(sym);
1968 sym_change_count = 1;
1971 const char *zconf_tokenname(int token)
1974 case T_MENU: return "menu";
1975 case T_ENDMENU: return "endmenu";
1976 case T_CHOICE: return "choice";
1977 case T_ENDCHOICE: return "endchoice";
1978 case T_IF: return "if";
1979 case T_ENDIF: return "endif";
1980 case T_DEPENDS: return "depends";
1985 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1987 if (id->token != endtoken) {
1988 zconf_error("unexpected '%s' within %s block",
1989 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1993 if (current_menu->file != current_file) {
1994 zconf_error("'%s' in different file than '%s'",
1995 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1996 fprintf(stderr, "%s:%d: location of the '%s'\n",
1997 current_menu->file->name, current_menu->lineno,
1998 zconf_tokenname(starttoken));
2005 static void zconfprint(const char *err, ...)
2009 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2011 vfprintf(stderr, err, ap);
2013 fprintf(stderr, "\n");
2016 static void zconf_error(const char *err, ...)
2021 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2023 vfprintf(stderr, err, ap);
2025 fprintf(stderr, "\n");
2028 static void zconferror(const char *err)
2031 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2035 void print_quoted_string(FILE *out, const char *str)
2041 while ((p = strchr(str, '"'))) {
2044 fprintf(out, "%.*s", len, str);
2052 void print_symbol(FILE *out, struct menu *menu)
2054 struct symbol *sym = menu->sym;
2055 struct property *prop;
2057 if (sym_is_choice(sym))
2058 fprintf(out, "choice\n");
2060 fprintf(out, "config %s\n", sym->name);
2061 switch (sym->type) {
2063 fputs(" boolean\n", out);
2066 fputs(" tristate\n", out);
2069 fputs(" string\n", out);
2072 fputs(" integer\n", out);
2075 fputs(" hex\n", out);
2078 fputs(" ???\n", out);
2081 for (prop = sym->prop; prop; prop = prop->next) {
2082 if (prop->menu != menu)
2084 switch (prop->type) {
2086 fputs(" prompt ", out);
2087 print_quoted_string(out, prop->text);
2088 if (!expr_is_yes(prop->visible.expr)) {
2090 expr_fprint(prop->visible.expr, out);
2095 fputs( " default ", out);
2096 expr_fprint(prop->expr, out);
2097 if (!expr_is_yes(prop->visible.expr)) {
2099 expr_fprint(prop->visible.expr, out);
2104 fputs(" #choice value\n", out);
2107 fprintf(out, " unknown prop %d!\n", prop->type);
2112 int len = strlen(sym->help);
2113 while (sym->help[--len] == '\n')
2115 fprintf(out, " help\n%s\n", sym->help);
2120 void zconfdump(FILE *out)
2122 struct property *prop;
2126 menu = rootmenu.list;
2128 if ((sym = menu->sym))
2129 print_symbol(out, menu);
2130 else if ((prop = menu->prompt)) {
2131 switch (prop->type) {
2133 fputs("\ncomment ", out);
2134 print_quoted_string(out, prop->text);
2138 fputs("\nmenu ", out);
2139 print_quoted_string(out, prop->text);
2145 if (!expr_is_yes(prop->visible.expr)) {
2146 fputs(" depends ", out);
2147 expr_fprint(prop->visible.expr, out);
2155 else if (menu->next)
2157 else while ((menu = menu->parent)) {
2158 if (menu->prompt && menu->prompt->type == P_MENU)
2159 fputs("\nendmenu\n", out);
2168 #include "lex.zconf.c"
2170 #include "confdata.c"