1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse zconfparse
63 #define yylex zconflex
64 #define yyerror zconferror
65 #define yylval zconflval
66 #define yychar zconfchar
67 #define yydebug zconfdebug
68 #define yynerrs zconfnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
112 #define T_MAINMENU 258
114 #define T_ENDMENU 260
117 #define T_ENDCHOICE 263
118 #define T_COMMENT 264
120 #define T_MENUCONFIG 266
122 #define T_HELPTEXT 268
125 #define T_DEPENDS 271
126 #define T_OPTIONAL 272
129 #define T_DEFAULT 275
135 #define T_WORD_QUOTE 281
136 #define T_UNEQUAL 282
137 #define T_CLOSE_PAREN 283
138 #define T_OPEN_PAREN 284
148 /* Copy the first part of user declarations. */
152 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
153 * Released under the terms of the GNU GPL v2.0.
162 #define LKC_DIRECT_LINK
165 #include "zconf.hash.c"
167 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
169 #define PRINTD 0x0001
170 #define DEBUG_PARSE 0x0002
174 extern int zconflex(void);
175 static void zconfprint(const char *err, ...);
176 static void zconf_error(const char *err, ...);
177 static void zconferror(const char *err);
178 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
180 struct symbol *symbol_hash[257];
182 static struct menu *current_menu, *current_entry;
186 #define YYERROR_VERBOSE
190 /* Enabling traces. */
195 /* Enabling verbose error messages. */
196 #ifdef YYERROR_VERBOSE
197 # undef YYERROR_VERBOSE
198 # define YYERROR_VERBOSE 1
200 # define YYERROR_VERBOSE 0
203 /* Enabling the token table. */
204 #ifndef YYTOKEN_TABLE
205 # define YYTOKEN_TABLE 0
208 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
209 typedef union YYSTYPE
214 struct symbol *symbol;
219 /* Line 187 of yacc.c. */
222 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
223 # define YYSTYPE_IS_DECLARED 1
224 # define YYSTYPE_IS_TRIVIAL 1
229 /* Copy the second part of user declarations. */
232 /* Line 216 of yacc.c. */
240 typedef YYTYPE_UINT8 yytype_uint8;
242 typedef unsigned char yytype_uint8;
246 typedef YYTYPE_INT8 yytype_int8;
247 #elif (defined __STDC__ || defined __C99__FUNC__ \
248 || defined __cplusplus || defined _MSC_VER)
249 typedef signed char yytype_int8;
251 typedef short int yytype_int8;
255 typedef YYTYPE_UINT16 yytype_uint16;
257 typedef unsigned short int yytype_uint16;
261 typedef YYTYPE_INT16 yytype_int16;
263 typedef short int yytype_int16;
267 # ifdef __SIZE_TYPE__
268 # define YYSIZE_T __SIZE_TYPE__
269 # elif defined size_t
270 # define YYSIZE_T size_t
271 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
272 || defined __cplusplus || defined _MSC_VER)
273 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
274 # define YYSIZE_T size_t
276 # define YYSIZE_T unsigned int
280 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
285 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
286 # define YY_(msgid) dgettext ("bison-runtime", msgid)
290 # define YY_(msgid) msgid
294 /* Suppress unused-variable warnings by "using" E. */
295 #if ! defined lint || defined __GNUC__
296 # define YYUSE(e) ((void) (e))
298 # define YYUSE(e) /* empty */
301 /* Identity function, used to suppress warnings about constant conditions. */
305 #if (defined __STDC__ || defined __C99__FUNC__ \
306 || defined __cplusplus || defined _MSC_VER)
319 #if ! defined yyoverflow || YYERROR_VERBOSE
321 /* The parser invokes alloca or malloc; define the necessary symbols. */
323 # ifdef YYSTACK_USE_ALLOCA
324 # if YYSTACK_USE_ALLOCA
326 # define YYSTACK_ALLOC __builtin_alloca
327 # elif defined __BUILTIN_VA_ARG_INCR
328 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
330 # define YYSTACK_ALLOC __alloca
331 # elif defined _MSC_VER
332 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
333 # define alloca _alloca
335 # define YYSTACK_ALLOC alloca
336 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
337 || defined __cplusplus || defined _MSC_VER)
338 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
347 # ifdef YYSTACK_ALLOC
348 /* Pacify GCC's `empty if-body' warning. */
349 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
350 # ifndef YYSTACK_ALLOC_MAXIMUM
351 /* The OS might guarantee only one guard page at the bottom of the stack,
352 and a page size can be as small as 4096 bytes. So we cannot safely
353 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
354 to allow for a few compiler-allocated temporary stack slots. */
355 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
358 # define YYSTACK_ALLOC YYMALLOC
359 # define YYSTACK_FREE YYFREE
360 # ifndef YYSTACK_ALLOC_MAXIMUM
361 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
363 # if (defined __cplusplus && ! defined _STDLIB_H \
364 && ! ((defined YYMALLOC || defined malloc) \
365 && (defined YYFREE || defined free)))
366 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
372 # define YYMALLOC malloc
373 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
374 || defined __cplusplus || defined _MSC_VER)
375 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
380 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
381 || defined __cplusplus || defined _MSC_VER)
382 void free (void *); /* INFRINGES ON USER NAME SPACE */
386 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
389 #if (! defined yyoverflow \
390 && (! defined __cplusplus \
391 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
393 /* A type that is properly aligned for any stack member. */
400 /* The size of the maximum gap between one aligned stack and the next. */
401 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
403 /* The size of an array large to enough to hold all stacks, each with
405 # define YYSTACK_BYTES(N) \
406 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
407 + YYSTACK_GAP_MAXIMUM)
409 /* Copy COUNT objects from FROM to TO. The source and destination do
412 # if defined __GNUC__ && 1 < __GNUC__
413 # define YYCOPY(To, From, Count) \
414 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
416 # define YYCOPY(To, From, Count) \
420 for (yyi = 0; yyi < (Count); yyi++) \
421 (To)[yyi] = (From)[yyi]; \
427 /* Relocate STACK from its old location to the new one. The
428 local variables YYSIZE and YYSTACKSIZE give the old and new number of
429 elements in the stack, and YYPTR gives the new location of the
430 stack. Advance YYPTR to a properly aligned location for the next
432 # define YYSTACK_RELOCATE(Stack) \
435 YYSIZE_T yynewbytes; \
436 YYCOPY (&yyptr->Stack, Stack, yysize); \
437 Stack = &yyptr->Stack; \
438 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
439 yyptr += yynewbytes / sizeof (*yyptr); \
445 /* YYFINAL -- State number of the termination state. */
447 /* YYLAST -- Last index in YYTABLE. */
450 /* YYNTOKENS -- Number of terminals. */
452 /* YYNNTS -- Number of nonterminals. */
454 /* YYNRULES -- Number of rules. */
456 /* YYNRULES -- Number of states. */
457 #define YYNSTATES 178
459 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
461 #define YYMAXUTOK 289
463 #define YYTRANSLATE(YYX) \
464 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
466 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
467 static const yytype_uint8 yytranslate[] =
469 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
495 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
496 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
497 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
501 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
503 static const yytype_uint16 yyprhs[] =
505 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
506 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
507 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
508 81, 84, 85, 88, 91, 94, 97, 100, 103, 107,
509 112, 117, 122, 128, 132, 133, 137, 138, 141, 144,
510 147, 149, 153, 154, 157, 160, 163, 166, 169, 174,
511 178, 181, 186, 187, 190, 194, 196, 200, 201, 204,
512 207, 210, 214, 217, 219, 223, 224, 227, 230, 233,
513 237, 241, 244, 247, 250, 251, 254, 257, 260, 265,
514 266, 269, 271, 273, 276, 279, 282, 284, 287, 288,
515 291, 293, 297, 301, 305, 308, 312, 316, 318
518 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
519 static const yytype_int8 yyrhs[] =
521 36, 0, -1, 37, -1, -1, 37, 39, -1, 37,
522 53, -1, 37, 64, -1, 37, 3, 74, 76, -1,
523 37, 75, -1, 37, 25, 1, 30, -1, 37, 38,
524 1, 30, -1, 37, 1, 30, -1, 16, -1, 18,
525 -1, 19, -1, 21, -1, 17, -1, 22, -1, 20,
526 -1, 30, -1, 59, -1, 68, -1, 42, -1, 44,
527 -1, 66, -1, 25, 1, 30, -1, 1, 30, -1,
528 10, 25, 30, -1, 41, 45, -1, 11, 25, 30,
529 -1, 43, 45, -1, -1, 45, 46, -1, 45, 47,
530 -1, 45, 72, -1, 45, 70, -1, 45, 40, -1,
531 45, 30, -1, 19, 73, 30, -1, 18, 74, 77,
532 30, -1, 20, 78, 77, 30, -1, 21, 25, 77,
533 30, -1, 22, 79, 79, 77, 30, -1, 23, 48,
534 30, -1, -1, 48, 25, 49, -1, -1, 33, 74,
535 -1, 7, 30, -1, 50, 54, -1, 75, -1, 51,
536 56, 52, -1, -1, 54, 55, -1, 54, 72, -1,
537 54, 70, -1, 54, 30, -1, 54, 40, -1, 18,
538 74, 77, 30, -1, 19, 73, 30, -1, 17, 30,
539 -1, 20, 25, 77, 30, -1, -1, 56, 39, -1,
540 14, 78, 76, -1, 75, -1, 57, 60, 58, -1,
541 -1, 60, 39, -1, 60, 64, -1, 60, 53, -1,
542 4, 74, 30, -1, 61, 71, -1, 75, -1, 62,
543 65, 63, -1, -1, 65, 39, -1, 65, 64, -1,
544 65, 53, -1, 6, 74, 30, -1, 9, 74, 30,
545 -1, 67, 71, -1, 12, 30, -1, 69, 13, -1,
546 -1, 71, 72, -1, 71, 30, -1, 71, 40, -1,
547 16, 24, 78, 30, -1, -1, 74, 77, -1, 25,
548 -1, 26, -1, 5, 30, -1, 8, 30, -1, 15,
549 30, -1, 30, -1, 76, 30, -1, -1, 14, 78,
550 -1, 79, -1, 79, 33, 79, -1, 79, 27, 79,
551 -1, 29, 78, 28, -1, 34, 78, -1, 78, 31,
552 78, -1, 78, 32, 78, -1, 25, -1, 26, -1
555 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
556 static const yytype_uint16 yyrline[] =
558 0, 104, 104, 106, 108, 109, 110, 111, 112, 113,
559 114, 118, 122, 122, 122, 122, 122, 122, 122, 126,
560 127, 128, 129, 130, 131, 135, 136, 142, 150, 156,
561 164, 174, 176, 177, 178, 179, 180, 181, 184, 192,
562 198, 208, 214, 220, 223, 225, 236, 237, 242, 251,
563 256, 264, 267, 269, 270, 271, 272, 273, 276, 282,
564 293, 299, 309, 311, 316, 324, 332, 335, 337, 338,
565 339, 344, 351, 356, 364, 367, 369, 370, 371, 374,
566 382, 389, 396, 402, 409, 411, 412, 413, 416, 424,
567 426, 431, 432, 435, 436, 437, 441, 442, 445, 446,
568 449, 450, 451, 452, 453, 454, 455, 458, 459
572 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
573 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
574 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
575 static const char *const yytname[] =
577 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
578 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
579 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
580 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
581 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
582 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
583 "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt",
584 "option_error", "config_entry_start", "config_stmt",
585 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
586 "config_option", "symbol_option", "symbol_option_list",
587 "symbol_option_arg", "choice", "choice_entry", "choice_end",
588 "choice_stmt", "choice_option_list", "choice_option", "choice_block",
589 "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry",
590 "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment",
591 "comment_stmt", "help_start", "help", "depends_list", "depends",
592 "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
597 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
599 static const yytype_uint16 yytoknum[] =
601 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
602 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
603 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
604 285, 286, 287, 288, 289
608 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
609 static const yytype_uint8 yyr1[] =
611 0, 35, 36, 37, 37, 37, 37, 37, 37, 37,
612 37, 37, 38, 38, 38, 38, 38, 38, 38, 39,
613 39, 39, 39, 39, 39, 40, 40, 41, 42, 43,
614 44, 45, 45, 45, 45, 45, 45, 45, 46, 46,
615 46, 46, 46, 47, 48, 48, 49, 49, 50, 51,
616 52, 53, 54, 54, 54, 54, 54, 54, 55, 55,
617 55, 55, 56, 56, 57, 58, 59, 60, 60, 60,
618 60, 61, 62, 63, 64, 65, 65, 65, 65, 66,
619 67, 68, 69, 70, 71, 71, 71, 71, 72, 73,
620 73, 74, 74, 75, 75, 75, 76, 76, 77, 77,
621 78, 78, 78, 78, 78, 78, 78, 79, 79
624 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
625 static const yytype_uint8 yyr2[] =
627 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
628 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
629 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
630 2, 0, 2, 2, 2, 2, 2, 2, 3, 4,
631 4, 4, 5, 3, 0, 3, 0, 2, 2, 2,
632 1, 3, 0, 2, 2, 2, 2, 2, 4, 3,
633 2, 4, 0, 2, 3, 1, 3, 0, 2, 2,
634 2, 3, 2, 1, 3, 0, 2, 2, 2, 3,
635 3, 2, 2, 2, 0, 2, 2, 2, 4, 0,
636 2, 1, 1, 2, 2, 2, 1, 2, 0, 2,
637 1, 3, 3, 3, 2, 3, 3, 1, 1
640 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
641 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
642 means the default is an error. */
643 static const yytype_uint8 yydefact[] =
645 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
646 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
647 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
648 23, 52, 62, 5, 67, 20, 84, 75, 6, 24,
649 84, 21, 8, 11, 91, 92, 0, 0, 93, 0,
650 48, 94, 0, 0, 0, 107, 108, 0, 0, 0,
651 100, 95, 0, 0, 0, 0, 0, 0, 0, 0,
652 0, 0, 96, 7, 71, 79, 80, 27, 29, 0,
653 104, 0, 0, 64, 0, 0, 9, 10, 0, 0,
654 0, 0, 89, 0, 0, 0, 44, 0, 37, 36,
655 32, 33, 0, 35, 34, 0, 0, 89, 0, 56,
656 57, 53, 55, 54, 63, 51, 50, 68, 70, 66,
657 69, 65, 86, 87, 85, 76, 78, 74, 77, 73,
658 97, 103, 105, 106, 102, 101, 26, 82, 0, 98,
659 0, 98, 98, 98, 0, 0, 0, 83, 60, 98,
660 0, 98, 0, 0, 0, 38, 90, 0, 0, 98,
661 46, 43, 25, 0, 59, 0, 88, 99, 39, 40,
662 41, 0, 0, 45, 58, 61, 42, 47
665 /* YYDEFGOTO[NTERM-NUM]. */
666 static const yytype_int16 yydefgoto[] =
668 -1, 1, 2, 25, 26, 99, 27, 28, 29, 30,
669 64, 100, 101, 145, 173, 31, 32, 115, 33, 66,
670 111, 67, 34, 119, 35, 68, 36, 37, 127, 38,
671 70, 39, 40, 41, 102, 103, 69, 104, 140, 141,
675 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
677 #define YYPACT_NINF -78
678 static const yytype_int16 yypact[] =
680 -78, 33, 130, -78, -28, 73, 73, 7, 73, 36,
681 41, 73, 26, 52, -4, 58, -78, -78, -78, -78,
682 -78, -78, -78, 90, -78, 94, -78, -78, -78, -78,
683 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
684 -78, -78, -78, -78, -78, -78, 74, 85, -78, 96,
685 -78, -78, 131, 134, 147, -78, -78, -4, -4, 193,
686 -10, -78, 162, 164, 38, 102, 64, 148, 5, 192,
687 5, 165, -78, 174, -78, -78, -78, -78, -78, 65,
688 -78, -4, -4, 174, 103, 103, -78, -78, 175, 185,
689 197, 73, 73, -4, 194, 103, -78, 231, -78, -78,
690 -78, -78, 220, -78, -78, 204, 73, 73, 210, -78,
691 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
692 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
693 -78, -78, 205, -78, -78, -78, -78, -78, -4, 222,
694 208, 222, 195, 222, 103, 2, 209, -78, -78, 222,
695 211, 222, 199, -4, 212, -78, -78, 213, 214, 222,
696 207, -78, -78, 215, -78, 216, -78, 111, -78, -78,
697 -78, 217, 73, -78, -78, -78, -78, -78
700 /* YYPGOTO[NTERM-NUM]. */
701 static const yytype_int16 yypgoto[] =
703 -78, -78, -78, -78, 121, -35, -78, -78, -78, -78,
704 219, -78, -78, -78, -78, -78, -78, -78, -44, -78,
705 -78, -78, -78, -78, -78, -78, -78, -78, -78, -6,
706 -78, -78, -78, -78, -78, 183, 218, 21, 143, -5,
707 146, 196, 69, -53, -77
710 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
711 positive, shift that token. If negative, reduce the rule which
712 number is the opposite. If zero, do what YYDEFACT says.
713 If YYTABLE_NINF, syntax error. */
714 #define YYTABLE_NINF -82
715 static const yytype_int16 yytable[] =
717 46, 47, 43, 49, 79, 80, 52, 134, 135, 6,
718 7, 8, 9, 10, 11, 12, 13, 84, 144, 14,
719 15, 55, 56, 85, 118, 57, 126, 160, 132, 133,
720 58, 110, 161, 3, 123, 24, 123, 48, -28, 88,
721 142, -28, -28, -28, -28, -28, -28, -28, -28, -28,
722 89, 53, -28, -28, 90, -28, 91, 92, 93, 94,
723 95, 96, 120, 97, 128, 88, 50, 159, 98, -49,
724 -49, 51, -49, -49, -49, -49, 89, 54, -49, -49,
725 90, 105, 106, 107, 108, 152, 139, 113, 61, 97,
726 124, 62, 124, 131, 109, 63, 81, 82, 44, 45,
727 167, 149, -30, 88, 72, -30, -30, -30, -30, -30,
728 -30, -30, -30, -30, 89, 74, -30, -30, 90, -30,
729 91, 92, 93, 94, 95, 96, 75, 97, 55, 56,
730 -2, 4, 98, 5, 6, 7, 8, 9, 10, 11,
731 12, 13, 81, 82, 14, 15, 16, 17, 18, 19,
732 20, 21, 22, 7, 8, 23, 10, 11, 12, 13,
733 24, 76, 14, 15, 77, -81, 88, 177, -81, -81,
734 -81, -81, -81, -81, -81, -81, -81, 78, 24, -81,
735 -81, 90, -81, -81, -81, -81, -81, -81, 114, 117,
736 97, 125, 86, 88, 87, 122, -72, -72, -72, -72,
737 -72, -72, -72, -72, 130, 136, -72, -72, 90, 153,
738 156, 157, 158, 116, 121, 137, 129, 97, 163, 143,
739 165, 138, 122, 72, 81, 82, 81, 82, 171, 166,
740 81, 82, 146, 147, 148, 151, 153, 82, 155, 162,
741 172, 164, 168, 169, 170, 174, 175, 176, 65, 112,
742 150, 0, 0, 0, 0, 83, 0, 0, 71
745 static const yytype_int16 yycheck[] =
747 5, 6, 30, 8, 57, 58, 11, 84, 85, 4,
748 5, 6, 7, 8, 9, 10, 11, 27, 95, 14,
749 15, 25, 26, 33, 68, 29, 70, 25, 81, 82,
750 34, 66, 30, 0, 69, 30, 71, 30, 0, 1,
751 93, 3, 4, 5, 6, 7, 8, 9, 10, 11,
752 12, 25, 14, 15, 16, 17, 18, 19, 20, 21,
753 22, 23, 68, 25, 70, 1, 30, 144, 30, 5,
754 6, 30, 8, 9, 10, 11, 12, 25, 14, 15,
755 16, 17, 18, 19, 20, 138, 91, 66, 30, 25,
756 69, 1, 71, 28, 30, 1, 31, 32, 25, 26,
757 153, 106, 0, 1, 30, 3, 4, 5, 6, 7,
758 8, 9, 10, 11, 12, 30, 14, 15, 16, 17,
759 18, 19, 20, 21, 22, 23, 30, 25, 25, 26,
760 0, 1, 30, 3, 4, 5, 6, 7, 8, 9,
761 10, 11, 31, 32, 14, 15, 16, 17, 18, 19,
762 20, 21, 22, 5, 6, 25, 8, 9, 10, 11,
763 30, 30, 14, 15, 30, 0, 1, 172, 3, 4,
764 5, 6, 7, 8, 9, 10, 11, 30, 30, 14,
765 15, 16, 17, 18, 19, 20, 21, 22, 67, 68,
766 25, 70, 30, 1, 30, 30, 4, 5, 6, 7,
767 8, 9, 10, 11, 30, 30, 14, 15, 16, 14,
768 141, 142, 143, 67, 68, 30, 70, 25, 149, 25,
769 151, 24, 30, 30, 31, 32, 31, 32, 159, 30,
770 31, 32, 1, 13, 30, 25, 14, 32, 30, 30,
771 33, 30, 30, 30, 30, 30, 30, 30, 29, 66,
772 107, -1, -1, -1, -1, 59, -1, -1, 40
775 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
776 symbol of state STATE-NUM. */
777 static const yytype_uint8 yystos[] =
779 0, 36, 37, 0, 1, 3, 4, 5, 6, 7,
780 8, 9, 10, 11, 14, 15, 16, 17, 18, 19,
781 20, 21, 22, 25, 30, 38, 39, 41, 42, 43,
782 44, 50, 51, 53, 57, 59, 61, 62, 64, 66,
783 67, 68, 75, 30, 25, 26, 74, 74, 30, 74,
784 30, 30, 74, 25, 25, 25, 26, 29, 34, 78,
785 79, 30, 1, 1, 45, 45, 54, 56, 60, 71,
786 65, 71, 30, 76, 30, 30, 30, 30, 30, 78,
787 78, 31, 32, 76, 27, 33, 30, 30, 1, 12,
788 16, 18, 19, 20, 21, 22, 23, 25, 30, 40,
789 46, 47, 69, 70, 72, 17, 18, 19, 20, 30,
790 40, 55, 70, 72, 39, 52, 75, 39, 53, 58,
791 64, 75, 30, 40, 72, 39, 53, 63, 64, 75,
792 30, 28, 78, 78, 79, 79, 30, 30, 24, 74,
793 73, 74, 78, 25, 79, 48, 1, 13, 30, 74,
794 73, 25, 78, 14, 77, 30, 77, 77, 77, 79,
795 25, 30, 30, 77, 30, 77, 30, 78, 30, 30,
796 30, 77, 33, 49, 30, 30, 30, 74
799 #define yyerrok (yyerrstatus = 0)
800 #define yyclearin (yychar = YYEMPTY)
804 #define YYACCEPT goto yyacceptlab
805 #define YYABORT goto yyabortlab
806 #define YYERROR goto yyerrorlab
809 /* Like YYERROR except do call yyerror. This remains here temporarily
810 to ease the transition to the new meaning of YYERROR, for GCC.
811 Once GCC version 2 has supplanted version 1, this can go. */
813 #define YYFAIL goto yyerrlab
815 #define YYRECOVERING() (!!yyerrstatus)
817 #define YYBACKUP(Token, Value) \
819 if (yychar == YYEMPTY && yylen == 1) \
823 yytoken = YYTRANSLATE (yychar); \
829 yyerror (YY_("syntax error: cannot back up")); \
836 #define YYERRCODE 256
839 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
840 If N is 0, then set CURRENT to the empty location which ends
841 the previous symbol: RHS[0] (always defined). */
843 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
844 #ifndef YYLLOC_DEFAULT
845 # define YYLLOC_DEFAULT(Current, Rhs, N) \
849 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
850 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
851 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
852 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
856 (Current).first_line = (Current).last_line = \
857 YYRHSLOC (Rhs, 0).last_line; \
858 (Current).first_column = (Current).last_column = \
859 YYRHSLOC (Rhs, 0).last_column; \
865 /* YY_LOCATION_PRINT -- Print the location on the stream.
866 This macro was not mandated originally: define only if we know
867 we won't break user code: when these are the locations we know. */
869 #ifndef YY_LOCATION_PRINT
870 # if YYLTYPE_IS_TRIVIAL
871 # define YY_LOCATION_PRINT(File, Loc) \
872 fprintf (File, "%d.%d-%d.%d", \
873 (Loc).first_line, (Loc).first_column, \
874 (Loc).last_line, (Loc).last_column)
876 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
881 /* YYLEX -- calling `yylex' with the right arguments. */
884 # define YYLEX yylex (YYLEX_PARAM)
886 # define YYLEX yylex ()
889 /* Enable debugging if requested. */
893 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
894 # define YYFPRINTF fprintf
897 # define YYDPRINTF(Args) \
903 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
907 YYFPRINTF (stderr, "%s ", Title); \
908 yy_symbol_print (stderr, \
910 YYFPRINTF (stderr, "\n"); \
915 /*--------------------------------.
916 | Print this symbol on YYOUTPUT. |
917 `--------------------------------*/
920 #if (defined __STDC__ || defined __C99__FUNC__ \
921 || defined __cplusplus || defined _MSC_VER)
923 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
926 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
929 YYSTYPE const * const yyvaluep;
935 if (yytype < YYNTOKENS)
936 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
948 /*--------------------------------.
949 | Print this symbol on YYOUTPUT. |
950 `--------------------------------*/
952 #if (defined __STDC__ || defined __C99__FUNC__ \
953 || defined __cplusplus || defined _MSC_VER)
955 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
958 yy_symbol_print (yyoutput, yytype, yyvaluep)
961 YYSTYPE const * const yyvaluep;
964 if (yytype < YYNTOKENS)
965 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
967 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
969 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
970 YYFPRINTF (yyoutput, ")");
973 /*------------------------------------------------------------------.
974 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
976 `------------------------------------------------------------------*/
978 #if (defined __STDC__ || defined __C99__FUNC__ \
979 || defined __cplusplus || defined _MSC_VER)
981 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
984 yy_stack_print (bottom, top)
985 yytype_int16 *bottom;
989 YYFPRINTF (stderr, "Stack now");
990 for (; bottom <= top; ++bottom)
991 YYFPRINTF (stderr, " %d", *bottom);
992 YYFPRINTF (stderr, "\n");
995 # define YY_STACK_PRINT(Bottom, Top) \
998 yy_stack_print ((Bottom), (Top)); \
1002 /*------------------------------------------------.
1003 | Report that the YYRULE is going to be reduced. |
1004 `------------------------------------------------*/
1006 #if (defined __STDC__ || defined __C99__FUNC__ \
1007 || defined __cplusplus || defined _MSC_VER)
1009 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1012 yy_reduce_print (yyvsp, yyrule)
1017 int yynrhs = yyr2[yyrule];
1019 unsigned long int yylno = yyrline[yyrule];
1020 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1022 /* The symbols being reduced. */
1023 for (yyi = 0; yyi < yynrhs; yyi++)
1025 fprintf (stderr, " $%d = ", yyi + 1);
1026 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1027 &(yyvsp[(yyi + 1) - (yynrhs)])
1029 fprintf (stderr, "\n");
1033 # define YY_REDUCE_PRINT(Rule) \
1036 yy_reduce_print (yyvsp, Rule); \
1039 /* Nonzero means print parse trace. It is left uninitialized so that
1040 multiple parsers can coexist. */
1042 #else /* !YYDEBUG */
1043 # define YYDPRINTF(Args)
1044 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1045 # define YY_STACK_PRINT(Bottom, Top)
1046 # define YY_REDUCE_PRINT(Rule)
1047 #endif /* !YYDEBUG */
1050 /* YYINITDEPTH -- initial size of the parser's stacks. */
1052 # define YYINITDEPTH 200
1055 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1056 if the built-in stack extension method is used).
1058 Do not make this value too large; the results are undefined if
1059 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1060 evaluated with infinite-precision integer arithmetic. */
1063 # define YYMAXDEPTH 10000
1071 # if defined __GLIBC__ && defined _STRING_H
1072 # define yystrlen strlen
1074 /* Return the length of YYSTR. */
1075 #if (defined __STDC__ || defined __C99__FUNC__ \
1076 || defined __cplusplus || defined _MSC_VER)
1078 yystrlen (const char *yystr)
1086 for (yylen = 0; yystr[yylen]; yylen++)
1094 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1095 # define yystpcpy stpcpy
1097 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1099 #if (defined __STDC__ || defined __C99__FUNC__ \
1100 || defined __cplusplus || defined _MSC_VER)
1102 yystpcpy (char *yydest, const char *yysrc)
1105 yystpcpy (yydest, yysrc)
1111 const char *yys = yysrc;
1113 while ((*yyd++ = *yys++) != '\0')
1122 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1123 quotes and backslashes, so that it's suitable for yyerror. The
1124 heuristic is that double-quoting is unnecessary unless the string
1125 contains an apostrophe, a comma, or backslash (other than
1126 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1127 null, do not copy; instead, return the length of what the result
1130 yytnamerr (char *yyres, const char *yystr)
1135 char const *yyp = yystr;
1142 goto do_not_strip_quotes;
1146 goto do_not_strip_quotes;
1159 do_not_strip_quotes: ;
1163 return yystrlen (yystr);
1165 return yystpcpy (yyres, yystr) - yyres;
1169 /* Copy into YYRESULT an error message about the unexpected token
1170 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1171 including the terminating null byte. If YYRESULT is null, do not
1172 copy anything; just return the number of bytes that would be
1173 copied. As a special case, return 0 if an ordinary "syntax error"
1174 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1175 size calculation. */
1177 yysyntax_error (char *yyresult, int yystate, int yychar)
1179 int yyn = yypact[yystate];
1181 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1185 int yytype = YYTRANSLATE (yychar);
1186 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1187 YYSIZE_T yysize = yysize0;
1189 int yysize_overflow = 0;
1190 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1191 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1195 /* This is so xgettext sees the translatable formats that are
1196 constructed on the fly. */
1197 YY_("syntax error, unexpected %s");
1198 YY_("syntax error, unexpected %s, expecting %s");
1199 YY_("syntax error, unexpected %s, expecting %s or %s");
1200 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1201 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1205 static char const yyunexpected[] = "syntax error, unexpected %s";
1206 static char const yyexpecting[] = ", expecting %s";
1207 static char const yyor[] = " or %s";
1208 char yyformat[sizeof yyunexpected
1209 + sizeof yyexpecting - 1
1210 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1211 * (sizeof yyor - 1))];
1212 char const *yyprefix = yyexpecting;
1214 /* Start YYX at -YYN if negative to avoid negative indexes in
1216 int yyxbegin = yyn < 0 ? -yyn : 0;
1218 /* Stay within bounds of both yycheck and yytname. */
1219 int yychecklim = YYLAST - yyn + 1;
1220 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1223 yyarg[0] = yytname[yytype];
1224 yyfmt = yystpcpy (yyformat, yyunexpected);
1226 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1227 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1229 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1233 yyformat[sizeof yyunexpected - 1] = '\0';
1236 yyarg[yycount++] = yytname[yyx];
1237 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1238 yysize_overflow |= (yysize1 < yysize);
1240 yyfmt = yystpcpy (yyfmt, yyprefix);
1244 yyf = YY_(yyformat);
1245 yysize1 = yysize + yystrlen (yyf);
1246 yysize_overflow |= (yysize1 < yysize);
1249 if (yysize_overflow)
1250 return YYSIZE_MAXIMUM;
1254 /* Avoid sprintf, as that infringes on the user's name space.
1255 Don't have undefined behavior even if the translation
1256 produced a string with the wrong number of "%s"s. */
1257 char *yyp = yyresult;
1259 while ((*yyp = *yyf) != '\0')
1261 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1263 yyp += yytnamerr (yyp, yyarg[yyi++]);
1276 #endif /* YYERROR_VERBOSE */
1279 /*-----------------------------------------------.
1280 | Release the memory associated to this symbol. |
1281 `-----------------------------------------------*/
1284 #if (defined __STDC__ || defined __C99__FUNC__ \
1285 || defined __cplusplus || defined _MSC_VER)
1287 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1290 yydestruct (yymsg, yytype, yyvaluep)
1300 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1304 case 51: /* "choice_entry" */
1307 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1308 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1309 if (current_menu == (yyvaluep->menu))
1314 case 57: /* "if_entry" */
1317 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1318 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1319 if (current_menu == (yyvaluep->menu))
1324 case 62: /* "menu_entry" */
1327 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1328 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1329 if (current_menu == (yyvaluep->menu))
1341 /* Prevent warnings from -Wmissing-prototypes. */
1343 #ifdef YYPARSE_PARAM
1344 #if defined __STDC__ || defined __cplusplus
1345 int yyparse (void *YYPARSE_PARAM);
1349 #else /* ! YYPARSE_PARAM */
1350 #if defined __STDC__ || defined __cplusplus
1355 #endif /* ! YYPARSE_PARAM */
1359 /* The look-ahead symbol. */
1362 /* The semantic value of the look-ahead symbol. */
1365 /* Number of syntax errors so far. */
1374 #ifdef YYPARSE_PARAM
1375 #if (defined __STDC__ || defined __C99__FUNC__ \
1376 || defined __cplusplus || defined _MSC_VER)
1378 yyparse (void *YYPARSE_PARAM)
1381 yyparse (YYPARSE_PARAM)
1382 void *YYPARSE_PARAM;
1384 #else /* ! YYPARSE_PARAM */
1385 #if (defined __STDC__ || defined __C99__FUNC__ \
1386 || defined __cplusplus || defined _MSC_VER)
1400 /* Number of tokens to shift before error messages enabled. */
1402 /* Look-ahead token as an internal (translated) token number. */
1405 /* Buffer for error messages, and its allocated size. */
1407 char *yymsg = yymsgbuf;
1408 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1411 /* Three stacks and their tools:
1412 `yyss': related to states,
1413 `yyvs': related to semantic values,
1414 `yyls': related to locations.
1416 Refer to the stacks thru separate pointers, to allow yyoverflow
1417 to reallocate them elsewhere. */
1419 /* The state stack. */
1420 yytype_int16 yyssa[YYINITDEPTH];
1421 yytype_int16 *yyss = yyssa;
1422 yytype_int16 *yyssp;
1424 /* The semantic value stack. */
1425 YYSTYPE yyvsa[YYINITDEPTH];
1426 YYSTYPE *yyvs = yyvsa;
1431 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1433 YYSIZE_T yystacksize = YYINITDEPTH;
1435 /* The variables used to return semantic value and location from the
1440 /* The number of symbols on the RHS of the reduced rule.
1441 Keep to zero when no symbol should be popped. */
1444 YYDPRINTF ((stderr, "Starting parse\n"));
1449 yychar = YYEMPTY; /* Cause a token to be read. */
1451 /* Initialize stack pointers.
1452 Waste one element of value and location stack
1453 so that they stay on the same level as the state stack.
1454 The wasted elements are never initialized. */
1461 /*------------------------------------------------------------.
1462 | yynewstate -- Push a new state, which is found in yystate. |
1463 `------------------------------------------------------------*/
1465 /* In all cases, when you get here, the value and location stacks
1466 have just been pushed. So pushing a state here evens the stacks. */
1472 if (yyss + yystacksize - 1 <= yyssp)
1474 /* Get the current used size of the three stacks, in elements. */
1475 YYSIZE_T yysize = yyssp - yyss + 1;
1479 /* Give user a chance to reallocate the stack. Use copies of
1480 these so that the &'s don't force the real ones into
1482 YYSTYPE *yyvs1 = yyvs;
1483 yytype_int16 *yyss1 = yyss;
1486 /* Each stack pointer address is followed by the size of the
1487 data in use in that stack, in bytes. This used to be a
1488 conditional around just the two extra args, but that might
1489 be undefined if yyoverflow is a macro. */
1490 yyoverflow (YY_("memory exhausted"),
1491 &yyss1, yysize * sizeof (*yyssp),
1492 &yyvs1, yysize * sizeof (*yyvsp),
1499 #else /* no yyoverflow */
1500 # ifndef YYSTACK_RELOCATE
1501 goto yyexhaustedlab;
1503 /* Extend the stack our own way. */
1504 if (YYMAXDEPTH <= yystacksize)
1505 goto yyexhaustedlab;
1507 if (YYMAXDEPTH < yystacksize)
1508 yystacksize = YYMAXDEPTH;
1511 yytype_int16 *yyss1 = yyss;
1512 union yyalloc *yyptr =
1513 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1515 goto yyexhaustedlab;
1516 YYSTACK_RELOCATE (yyss);
1517 YYSTACK_RELOCATE (yyvs);
1519 # undef YYSTACK_RELOCATE
1521 YYSTACK_FREE (yyss1);
1524 #endif /* no yyoverflow */
1526 yyssp = yyss + yysize - 1;
1527 yyvsp = yyvs + yysize - 1;
1530 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1531 (unsigned long int) yystacksize));
1533 if (yyss + yystacksize - 1 <= yyssp)
1537 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1546 /* Do appropriate processing given the current state. Read a
1547 look-ahead token if we need one and don't already have one. */
1549 /* First try to decide what to do without reference to look-ahead token. */
1550 yyn = yypact[yystate];
1551 if (yyn == YYPACT_NINF)
1554 /* Not known => get a look-ahead token if don't already have one. */
1556 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1557 if (yychar == YYEMPTY)
1559 YYDPRINTF ((stderr, "Reading a token: "));
1563 if (yychar <= YYEOF)
1565 yychar = yytoken = YYEOF;
1566 YYDPRINTF ((stderr, "Now at end of input.\n"));
1570 yytoken = YYTRANSLATE (yychar);
1571 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1574 /* If the proper action on seeing token YYTOKEN is to reduce or to
1575 detect an error, take that action. */
1577 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1582 if (yyn == 0 || yyn == YYTABLE_NINF)
1591 /* Count tokens shifted since error; after three, turn off error
1596 /* Shift the look-ahead token. */
1597 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1599 /* Discard the shifted token unless it is eof. */
1600 if (yychar != YYEOF)
1609 /*-----------------------------------------------------------.
1610 | yydefault -- do the default action for the current state. |
1611 `-----------------------------------------------------------*/
1613 yyn = yydefact[yystate];
1619 /*-----------------------------.
1620 | yyreduce -- Do a reduction. |
1621 `-----------------------------*/
1623 /* yyn is the number of a rule to reduce with. */
1626 /* If YYLEN is nonzero, implement the default value of the action:
1629 Otherwise, the following line sets YYVAL to garbage.
1630 This behavior is undocumented and Bison
1631 users should not rely upon it. Assigning to YYVAL
1632 unconditionally makes the parser a bit smaller, and it avoids a
1633 GCC warning that YYVAL may be used uninitialized. */
1634 yyval = yyvsp[1-yylen];
1637 YY_REDUCE_PRINT (yyn);
1642 { zconf_error("unexpected end statement"); ;}
1647 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;}
1653 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
1659 { zconf_error("invalid statement"); ;}
1664 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
1669 { zconf_error("invalid option"); ;}
1675 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
1676 sym->flags |= SYMBOL_OPTIONAL;
1677 menu_add_entry(sym);
1678 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1686 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1693 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
1694 sym->flags |= SYMBOL_OPTIONAL;
1695 menu_add_entry(sym);
1696 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1703 if (current_entry->prompt)
1704 current_entry->prompt->type = P_MENU;
1706 zconfprint("warning: menuconfig statement without prompt");
1708 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1715 menu_set_type((yyvsp[(1) - (3)].id)->stype);
1716 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1717 zconf_curname(), zconf_lineno(),
1718 (yyvsp[(1) - (3)].id)->stype);
1725 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1726 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1733 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
1734 if ((yyvsp[(1) - (4)].id)->stype != S_UNKNOWN)
1735 menu_set_type((yyvsp[(1) - (4)].id)->stype);
1736 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1737 zconf_curname(), zconf_lineno(),
1738 (yyvsp[(1) - (4)].id)->stype);
1745 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
1746 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1753 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
1754 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1761 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
1762 if (id && id->flags & TF_OPTION)
1763 menu_add_option(id->token, (yyvsp[(3) - (3)].string));
1765 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
1766 free((yyvsp[(2) - (3)].string));
1772 { (yyval.string) = NULL; ;}
1777 { (yyval.string) = (yyvsp[(2) - (2)].string); ;}
1783 struct symbol *sym = sym_lookup(NULL, 0);
1784 sym->flags |= SYMBOL_CHOICE;
1785 menu_add_entry(sym);
1786 menu_add_expr(P_CHOICE, NULL, NULL);
1787 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1794 (yyval.menu) = menu_add_menu();
1801 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
1803 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1811 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1812 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1819 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
1820 menu_set_type((yyvsp[(1) - (3)].id)->stype);
1821 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1822 zconf_curname(), zconf_lineno(),
1823 (yyvsp[(1) - (3)].id)->stype);
1832 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1833 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1840 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
1841 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
1842 printd(DEBUG_PARSE, "%s:%d:default\n",
1843 zconf_curname(), zconf_lineno());
1852 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1853 menu_add_entry(NULL);
1854 menu_add_dep((yyvsp[(2) - (3)].expr));
1855 (yyval.menu) = menu_add_menu();
1862 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
1864 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1872 menu_add_entry(NULL);
1873 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1874 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1881 (yyval.menu) = menu_add_menu();
1888 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
1890 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1898 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1899 zconf_nextfile((yyvsp[(2) - (3)].string));
1906 menu_add_entry(NULL);
1907 menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
1908 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1922 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1930 current_entry->help = (yyvsp[(2) - (2)].string);
1937 menu_add_dep((yyvsp[(3) - (4)].expr));
1938 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1945 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
1951 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1956 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1961 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1966 { (yyval.expr) = NULL; ;}
1971 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
1976 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
1981 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1986 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1991 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
1996 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
2001 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
2006 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
2011 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
2016 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 1); free((yyvsp[(1) - (1)].string)); ;}
2020 /* Line 1267 of yacc.c. */
2024 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2028 YY_STACK_PRINT (yyss, yyssp);
2033 /* Now `shift' the result of the reduction. Determine what state
2034 that goes to, based on the state we popped back to and the rule
2035 number reduced by. */
2039 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2040 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2041 yystate = yytable[yystate];
2043 yystate = yydefgoto[yyn - YYNTOKENS];
2048 /*------------------------------------.
2049 | yyerrlab -- here on detecting error |
2050 `------------------------------------*/
2052 /* If not already recovering from an error, report this error. */
2056 #if ! YYERROR_VERBOSE
2057 yyerror (YY_("syntax error"));
2060 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2061 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2063 YYSIZE_T yyalloc = 2 * yysize;
2064 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2065 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2066 if (yymsg != yymsgbuf)
2067 YYSTACK_FREE (yymsg);
2068 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2070 yymsg_alloc = yyalloc;
2074 yymsg_alloc = sizeof yymsgbuf;
2078 if (0 < yysize && yysize <= yymsg_alloc)
2080 (void) yysyntax_error (yymsg, yystate, yychar);
2085 yyerror (YY_("syntax error"));
2087 goto yyexhaustedlab;
2095 if (yyerrstatus == 3)
2097 /* If just tried and failed to reuse look-ahead token after an
2098 error, discard it. */
2100 if (yychar <= YYEOF)
2102 /* Return failure if at end of input. */
2103 if (yychar == YYEOF)
2108 yydestruct ("Error: discarding",
2114 /* Else will try to reuse look-ahead token after shifting the error
2119 /*---------------------------------------------------.
2120 | yyerrorlab -- error raised explicitly by YYERROR. |
2121 `---------------------------------------------------*/
2124 /* Pacify compilers like GCC when the user code never invokes
2125 YYERROR and the label yyerrorlab therefore never appears in user
2127 if (/*CONSTCOND*/ 0)
2130 /* Do not reclaim the symbols of the rule which action triggered
2134 YY_STACK_PRINT (yyss, yyssp);
2139 /*-------------------------------------------------------------.
2140 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2141 `-------------------------------------------------------------*/
2143 yyerrstatus = 3; /* Each real token shifted decrements this. */
2147 yyn = yypact[yystate];
2148 if (yyn != YYPACT_NINF)
2151 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2159 /* Pop the current state because it cannot handle the error token. */
2164 yydestruct ("Error: popping",
2165 yystos[yystate], yyvsp);
2168 YY_STACK_PRINT (yyss, yyssp);
2177 /* Shift the error token. */
2178 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2184 /*-------------------------------------.
2185 | yyacceptlab -- YYACCEPT comes here. |
2186 `-------------------------------------*/
2191 /*-----------------------------------.
2192 | yyabortlab -- YYABORT comes here. |
2193 `-----------------------------------*/
2199 /*-------------------------------------------------.
2200 | yyexhaustedlab -- memory exhaustion comes here. |
2201 `-------------------------------------------------*/
2203 yyerror (YY_("memory exhausted"));
2209 if (yychar != YYEOF && yychar != YYEMPTY)
2210 yydestruct ("Cleanup: discarding lookahead",
2212 /* Do not reclaim the symbols of the rule which action triggered
2213 this YYABORT or YYACCEPT. */
2215 YY_STACK_PRINT (yyss, yyssp);
2216 while (yyssp != yyss)
2218 yydestruct ("Cleanup: popping",
2219 yystos[*yyssp], yyvsp);
2224 YYSTACK_FREE (yyss);
2227 if (yymsg != yymsgbuf)
2228 YYSTACK_FREE (yymsg);
2230 /* Make sure YYID is used. */
2231 return YYID (yyresult);
2238 void conf_parse(const char *name)
2243 zconf_initscan(name);
2247 modules_sym = sym_lookup(NULL, 0);
2248 modules_sym->type = S_BOOLEAN;
2249 modules_sym->flags |= SYMBOL_AUTO;
2250 rootmenu.prompt = menu_add_prompt(P_MENU, "coreboot Configuration", NULL);
2253 if (getenv("ZCONF_DEBUG"))
2259 if (!modules_sym->prop) {
2260 struct property *prop;
2262 prop = prop_alloc(P_DEFAULT, modules_sym);
2263 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2265 menu_finalize(&rootmenu);
2266 for_all_symbols(i, sym) {
2267 if (sym_check_deps(sym))
2272 sym_set_change_count(1);
2275 const char *zconf_tokenname(int token)
2278 case T_MENU: return "menu";
2279 case T_ENDMENU: return "endmenu";
2280 case T_CHOICE: return "choice";
2281 case T_ENDCHOICE: return "endchoice";
2282 case T_IF: return "if";
2283 case T_ENDIF: return "endif";
2284 case T_DEPENDS: return "depends";
2289 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
2291 if (id->token != endtoken) {
2292 zconf_error("unexpected '%s' within %s block",
2293 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2297 if (current_menu->file != current_file) {
2298 zconf_error("'%s' in different file than '%s'",
2299 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2300 fprintf(stderr, "%s:%d: location of the '%s'\n",
2301 current_menu->file->name, current_menu->lineno,
2302 zconf_tokenname(starttoken));
2309 static void zconfprint(const char *err, ...)
2313 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2315 vfprintf(stderr, err, ap);
2317 fprintf(stderr, "\n");
2320 static void zconf_error(const char *err, ...)
2325 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2327 vfprintf(stderr, err, ap);
2329 fprintf(stderr, "\n");
2332 static void zconferror(const char *err)
2335 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2339 void print_quoted_string(FILE *out, const char *str)
2345 while ((p = strchr(str, '"'))) {
2348 fprintf(out, "%.*s", len, str);
2356 void print_symbol(FILE *out, struct menu *menu)
2358 struct symbol *sym = menu->sym;
2359 struct property *prop;
2361 if (sym_is_choice(sym))
2362 fprintf(out, "choice\n");
2364 fprintf(out, "config %s\n", sym->name);
2365 switch (sym->type) {
2367 fputs(" boolean\n", out);
2370 fputs(" tristate\n", out);
2373 fputs(" string\n", out);
2376 fputs(" integer\n", out);
2379 fputs(" hex\n", out);
2382 fputs(" ???\n", out);
2385 for (prop = sym->prop; prop; prop = prop->next) {
2386 if (prop->menu != menu)
2388 switch (prop->type) {
2390 fputs(" prompt ", out);
2391 print_quoted_string(out, prop->text);
2392 if (!expr_is_yes(prop->visible.expr)) {
2394 expr_fprint(prop->visible.expr, out);
2399 fputs( " default ", out);
2400 expr_fprint(prop->expr, out);
2401 if (!expr_is_yes(prop->visible.expr)) {
2403 expr_fprint(prop->visible.expr, out);
2408 fputs(" #choice value\n", out);
2411 fprintf(out, " unknown prop %d!\n", prop->type);
2416 int len = strlen(menu->help);
2417 while (menu->help[--len] == '\n')
2418 menu->help[len] = 0;
2419 fprintf(out, " help\n%s\n", menu->help);
2424 void zconfdump(FILE *out)
2426 struct property *prop;
2430 menu = rootmenu.list;
2432 if ((sym = menu->sym))
2433 print_symbol(out, menu);
2434 else if ((prop = menu->prompt)) {
2435 switch (prop->type) {
2437 fputs("\ncomment ", out);
2438 print_quoted_string(out, prop->text);
2442 fputs("\nmenu ", out);
2443 print_quoted_string(out, prop->text);
2449 if (!expr_is_yes(prop->visible.expr)) {
2450 fputs(" depends ", out);
2451 expr_fprint(prop->visible.expr, out);
2459 else if (menu->next)
2461 else while ((menu = menu->parent)) {
2462 if (menu->prompt && menu->prompt->type == P_MENU)
2463 fputs("\nendmenu\n", out);
2472 #include "lex.zconf.c"
2474 #include "confdata.c"