1 /* A Bison parser, made by GNU Bison 2.0. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* Substitute the variable and function names. */
49 #define yyparse zconfparse
50 #define yylex zconflex
51 #define yyerror zconferror
52 #define yylval zconflval
53 #define yychar zconfchar
54 #define yydebug zconfdebug
55 #define yynerrs zconfnerrs
61 /* Put the tokens into the symbol table, so that GDB and other debuggers
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
136 /* Copy the first part of user declarations. */
140 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
141 * Released under the terms of the GNU GPL v2.0.
151 #define LKC_DIRECT_LINK
154 #include "zconf.hash.c"
156 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
158 #define PRINTD 0x0001
159 #define DEBUG_PARSE 0x0002
163 extern int zconflex(void);
164 static void zconfprint(const char *err, ...);
165 static void zconferror(const char *err);
166 static bool zconf_endtoken(int token, int starttoken, int endtoken);
168 struct symbol *symbol_hash[257];
170 static struct menu *current_menu, *current_entry;
172 #define YYERROR_VERBOSE
175 /* Enabling traces. */
180 /* Enabling verbose error messages. */
181 #ifdef YYERROR_VERBOSE
182 # undef YYERROR_VERBOSE
183 # define YYERROR_VERBOSE 1
185 # define YYERROR_VERBOSE 0
188 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
190 typedef union YYSTYPE {
193 struct symbol *symbol;
198 /* Line 190 of yacc.c. */
200 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
201 # define YYSTYPE_IS_DECLARED 1
202 # define YYSTYPE_IS_TRIVIAL 1
207 /* Copy the second part of user declarations. */
210 /* Line 213 of yacc.c. */
213 #if ! defined (yyoverflow) || YYERROR_VERBOSE
219 # define YYMALLOC malloc
222 /* The parser invokes alloca or malloc; define the necessary symbols. */
224 # ifdef YYSTACK_USE_ALLOCA
225 # if YYSTACK_USE_ALLOCA
227 # define YYSTACK_ALLOC __builtin_alloca
229 # define YYSTACK_ALLOC alloca
234 # ifdef YYSTACK_ALLOC
235 /* Pacify GCC's `empty if-body' warning. */
236 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
238 # if defined (__STDC__) || defined (__cplusplus)
239 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
240 # define YYSIZE_T size_t
242 # define YYSTACK_ALLOC YYMALLOC
243 # define YYSTACK_FREE YYFREE
245 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
248 #if (! defined (yyoverflow) \
249 && (! defined (__cplusplus) \
250 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
252 /* A type that is properly aligned for any stack member. */
259 /* The size of the maximum gap between one aligned stack and the next. */
260 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
262 /* The size of an array large to enough to hold all stacks, each with
264 # define YYSTACK_BYTES(N) \
265 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
266 + YYSTACK_GAP_MAXIMUM)
268 /* Copy COUNT objects from FROM to TO. The source and destination do
271 # if defined (__GNUC__) && 1 < __GNUC__
272 # define YYCOPY(To, From, Count) \
273 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
275 # define YYCOPY(To, From, Count) \
278 register YYSIZE_T yyi; \
279 for (yyi = 0; yyi < (Count); yyi++) \
280 (To)[yyi] = (From)[yyi]; \
286 /* Relocate STACK from its old location to the new one. The
287 local variables YYSIZE and YYSTACKSIZE give the old and new number of
288 elements in the stack, and YYPTR gives the new location of the
289 stack. Advance YYPTR to a properly aligned location for the next
291 # define YYSTACK_RELOCATE(Stack) \
294 YYSIZE_T yynewbytes; \
295 YYCOPY (&yyptr->Stack, Stack, yysize); \
296 Stack = &yyptr->Stack; \
297 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
298 yyptr += yynewbytes / sizeof (*yyptr); \
304 #if defined (__STDC__) || defined (__cplusplus)
305 typedef signed char yysigned_char;
307 typedef short int yysigned_char;
310 /* YYFINAL -- State number of the termination state. */
312 /* YYLAST -- Last index in YYTABLE. */
315 /* YYNTOKENS -- Number of terminals. */
317 /* YYNNTS -- Number of nonterminals. */
319 /* YYNRULES -- Number of rules. */
321 /* YYNRULES -- Number of states. */
322 #define YYNSTATES 159
324 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
326 #define YYMAXUTOK 290
328 #define YYTRANSLATE(YYX) \
329 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
331 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
332 static const unsigned char yytranslate[] =
334 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
360 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
361 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
362 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
367 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
369 static const unsigned short int yyprhs[] =
371 0, 0, 3, 4, 7, 9, 11, 13, 17, 19,
372 21, 23, 26, 28, 30, 32, 34, 36, 38, 42,
373 45, 49, 52, 53, 56, 59, 62, 65, 69, 74,
374 79, 84, 90, 93, 96, 98, 102, 105, 106, 109,
375 112, 115, 118, 123, 127, 130, 135, 136, 139, 143,
376 145, 149, 152, 153, 156, 159, 162, 166, 169, 171,
377 175, 178, 179, 182, 185, 188, 192, 196, 198, 202,
378 205, 208, 211, 212, 215, 218, 223, 227, 231, 232,
379 235, 237, 239, 242, 245, 248, 250, 252, 253, 256,
380 258, 262, 266, 270, 273, 277, 281, 283
383 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
384 static const yysigned_char yyrhs[] =
386 37, 0, -1, -1, 37, 38, -1, 39, -1, 49,
387 -1, 60, -1, 3, 71, 73, -1, 5, -1, 15,
388 -1, 8, -1, 1, 73, -1, 55, -1, 65, -1,
389 41, -1, 43, -1, 63, -1, 73, -1, 10, 25,
390 30, -1, 40, 44, -1, 11, 25, 30, -1, 42,
391 44, -1, -1, 44, 45, -1, 44, 69, -1, 44,
392 67, -1, 44, 30, -1, 20, 70, 30, -1, 19,
393 71, 74, 30, -1, 21, 75, 74, 30, -1, 22,
394 25, 74, 30, -1, 23, 76, 76, 74, 30, -1,
395 7, 30, -1, 46, 50, -1, 72, -1, 47, 52,
396 48, -1, 47, 52, -1, -1, 50, 51, -1, 50,
397 69, -1, 50, 67, -1, 50, 30, -1, 19, 71,
398 74, 30, -1, 20, 70, 30, -1, 18, 30, -1,
399 21, 25, 74, 30, -1, -1, 52, 39, -1, 14,
400 75, 30, -1, 72, -1, 53, 56, 54, -1, 53,
401 56, -1, -1, 56, 39, -1, 56, 60, -1, 56,
402 49, -1, 4, 71, 30, -1, 57, 68, -1, 72,
403 -1, 58, 61, 59, -1, 58, 61, -1, -1, 61,
404 39, -1, 61, 60, -1, 61, 49, -1, 61, 1,
405 30, -1, 6, 71, 30, -1, 62, -1, 9, 71,
406 30, -1, 64, 68, -1, 12, 30, -1, 66, 13,
407 -1, -1, 68, 69, -1, 68, 30, -1, 16, 24,
408 75, 30, -1, 16, 75, 30, -1, 17, 75, 30,
409 -1, -1, 71, 74, -1, 25, -1, 26, -1, 5,
410 73, -1, 8, 73, -1, 15, 73, -1, 30, -1,
411 31, -1, -1, 14, 75, -1, 76, -1, 76, 34,
412 76, -1, 76, 27, 76, -1, 29, 75, 28, -1,
413 35, 75, -1, 75, 32, 75, -1, 75, 33, 75,
417 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
418 static const unsigned short int yyrline[] =
420 0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
421 102, 103, 107, 108, 109, 110, 111, 112, 118, 126,
422 132, 140, 150, 152, 153, 154, 155, 158, 166, 172,
423 182, 188, 196, 205, 211, 220, 221, 227, 229, 230,
424 231, 232, 235, 241, 252, 258, 268, 270, 275, 284,
425 293, 294, 300, 302, 303, 304, 309, 316, 322, 331,
426 332, 338, 340, 341, 342, 343, 346, 352, 359, 366,
427 373, 379, 386, 387, 388, 391, 396, 401, 409, 411,
428 416, 417, 420, 421, 422, 426, 426, 428, 429, 432,
429 433, 434, 435, 436, 437, 438, 441, 442
433 #if YYDEBUG || YYERROR_VERBOSE
434 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
435 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
436 static const char *const yytname[] =
438 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
439 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
440 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
441 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
442 "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
443 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_EOF", "T_OR", "T_AND",
444 "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block",
445 "config_entry_start", "config_stmt", "menuconfig_entry_start",
446 "menuconfig_stmt", "config_option_list", "config_option", "choice",
447 "choice_entry", "choice_end", "choice_stmt", "choice_option_list",
448 "choice_option", "choice_block", "if", "if_end", "if_stmt", "if_block",
449 "menu", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source",
450 "source_stmt", "comment", "comment_stmt", "help_start", "help",
451 "depends_list", "depends", "prompt_stmt_opt", "prompt", "end",
452 "nl_or_eof", "if_expr", "expr", "symbol", 0
457 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
459 static const unsigned short int yytoknum[] =
461 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
462 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
463 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
464 285, 286, 287, 288, 289, 290
468 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
469 static const unsigned char yyr1[] =
471 0, 36, 37, 37, 38, 38, 38, 38, 38, 38,
472 38, 38, 39, 39, 39, 39, 39, 39, 40, 41,
473 42, 43, 44, 44, 44, 44, 44, 45, 45, 45,
474 45, 45, 46, 47, 48, 49, 49, 50, 50, 50,
475 50, 50, 51, 51, 51, 51, 52, 52, 53, 54,
476 55, 55, 56, 56, 56, 56, 57, 58, 59, 60,
477 60, 61, 61, 61, 61, 61, 62, 63, 64, 65,
478 66, 67, 68, 68, 68, 69, 69, 69, 70, 70,
479 71, 71, 72, 72, 72, 73, 73, 74, 74, 75,
480 75, 75, 75, 75, 75, 75, 76, 76
483 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
484 static const unsigned char yyr2[] =
486 0, 2, 0, 2, 1, 1, 1, 3, 1, 1,
487 1, 2, 1, 1, 1, 1, 1, 1, 3, 2,
488 3, 2, 0, 2, 2, 2, 2, 3, 4, 4,
489 4, 5, 2, 2, 1, 3, 2, 0, 2, 2,
490 2, 2, 4, 3, 2, 4, 0, 2, 3, 1,
491 3, 2, 0, 2, 2, 2, 3, 2, 1, 3,
492 2, 0, 2, 2, 2, 3, 3, 1, 3, 2,
493 2, 2, 0, 2, 2, 4, 3, 3, 0, 2,
494 1, 1, 2, 2, 2, 1, 1, 0, 2, 1,
495 3, 3, 3, 2, 3, 3, 1, 1
498 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
499 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
500 means the default is an error. */
501 static const unsigned char yydefact[] =
503 2, 0, 1, 0, 0, 0, 8, 0, 0, 10,
504 0, 0, 0, 0, 9, 85, 86, 3, 4, 22,
505 14, 22, 15, 37, 46, 5, 52, 12, 72, 61,
506 6, 67, 16, 72, 13, 17, 11, 80, 81, 0,
507 0, 0, 32, 0, 0, 0, 96, 97, 0, 0,
508 0, 89, 19, 21, 33, 36, 51, 57, 0, 69,
509 7, 56, 66, 68, 18, 20, 0, 93, 48, 0,
510 0, 0, 0, 0, 0, 0, 0, 78, 0, 0,
511 0, 26, 23, 0, 25, 24, 0, 0, 78, 0,
512 41, 38, 40, 39, 0, 0, 0, 47, 35, 34,
513 53, 55, 50, 54, 49, 74, 73, 0, 62, 64,
514 59, 63, 58, 92, 94, 95, 91, 90, 70, 0,
515 0, 0, 87, 0, 87, 87, 87, 0, 71, 44,
516 87, 0, 87, 82, 83, 84, 65, 0, 76, 77,
517 0, 0, 27, 79, 0, 0, 87, 0, 43, 0,
518 75, 88, 28, 29, 30, 0, 42, 45, 31
521 /* YYDEFGOTO[NTERM-NUM]. */
522 static const short int yydefgoto[] =
524 -1, 1, 17, 18, 19, 20, 21, 22, 52, 82,
525 23, 24, 98, 25, 54, 91, 55, 26, 102, 27,
526 56, 28, 29, 110, 30, 58, 31, 32, 33, 34,
527 83, 84, 57, 85, 123, 124, 99, 35, 141, 50,
531 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
533 #define YYPACT_NINF -113
534 static const short int yypact[] =
536 -113, 37, -113, 114, 136, 136, -113, 136, -29, -113,
537 136, -19, -14, -10, -113, -113, -113, -113, -113, -113,
538 -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
539 -113, -113, -113, -113, -113, -113, -113, -113, -113, 114,
540 9, 25, -113, 56, 60, 65, -113, -113, -10, -10,
541 33, -1, 108, 108, 41, 103, 92, 5, 74, 5,
542 -113, -113, -113, -113, -113, -113, 115, -113, -113, -10,
543 -10, 138, 138, 80, 111, -10, 136, 136, -10, 2,
544 138, -113, -113, 113, -113, -113, 85, 136, 136, 107,
545 -113, -113, -113, -113, 114, 114, 114, -113, -113, -113,
546 -113, -113, -113, -113, -113, -113, -113, 120, -113, -113,
547 -113, -113, -113, -113, 121, -113, -113, -113, -113, -10,
548 109, 119, 16, 137, 16, 17, 16, 138, -113, -113,
549 16, 139, 16, -113, -113, -113, -113, 123, -113, -113,
550 -10, 140, -113, -113, 141, 142, 16, 143, -113, 144,
551 -113, 133, -113, -113, -113, 145, -113, -113, -113
554 /* YYPGOTO[NTERM-NUM]. */
555 static const short int yypgoto[] =
557 -113, -113, -113, 14, -113, -113, -113, -113, 147, -113,
558 -113, -113, -113, -2, -113, -113, -113, -113, -113, -113,
559 -113, -113, -113, -113, 101, -113, -113, -113, -113, -113,
560 -113, 122, 146, 62, 89, 0, 102, -3, -112, -46,
564 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
565 positive, shift that token. If negative, reduce the rule which
566 number is the opposite. If zero, do what YYDEFACT says.
567 If YYTABLE_NINF, syntax error. */
568 #define YYTABLE_NINF -61
569 static const short int yytable[] =
571 36, 42, 66, 67, 39, 40, 44, 41, 116, 117,
572 43, 45, 143, 144, 145, 46, 47, 127, 147, 48,
573 149, 74, 75, 114, 115, 49, 71, 126, 120, 121,
574 140, 140, 125, 72, 155, 105, 60, 2, 3, 61,
575 4, 5, 6, 7, 8, 9, 10, 11, 12, 69,
576 70, 13, 14, 73, 101, 62, 109, 74, 75, 86,
577 87, 88, 89, 68, 146, 69, 70, 15, 16, 97,
578 100, 90, 108, 137, -60, 107, 122, -60, 5, 94,
579 7, 8, 95, 10, 11, 12, 63, 130, 13, 96,
580 64, 133, 134, 135, 151, 65, 5, 94, 7, 8,
581 95, 10, 11, 12, 15, 16, 13, 96, 94, 7,
582 118, 95, 10, 11, 12, 129, 93, 13, 96, 106,
583 73, 106, 15, 16, 74, 75, 128, 76, 77, 78,
584 79, 80, 132, 15, 16, 119, 46, 47, 81, 138,
585 48, 69, 70, 113, 15, 16, 49, 69, 70, 139,
586 136, 69, 70, 150, 70, 69, 70, 103, 104, 111,
587 112, 37, 38, 46, 47, 69, 70, 142, 53, 148,
588 152, 153, 154, 156, 157, 158, 92, 131, 0, 59
591 static const short int yycheck[] =
593 3, 30, 48, 49, 4, 5, 25, 7, 71, 72,
594 10, 25, 124, 125, 126, 25, 26, 80, 130, 29,
595 132, 16, 17, 69, 70, 35, 27, 25, 74, 75,
596 14, 14, 78, 34, 146, 30, 39, 0, 1, 30,
597 3, 4, 5, 6, 7, 8, 9, 10, 11, 32,
598 33, 14, 15, 12, 56, 30, 58, 16, 17, 18,
599 19, 20, 21, 30, 127, 32, 33, 30, 31, 55,
600 56, 30, 58, 119, 0, 1, 76, 3, 4, 5,
601 6, 7, 8, 9, 10, 11, 30, 87, 14, 15,
602 30, 94, 95, 96, 140, 30, 4, 5, 6, 7,
603 8, 9, 10, 11, 30, 31, 14, 15, 5, 6,
604 30, 8, 9, 10, 11, 30, 54, 14, 15, 57,
605 12, 59, 30, 31, 16, 17, 13, 19, 20, 21,
606 22, 23, 25, 30, 31, 24, 25, 26, 30, 30,
607 29, 32, 33, 28, 30, 31, 35, 32, 33, 30,
608 30, 32, 33, 30, 33, 32, 33, 56, 56, 58,
609 58, 25, 26, 25, 26, 32, 33, 30, 21, 30,
610 30, 30, 30, 30, 30, 30, 54, 88, -1, 33
613 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
614 symbol of state STATE-NUM. */
615 static const unsigned char yystos[] =
617 0, 37, 0, 1, 3, 4, 5, 6, 7, 8,
618 9, 10, 11, 14, 15, 30, 31, 38, 39, 40,
619 41, 42, 43, 46, 47, 49, 53, 55, 57, 58,
620 60, 62, 63, 64, 65, 73, 73, 25, 26, 71,
621 71, 71, 30, 71, 25, 25, 25, 26, 29, 35,
622 75, 76, 44, 44, 50, 52, 56, 68, 61, 68,
623 73, 30, 30, 30, 30, 30, 75, 75, 30, 32,
624 33, 27, 34, 12, 16, 17, 19, 20, 21, 22,
625 23, 30, 45, 66, 67, 69, 18, 19, 20, 21,
626 30, 51, 67, 69, 5, 8, 15, 39, 48, 72,
627 39, 49, 54, 60, 72, 30, 69, 1, 39, 49,
628 59, 60, 72, 28, 75, 75, 76, 76, 30, 24,
629 75, 75, 71, 70, 71, 75, 25, 76, 13, 30,
630 71, 70, 25, 73, 73, 73, 30, 75, 30, 30,
631 14, 74, 30, 74, 74, 74, 76, 74, 30, 74,
632 30, 75, 30, 30, 30, 74, 30, 30, 30
635 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
636 # define YYSIZE_T __SIZE_TYPE__
638 #if ! defined (YYSIZE_T) && defined (size_t)
639 # define YYSIZE_T size_t
641 #if ! defined (YYSIZE_T)
642 # if defined (__STDC__) || defined (__cplusplus)
643 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
644 # define YYSIZE_T size_t
647 #if ! defined (YYSIZE_T)
648 # define YYSIZE_T unsigned int
651 #define yyerrok (yyerrstatus = 0)
652 #define yyclearin (yychar = YYEMPTY)
656 #define YYACCEPT goto yyacceptlab
657 #define YYABORT goto yyabortlab
658 #define YYERROR goto yyerrorlab
661 /* Like YYERROR except do call yyerror. This remains here temporarily
662 to ease the transition to the new meaning of YYERROR, for GCC.
663 Once GCC version 2 has supplanted version 1, this can go. */
665 #define YYFAIL goto yyerrlab
667 #define YYRECOVERING() (!!yyerrstatus)
669 #define YYBACKUP(Token, Value) \
671 if (yychar == YYEMPTY && yylen == 1) \
675 yytoken = YYTRANSLATE (yychar); \
681 yyerror ("syntax error: cannot back up");\
688 #define YYERRCODE 256
691 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
692 If N is 0, then set CURRENT to the empty location which ends
693 the previous symbol: RHS[0] (always defined). */
695 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
696 #ifndef YYLLOC_DEFAULT
697 # define YYLLOC_DEFAULT(Current, Rhs, N) \
701 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
702 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
703 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
704 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
708 (Current).first_line = (Current).last_line = \
709 YYRHSLOC (Rhs, 0).last_line; \
710 (Current).first_column = (Current).last_column = \
711 YYRHSLOC (Rhs, 0).last_column; \
717 /* YY_LOCATION_PRINT -- Print the location on the stream.
718 This macro was not mandated originally: define only if we know
719 we won't break user code: when these are the locations we know. */
721 #ifndef YY_LOCATION_PRINT
722 # if YYLTYPE_IS_TRIVIAL
723 # define YY_LOCATION_PRINT(File, Loc) \
724 fprintf (File, "%d.%d-%d.%d", \
725 (Loc).first_line, (Loc).first_column, \
726 (Loc).last_line, (Loc).last_column)
728 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
733 /* YYLEX -- calling `yylex' with the right arguments. */
736 # define YYLEX yylex (YYLEX_PARAM)
738 # define YYLEX yylex ()
741 /* Enable debugging if requested. */
745 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
746 # define YYFPRINTF fprintf
749 # define YYDPRINTF(Args) \
755 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
759 YYFPRINTF (stderr, "%s ", Title); \
760 yysymprint (stderr, \
762 YYFPRINTF (stderr, "\n"); \
766 /*------------------------------------------------------------------.
767 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
769 `------------------------------------------------------------------*/
771 #if defined (__STDC__) || defined (__cplusplus)
773 yy_stack_print (short int *bottom, short int *top)
776 yy_stack_print (bottom, top)
781 YYFPRINTF (stderr, "Stack now");
782 for (/* Nothing. */; bottom <= top; ++bottom)
783 YYFPRINTF (stderr, " %d", *bottom);
784 YYFPRINTF (stderr, "\n");
787 # define YY_STACK_PRINT(Bottom, Top) \
790 yy_stack_print ((Bottom), (Top)); \
794 /*------------------------------------------------.
795 | Report that the YYRULE is going to be reduced. |
796 `------------------------------------------------*/
798 #if defined (__STDC__) || defined (__cplusplus)
800 yy_reduce_print (int yyrule)
803 yy_reduce_print (yyrule)
808 unsigned int yylno = yyrline[yyrule];
809 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
811 /* Print the symbols being reduced, and their result. */
812 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
813 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
814 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
817 # define YY_REDUCE_PRINT(Rule) \
820 yy_reduce_print (Rule); \
823 /* Nonzero means print parse trace. It is left uninitialized so that
824 multiple parsers can coexist. */
827 # define YYDPRINTF(Args)
828 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
829 # define YY_STACK_PRINT(Bottom, Top)
830 # define YY_REDUCE_PRINT(Rule)
831 #endif /* !YYDEBUG */
834 /* YYINITDEPTH -- initial size of the parser's stacks. */
836 # define YYINITDEPTH 200
839 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
840 if the built-in stack extension method is used).
842 Do not make this value too large; the results are undefined if
843 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
844 evaluated with infinite-precision integer arithmetic. */
847 # define YYMAXDEPTH 10000
855 # if defined (__GLIBC__) && defined (_STRING_H)
856 # define yystrlen strlen
858 /* Return the length of YYSTR. */
860 # if defined (__STDC__) || defined (__cplusplus)
861 yystrlen (const char *yystr)
867 register const char *yys = yystr;
869 while (*yys++ != '\0')
872 return yys - yystr - 1;
878 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
879 # define yystpcpy stpcpy
881 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
884 # if defined (__STDC__) || defined (__cplusplus)
885 yystpcpy (char *yydest, const char *yysrc)
887 yystpcpy (yydest, yysrc)
892 register char *yyd = yydest;
893 register const char *yys = yysrc;
895 while ((*yyd++ = *yys++) != '\0')
903 #endif /* !YYERROR_VERBOSE */
908 /*--------------------------------.
909 | Print this symbol on YYOUTPUT. |
910 `--------------------------------*/
912 #if defined (__STDC__) || defined (__cplusplus)
914 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
917 yysymprint (yyoutput, yytype, yyvaluep)
923 /* Pacify ``unused variable'' warnings. */
926 if (yytype < YYNTOKENS)
927 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
929 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
933 if (yytype < YYNTOKENS)
934 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
941 YYFPRINTF (yyoutput, ")");
944 #endif /* ! YYDEBUG */
945 /*-----------------------------------------------.
946 | Release the memory associated to this symbol. |
947 `-----------------------------------------------*/
949 #if defined (__STDC__) || defined (__cplusplus)
951 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
954 yydestruct (yymsg, yytype, yyvaluep)
960 /* Pacify ``unused variable'' warnings. */
965 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
976 /* Prevent warnings from -Wmissing-prototypes. */
979 # if defined (__STDC__) || defined (__cplusplus)
980 int yyparse (void *YYPARSE_PARAM);
984 #else /* ! YYPARSE_PARAM */
985 #if defined (__STDC__) || defined (__cplusplus)
990 #endif /* ! YYPARSE_PARAM */
994 /* The look-ahead symbol. */
997 /* The semantic value of the look-ahead symbol. */
1000 /* Number of syntax errors so far. */
1009 #ifdef YYPARSE_PARAM
1010 # if defined (__STDC__) || defined (__cplusplus)
1011 int yyparse (void *YYPARSE_PARAM)
1013 int yyparse (YYPARSE_PARAM)
1014 void *YYPARSE_PARAM;
1016 #else /* ! YYPARSE_PARAM */
1017 #if defined (__STDC__) || defined (__cplusplus)
1028 register int yystate;
1031 /* Number of tokens to shift before error messages enabled. */
1033 /* Look-ahead token as an internal (translated) token number. */
1036 /* Three stacks and their tools:
1037 `yyss': related to states,
1038 `yyvs': related to semantic values,
1039 `yyls': related to locations.
1041 Refer to the stacks thru separate pointers, to allow yyoverflow
1042 to reallocate them elsewhere. */
1044 /* The state stack. */
1045 short int yyssa[YYINITDEPTH];
1046 short int *yyss = yyssa;
1047 register short int *yyssp;
1049 /* The semantic value stack. */
1050 YYSTYPE yyvsa[YYINITDEPTH];
1051 YYSTYPE *yyvs = yyvsa;
1052 register YYSTYPE *yyvsp;
1056 #define YYPOPSTACK (yyvsp--, yyssp--)
1058 YYSIZE_T yystacksize = YYINITDEPTH;
1060 /* The variables used to return semantic value and location from the
1065 /* When reducing, the number of symbols on the RHS of the reduced
1069 YYDPRINTF ((stderr, "Starting parse\n"));
1074 yychar = YYEMPTY; /* Cause a token to be read. */
1076 /* Initialize stack pointers.
1077 Waste one element of value and location stack
1078 so that they stay on the same level as the state stack.
1079 The wasted elements are never initialized. */
1089 /*------------------------------------------------------------.
1090 | yynewstate -- Push a new state, which is found in yystate. |
1091 `------------------------------------------------------------*/
1093 /* In all cases, when you get here, the value and location stacks
1094 have just been pushed. so pushing a state here evens the stacks.
1101 if (yyss + yystacksize - 1 <= yyssp)
1103 /* Get the current used size of the three stacks, in elements. */
1104 YYSIZE_T yysize = yyssp - yyss + 1;
1108 /* Give user a chance to reallocate the stack. Use copies of
1109 these so that the &'s don't force the real ones into
1111 YYSTYPE *yyvs1 = yyvs;
1112 short int *yyss1 = yyss;
1115 /* Each stack pointer address is followed by the size of the
1116 data in use in that stack, in bytes. This used to be a
1117 conditional around just the two extra args, but that might
1118 be undefined if yyoverflow is a macro. */
1119 yyoverflow ("parser stack overflow",
1120 &yyss1, yysize * sizeof (*yyssp),
1121 &yyvs1, yysize * sizeof (*yyvsp),
1128 #else /* no yyoverflow */
1129 # ifndef YYSTACK_RELOCATE
1132 /* Extend the stack our own way. */
1133 if (YYMAXDEPTH <= yystacksize)
1136 if (YYMAXDEPTH < yystacksize)
1137 yystacksize = YYMAXDEPTH;
1140 short int *yyss1 = yyss;
1141 union yyalloc *yyptr =
1142 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1145 YYSTACK_RELOCATE (yyss);
1146 YYSTACK_RELOCATE (yyvs);
1148 # undef YYSTACK_RELOCATE
1150 YYSTACK_FREE (yyss1);
1153 #endif /* no yyoverflow */
1155 yyssp = yyss + yysize - 1;
1156 yyvsp = yyvs + yysize - 1;
1159 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1160 (unsigned long int) yystacksize));
1162 if (yyss + yystacksize - 1 <= yyssp)
1166 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1175 /* Do appropriate processing given the current state. */
1176 /* Read a look-ahead token if we need one and don't already have one. */
1179 /* First try to decide what to do without reference to look-ahead token. */
1181 yyn = yypact[yystate];
1182 if (yyn == YYPACT_NINF)
1185 /* Not known => get a look-ahead token if don't already have one. */
1187 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1188 if (yychar == YYEMPTY)
1190 YYDPRINTF ((stderr, "Reading a token: "));
1194 if (yychar <= YYEOF)
1196 yychar = yytoken = YYEOF;
1197 YYDPRINTF ((stderr, "Now at end of input.\n"));
1201 yytoken = YYTRANSLATE (yychar);
1202 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1205 /* If the proper action on seeing token YYTOKEN is to reduce or to
1206 detect an error, take that action. */
1208 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1213 if (yyn == 0 || yyn == YYTABLE_NINF)
1222 /* Shift the look-ahead token. */
1223 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1225 /* Discard the token being shifted unless it is eof. */
1226 if (yychar != YYEOF)
1232 /* Count tokens shifted since error; after three, turn off error
1241 /*-----------------------------------------------------------.
1242 | yydefault -- do the default action for the current state. |
1243 `-----------------------------------------------------------*/
1245 yyn = yydefact[yystate];
1251 /*-----------------------------.
1252 | yyreduce -- Do a reduction. |
1253 `-----------------------------*/
1255 /* yyn is the number of a rule to reduce with. */
1258 /* If YYLEN is nonzero, implement the default value of the action:
1261 Otherwise, the following line sets YYVAL to garbage.
1262 This behavior is undocumented and Bison
1263 users should not rely upon it. Assigning to YYVAL
1264 unconditionally makes the parser a bit smaller, and it avoids a
1265 GCC warning that YYVAL may be used uninitialized. */
1266 yyval = yyvsp[1-yylen];
1269 YY_REDUCE_PRINT (yyn);
1274 { zconfprint("unexpected 'endmenu' statement"); ;}
1279 { zconfprint("unexpected 'endif' statement"); ;}
1284 { zconfprint("unexpected 'endchoice' statement"); ;}
1289 { zconfprint("syntax error"); yyerrok; ;}
1295 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1296 sym->flags |= SYMBOL_OPTIONAL;
1297 menu_add_entry(sym);
1298 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1306 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1313 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1314 sym->flags |= SYMBOL_OPTIONAL;
1315 menu_add_entry(sym);
1316 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1323 if (current_entry->prompt)
1324 current_entry->prompt->type = P_MENU;
1326 zconfprint("warning: menuconfig statement without prompt");
1328 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1335 menu_set_type((yyvsp[-2].id)->stype);
1336 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1337 zconf_curname(), zconf_lineno(),
1338 (yyvsp[-2].id)->stype);
1345 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1346 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1353 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1354 if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1355 menu_set_type((yyvsp[-3].id)->stype);
1356 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1357 zconf_curname(), zconf_lineno(),
1358 (yyvsp[-3].id)->stype);
1365 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1366 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1373 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1374 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1381 struct symbol *sym = sym_lookup(NULL, 0);
1382 sym->flags |= SYMBOL_CHOICE;
1383 menu_add_entry(sym);
1384 menu_add_expr(P_CHOICE, NULL, NULL);
1385 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1400 if (zconf_endtoken((yyvsp[0].token), T_CHOICE, T_ENDCHOICE)) {
1402 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1410 printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
1418 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1419 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1426 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1427 menu_set_type((yyvsp[-2].id)->stype);
1428 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1429 zconf_curname(), zconf_lineno(),
1430 (yyvsp[-2].id)->stype);
1439 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1440 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1447 if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1448 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1449 printd(DEBUG_PARSE, "%s:%d:default\n",
1450 zconf_curname(), zconf_lineno());
1459 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1460 menu_add_entry(NULL);
1461 menu_add_dep((yyvsp[-1].expr));
1470 if (zconf_endtoken((yyvsp[0].token), T_IF, T_ENDIF)) {
1472 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1480 printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
1488 menu_add_entry(NULL);
1489 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1490 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1505 if (zconf_endtoken((yyvsp[0].token), T_MENU, T_ENDMENU)) {
1507 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1515 printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
1522 { zconfprint("invalid menu option"); yyerrok; ;}
1528 (yyval.string) = (yyvsp[-1].string);
1529 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1536 zconf_nextfile((yyvsp[0].string));
1543 menu_add_entry(NULL);
1544 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1545 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1559 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1567 current_entry->sym->help = (yyvsp[0].string);
1574 menu_add_dep((yyvsp[-1].expr));
1575 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1582 menu_add_dep((yyvsp[-1].expr));
1583 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1590 menu_add_dep((yyvsp[-1].expr));
1591 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1598 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1604 { (yyval.token) = T_ENDMENU; ;}
1609 { (yyval.token) = T_ENDCHOICE; ;}
1614 { (yyval.token) = T_ENDIF; ;}
1619 { (yyval.expr) = NULL; ;}
1624 { (yyval.expr) = (yyvsp[0].expr); ;}
1629 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1634 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1639 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1644 { (yyval.expr) = (yyvsp[-1].expr); ;}
1649 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1654 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1659 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1664 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1669 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1675 /* Line 1037 of yacc.c. */
1682 YY_STACK_PRINT (yyss, yyssp);
1687 /* Now `shift' the result of the reduction. Determine what state
1688 that goes to, based on the state we popped back to and the rule
1689 number reduced by. */
1693 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1694 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1695 yystate = yytable[yystate];
1697 yystate = yydefgoto[yyn - YYNTOKENS];
1702 /*------------------------------------.
1703 | yyerrlab -- here on detecting error |
1704 `------------------------------------*/
1706 /* If not already recovering from an error, report this error. */
1711 yyn = yypact[yystate];
1713 if (YYPACT_NINF < yyn && yyn < YYLAST)
1715 YYSIZE_T yysize = 0;
1716 int yytype = YYTRANSLATE (yychar);
1717 const char* yyprefix;
1721 /* Start YYX at -YYN if negative to avoid negative indexes in
1723 int yyxbegin = yyn < 0 ? -yyn : 0;
1725 /* Stay within bounds of both yycheck and yytname. */
1726 int yychecklim = YYLAST - yyn;
1727 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1730 yyprefix = ", expecting ";
1731 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1732 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1734 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1742 yysize += (sizeof ("syntax error, unexpected ")
1743 + yystrlen (yytname[yytype]));
1744 yymsg = (char *) YYSTACK_ALLOC (yysize);
1747 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1748 yyp = yystpcpy (yyp, yytname[yytype]);
1752 yyprefix = ", expecting ";
1753 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1754 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1756 yyp = yystpcpy (yyp, yyprefix);
1757 yyp = yystpcpy (yyp, yytname[yyx]);
1762 YYSTACK_FREE (yymsg);
1765 yyerror ("syntax error; also virtual memory exhausted");
1768 #endif /* YYERROR_VERBOSE */
1769 yyerror ("syntax error");
1774 if (yyerrstatus == 3)
1776 /* If just tried and failed to reuse look-ahead token after an
1777 error, discard it. */
1779 if (yychar <= YYEOF)
1781 /* If at end of input, pop the error token,
1782 then the rest of the stack, then return failure. */
1783 if (yychar == YYEOF)
1790 yydestruct ("Error: popping",
1791 yystos[*yyssp], yyvsp);
1796 yydestruct ("Error: discarding", yytoken, &yylval);
1801 /* Else will try to reuse look-ahead token after shifting the error
1806 /*---------------------------------------------------.
1807 | yyerrorlab -- error raised explicitly by YYERROR. |
1808 `---------------------------------------------------*/
1812 /* Pacify GCC when the user code never invokes YYERROR and the label
1813 yyerrorlab therefore never appears in user code. */
1824 /*-------------------------------------------------------------.
1825 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1826 `-------------------------------------------------------------*/
1828 yyerrstatus = 3; /* Each real token shifted decrements this. */
1832 yyn = yypact[yystate];
1833 if (yyn != YYPACT_NINF)
1836 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1844 /* Pop the current state because it cannot handle the error token. */
1849 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1852 YY_STACK_PRINT (yyss, yyssp);
1861 /* Shift the error token. */
1862 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1868 /*-------------------------------------.
1869 | yyacceptlab -- YYACCEPT comes here. |
1870 `-------------------------------------*/
1875 /*-----------------------------------.
1876 | yyabortlab -- YYABORT comes here. |
1877 `-----------------------------------*/
1879 yydestruct ("Error: discarding lookahead",
1886 /*----------------------------------------------.
1887 | yyoverflowlab -- parser overflow comes here. |
1888 `----------------------------------------------*/
1890 yyerror ("parser stack overflow");
1898 YYSTACK_FREE (yyss);
1907 void conf_parse(const char *name)
1912 zconf_initscan(name);
1916 modules_sym = sym_lookup("MODULES", 0);
1917 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
1923 menu_finalize(&rootmenu);
1924 for_all_symbols(i, sym) {
1925 sym_check_deps(sym);
1928 sym_change_count = 1;
1931 const char *zconf_tokenname(int token)
1934 case T_MENU: return "menu";
1935 case T_ENDMENU: return "endmenu";
1936 case T_CHOICE: return "choice";
1937 case T_ENDCHOICE: return "endchoice";
1938 case T_IF: return "if";
1939 case T_ENDIF: return "endif";
1944 static bool zconf_endtoken(int token, int starttoken, int endtoken)
1946 if (token != endtoken) {
1947 zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken));
1951 if (current_menu->file != current_file) {
1952 zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken));
1953 zconfprint("location of the '%s'", zconf_tokenname(starttoken));
1960 static void zconfprint(const char *err, ...)
1964 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1);
1966 vfprintf(stderr, err, ap);
1968 fprintf(stderr, "\n");
1971 static void zconferror(const char *err)
1973 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
1976 void print_quoted_string(FILE *out, const char *str)
1982 while ((p = strchr(str, '"'))) {
1985 fprintf(out, "%.*s", len, str);
1993 void print_symbol(FILE *out, struct menu *menu)
1995 struct symbol *sym = menu->sym;
1996 struct property *prop;
1998 if (sym_is_choice(sym))
1999 fprintf(out, "choice\n");
2001 fprintf(out, "config %s\n", sym->name);
2002 switch (sym->type) {
2004 fputs(" boolean\n", out);
2007 fputs(" tristate\n", out);
2010 fputs(" string\n", out);
2013 fputs(" integer\n", out);
2016 fputs(" hex\n", out);
2019 fputs(" ???\n", out);
2022 for (prop = sym->prop; prop; prop = prop->next) {
2023 if (prop->menu != menu)
2025 switch (prop->type) {
2027 fputs(" prompt ", out);
2028 print_quoted_string(out, prop->text);
2029 if (!expr_is_yes(prop->visible.expr)) {
2031 expr_fprint(prop->visible.expr, out);
2036 fputs( " default ", out);
2037 expr_fprint(prop->expr, out);
2038 if (!expr_is_yes(prop->visible.expr)) {
2040 expr_fprint(prop->visible.expr, out);
2045 fputs(" #choice value\n", out);
2048 fprintf(out, " unknown prop %d!\n", prop->type);
2053 int len = strlen(sym->help);
2054 while (sym->help[--len] == '\n')
2056 fprintf(out, " help\n%s\n", sym->help);
2061 void zconfdump(FILE *out)
2063 struct property *prop;
2067 menu = rootmenu.list;
2069 if ((sym = menu->sym))
2070 print_symbol(out, menu);
2071 else if ((prop = menu->prompt)) {
2072 switch (prop->type) {
2074 fputs("\ncomment ", out);
2075 print_quoted_string(out, prop->text);
2079 fputs("\nmenu ", out);
2080 print_quoted_string(out, prop->text);
2086 if (!expr_is_yes(prop->visible.expr)) {
2087 fputs(" depends ", out);
2088 expr_fprint(prop->visible.expr, out);
2096 else if (menu->next)
2098 else while ((menu = menu->parent)) {
2099 if (menu->prompt && menu->prompt->type == P_MENU)
2100 fputs("\nendmenu\n", out);
2109 #include "lex.zconf.c"
2111 #include "confdata.c"