1 /* A Bison parser, made by GNU Bison 3.1. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.1"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
77 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
80 #define DEBUG_PARSE 0x0002
84 static void yyerror(const char *err);
85 static void zconfprint(const char *err, ...);
86 static void zconf_error(const char *err, ...);
87 static bool zconf_endtoken(const char *tokenname,
88 const char *expected_tokenname);
90 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
92 static struct menu *current_menu, *current_entry;
98 # if defined __cplusplus && 201103L <= __cplusplus
99 # define YY_NULLPTR nullptr
101 # define YY_NULLPTR 0
105 /* Enabling verbose error messages. */
106 #ifdef YYERROR_VERBOSE
107 # undef YYERROR_VERBOSE
108 # define YYERROR_VERBOSE 1
110 # define YYERROR_VERBOSE 0
113 /* In a future release of Bison, this section will be replaced
114 by #include "parser.tab.h". */
115 #ifndef YY_YY_PARSER_TAB_H_INCLUDED
116 # define YY_YY_PARSER_TAB_H_INCLUDED
133 T_ALLNOCONFIG_Y = 261,
141 T_DEFCONFIG_LIST = 269,
143 T_DEF_TRISTATE = 271,
179 T_GREATER_EQUAL = 307,
185 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
192 struct symbol *symbol;
195 enum symbol_type type;
196 enum variable_flavor flavor;
201 typedef union YYSTYPE YYSTYPE;
202 # define YYSTYPE_IS_TRIVIAL 1
203 # define YYSTYPE_IS_DECLARED 1
207 extern YYSTYPE yylval;
211 #endif /* !YY_YY_PARSER_TAB_H_INCLUDED */
213 /* Copy the second part of user declarations. */
222 typedef YYTYPE_UINT8 yytype_uint8;
224 typedef unsigned char yytype_uint8;
228 typedef YYTYPE_INT8 yytype_int8;
230 typedef signed char yytype_int8;
234 typedef YYTYPE_UINT16 yytype_uint16;
236 typedef unsigned short yytype_uint16;
240 typedef YYTYPE_INT16 yytype_int16;
242 typedef short yytype_int16;
246 # ifdef __SIZE_TYPE__
247 # define YYSIZE_T __SIZE_TYPE__
248 # elif defined size_t
249 # define YYSIZE_T size_t
250 # elif ! defined YYSIZE_T
251 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
252 # define YYSIZE_T size_t
254 # define YYSIZE_T unsigned
258 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
261 # if defined YYENABLE_NLS && YYENABLE_NLS
263 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
264 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
268 # define YY_(Msgid) Msgid
273 # if (defined __GNUC__ \
274 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
275 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
276 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
278 # define YY_ATTRIBUTE(Spec) /* empty */
282 #ifndef YY_ATTRIBUTE_PURE
283 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
286 #ifndef YY_ATTRIBUTE_UNUSED
287 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
290 #if !defined _Noreturn \
291 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
292 # if defined _MSC_VER && 1200 <= _MSC_VER
293 # define _Noreturn __declspec (noreturn)
295 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
299 /* Suppress unused-variable warnings by "using" E. */
300 #if ! defined lint || defined __GNUC__
301 # define YYUSE(E) ((void) (E))
303 # define YYUSE(E) /* empty */
306 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
307 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
308 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
309 _Pragma ("GCC diagnostic push") \
310 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
311 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
312 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
313 _Pragma ("GCC diagnostic pop")
315 # define YY_INITIAL_VALUE(Value) Value
317 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
318 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
319 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
321 #ifndef YY_INITIAL_VALUE
322 # define YY_INITIAL_VALUE(Value) /* Nothing. */
326 #if ! defined yyoverflow || YYERROR_VERBOSE
328 /* The parser invokes alloca or malloc; define the necessary symbols. */
330 # ifdef YYSTACK_USE_ALLOCA
331 # if YYSTACK_USE_ALLOCA
333 # define YYSTACK_ALLOC __builtin_alloca
334 # elif defined __BUILTIN_VA_ARG_INCR
335 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
337 # define YYSTACK_ALLOC __alloca
338 # elif defined _MSC_VER
339 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
340 # define alloca _alloca
342 # define YYSTACK_ALLOC alloca
343 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
344 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
345 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
346 # ifndef EXIT_SUCCESS
347 # define EXIT_SUCCESS 0
354 # ifdef YYSTACK_ALLOC
355 /* Pacify GCC's 'empty if-body' warning. */
356 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
357 # ifndef YYSTACK_ALLOC_MAXIMUM
358 /* The OS might guarantee only one guard page at the bottom of the stack,
359 and a page size can be as small as 4096 bytes. So we cannot safely
360 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
361 to allow for a few compiler-allocated temporary stack slots. */
362 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
365 # define YYSTACK_ALLOC YYMALLOC
366 # define YYSTACK_FREE YYFREE
367 # ifndef YYSTACK_ALLOC_MAXIMUM
368 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
370 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
371 && ! ((defined YYMALLOC || defined malloc) \
372 && (defined YYFREE || defined free)))
373 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
374 # ifndef EXIT_SUCCESS
375 # define EXIT_SUCCESS 0
379 # define YYMALLOC malloc
380 # if ! defined malloc && ! defined EXIT_SUCCESS
381 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
386 # if ! defined free && ! defined EXIT_SUCCESS
387 void free (void *); /* INFRINGES ON USER NAME SPACE */
391 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
394 #if (! defined yyoverflow \
395 && (! defined __cplusplus \
396 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
398 /* A type that is properly aligned for any stack member. */
401 yytype_int16 yyss_alloc;
405 /* The size of the maximum gap between one aligned stack and the next. */
406 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
408 /* The size of an array large to enough to hold all stacks, each with
410 # define YYSTACK_BYTES(N) \
411 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
412 + YYSTACK_GAP_MAXIMUM)
414 # define YYCOPY_NEEDED 1
416 /* Relocate STACK from its old location to the new one. The
417 local variables YYSIZE and YYSTACKSIZE give the old and new number of
418 elements in the stack, and YYPTR gives the new location of the
419 stack. Advance YYPTR to a properly aligned location for the next
421 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
424 YYSIZE_T yynewbytes; \
425 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
426 Stack = &yyptr->Stack_alloc; \
427 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
428 yyptr += yynewbytes / sizeof (*yyptr); \
434 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
435 /* Copy COUNT objects from SRC to DST. The source and destination do
438 # if defined __GNUC__ && 1 < __GNUC__
439 # define YYCOPY(Dst, Src, Count) \
440 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
442 # define YYCOPY(Dst, Src, Count) \
446 for (yyi = 0; yyi < (Count); yyi++) \
447 (Dst)[yyi] = (Src)[yyi]; \
452 #endif /* !YYCOPY_NEEDED */
454 /* YYFINAL -- State number of the termination state. */
456 /* YYLAST -- Last index in YYTABLE. */
459 /* YYNTOKENS -- Number of terminals. */
461 /* YYNNTS -- Number of nonterminals. */
463 /* YYNRULES -- Number of rules. */
465 /* YYNSTATES -- Number of states. */
466 #define YYNSTATES 187
468 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
469 by yylex, with out-of-bounds checking. */
471 #define YYMAXUTOK 308
473 #define YYTRANSLATE(YYX) \
474 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
476 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
477 as returned by yylex, without out-of-bounds checking. */
478 static const yytype_uint8 yytranslate[] =
480 0, 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, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
506 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
507 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
508 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
509 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
510 45, 46, 47, 48, 49, 50, 51, 52, 53
514 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
515 static const yytype_uint16 yyrline[] =
517 0, 112, 112, 112, 116, 121, 123, 124, 125, 126,
518 127, 131, 132, 133, 134, 135, 136, 141, 148, 153,
519 160, 169, 171, 172, 173, 176, 184, 190, 200, 206,
520 212, 218, 223, 228, 235, 245, 250, 258, 261, 263,
521 264, 265, 268, 274, 281, 287, 292, 300, 301, 302,
522 303, 306, 307, 310, 311, 312, 314, 316, 321, 329,
523 337, 342, 349, 354, 362, 365, 367, 368, 371, 380,
524 387, 390, 392, 397, 403, 415, 422, 429, 431, 436,
525 437, 438, 441, 442, 445, 446, 447, 448, 449, 450,
526 451, 452, 453, 454, 455, 459, 461, 462, 465, 466,
527 470, 473, 474, 475, 479, 480
531 #if YYDEBUG || YYERROR_VERBOSE || 0
532 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
533 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
534 static const char *const yytname[] =
536 "$end", "error", "$undefined", "T_HELPTEXT", "T_WORD", "T_WORD_QUOTE",
537 "T_ALLNOCONFIG_Y", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN",
538 "T_COLON_EQUAL", "T_COMMENT", "T_CONFIG", "T_DEFAULT",
539 "T_DEFCONFIG_LIST", "T_DEF_BOOL", "T_DEF_TRISTATE", "T_DEPENDS",
540 "T_ENDCHOICE", "T_ENDIF", "T_ENDMENU", "T_HELP", "T_HEX", "T_IF",
541 "T_IMPLY", "T_INT", "T_MAINMENU", "T_MENU", "T_MENUCONFIG", "T_MODULES",
542 "T_ON", "T_OPEN_PAREN", "T_OPTION", "T_OPTIONAL", "T_PLUS_EQUAL",
543 "T_PROMPT", "T_RANGE", "T_RESET", "T_SELECT", "T_SOURCE", "T_STRING",
544 "T_TRISTATE", "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND",
545 "T_EQUAL", "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER",
546 "T_GREATER_EQUAL", "T_NOT", "$accept", "input", "mainmenu_stmt",
547 "stmt_list", "common_stmt", "config_entry_start", "config_stmt",
548 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
549 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
550 "choice_option_list", "choice_option", "type", "logic_type", "default",
551 "choice_block", "if_entry", "if_end", "if_stmt", "menu", "menu_entry",
552 "menu_end", "menu_stmt", "menu_option_list", "source_stmt", "comment",
553 "comment_stmt", "comment_option_list", "help_start", "help", "depends",
554 "visible", "prompt_stmt_opt", "end", "if_expr", "expr",
555 "nonconst_symbol", "symbol", "word_opt", "assignment_stmt", "assign_op",
556 "assign_val", YY_NULLPTR
561 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
562 (internal) symbol number NUM (which must be that of a token). */
563 static const yytype_uint16 yytoknum[] =
565 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
566 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
567 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
568 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
569 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
574 #define YYPACT_NINF -107
576 #define yypact_value_is_default(Yystate) \
577 (!!((Yystate) == (-107)))
579 #define YYTABLE_NINF -4
581 #define yytable_value_is_error(Yytable_value) \
584 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
586 static const yytype_int16 yypact[] =
588 -6, 24, 33, -107, 65, -7, -107, 71, -4, 12,
589 49, 53, 63, -1, 69, 63, 76, -107, -107, -107,
590 -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
591 -107, -107, -107, -107, -107, -107, 25, -107, -107, -107,
592 26, -107, 46, 47, -107, 54, -107, -1, -1, -22,
593 -107, 142, 58, 60, 68, 134, 134, 147, 114, 101,
594 2, 101, 67, -107, -107, 72, -107, -107, -107, 5,
595 -107, -107, -1, -1, 44, 44, 44, 44, 44, 44,
596 -107, -107, -107, -107, -107, -107, -107, 66, 73, -107,
597 63, -107, 94, 109, 44, 63, -107, -107, -107, 112,
598 -107, -1, 103, -107, -107, 63, 79, 122, 107, -107,
599 112, -107, -107, 8, 88, 92, 93, -107, -107, -107,
600 -107, -107, 107, -107, -107, -107, -107, -107, -107, -107,
601 97, -107, -107, -107, -107, -107, -107, -107, -1, -107,
602 107, 95, 96, 102, 107, 44, 107, 107, 105, 41,
603 -107, 107, -107, 107, -1, 118, 119, -107, -107, -107,
604 120, 17, 124, -107, -107, -107, 128, 107, 130, -107,
605 -107, 133, 135, 136, 11, -107, -107, -107, -107, -107,
606 -107, 138, -107, -107, -107, -107, -107
609 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
610 Performed when YYTABLE does not specify something else to do. Zero
611 means the default is an error. */
612 static const yytype_uint8 yydefact[] =
614 5, 0, 0, 5, 0, 0, 1, 0, 0, 0,
615 98, 0, 0, 0, 0, 0, 0, 6, 21, 13,
616 21, 14, 38, 56, 7, 5, 11, 65, 5, 8,
617 15, 71, 12, 16, 4, 10, 0, 102, 103, 101,
618 104, 99, 0, 0, 95, 0, 97, 0, 0, 0,
619 96, 84, 0, 0, 0, 18, 20, 35, 0, 0,
620 62, 0, 70, 9, 105, 0, 34, 69, 17, 0,
621 92, 58, 0, 0, 0, 0, 0, 0, 0, 0,
622 61, 19, 68, 51, 53, 54, 55, 0, 0, 49,
623 0, 48, 0, 0, 0, 0, 50, 52, 22, 77,
624 47, 0, 0, 24, 23, 0, 0, 0, 82, 39,
625 77, 41, 40, 0, 0, 0, 0, 57, 37, 36,
626 60, 59, 82, 67, 66, 64, 63, 72, 100, 91,
627 93, 94, 89, 90, 85, 86, 87, 88, 0, 73,
628 82, 0, 0, 0, 82, 0, 82, 82, 0, 82,
629 74, 82, 44, 82, 0, 0, 0, 80, 81, 79,
630 0, 0, 0, 33, 32, 31, 0, 82, 0, 78,
631 25, 0, 0, 0, 83, 45, 43, 76, 75, 29,
632 26, 0, 28, 27, 46, 42, 30
635 /* YYPGOTO[NTERM-NUM]. */
636 static const yytype_int8 yypgoto[] =
638 -107, -107, -107, 3, 86, -107, -107, -107, -107, 126,
639 -107, -107, -107, -107, -107, -107, -107, -107, 100, -107,
640 -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
641 -107, -107, -107, -107, 108, -25, -107, 42, -44, -106,
642 -47, -10, -67, -107, -107, -107, -107
645 /* YYDEFGOTO[NTERM-NUM]. */
646 static const yytype_int16 yydefgoto[] =
648 -1, 2, 3, 4, 17, 18, 19, 20, 21, 55,
649 98, 22, 23, 118, 24, 57, 109, 99, 100, 101,
650 58, 25, 120, 26, 27, 28, 125, 29, 60, 30,
651 31, 32, 62, 102, 103, 104, 124, 148, 119, 155,
652 49, 50, 51, 42, 33, 40, 65
655 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
656 positive, shift that token. If negative, reduce the rule whose
657 number is the opposite. If YYTABLE_NINF, syntax error. */
658 static const yytype_int16 yytable[] =
660 69, 70, 45, 44, 46, 53, 7, 132, 133, 134,
661 135, 136, 137, 36, 129, 121, 160, 126, 37, 87,
662 1, 71, 37, 72, 73, 130, 131, 145, 59, 5,
663 47, 61, 112, 6, 162, 123, 34, 127, 166, 35,
664 168, 169, 38, 171, 122, 172, 38, 173, 44, 46,
665 72, 73, 48, 41, 149, 39, 72, 73, 43, 39,
666 178, 181, 72, 73, 154, -3, 8, 44, 63, 9,
667 64, -2, 8, 10, 52, 9, 11, 12, 167, 10,
668 140, 54, 11, 12, 87, 146, 72, 73, 13, 66,
669 67, 161, 14, 15, 13, 151, 138, 68, 14, 15,
670 141, 80, 8, 81, 16, 9, 150, 174, 142, 10,
671 16, 82, 11, 12, 144, 128, 139, 147, 113, 114,
672 115, 116, 152, 143, 13, 11, 12, 153, 14, 15,
673 154, 157, 114, 115, 116, 158, 159, 13, 163, 164,
674 16, 83, 15, 73, 117, 165, 56, 84, 170, 85,
675 86, 87, 156, 16, 83, 88, 89, 110, 90, 91,
676 105, 175, 176, 177, 87, 111, 92, 179, 88, 93,
677 94, 180, 95, 182, 96, 97, 183, 0, 184, 185,
678 106, 186, 107, 0, 108, 0, 0, 0, 97, 74,
682 static const yytype_int16 yycheck[] =
684 47, 48, 12, 4, 5, 15, 3, 74, 75, 76,
685 77, 78, 79, 1, 9, 59, 122, 61, 10, 17,
686 26, 43, 10, 45, 46, 72, 73, 94, 25, 5,
687 31, 28, 57, 0, 140, 60, 43, 62, 144, 43,
688 146, 147, 34, 149, 42, 151, 34, 153, 4, 5,
689 45, 46, 53, 4, 101, 47, 45, 46, 5, 47,
690 43, 167, 45, 46, 23, 0, 1, 4, 43, 4,
691 44, 0, 1, 8, 5, 4, 11, 12, 145, 8,
692 90, 5, 11, 12, 17, 95, 45, 46, 23, 43,
693 43, 138, 27, 28, 23, 105, 30, 43, 27, 28,
694 6, 43, 1, 43, 39, 4, 3, 154, 14, 8,
695 39, 43, 11, 12, 5, 43, 43, 5, 4, 18,
696 19, 20, 43, 29, 23, 11, 12, 5, 27, 28,
697 23, 43, 18, 19, 20, 43, 43, 23, 43, 43,
698 39, 7, 28, 46, 58, 43, 20, 13, 43, 15,
699 16, 17, 110, 39, 7, 21, 22, 57, 24, 25,
700 13, 43, 43, 43, 17, 57, 32, 43, 21, 35,
701 36, 43, 38, 43, 40, 41, 43, -1, 43, 43,
702 33, 43, 35, -1, 37, -1, -1, -1, 41, 47,
706 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
707 symbol of state STATE-NUM. */
708 static const yytype_uint8 yystos[] =
710 0, 26, 55, 56, 57, 5, 0, 57, 1, 4,
711 8, 11, 12, 23, 27, 28, 39, 58, 59, 60,
712 61, 62, 65, 66, 68, 75, 77, 78, 79, 81,
713 83, 84, 85, 98, 43, 43, 1, 10, 34, 47,
714 99, 4, 97, 5, 4, 95, 5, 31, 53, 94,
715 95, 96, 5, 95, 5, 63, 63, 69, 74, 57,
716 82, 57, 86, 43, 44, 100, 43, 43, 43, 94,
717 94, 43, 45, 46, 47, 48, 49, 50, 51, 52,
718 43, 43, 43, 7, 13, 15, 16, 17, 21, 22,
719 24, 25, 32, 35, 36, 38, 40, 41, 64, 71,
720 72, 73, 87, 88, 89, 13, 33, 35, 37, 70,
721 72, 88, 89, 4, 18, 19, 20, 58, 67, 92,
722 76, 92, 42, 89, 90, 80, 92, 89, 43, 9,
723 94, 94, 96, 96, 96, 96, 96, 96, 30, 43,
724 95, 6, 14, 29, 5, 96, 95, 5, 91, 94,
725 3, 95, 43, 5, 23, 93, 91, 43, 43, 43,
726 93, 94, 93, 43, 43, 43, 93, 96, 93, 93,
727 43, 93, 93, 93, 94, 43, 43, 43, 43, 43,
728 43, 93, 43, 43, 43, 43, 43
731 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
732 static const yytype_uint8 yyr1[] =
734 0, 54, 55, 55, 56, 57, 57, 57, 57, 57,
735 57, 58, 58, 58, 58, 58, 58, 59, 60, 61,
736 62, 63, 63, 63, 63, 64, 64, 64, 64, 64,
737 64, 64, 64, 64, 65, 66, 67, 68, 69, 69,
738 69, 69, 70, 70, 70, 70, 70, 71, 71, 71,
739 71, 72, 72, 73, 73, 73, 74, 74, 75, 76,
740 77, 78, 79, 80, 81, 82, 82, 82, 83, 84,
741 85, 86, 86, 87, 88, 89, 90, 91, 91, 92,
742 92, 92, 93, 93, 94, 94, 94, 94, 94, 94,
743 94, 94, 94, 94, 94, 95, 96, 96, 97, 97,
744 98, 99, 99, 99, 100, 100
747 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
748 static const yytype_uint8 yyr2[] =
750 0, 2, 2, 1, 3, 0, 2, 2, 2, 4,
751 3, 1, 1, 1, 1, 1, 1, 3, 2, 3,
752 2, 0, 2, 2, 2, 3, 4, 4, 4, 4,
753 5, 3, 3, 3, 3, 2, 1, 3, 0, 2,
754 2, 2, 4, 3, 2, 3, 4, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 0, 2, 3, 1,
756 3, 3, 2, 1, 3, 0, 2, 2, 3, 3,
757 2, 0, 2, 2, 2, 4, 3, 0, 2, 2,
758 2, 2, 0, 2, 1, 3, 3, 3, 3, 3,
759 3, 3, 2, 3, 3, 1, 1, 1, 0, 1,
764 #define yyerrok (yyerrstatus = 0)
765 #define yyclearin (yychar = YYEMPTY)
769 #define YYACCEPT goto yyacceptlab
770 #define YYABORT goto yyabortlab
771 #define YYERROR goto yyerrorlab
774 #define YYRECOVERING() (!!yyerrstatus)
776 #define YYBACKUP(Token, Value) \
778 if (yychar == YYEMPTY) \
782 YYPOPSTACK (yylen); \
788 yyerror (YY_("syntax error: cannot back up")); \
793 /* Error token number */
795 #define YYERRCODE 256
799 /* Enable debugging if requested. */
803 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
804 # define YYFPRINTF fprintf
807 # define YYDPRINTF(Args) \
813 /* This macro is provided for backward compatibility. */
814 #ifndef YY_LOCATION_PRINT
815 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
819 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
823 YYFPRINTF (stderr, "%s ", Title); \
824 yy_symbol_print (stderr, \
826 YYFPRINTF (stderr, "\n"); \
831 /*----------------------------------------.
832 | Print this symbol's value on YYOUTPUT. |
833 `----------------------------------------*/
836 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
838 FILE *yyo = yyoutput;
843 if (yytype < YYNTOKENS)
844 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
850 /*--------------------------------.
851 | Print this symbol on YYOUTPUT. |
852 `--------------------------------*/
855 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
857 YYFPRINTF (yyoutput, "%s %s (",
858 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
860 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
861 YYFPRINTF (yyoutput, ")");
864 /*------------------------------------------------------------------.
865 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
867 `------------------------------------------------------------------*/
870 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
872 YYFPRINTF (stderr, "Stack now");
873 for (; yybottom <= yytop; yybottom++)
875 int yybot = *yybottom;
876 YYFPRINTF (stderr, " %d", yybot);
878 YYFPRINTF (stderr, "\n");
881 # define YY_STACK_PRINT(Bottom, Top) \
884 yy_stack_print ((Bottom), (Top)); \
888 /*------------------------------------------------.
889 | Report that the YYRULE is going to be reduced. |
890 `------------------------------------------------*/
893 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
895 unsigned long yylno = yyrline[yyrule];
896 int yynrhs = yyr2[yyrule];
898 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
900 /* The symbols being reduced. */
901 for (yyi = 0; yyi < yynrhs; yyi++)
903 YYFPRINTF (stderr, " $%d = ", yyi + 1);
904 yy_symbol_print (stderr,
905 yystos[yyssp[yyi + 1 - yynrhs]],
906 &(yyvsp[(yyi + 1) - (yynrhs)])
908 YYFPRINTF (stderr, "\n");
912 # define YY_REDUCE_PRINT(Rule) \
915 yy_reduce_print (yyssp, yyvsp, Rule); \
918 /* Nonzero means print parse trace. It is left uninitialized so that
919 multiple parsers can coexist. */
922 # define YYDPRINTF(Args)
923 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
924 # define YY_STACK_PRINT(Bottom, Top)
925 # define YY_REDUCE_PRINT(Rule)
926 #endif /* !YYDEBUG */
929 /* YYINITDEPTH -- initial size of the parser's stacks. */
931 # define YYINITDEPTH 200
934 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
935 if the built-in stack extension method is used).
937 Do not make this value too large; the results are undefined if
938 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
939 evaluated with infinite-precision integer arithmetic. */
942 # define YYMAXDEPTH 10000
949 # if defined __GLIBC__ && defined _STRING_H
950 # define yystrlen strlen
952 /* Return the length of YYSTR. */
954 yystrlen (const char *yystr)
957 for (yylen = 0; yystr[yylen]; yylen++)
965 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
966 # define yystpcpy stpcpy
968 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
971 yystpcpy (char *yydest, const char *yysrc)
974 const char *yys = yysrc;
976 while ((*yyd++ = *yys++) != '\0')
985 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
986 quotes and backslashes, so that it's suitable for yyerror. The
987 heuristic is that double-quoting is unnecessary unless the string
988 contains an apostrophe, a comma, or backslash (other than
989 backslash-backslash). YYSTR is taken from yytname. If YYRES is
990 null, do not copy; instead, return the length of what the result
993 yytnamerr (char *yyres, const char *yystr)
998 char const *yyp = yystr;
1005 goto do_not_strip_quotes;
1009 goto do_not_strip_quotes;
1022 do_not_strip_quotes: ;
1026 return yystrlen (yystr);
1028 return yystpcpy (yyres, yystr) - yyres;
1032 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1033 about the unexpected token YYTOKEN for the state stack whose top is
1036 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1037 not large enough to hold the message. In that case, also set
1038 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1039 required number of bytes is too large to store. */
1041 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1042 yytype_int16 *yyssp, int yytoken)
1044 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1045 YYSIZE_T yysize = yysize0;
1046 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1047 /* Internationalized format string. */
1048 const char *yyformat = YY_NULLPTR;
1049 /* Arguments of yyformat. */
1050 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1051 /* Number of reported tokens (one for the "unexpected", one per
1055 /* There are many possibilities here to consider:
1056 - If this state is a consistent state with a default action, then
1057 the only way this function was invoked is if the default action
1058 is an error action. In that case, don't check for expected
1059 tokens because there are none.
1060 - The only way there can be no lookahead present (in yychar) is if
1061 this state is a consistent state with a default action. Thus,
1062 detecting the absence of a lookahead is sufficient to determine
1063 that there is no unexpected or expected token to report. In that
1064 case, just report a simple "syntax error".
1065 - Don't assume there isn't a lookahead just because this state is a
1066 consistent state with a default action. There might have been a
1067 previous inconsistent state, consistent state with a non-default
1068 action, or user semantic action that manipulated yychar.
1069 - Of course, the expected token list depends on states to have
1070 correct lookahead information, and it depends on the parser not
1071 to perform extra reductions after fetching a lookahead from the
1072 scanner and before detecting a syntax error. Thus, state merging
1073 (from LALR or IELR) and default reductions corrupt the expected
1074 token list. However, the list is correct for canonical LR with
1075 one exception: it will still contain any token that will not be
1076 accepted due to an error action in a later state.
1078 if (yytoken != YYEMPTY)
1080 int yyn = yypact[*yyssp];
1081 yyarg[yycount++] = yytname[yytoken];
1082 if (!yypact_value_is_default (yyn))
1084 /* Start YYX at -YYN if negative to avoid negative indexes in
1085 YYCHECK. In other words, skip the first -YYN actions for
1086 this state because they are default actions. */
1087 int yyxbegin = yyn < 0 ? -yyn : 0;
1088 /* Stay within bounds of both yycheck and yytname. */
1089 int yychecklim = YYLAST - yyn + 1;
1090 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1093 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1094 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1095 && !yytable_value_is_error (yytable[yyx + yyn]))
1097 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1103 yyarg[yycount++] = yytname[yyx];
1105 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1106 if (! (yysize <= yysize1
1107 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1117 # define YYCASE_(N, S) \
1121 default: /* Avoid compiler warnings. */
1122 YYCASE_(0, YY_("syntax error"));
1123 YYCASE_(1, YY_("syntax error, unexpected %s"));
1124 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1125 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1126 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1127 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1132 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1133 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1138 if (*yymsg_alloc < yysize)
1140 *yymsg_alloc = 2 * yysize;
1141 if (! (yysize <= *yymsg_alloc
1142 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1143 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1147 /* Avoid sprintf, as that infringes on the user's name space.
1148 Don't have undefined behavior even if the translation
1149 produced a string with the wrong number of "%s"s. */
1153 while ((*yyp = *yyformat) != '\0')
1154 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1156 yyp += yytnamerr (yyp, yyarg[yyi++]);
1167 #endif /* YYERROR_VERBOSE */
1169 /*-----------------------------------------------.
1170 | Release the memory associated to this symbol. |
1171 `-----------------------------------------------*/
1174 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1179 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1181 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1184 case 66: /* choice_entry */
1187 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1188 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1189 if (current_menu == ((*yyvaluep).menu))
1195 case 75: /* if_entry */
1198 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1199 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1200 if (current_menu == ((*yyvaluep).menu))
1206 case 79: /* menu_entry */
1209 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1210 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1211 if (current_menu == ((*yyvaluep).menu))
1221 YY_IGNORE_MAYBE_UNINITIALIZED_END
1227 /* The lookahead symbol. */
1230 /* The semantic value of the lookahead symbol. */
1232 /* Number of syntax errors so far. */
1244 /* Number of tokens to shift before error messages enabled. */
1247 /* The stacks and their tools:
1248 'yyss': related to states.
1249 'yyvs': related to semantic values.
1251 Refer to the stacks through separate pointers, to allow yyoverflow
1252 to reallocate them elsewhere. */
1254 /* The state stack. */
1255 yytype_int16 yyssa[YYINITDEPTH];
1257 yytype_int16 *yyssp;
1259 /* The semantic value stack. */
1260 YYSTYPE yyvsa[YYINITDEPTH];
1264 YYSIZE_T yystacksize;
1268 /* Lookahead token as an internal (translated) token number. */
1270 /* The variables used to return semantic value and location from the
1275 /* Buffer for error messages, and its allocated size. */
1277 char *yymsg = yymsgbuf;
1278 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1281 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1283 /* The number of symbols on the RHS of the reduced rule.
1284 Keep to zero when no symbol should be popped. */
1287 yyssp = yyss = yyssa;
1288 yyvsp = yyvs = yyvsa;
1289 yystacksize = YYINITDEPTH;
1291 YYDPRINTF ((stderr, "Starting parse\n"));
1296 yychar = YYEMPTY; /* Cause a token to be read. */
1299 /*------------------------------------------------------------.
1300 | yynewstate -- Push a new state, which is found in yystate. |
1301 `------------------------------------------------------------*/
1303 /* In all cases, when you get here, the value and location stacks
1304 have just been pushed. So pushing a state here evens the stacks. */
1310 if (yyss + yystacksize - 1 <= yyssp)
1312 /* Get the current used size of the three stacks, in elements. */
1313 YYSIZE_T yysize = yyssp - yyss + 1;
1317 /* Give user a chance to reallocate the stack. Use copies of
1318 these so that the &'s don't force the real ones into
1320 YYSTYPE *yyvs1 = yyvs;
1321 yytype_int16 *yyss1 = yyss;
1323 /* Each stack pointer address is followed by the size of the
1324 data in use in that stack, in bytes. This used to be a
1325 conditional around just the two extra args, but that might
1326 be undefined if yyoverflow is a macro. */
1327 yyoverflow (YY_("memory exhausted"),
1328 &yyss1, yysize * sizeof (*yyssp),
1329 &yyvs1, yysize * sizeof (*yyvsp),
1335 #else /* no yyoverflow */
1336 # ifndef YYSTACK_RELOCATE
1337 goto yyexhaustedlab;
1339 /* Extend the stack our own way. */
1340 if (YYMAXDEPTH <= yystacksize)
1341 goto yyexhaustedlab;
1343 if (YYMAXDEPTH < yystacksize)
1344 yystacksize = YYMAXDEPTH;
1347 yytype_int16 *yyss1 = yyss;
1348 union yyalloc *yyptr =
1349 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1351 goto yyexhaustedlab;
1352 YYSTACK_RELOCATE (yyss_alloc, yyss);
1353 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1354 # undef YYSTACK_RELOCATE
1356 YYSTACK_FREE (yyss1);
1359 #endif /* no yyoverflow */
1361 yyssp = yyss + yysize - 1;
1362 yyvsp = yyvs + yysize - 1;
1364 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1365 (unsigned long) yystacksize));
1367 if (yyss + yystacksize - 1 <= yyssp)
1371 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1373 if (yystate == YYFINAL)
1383 /* Do appropriate processing given the current state. Read a
1384 lookahead token if we need one and don't already have one. */
1386 /* First try to decide what to do without reference to lookahead token. */
1387 yyn = yypact[yystate];
1388 if (yypact_value_is_default (yyn))
1391 /* Not known => get a lookahead token if don't already have one. */
1393 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1394 if (yychar == YYEMPTY)
1396 YYDPRINTF ((stderr, "Reading a token: "));
1400 if (yychar <= YYEOF)
1402 yychar = yytoken = YYEOF;
1403 YYDPRINTF ((stderr, "Now at end of input.\n"));
1407 yytoken = YYTRANSLATE (yychar);
1408 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1411 /* If the proper action on seeing token YYTOKEN is to reduce or to
1412 detect an error, take that action. */
1414 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1419 if (yytable_value_is_error (yyn))
1425 /* Count tokens shifted since error; after three, turn off error
1430 /* Shift the lookahead token. */
1431 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1433 /* Discard the shifted token. */
1437 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1439 YY_IGNORE_MAYBE_UNINITIALIZED_END
1444 /*-----------------------------------------------------------.
1445 | yydefault -- do the default action for the current state. |
1446 `-----------------------------------------------------------*/
1448 yyn = yydefact[yystate];
1454 /*-----------------------------.
1455 | yyreduce -- Do a reduction. |
1456 `-----------------------------*/
1458 /* yyn is the number of a rule to reduce with. */
1461 /* If YYLEN is nonzero, implement the default value of the action:
1464 Otherwise, the following line sets YYVAL to garbage.
1465 This behavior is undocumented and Bison
1466 users should not rely upon it. Assigning to YYVAL
1467 unconditionally makes the parser a bit smaller, and it avoids a
1468 GCC warning that YYVAL may be used uninitialized. */
1469 yyval = yyvsp[1-yylen];
1472 YY_REDUCE_PRINT (yyn);
1478 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1485 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); }
1491 { zconf_error("invalid statement"); }
1498 (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL;
1499 menu_add_entry((yyvsp[-1].symbol));
1500 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name);
1508 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1516 (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL;
1517 menu_add_entry((yyvsp[-1].symbol));
1518 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name);
1526 if (current_entry->prompt)
1527 current_entry->prompt->type = P_MENU;
1529 zconfprint("warning: menuconfig statement without prompt");
1530 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1538 menu_set_type((yyvsp[-2].type));
1539 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1540 zconf_curname(), zconf_lineno(),
1549 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1550 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1558 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1559 if ((yyvsp[-3].type) != S_UNKNOWN)
1560 menu_set_type((yyvsp[-3].type));
1561 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1562 zconf_curname(), zconf_lineno(),
1571 menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1572 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1580 menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1581 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1589 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1590 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1598 menu_add_option_modules();
1606 menu_add_option_defconfig_list();
1614 menu_add_option_allnoconfig_y();
1622 struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE);
1623 sym->flags |= SYMBOL_NO_WRITE;
1624 menu_add_entry(sym);
1625 menu_add_expr(P_CHOICE, NULL, NULL);
1626 free((yyvsp[-1].string));
1627 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1635 (yyval.menu) = menu_add_menu();
1643 if (zconf_endtoken((yyvsp[0].string), "choice")) {
1645 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1654 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1655 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1663 menu_set_type((yyvsp[-2].type));
1664 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1665 zconf_curname(), zconf_lineno(), (yyvsp[-2].type));
1673 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1674 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1682 menu_add_prop(P_RESET, NULL, (yyvsp[-1].expr));
1690 menu_add_symbol(P_DEFAULT, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1691 printd(DEBUG_PARSE, "%s:%d:default\n",
1692 zconf_curname(), zconf_lineno());
1699 { (yyval.type) = S_INT; }
1705 { (yyval.type) = S_HEX; }
1711 { (yyval.type) = S_STRING; }
1717 { (yyval.type) = S_BOOLEAN; }
1723 { (yyval.type) = S_TRISTATE; }
1729 { (yyval.type) = S_UNKNOWN; }
1735 { (yyval.type) = S_BOOLEAN; }
1741 { (yyval.type) = S_TRISTATE; }
1748 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1749 menu_add_entry(NULL);
1750 menu_add_dep((yyvsp[-1].expr));
1751 (yyval.menu) = menu_add_menu();
1759 if (zconf_endtoken((yyvsp[0].string), "if")) {
1761 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1770 menu_add_entry(NULL);
1771 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1772 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1780 (yyval.menu) = menu_add_menu();
1788 if (zconf_endtoken((yyvsp[0].string), "menu")) {
1790 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1799 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1800 zconf_nextfile((yyvsp[-1].string));
1801 free((yyvsp[-1].string));
1809 menu_add_entry(NULL);
1810 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1811 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1819 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1828 /* Is the help text empty or all whitespace? */
1829 if ((yyvsp[0].string)[strspn((yyvsp[0].string), " \f\n\r\t\v")] == '\0')
1830 zconfprint("warning: '%s' defined with blank help text",
1831 current_entry->sym->name ?: "<choice>");
1833 current_entry->help = (yyvsp[0].string);
1841 menu_add_dep((yyvsp[-1].expr));
1842 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1850 menu_add_visibility((yyvsp[-1].expr));
1858 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1865 { (yyval.string) = "menu"; }
1871 { (yyval.string) = "choice"; }
1877 { (yyval.string) = "if"; }
1883 { (yyval.expr) = NULL; }
1889 { (yyval.expr) = (yyvsp[0].expr); }
1895 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); }
1901 { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1907 { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1913 { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1919 { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1925 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1931 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1937 { (yyval.expr) = (yyvsp[-1].expr); }
1943 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); }
1949 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1955 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1961 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); }
1967 { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); }
1973 { (yyval.string) = NULL; }
1979 { variable_add((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[-2].flavor)); free((yyvsp[-3].string)); free((yyvsp[-1].string)); }
1985 { (yyval.flavor) = VAR_RECURSIVE; }
1991 { (yyval.flavor) = VAR_SIMPLE; }
1997 { (yyval.flavor) = VAR_APPEND; }
2003 { (yyval.string) = xstrdup(""); }
2011 /* User semantic actions sometimes alter yychar, and that requires
2012 that yytoken be updated with the new translation. We take the
2013 approach of translating immediately before every use of yytoken.
2014 One alternative is translating here after every semantic action,
2015 but that translation would be missed if the semantic action invokes
2016 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2017 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2018 incorrect destructor might then be invoked immediately. In the
2019 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2020 to an incorrect destructor call or verbose syntax error message
2021 before the lookahead is translated. */
2022 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2026 YY_STACK_PRINT (yyss, yyssp);
2030 /* Now 'shift' the result of the reduction. Determine what state
2031 that goes to, based on the state we popped back to and the rule
2032 number reduced by. */
2036 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2037 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2038 yystate = yytable[yystate];
2040 yystate = yydefgoto[yyn - YYNTOKENS];
2045 /*--------------------------------------.
2046 | yyerrlab -- here on detecting error. |
2047 `--------------------------------------*/
2049 /* Make sure we have latest lookahead translation. See comments at
2050 user semantic actions for why this is necessary. */
2051 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2053 /* If not already recovering from an error, report this error. */
2057 #if ! YYERROR_VERBOSE
2058 yyerror (YY_("syntax error"));
2060 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2063 char const *yymsgp = YY_("syntax error");
2064 int yysyntax_error_status;
2065 yysyntax_error_status = YYSYNTAX_ERROR;
2066 if (yysyntax_error_status == 0)
2068 else if (yysyntax_error_status == 1)
2070 if (yymsg != yymsgbuf)
2071 YYSTACK_FREE (yymsg);
2072 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2076 yymsg_alloc = sizeof yymsgbuf;
2077 yysyntax_error_status = 2;
2081 yysyntax_error_status = YYSYNTAX_ERROR;
2086 if (yysyntax_error_status == 2)
2087 goto yyexhaustedlab;
2089 # undef YYSYNTAX_ERROR
2095 if (yyerrstatus == 3)
2097 /* If just tried and failed to reuse lookahead 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 lookahead 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 whose 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 (!yypact_value_is_default (yyn))
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);
2171 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2173 YY_IGNORE_MAYBE_UNINITIALIZED_END
2176 /* Shift the error token. */
2177 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2183 /*-------------------------------------.
2184 | yyacceptlab -- YYACCEPT comes here. |
2185 `-------------------------------------*/
2190 /*-----------------------------------.
2191 | yyabortlab -- YYABORT comes here. |
2192 `-----------------------------------*/
2197 #if !defined yyoverflow || YYERROR_VERBOSE
2198 /*-------------------------------------------------.
2199 | yyexhaustedlab -- memory exhaustion comes here. |
2200 `-------------------------------------------------*/
2202 yyerror (YY_("memory exhausted"));
2208 if (yychar != YYEMPTY)
2210 /* Make sure we have latest lookahead translation. See comments at
2211 user semantic actions for why this is necessary. */
2212 yytoken = YYTRANSLATE (yychar);
2213 yydestruct ("Cleanup: discarding lookahead",
2216 /* Do not reclaim the symbols of the rule whose action triggered
2217 this YYABORT or YYACCEPT. */
2219 YY_STACK_PRINT (yyss, yyssp);
2220 while (yyssp != yyss)
2222 yydestruct ("Cleanup: popping",
2223 yystos[*yyssp], yyvsp);
2228 YYSTACK_FREE (yyss);
2231 if (yymsg != yymsgbuf)
2232 YYSTACK_FREE (yymsg);
2239 void conf_parse(const char *name)
2244 zconf_initscan(name);
2249 if (getenv("ZCONF_DEBUG"))
2254 /* Variables are expanded in the parse phase. We can free them here. */
2260 modules_sym = sym_find( "n" );
2262 if (!menu_has_prompt(&rootmenu)) {
2263 current_entry = &rootmenu;
2264 menu_add_prompt(P_MENU, "Main menu", NULL);
2267 menu_finalize(&rootmenu);
2268 for_all_symbols(i, sym) {
2269 if (sym_check_deps(sym))
2274 sym_set_change_count(1);
2277 static bool zconf_endtoken(const char *tokenname,
2278 const char *expected_tokenname)
2280 if (strcmp(tokenname, expected_tokenname)) {
2281 zconf_error("unexpected '%s' within %s block",
2282 tokenname, expected_tokenname);
2286 if (current_menu->file != current_file) {
2287 zconf_error("'%s' in different file than '%s'",
2288 tokenname, expected_tokenname);
2289 fprintf(stderr, "%s:%d: location of the '%s'\n",
2290 current_menu->file->name, current_menu->lineno,
2291 expected_tokenname);
2298 static void zconfprint(const char *err, ...)
2302 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2304 vfprintf(stderr, err, ap);
2306 fprintf(stderr, "\n");
2309 static void zconf_error(const char *err, ...)
2314 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2316 vfprintf(stderr, err, ap);
2318 fprintf(stderr, "\n");
2321 static void yyerror(const char *err)
2323 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2326 static void print_quoted_string(FILE *out, const char *str)
2332 while ((p = strchr(str, '"'))) {
2335 fprintf(out, "%.*s", len, str);
2343 static void print_symbol(FILE *out, struct menu *menu)
2345 struct symbol *sym = menu->sym;
2346 struct property *prop;
2348 if (sym_is_choice(sym))
2349 fprintf(out, "\nchoice\n");
2351 fprintf(out, "\nconfig %s\n", sym->name);
2352 switch (sym->type) {
2354 fputs(" bool\n", out);
2357 fputs(" tristate\n", out);
2360 fputs(" string\n", out);
2363 fputs(" integer\n", out);
2366 fputs(" hex\n", out);
2369 fputs(" ???\n", out);
2372 for (prop = sym->prop; prop; prop = prop->next) {
2373 if (prop->menu != menu)
2375 switch (prop->type) {
2377 fputs(" prompt ", out);
2378 print_quoted_string(out, prop->text);
2379 if (!expr_is_yes(prop->visible.expr)) {
2381 expr_fprint(prop->visible.expr, out);
2386 fputs( " default ", out);
2387 expr_fprint(prop->expr, out);
2388 if (!expr_is_yes(prop->visible.expr)) {
2390 expr_fprint(prop->visible.expr, out);
2395 fputs(" #choice value\n", out);
2398 fputs( " select ", out);
2399 expr_fprint(prop->expr, out);
2403 fputs( " imply ", out);
2404 expr_fprint(prop->expr, out);
2408 fputs( " range ", out);
2409 expr_fprint(prop->expr, out);
2413 fputs( " menu ", out);
2414 print_quoted_string(out, prop->text);
2418 fputs( " symbol ", out);
2419 fprintf(out, "%s\n", prop->menu->sym->name);
2422 fprintf(out, " unknown prop %d!\n", prop->type);
2427 int len = strlen(menu->help);
2428 while (menu->help[--len] == '\n')
2429 menu->help[len] = 0;
2430 fprintf(out, " help\n%s\n", menu->help);
2434 void zconfdump(FILE *out)
2436 struct property *prop;
2440 menu = rootmenu.list;
2442 if ((sym = menu->sym))
2443 print_symbol(out, menu);
2444 else if ((prop = menu->prompt)) {
2445 switch (prop->type) {
2447 fputs("\ncomment ", out);
2448 print_quoted_string(out, prop->text);
2452 fputs("\nmenu ", out);
2453 print_quoted_string(out, prop->text);
2459 if (!expr_is_yes(prop->visible.expr)) {
2460 fputs(" depends ", out);
2461 expr_fprint(prop->visible.expr, out);
2468 else if (menu->next)
2470 else while ((menu = menu->parent)) {
2471 if (menu->prompt && menu->prompt->type == P_MENU)
2472 fputs("\nendmenu\n", out);