1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 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.0.4"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
68 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
69 * Released under the terms of the GNU GPL v2.0.
81 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
84 #define DEBUG_PARSE 0x0002
89 static void yyerror(const char *err
);
90 static void zconfprint(const char *err
, ...);
91 static void zconf_error(const char *err
, ...);
92 static bool zconf_endtoken(const struct kconf_id
*id
, int starttoken
, int endtoken
);
94 struct symbol
*symbol_hash
[SYMBOL_HASHSIZE
];
96 static struct menu
*current_menu
, *current_entry
;
102 # if defined __cplusplus && 201103L <= __cplusplus
103 # define YY_NULLPTR nullptr
105 # define YY_NULLPTR 0
109 /* Enabling verbose error messages. */
110 #ifdef YYERROR_VERBOSE
111 # undef YYERROR_VERBOSE
112 # define YYERROR_VERBOSE 1
114 # define YYERROR_VERBOSE 0
161 T_GREATER_EQUAL
= 288,
173 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
181 struct symbol
*symbol
;
184 const struct kconf_id
*id
;
189 typedef union YYSTYPE YYSTYPE
;
190 # define YYSTYPE_IS_TRIVIAL 1
191 # define YYSTYPE_IS_DECLARED 1
195 extern YYSTYPE yylval
;
201 /* Copy the second part of user declarations. */
204 /* Include kconf_id.c here so it can see the token constants. */
205 #include "kconf_id.c"
214 typedef YYTYPE_UINT8 yytype_uint8
;
216 typedef unsigned char yytype_uint8
;
220 typedef YYTYPE_INT8 yytype_int8
;
222 typedef signed char yytype_int8
;
226 typedef YYTYPE_UINT16 yytype_uint16
;
228 typedef unsigned short int yytype_uint16
;
232 typedef YYTYPE_INT16 yytype_int16
;
234 typedef short int yytype_int16
;
238 # ifdef __SIZE_TYPE__
239 # define YYSIZE_T __SIZE_TYPE__
240 # elif defined size_t
241 # define YYSIZE_T size_t
242 # elif ! defined YYSIZE_T
243 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
244 # define YYSIZE_T size_t
246 # define YYSIZE_T unsigned int
250 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
253 # if defined YYENABLE_NLS && YYENABLE_NLS
255 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
256 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
260 # define YY_(Msgid) Msgid
265 # if (defined __GNUC__ \
266 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
267 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
268 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
270 # define YY_ATTRIBUTE(Spec) /* empty */
274 #ifndef YY_ATTRIBUTE_PURE
275 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
278 #ifndef YY_ATTRIBUTE_UNUSED
279 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
282 #if !defined _Noreturn \
283 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
284 # if defined _MSC_VER && 1200 <= _MSC_VER
285 # define _Noreturn __declspec (noreturn)
287 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
291 /* Suppress unused-variable warnings by "using" E. */
292 #if ! defined lint || defined __GNUC__
293 # define YYUSE(E) ((void) (E))
295 # define YYUSE(E) /* empty */
298 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
299 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
300 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
301 _Pragma ("GCC diagnostic push") \
302 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
303 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
304 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
305 _Pragma ("GCC diagnostic pop")
307 # define YY_INITIAL_VALUE(Value) Value
309 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
310 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
311 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
313 #ifndef YY_INITIAL_VALUE
314 # define YY_INITIAL_VALUE(Value) /* Nothing. */
318 #if ! defined yyoverflow || YYERROR_VERBOSE
320 /* The parser invokes alloca or malloc; define the necessary symbols. */
322 # ifdef YYSTACK_USE_ALLOCA
323 # if YYSTACK_USE_ALLOCA
325 # define YYSTACK_ALLOC __builtin_alloca
326 # elif defined __BUILTIN_VA_ARG_INCR
327 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
329 # define YYSTACK_ALLOC __alloca
330 # elif defined _MSC_VER
331 # include <malloglob.h> /* INFRINGES ON USER NAME SPACE */
332 # define alloca _alloca
334 # define YYSTACK_ALLOC alloca
335 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
336 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
337 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
338 # ifndef EXIT_SUCCESS
339 # define EXIT_SUCCESS 0
346 # ifdef YYSTACK_ALLOC
347 /* Pacify GCC's 'empty if-body' warning. */
348 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
349 # ifndef YYSTACK_ALLOC_MAXIMUM
350 /* The OS might guarantee only one guard page at the bottom of the stack,
351 and a page size can be as small as 4096 bytes. So we cannot safely
352 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
353 to allow for a few compiler-allocated temporary stack slots. */
354 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
357 # define YYSTACK_ALLOC YYMALLOC
358 # define YYSTACK_FREE YYFREE
359 # ifndef YYSTACK_ALLOC_MAXIMUM
360 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
362 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
363 && ! ((defined YYMALLOC || defined malloc) \
364 && (defined YYFREE || defined free)))
365 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
366 # ifndef EXIT_SUCCESS
367 # define EXIT_SUCCESS 0
371 # define YYMALLOC malloc
372 # if ! defined malloc && ! defined EXIT_SUCCESS
373 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
378 # if ! defined free && ! defined EXIT_SUCCESS
379 void free (void *); /* INFRINGES ON USER NAME SPACE */
383 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
386 #if (! defined yyoverflow \
387 && (! defined __cplusplus \
388 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
390 /* A type that is properly aligned for any stack member. */
393 yytype_int16 yyss_alloc
;
397 /* The size of the maximum gap between one aligned stack and the next. */
398 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
400 /* The size of an array large to enough to hold all stacks, each with
402 # define YYSTACK_BYTES(N) \
403 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
404 + YYSTACK_GAP_MAXIMUM)
406 # define YYCOPY_NEEDED 1
408 /* Relocate STACK from its old location to the new one. The
409 local variables YYSIZE and YYSTACKSIZE give the old and new number of
410 elements in the stack, and YYPTR gives the new location of the
411 stack. Advance YYPTR to a properly aligned location for the next
413 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
416 YYSIZE_T yynewbytes; \
417 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
418 Stack = &yyptr->Stack_alloc; \
419 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
420 yyptr += yynewbytes / sizeof (*yyptr); \
426 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
427 /* Copy COUNT objects from SRC to DST. The source and destination do
430 # if defined __GNUC__ && 1 < __GNUC__
431 # define YYCOPY(Dst, Src, Count) \
432 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
434 # define YYCOPY(Dst, Src, Count) \
438 for (yyi = 0; yyi < (Count); yyi++) \
439 (Dst)[yyi] = (Src)[yyi]; \
444 #endif /* !YYCOPY_NEEDED */
446 /* YYFINAL -- State number of the termination state. */
448 /* YYLAST -- Last index in YYTABLE. */
451 /* YYNTOKENS -- Number of terminals. */
453 /* YYNNTS -- Number of nonterminals. */
455 /* YYNRULES -- Number of rules. */
457 /* YYNSTATES -- Number of states. */
458 #define YYNSTATES 206
460 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
461 by yylex, with out-of-bounds checking. */
463 #define YYMAXUTOK 295
465 #define YYTRANSLATE(YYX) \
466 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
468 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
469 as returned by yylex, without out-of-bounds checking. */
470 static const yytype_uint8 yytranslate
[] =
472 0, 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, 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, 1, 2, 3, 4,
498 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
499 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
500 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
501 35, 36, 37, 38, 39, 40
505 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
506 static const yytype_uint16 yyrline
[] =
508 0, 110, 110, 110, 112, 112, 116, 124, 134, 136,
509 137, 138, 139, 140, 141, 145, 149, 149, 149, 149,
510 149, 149, 149, 149, 149, 153, 154, 155, 156, 157,
511 158, 162, 163, 169, 176, 181, 188, 197, 199, 200,
512 201, 202, 203, 204, 207, 215, 221, 231, 237, 243,
513 249, 252, 254, 267, 268, 273, 283, 288, 296, 299,
514 301, 302, 303, 304, 305, 308, 314, 325, 331, 341,
515 343, 348, 356, 364, 367, 369, 370, 371, 376, 383,
516 388, 396, 399, 401, 402, 403, 406, 415, 422, 427,
517 433, 451, 453, 454, 455, 458, 466, 468, 469, 472,
518 479, 481, 486, 487, 490, 491, 492, 496, 497, 500,
519 501, 504, 505, 506, 507, 508, 509, 510, 511, 512,
520 513, 514, 518, 520, 521, 524, 525
524 #if YYDEBUG || YYERROR_VERBOSE || 0
525 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
526 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
527 static const char *const yytname
[] =
529 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
530 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
531 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
532 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_IMPLY",
533 "T_RANGE", "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE",
534 "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL",
535 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
536 "T_NOT", "$accept", "input", "start", "mainmenu_stmt",
537 "no_mainmenu_stmt", "stmt_list", "option_name", "common_stmt",
538 "option_error", "config_entry_start", "config_stmt",
539 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
540 "config_option", "symbol_option", "symbol_option_list",
541 "symbol_option_arg", "choice", "choice_entry", "choice_end",
542 "choice_stmt", "choice_option_list", "choice_option", "choice_block",
543 "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry",
544 "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment",
545 "comment_stmt", "help_start", "help", "depends_list", "depends",
546 "visibility_list", "visible", "prompt_stmt_opt", "prompt", "end", "nl",
547 "if_expr", "expr", "nonconst_symbol", "symbol", "word_opt", YY_NULLPTR
552 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
553 (internal) symbol number NUM (which must be that of a token). */
554 static const yytype_uint16 yytoknum
[] =
556 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
557 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
558 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
559 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
564 #define YYPACT_NINF -92
566 #define yypact_value_is_default(Yystate) \
567 (!!((Yystate) == (-92)))
569 #define YYTABLE_NINF -89
571 #define yytable_value_is_error(Yytable_value) \
574 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
576 static const yytype_int16 yypact
[] =
578 20, 33, -92, 16, -92, -92, -92, 21, -92, -92,
579 29, -92, 152, 186, -92, -92, 40, 67, 33, 71,
580 33, 42, 80, 33, 78, 78, 31, 82, -92, -92,
581 -92, -92, -92, -92, -92, -92, -92, 120, -92, 131,
582 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
583 -92, -92, -92, -92, -92, -92, -92, -92, 109, -92,
584 118, -92, 128, -92, 129, -92, 141, 142, -92, 31,
585 31, 74, -92, 69, -92, 144, 145, 28, 119, 248,
586 286, 77, 38, 77, 219, -92, -92, -92, -92, -92,
587 -92, -7, -92, 31, 31, 40, 52, 52, 52, 52,
588 52, 52, -92, -92, 146, 147, 158, 33, 33, 31,
589 78, 78, 52, -92, 184, -92, -92, -92, -92, 176,
590 -92, -92, 162, 33, 33, 78, -92, -92, -92, -92,
591 -92, -92, -92, -92, -92, -92, -92, -92, -92, 197,
592 -92, 272, -92, -92, -92, -92, -92, -92, -92, -92,
593 -92, -92, 174, -92, -92, -92, -92, -92, -92, -92,
594 -92, -92, 31, 197, 178, 197, 59, 197, 197, 52,
595 27, 179, -92, -92, 197, 180, 197, 31, -92, 111,
596 181, -92, -92, 182, 185, 195, 197, 193, -92, -92,
597 208, -92, 209, 113, -92, -92, -92, -92, -92, 211,
598 33, -92, -92, -92, -92, -92
601 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
602 Performed when YYTABLE does not specify something else to do. Zero
603 means the default is an error. */
604 static const yytype_uint8 yydefact
[] =
606 7, 0, 107, 0, 3, 8, 8, 7, 102, 103,
607 0, 1, 0, 0, 108, 2, 6, 0, 0, 0,
608 0, 125, 0, 0, 0, 0, 0, 0, 16, 21,
609 17, 18, 23, 19, 20, 22, 24, 0, 25, 0,
610 9, 37, 28, 37, 29, 59, 69, 10, 74, 26,
611 96, 82, 11, 30, 91, 27, 12, 15, 0, 104,
612 0, 126, 0, 105, 0, 122, 0, 0, 124, 0,
613 0, 0, 123, 111, 106, 0, 0, 0, 0, 0,
614 0, 0, 91, 0, 0, 78, 86, 55, 87, 33,
615 35, 0, 119, 0, 0, 71, 0, 0, 0, 0,
616 0, 0, 13, 14, 0, 0, 0, 0, 100, 0,
617 0, 0, 0, 51, 0, 43, 42, 38, 39, 0,
618 41, 40, 0, 0, 100, 0, 63, 64, 60, 62,
619 61, 70, 58, 57, 75, 77, 73, 76, 72, 109,
620 98, 0, 97, 83, 85, 81, 84, 80, 93, 94,
621 92, 118, 120, 121, 117, 112, 113, 114, 115, 116,
622 32, 89, 0, 109, 0, 109, 109, 109, 109, 0,
623 0, 0, 90, 67, 109, 0, 109, 0, 99, 0,
624 0, 44, 101, 0, 0, 0, 109, 53, 50, 31,
625 0, 66, 0, 110, 95, 45, 46, 47, 48, 0,
626 0, 52, 65, 68, 49, 54
629 /* YYPGOTO[NTERM-NUM]. */
630 static const yytype_int16 yypgoto
[] =
632 -92, -92, 241, -92, -92, 244, -92, -13, -66, -92,
633 -92, -92, -92, 218, -92, -92, -92, -92, -92, -92,
634 -92, -69, -92, -92, -92, -92, -92, -92, -92, -92,
635 -92, -92, 12, -92, -92, -92, -92, -92, 172, 170,
636 -64, -92, -92, 148, -1, 34, 1, 139, -68, -21,
640 /* YYDEFGOTO[NTERM-NUM]. */
641 static const yytype_int16 yydefgoto
[] =
643 -1, 3, 4, 5, 6, 12, 39, 40, 116, 41,
644 42, 43, 44, 77, 117, 118, 170, 201, 45, 46,
645 132, 47, 79, 128, 80, 48, 136, 49, 81, 50,
646 51, 145, 52, 83, 53, 54, 55, 119, 120, 84,
647 121, 82, 142, 164, 165, 56, 7, 178, 71, 72,
651 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
652 positive, shift that token. If negative, reduce the rule whose
653 number is the opposite. If YYTABLE_NINF, syntax error. */
654 static const yytype_int16 yytable
[] =
656 10, 91, 92, 66, 67, 154, 155, 156, 157, 158,
657 159, 16, 135, 127, 144, 130, 11, 58, 149, 60,
658 150, 169, 64, 1, 1, 152, 153, 151, -34, 104,
659 93, 94, -34, -34, -34, -34, -34, -34, -34, -34,
660 105, 166, -34, -34, 106, -34, 107, 108, 109, 110,
661 111, 112, -34, 113, 187, 114, 2, 14, 65, 68,
662 8, 9, 139, 188, 115, 2, 69, 131, 134, 61,
663 143, 70, 95, 177, 140, 149, 14, 150, 186, 65,
664 68, 18, 19, 20, 21, 22, 23, 24, 25, 167,
665 168, 26, 27, 137, 179, 146, 93, 94, 96, 97,
666 98, 99, 100, 57, 176, 65, 163, 59, 101, 193,
667 2, 93, 94, 38, 133, 138, 63, 147, 74, -36,
668 104, 75, 174, -36, -36, -36, -36, -36, -36, -36,
669 -36, 105, 76, -36, -36, 106, -36, 107, 108, 109,
670 110, 111, 112, -36, 113, 85, 114, 194, 93, 94,
671 93, 94, -4, 17, 86, 115, 18, 19, 20, 21,
672 22, 23, 24, 25, 87, 88, 26, 27, 28, 29,
673 30, 31, 32, 33, 34, 35, 36, 89, 90, 37,
674 102, 103, 160, 161, 162, 171, -5, 17, 38, 172,
675 18, 19, 20, 21, 22, 23, 24, 25, 173, 205,
676 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
677 36, 177, 94, 37, 181, 189, 191, 195, 196, -88,
678 104, 197, 38, -88, -88, -88, -88, -88, -88, -88,
679 -88, 198, 200, -88, -88, 106, -88, -88, -88, -88,
680 -88, -88, -88, -88, 202, 203, 114, 204, 15, 104,
681 13, 129, 141, -56, -56, 148, -56, -56, -56, -56,
682 105, 78, -56, -56, 106, 122, 123, 124, 125, 0,
683 0, 0, 175, 104, 0, 114, -79, -79, -79, -79,
684 -79, -79, -79, -79, 126, 0, -79, -79, 106, 0,
685 0, 19, 20, 0, 22, 23, 24, 25, 0, 114,
686 26, 27, 180, 0, 182, 183, 184, 185, 148, 0,
687 0, 0, 0, 190, 0, 192, 0, 0, 0, 0,
691 static const yytype_int16 yycheck
[] =
693 1, 69, 70, 24, 25, 96, 97, 98, 99, 100,
694 101, 10, 81, 79, 83, 79, 0, 18, 84, 20,
695 84, 112, 23, 3, 3, 93, 94, 34, 0, 1,
696 37, 38, 4, 5, 6, 7, 8, 9, 10, 11,
697 12, 109, 14, 15, 16, 17, 18, 19, 20, 21,
698 22, 23, 24, 25, 27, 27, 36, 36, 27, 28,
699 27, 28, 24, 36, 36, 36, 35, 80, 81, 27,
700 83, 40, 71, 14, 36, 141, 36, 141, 169, 27,
701 28, 4, 5, 6, 7, 8, 9, 10, 11, 110,
702 111, 14, 15, 81, 162, 83, 37, 38, 29, 30,
703 31, 32, 33, 36, 125, 27, 107, 36, 39, 177,
704 36, 37, 38, 36, 80, 81, 36, 83, 36, 0,
705 1, 1, 123, 4, 5, 6, 7, 8, 9, 10,
706 11, 12, 1, 14, 15, 16, 17, 18, 19, 20,
707 21, 22, 23, 24, 25, 36, 27, 36, 37, 38,
708 37, 38, 0, 1, 36, 36, 4, 5, 6, 7,
709 8, 9, 10, 11, 36, 36, 14, 15, 16, 17,
710 18, 19, 20, 21, 22, 23, 24, 36, 36, 27,
711 36, 36, 36, 36, 26, 1, 0, 1, 36, 13,
712 4, 5, 6, 7, 8, 9, 10, 11, 36, 200,
713 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
714 24, 14, 38, 27, 36, 36, 36, 36, 36, 0,
715 1, 36, 36, 4, 5, 6, 7, 8, 9, 10,
716 11, 36, 39, 14, 15, 16, 17, 18, 19, 20,
717 21, 22, 23, 24, 36, 36, 27, 36, 7, 1,
718 6, 79, 82, 5, 6, 36, 8, 9, 10, 11,
719 12, 43, 14, 15, 16, 17, 18, 19, 20, -1,
720 -1, -1, 124, 1, -1, 27, 4, 5, 6, 7,
721 8, 9, 10, 11, 36, -1, 14, 15, 16, -1,
722 -1, 5, 6, -1, 8, 9, 10, 11, -1, 27,
723 14, 15, 163, -1, 165, 166, 167, 168, 36, -1,
724 -1, -1, -1, 174, -1, 176, -1, -1, -1, -1,
725 -1, -1, 36, -1, -1, 186
728 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
729 symbol of state STATE-NUM. */
730 static const yytype_uint8 yystos
[] =
732 0, 3, 36, 42, 43, 44, 45, 87, 27, 28,
733 85, 0, 46, 46, 36, 43, 87, 1, 4, 5,
734 6, 7, 8, 9, 10, 11, 14, 15, 16, 17,
735 18, 19, 20, 21, 22, 23, 24, 27, 36, 47,
736 48, 50, 51, 52, 53, 59, 60, 62, 66, 68,
737 70, 71, 73, 75, 76, 77, 86, 36, 85, 36,
738 85, 27, 92, 36, 85, 27, 90, 90, 28, 35,
739 40, 89, 90, 91, 36, 1, 1, 54, 54, 63,
740 65, 69, 82, 74, 80, 36, 36, 36, 36, 36,
741 36, 89, 89, 37, 38, 87, 29, 30, 31, 32,
742 33, 39, 36, 36, 1, 12, 16, 18, 19, 20,
743 21, 22, 23, 25, 27, 36, 49, 55, 56, 78,
744 79, 81, 17, 18, 19, 20, 36, 49, 64, 79,
745 81, 48, 61, 86, 48, 62, 67, 73, 86, 24,
746 36, 80, 83, 48, 62, 72, 73, 86, 36, 49,
747 81, 34, 89, 89, 91, 91, 91, 91, 91, 91,
748 36, 36, 26, 85, 84, 85, 89, 90, 90, 91,
749 57, 1, 13, 36, 85, 84, 90, 14, 88, 89,
750 88, 36, 88, 88, 88, 88, 91, 27, 36, 36,
751 88, 36, 88, 89, 36, 36, 36, 36, 36, 88,
752 39, 58, 36, 36, 36, 85
755 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
756 static const yytype_uint8 yyr1
[] =
758 0, 41, 42, 42, 43, 43, 44, 45, 46, 46,
759 46, 46, 46, 46, 46, 46, 47, 47, 47, 47,
760 47, 47, 47, 47, 47, 48, 48, 48, 48, 48,
761 48, 49, 49, 50, 51, 52, 53, 54, 54, 54,
762 54, 54, 54, 54, 55, 55, 55, 55, 55, 55,
763 56, 57, 57, 58, 58, 59, 60, 61, 62, 63,
764 63, 63, 63, 63, 63, 64, 64, 64, 64, 65,
765 65, 66, 67, 68, 69, 69, 69, 69, 70, 71,
766 72, 73, 74, 74, 74, 74, 75, 76, 77, 78,
767 79, 80, 80, 80, 80, 81, 82, 82, 82, 83,
768 84, 84, 85, 85, 86, 86, 86, 87, 87, 88,
769 88, 89, 89, 89, 89, 89, 89, 89, 89, 89,
770 89, 89, 90, 91, 91, 92, 92
773 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
774 static const yytype_uint8 yyr2
[] =
776 0, 2, 2, 1, 2, 2, 3, 0, 0, 2,
777 2, 2, 2, 4, 4, 3, 1, 1, 1, 1,
778 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
779 1, 3, 2, 3, 2, 3, 2, 0, 2, 2,
780 2, 2, 2, 2, 3, 4, 4, 4, 4, 5,
781 3, 0, 3, 0, 2, 3, 2, 1, 3, 0,
782 2, 2, 2, 2, 2, 4, 3, 2, 4, 0,
783 2, 3, 1, 3, 0, 2, 2, 2, 3, 3,
784 1, 3, 0, 2, 2, 2, 3, 3, 2, 2,
785 2, 0, 2, 2, 2, 4, 0, 2, 2, 2,
786 0, 2, 1, 1, 2, 2, 2, 1, 2, 0,
787 2, 1, 3, 3, 3, 3, 3, 3, 3, 2,
792 #define yyerrok (yyerrstatus = 0)
793 #define yyclearin (yychar = YYEMPTY)
797 #define YYACCEPT goto yyacceptlab
798 #define YYABORT goto yyabortlab
799 #define YYERROR goto yyerrorlab
802 #define YYRECOVERING() (!!yyerrstatus)
804 #define YYBACKUP(Token, Value) \
806 if (yychar == YYEMPTY) \
810 YYPOPSTACK (yylen); \
816 yyerror (YY_("syntax error: cannot back up")); \
821 /* Error token number */
823 #define YYERRCODE 256
827 /* Enable debugging if requested. */
831 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
832 # define YYFPRINTF fprintf
835 # define YYDPRINTF(Args) \
841 /* This macro is provided for backward compatibility. */
842 #ifndef YY_LOCATION_PRINT
843 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
847 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
851 YYFPRINTF (stderr, "%s ", Title); \
852 yy_symbol_print (stderr, \
854 YYFPRINTF (stderr, "\n"); \
859 /*----------------------------------------.
860 | Print this symbol's value on YYOUTPUT. |
861 `----------------------------------------*/
864 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
866 FILE *yyo
= yyoutput
;
871 if (yytype
< YYNTOKENS
)
872 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
878 /*--------------------------------.
879 | Print this symbol on YYOUTPUT. |
880 `--------------------------------*/
883 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
885 YYFPRINTF (yyoutput
, "%s %s (",
886 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
888 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
889 YYFPRINTF (yyoutput
, ")");
892 /*------------------------------------------------------------------.
893 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
895 `------------------------------------------------------------------*/
898 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
900 YYFPRINTF (stderr
, "Stack now");
901 for (; yybottom
<= yytop
; yybottom
++)
903 int yybot
= *yybottom
;
904 YYFPRINTF (stderr
, " %d", yybot
);
906 YYFPRINTF (stderr
, "\n");
909 # define YY_STACK_PRINT(Bottom, Top) \
912 yy_stack_print ((Bottom), (Top)); \
916 /*------------------------------------------------.
917 | Report that the YYRULE is going to be reduced. |
918 `------------------------------------------------*/
921 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
)
923 unsigned long int yylno
= yyrline
[yyrule
];
924 int yynrhs
= yyr2
[yyrule
];
926 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
928 /* The symbols being reduced. */
929 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
931 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
932 yy_symbol_print (stderr
,
933 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
934 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
936 YYFPRINTF (stderr
, "\n");
940 # define YY_REDUCE_PRINT(Rule) \
943 yy_reduce_print (yyssp, yyvsp, Rule); \
946 /* Nonzero means print parse trace. It is left uninitialized so that
947 multiple parsers can coexist. */
950 # define YYDPRINTF(Args)
951 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
952 # define YY_STACK_PRINT(Bottom, Top)
953 # define YY_REDUCE_PRINT(Rule)
954 #endif /* !YYDEBUG */
957 /* YYINITDEPTH -- initial size of the parser's stacks. */
959 # define YYINITDEPTH 200
962 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
963 if the built-in stack extension method is used).
965 Do not make this value too large; the results are undefined if
966 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
967 evaluated with infinite-precision integer arithmetic. */
970 # define YYMAXDEPTH 10000
977 # if defined __GLIBC__ && defined _STRING_H
978 # define yystrlen strlen
980 /* Return the length of YYSTR. */
982 yystrlen (const char *yystr
)
985 for (yylen
= 0; yystr
[yylen
]; yylen
++)
993 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
994 # define yystpcpy stpcpy
996 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
999 yystpcpy (char *yydest
, const char *yysrc
)
1002 const char *yys
= yysrc
;
1004 while ((*yyd
++ = *yys
++) != '\0')
1013 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1014 quotes and backslashes, so that it's suitable for yyerror. The
1015 heuristic is that double-quoting is unnecessary unless the string
1016 contains an apostrophe, a comma, or backslash (other than
1017 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1018 null, do not copy; instead, return the length of what the result
1021 yytnamerr (char *yyres
, const char *yystr
)
1026 char const *yyp
= yystr
;
1033 goto do_not_strip_quotes
;
1037 goto do_not_strip_quotes
;
1050 do_not_strip_quotes
: ;
1054 return yystrlen (yystr
);
1056 return yystpcpy (yyres
, yystr
) - yyres
;
1060 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1061 about the unexpected token YYTOKEN for the state stack whose top is
1064 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1065 not large enough to hold the message. In that case, also set
1066 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1067 required number of bytes is too large to store. */
1069 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1070 yytype_int16
*yyssp
, int yytoken
)
1072 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1073 YYSIZE_T yysize
= yysize0
;
1074 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1075 /* Internationalized format string. */
1076 const char *yyformat
= YY_NULLPTR
;
1077 /* Arguments of yyformat. */
1078 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1079 /* Number of reported tokens (one for the "unexpected", one per
1083 /* There are many possibilities here to consider:
1084 - If this state is a consistent state with a default action, then
1085 the only way this function was invoked is if the default action
1086 is an error action. In that case, don't check for expected
1087 tokens because there are none.
1088 - The only way there can be no lookahead present (in yychar) is if
1089 this state is a consistent state with a default action. Thus,
1090 detecting the absence of a lookahead is sufficient to determine
1091 that there is no unexpected or expected token to report. In that
1092 case, just report a simple "syntax error".
1093 - Don't assume there isn't a lookahead just because this state is a
1094 consistent state with a default action. There might have been a
1095 previous inconsistent state, consistent state with a non-default
1096 action, or user semantic action that manipulated yychar.
1097 - Of course, the expected token list depends on states to have
1098 correct lookahead information, and it depends on the parser not
1099 to perform extra reductions after fetching a lookahead from the
1100 scanner and before detecting a syntax error. Thus, state merging
1101 (from LALR or IELR) and default reductions corrupt the expected
1102 token list. However, the list is correct for canonical LR with
1103 one exception: it will still contain any token that will not be
1104 accepted due to an error action in a later state.
1106 if (yytoken
!= YYEMPTY
)
1108 int yyn
= yypact
[*yyssp
];
1109 yyarg
[yycount
++] = yytname
[yytoken
];
1110 if (!yypact_value_is_default (yyn
))
1112 /* Start YYX at -YYN if negative to avoid negative indexes in
1113 YYCHECK. In other words, skip the first -YYN actions for
1114 this state because they are default actions. */
1115 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1116 /* Stay within bounds of both yycheck and yytname. */
1117 int yychecklim
= YYLAST
- yyn
+ 1;
1118 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1121 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1122 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1123 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1125 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1131 yyarg
[yycount
++] = yytname
[yyx
];
1133 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1134 if (! (yysize
<= yysize1
1135 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1145 # define YYCASE_(N, S) \
1149 YYCASE_(0, YY_("syntax error"));
1150 YYCASE_(1, YY_("syntax error, unexpected %s"));
1151 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1152 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1153 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1154 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1159 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1160 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1165 if (*yymsg_alloc
< yysize
)
1167 *yymsg_alloc
= 2 * yysize
;
1168 if (! (yysize
<= *yymsg_alloc
1169 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1170 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1174 /* Avoid sprintf, as that infringes on the user's name space.
1175 Don't have undefined behavior even if the translation
1176 produced a string with the wrong number of "%s"s. */
1180 while ((*yyp
= *yyformat
) != '\0')
1181 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1183 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1194 #endif /* YYERROR_VERBOSE */
1196 /*-----------------------------------------------.
1197 | Release the memory associated to this symbol. |
1198 `-----------------------------------------------*/
1201 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1206 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1208 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1211 case 60: /* choice_entry */
1214 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1215 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1216 if (current_menu
== ((*yyvaluep
).menu
))
1222 case 66: /* if_entry */
1225 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1226 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1227 if (current_menu
== ((*yyvaluep
).menu
))
1233 case 71: /* menu_entry */
1236 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1237 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1238 if (current_menu
== ((*yyvaluep
).menu
))
1248 YY_IGNORE_MAYBE_UNINITIALIZED_END
1254 /* The lookahead symbol. */
1257 /* The semantic value of the lookahead symbol. */
1259 /* Number of syntax errors so far. */
1271 /* Number of tokens to shift before error messages enabled. */
1274 /* The stacks and their tools:
1275 'yyss': related to states.
1276 'yyvs': related to semantic values.
1278 Refer to the stacks through separate pointers, to allow yyoverflow
1279 to reallocate them elsewhere. */
1281 /* The state stack. */
1282 yytype_int16 yyssa
[YYINITDEPTH
];
1284 yytype_int16
*yyssp
;
1286 /* The semantic value stack. */
1287 YYSTYPE yyvsa
[YYINITDEPTH
];
1291 YYSIZE_T yystacksize
;
1295 /* Lookahead token as an internal (translated) token number. */
1297 /* The variables used to return semantic value and location from the
1302 /* Buffer for error messages, and its allocated size. */
1304 char *yymsg
= yymsgbuf
;
1305 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1308 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1310 /* The number of symbols on the RHS of the reduced rule.
1311 Keep to zero when no symbol should be popped. */
1314 yyssp
= yyss
= yyssa
;
1315 yyvsp
= yyvs
= yyvsa
;
1316 yystacksize
= YYINITDEPTH
;
1318 YYDPRINTF ((stderr
, "Starting parse\n"));
1323 yychar
= YYEMPTY
; /* Cause a token to be read. */
1326 /*------------------------------------------------------------.
1327 | yynewstate -- Push a new state, which is found in yystate. |
1328 `------------------------------------------------------------*/
1330 /* In all cases, when you get here, the value and location stacks
1331 have just been pushed. So pushing a state here evens the stacks. */
1337 if (yyss
+ yystacksize
- 1 <= yyssp
)
1339 /* Get the current used size of the three stacks, in elements. */
1340 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1344 /* Give user a chance to reallocate the stack. Use copies of
1345 these so that the &'s don't force the real ones into
1347 YYSTYPE
*yyvs1
= yyvs
;
1348 yytype_int16
*yyss1
= yyss
;
1350 /* Each stack pointer address is followed by the size of the
1351 data in use in that stack, in bytes. This used to be a
1352 conditional around just the two extra args, but that might
1353 be undefined if yyoverflow is a macro. */
1354 yyoverflow (YY_("memory exhausted"),
1355 &yyss1
, yysize
* sizeof (*yyssp
),
1356 &yyvs1
, yysize
* sizeof (*yyvsp
),
1362 #else /* no yyoverflow */
1363 # ifndef YYSTACK_RELOCATE
1364 goto yyexhaustedlab
;
1366 /* Extend the stack our own way. */
1367 if (YYMAXDEPTH
<= yystacksize
)
1368 goto yyexhaustedlab
;
1370 if (YYMAXDEPTH
< yystacksize
)
1371 yystacksize
= YYMAXDEPTH
;
1374 yytype_int16
*yyss1
= yyss
;
1375 union yyalloc
*yyptr
=
1376 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1378 goto yyexhaustedlab
;
1379 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1380 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1381 # undef YYSTACK_RELOCATE
1383 YYSTACK_FREE (yyss1
);
1386 #endif /* no yyoverflow */
1388 yyssp
= yyss
+ yysize
- 1;
1389 yyvsp
= yyvs
+ yysize
- 1;
1391 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1392 (unsigned long int) yystacksize
));
1394 if (yyss
+ yystacksize
- 1 <= yyssp
)
1398 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1400 if (yystate
== YYFINAL
)
1410 /* Do appropriate processing given the current state. Read a
1411 lookahead token if we need one and don't already have one. */
1413 /* First try to decide what to do without reference to lookahead token. */
1414 yyn
= yypact
[yystate
];
1415 if (yypact_value_is_default (yyn
))
1418 /* Not known => get a lookahead token if don't already have one. */
1420 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1421 if (yychar
== YYEMPTY
)
1423 YYDPRINTF ((stderr
, "Reading a token: "));
1427 if (yychar
<= YYEOF
)
1429 yychar
= yytoken
= YYEOF
;
1430 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1434 yytoken
= YYTRANSLATE (yychar
);
1435 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1438 /* If the proper action on seeing token YYTOKEN is to reduce or to
1439 detect an error, take that action. */
1441 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1446 if (yytable_value_is_error (yyn
))
1452 /* Count tokens shifted since error; after three, turn off error
1457 /* Shift the lookahead token. */
1458 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1460 /* Discard the shifted token. */
1464 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1466 YY_IGNORE_MAYBE_UNINITIALIZED_END
1471 /*-----------------------------------------------------------.
1472 | yydefault -- do the default action for the current state. |
1473 `-----------------------------------------------------------*/
1475 yyn
= yydefact
[yystate
];
1481 /*-----------------------------.
1482 | yyreduce -- Do a reduction. |
1483 `-----------------------------*/
1485 /* yyn is the number of a rule to reduce with. */
1488 /* If YYLEN is nonzero, implement the default value of the action:
1491 Otherwise, the following line sets YYVAL to garbage.
1492 This behavior is undocumented and Bison
1493 users should not rely upon it. Assigning to YYVAL
1494 unconditionally makes the parser a bit smaller, and it avoids a
1495 GCC warning that YYVAL may be used uninitialized. */
1496 yyval
= yyvsp
[1-yylen
];
1499 YY_REDUCE_PRINT (yyn
);
1505 menu_add_prompt(P_MENU
, (yyvsp
[-1].string
), NULL
);
1514 * Hack: Keep the main menu title on the heap so we can safely free it
1515 * later regardless of whether it comes from the 'prompt' in
1516 * mainmenu_stmt or here
1518 menu_add_prompt(P_MENU
, xstrdup("Buildroot Configuration"), NULL
);
1525 { zconf_error("unexpected end statement"); }
1531 { zconf_error("unknown statement \"%s\"", (yyvsp
[-2].string
)); }
1538 zconf_error("unexpected option \"%s\"", (yyvsp
[-2].id
)->name
);
1545 { zconf_error("invalid statement"); }
1551 { zconf_error("unknown option \"%s\"", (yyvsp
[-2].string
)); }
1557 { zconf_error("invalid option"); }
1564 (yyvsp
[-1].symbol
)->flags
|= SYMBOL_OPTIONAL
;
1565 menu_add_entry((yyvsp
[-1].symbol
));
1566 printd(DEBUG_PARSE
, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].symbol
)->name
);
1574 printd(DEBUG_PARSE
, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1582 (yyvsp
[-1].symbol
)->flags
|= SYMBOL_OPTIONAL
;
1583 menu_add_entry((yyvsp
[-1].symbol
));
1584 printd(DEBUG_PARSE
, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].symbol
)->name
);
1592 if (current_entry
->prompt
)
1593 current_entry
->prompt
->type
= P_MENU
;
1595 zconfprint("warning: menuconfig statement without prompt");
1596 printd(DEBUG_PARSE
, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1604 menu_set_type((yyvsp
[-2].id
)->stype
);
1605 printd(DEBUG_PARSE
, "%s:%d:type(%u)\n",
1606 zconf_curname(), zconf_lineno(),
1607 (yyvsp
[-2].id
)->stype
);
1615 menu_add_prompt(P_PROMPT
, (yyvsp
[-2].string
), (yyvsp
[-1].expr
));
1616 printd(DEBUG_PARSE
, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1624 menu_add_expr(P_DEFAULT
, (yyvsp
[-2].expr
), (yyvsp
[-1].expr
));
1625 if ((yyvsp
[-3].id
)->stype
!= S_UNKNOWN
)
1626 menu_set_type((yyvsp
[-3].id
)->stype
);
1627 printd(DEBUG_PARSE
, "%s:%d:default(%u)\n",
1628 zconf_curname(), zconf_lineno(),
1629 (yyvsp
[-3].id
)->stype
);
1637 menu_add_symbol(P_SELECT
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1638 printd(DEBUG_PARSE
, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1646 menu_add_symbol(P_IMPLY
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1647 printd(DEBUG_PARSE
, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1655 menu_add_expr(P_RANGE
, expr_alloc_comp(E_RANGE
,(yyvsp
[-3].symbol
), (yyvsp
[-2].symbol
)), (yyvsp
[-1].expr
));
1656 printd(DEBUG_PARSE
, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1664 const struct kconf_id
*id
= kconf_id_lookup((yyvsp
[-1].string
), strlen((yyvsp
[-1].string
)));
1665 if (id
&& id
->flags
& TF_OPTION
) {
1666 menu_add_option(id
->token
, (yyvsp
[0].string
));
1667 free((yyvsp
[0].string
));
1670 zconfprint("warning: ignoring unknown option %s", (yyvsp
[-1].string
));
1671 free((yyvsp
[-1].string
));
1678 { (yyval
.string
) = NULL
; }
1684 { (yyval
.string
) = (yyvsp
[0].string
); }
1691 struct symbol
*sym
= sym_lookup((yyvsp
[-1].string
), SYMBOL_CHOICE
);
1692 sym
->flags
|= SYMBOL_AUTO
;
1693 menu_add_entry(sym
);
1694 menu_add_expr(P_CHOICE
, NULL
, NULL
);
1695 free((yyvsp
[-1].string
));
1696 printd(DEBUG_PARSE
, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1704 (yyval
.menu
) = menu_add_menu();
1712 if (zconf_endtoken((yyvsp
[0].id
), T_CHOICE
, T_ENDCHOICE
)) {
1714 printd(DEBUG_PARSE
, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1723 menu_add_prompt(P_PROMPT
, (yyvsp
[-2].string
), (yyvsp
[-1].expr
));
1724 printd(DEBUG_PARSE
, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1732 if ((yyvsp
[-2].id
)->stype
== S_BOOLEAN
|| (yyvsp
[-2].id
)->stype
== S_TRISTATE
) {
1733 menu_set_type((yyvsp
[-2].id
)->stype
);
1734 printd(DEBUG_PARSE
, "%s:%d:type(%u)\n",
1735 zconf_curname(), zconf_lineno(),
1736 (yyvsp
[-2].id
)->stype
);
1746 current_entry
->sym
->flags
|= SYMBOL_OPTIONAL
;
1747 printd(DEBUG_PARSE
, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1755 if ((yyvsp
[-3].id
)->stype
== S_UNKNOWN
) {
1756 menu_add_symbol(P_DEFAULT
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1757 printd(DEBUG_PARSE
, "%s:%d:default\n",
1758 zconf_curname(), zconf_lineno());
1768 printd(DEBUG_PARSE
, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1769 menu_add_entry(NULL
);
1770 menu_add_dep((yyvsp
[-1].expr
));
1771 (yyval
.menu
) = menu_add_menu();
1779 if (zconf_endtoken((yyvsp
[0].id
), T_IF
, T_ENDIF
)) {
1781 printd(DEBUG_PARSE
, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1790 menu_add_entry(NULL
);
1791 menu_add_prompt(P_MENU
, (yyvsp
[-1].string
), NULL
);
1792 printd(DEBUG_PARSE
, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1800 (yyval
.menu
) = menu_add_menu();
1808 if (zconf_endtoken((yyvsp
[0].id
), T_MENU
, T_ENDMENU
)) {
1810 printd(DEBUG_PARSE
, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1819 printd(DEBUG_PARSE
, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].string
));
1820 zconf_nextfile((yyvsp
[-1].string
));
1821 free((yyvsp
[-1].string
));
1829 menu_add_entry(NULL
);
1830 menu_add_prompt(P_COMMENT
, (yyvsp
[-1].string
), NULL
);
1831 printd(DEBUG_PARSE
, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1839 printd(DEBUG_PARSE
, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1848 if (current_entry
->help
) {
1849 free(current_entry
->help
);
1850 zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
1851 current_entry
->sym
->name
?: "<choice>");
1854 /* Is the help text empty or all whitespace? */
1855 if ((yyvsp
[0].string
)[strspn((yyvsp
[0].string
), " \f\n\r\t\v")] == '\0')
1856 zconfprint("warning: '%s' defined with blank help text",
1857 current_entry
->sym
->name
?: "<choice>");
1859 current_entry
->help
= (yyvsp
[0].string
);
1867 menu_add_dep((yyvsp
[-1].expr
));
1868 printd(DEBUG_PARSE
, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1876 menu_add_visibility((yyvsp
[0].expr
));
1884 menu_add_prompt(P_PROMPT
, (yyvsp
[-1].string
), (yyvsp
[0].expr
));
1891 { (yyval
.id
) = (yyvsp
[-1].id
); }
1897 { (yyval
.id
) = (yyvsp
[-1].id
); }
1903 { (yyval
.id
) = (yyvsp
[-1].id
); }
1909 { (yyval
.expr
) = NULL
; }
1915 { (yyval
.expr
) = (yyvsp
[0].expr
); }
1921 { (yyval
.expr
) = expr_alloc_symbol((yyvsp
[0].symbol
)); }
1927 { (yyval
.expr
) = expr_alloc_comp(E_LTH
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1933 { (yyval
.expr
) = expr_alloc_comp(E_LEQ
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1939 { (yyval
.expr
) = expr_alloc_comp(E_GTH
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1945 { (yyval
.expr
) = expr_alloc_comp(E_GEQ
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1951 { (yyval
.expr
) = expr_alloc_comp(E_EQUAL
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1957 { (yyval
.expr
) = expr_alloc_comp(E_UNEQUAL
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1963 { (yyval
.expr
) = (yyvsp
[-1].expr
); }
1969 { (yyval
.expr
) = expr_alloc_one(E_NOT
, (yyvsp
[0].expr
)); }
1975 { (yyval
.expr
) = expr_alloc_two(E_OR
, (yyvsp
[-2].expr
), (yyvsp
[0].expr
)); }
1981 { (yyval
.expr
) = expr_alloc_two(E_AND
, (yyvsp
[-2].expr
), (yyvsp
[0].expr
)); }
1987 { (yyval
.symbol
) = sym_lookup((yyvsp
[0].string
), 0); free((yyvsp
[0].string
)); }
1993 { (yyval
.symbol
) = sym_lookup((yyvsp
[0].string
), SYMBOL_CONST
); free((yyvsp
[0].string
)); }
1999 { (yyval
.string
) = NULL
; }
2007 /* User semantic actions sometimes alter yychar, and that requires
2008 that yytoken be updated with the new translation. We take the
2009 approach of translating immediately before every use of yytoken.
2010 One alternative is translating here after every semantic action,
2011 but that translation would be missed if the semantic action invokes
2012 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2013 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2014 incorrect destructor might then be invoked immediately. In the
2015 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2016 to an incorrect destructor call or verbose syntax error message
2017 before the lookahead is translated. */
2018 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2022 YY_STACK_PRINT (yyss
, yyssp
);
2026 /* Now 'shift' the result of the reduction. Determine what state
2027 that goes to, based on the state we popped back to and the rule
2028 number reduced by. */
2032 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2033 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2034 yystate
= yytable
[yystate
];
2036 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2041 /*--------------------------------------.
2042 | yyerrlab -- here on detecting error. |
2043 `--------------------------------------*/
2045 /* Make sure we have latest lookahead translation. See comments at
2046 user semantic actions for why this is necessary. */
2047 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2049 /* If not already recovering from an error, report this error. */
2053 #if ! YYERROR_VERBOSE
2054 yyerror (YY_("syntax error"));
2056 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2059 char const *yymsgp
= YY_("syntax error");
2060 int yysyntax_error_status
;
2061 yysyntax_error_status
= YYSYNTAX_ERROR
;
2062 if (yysyntax_error_status
== 0)
2064 else if (yysyntax_error_status
== 1)
2066 if (yymsg
!= yymsgbuf
)
2067 YYSTACK_FREE (yymsg
);
2068 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2072 yymsg_alloc
= sizeof yymsgbuf
;
2073 yysyntax_error_status
= 2;
2077 yysyntax_error_status
= YYSYNTAX_ERROR
;
2082 if (yysyntax_error_status
== 2)
2083 goto yyexhaustedlab
;
2085 # undef YYSYNTAX_ERROR
2091 if (yyerrstatus
== 3)
2093 /* If just tried and failed to reuse lookahead token after an
2094 error, discard it. */
2096 if (yychar
<= YYEOF
)
2098 /* Return failure if at end of input. */
2099 if (yychar
== YYEOF
)
2104 yydestruct ("Error: discarding",
2110 /* Else will try to reuse lookahead token after shifting the error
2115 /*---------------------------------------------------.
2116 | yyerrorlab -- error raised explicitly by YYERROR. |
2117 `---------------------------------------------------*/
2120 /* Pacify compilers like GCC when the user code never invokes
2121 YYERROR and the label yyerrorlab therefore never appears in user
2123 if (/*CONSTCOND*/ 0)
2126 /* Do not reclaim the symbols of the rule whose action triggered
2130 YY_STACK_PRINT (yyss
, yyssp
);
2135 /*-------------------------------------------------------------.
2136 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2137 `-------------------------------------------------------------*/
2139 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2143 yyn
= yypact
[yystate
];
2144 if (!yypact_value_is_default (yyn
))
2147 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2155 /* Pop the current state because it cannot handle the error token. */
2160 yydestruct ("Error: popping",
2161 yystos
[yystate
], yyvsp
);
2164 YY_STACK_PRINT (yyss
, yyssp
);
2167 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2169 YY_IGNORE_MAYBE_UNINITIALIZED_END
2172 /* Shift the error token. */
2173 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2179 /*-------------------------------------.
2180 | yyacceptlab -- YYACCEPT comes here. |
2181 `-------------------------------------*/
2186 /*-----------------------------------.
2187 | yyabortlab -- YYABORT comes here. |
2188 `-----------------------------------*/
2193 #if !defined yyoverflow || YYERROR_VERBOSE
2194 /*-------------------------------------------------.
2195 | yyexhaustedlab -- memory exhaustion comes here. |
2196 `-------------------------------------------------*/
2198 yyerror (YY_("memory exhausted"));
2204 if (yychar
!= YYEMPTY
)
2206 /* Make sure we have latest lookahead translation. See comments at
2207 user semantic actions for why this is necessary. */
2208 yytoken
= YYTRANSLATE (yychar
);
2209 yydestruct ("Cleanup: discarding lookahead",
2212 /* Do not reclaim the symbols of the rule whose 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
);
2235 void conf_parse(const char *name
)
2241 zconf_initscan(name
);
2246 if (getenv("ZCONF_DEBUG"))
2252 modules_sym
= sym_find( "n" );
2254 tmp
= rootmenu
.prompt
->text
;
2255 rootmenu
.prompt
->text
= _(rootmenu
.prompt
->text
);
2256 rootmenu
.prompt
->text
= sym_expand_string_value(rootmenu
.prompt
->text
);
2259 menu_finalize(&rootmenu
);
2260 for_all_symbols(i
, sym
) {
2261 if (sym_check_deps(sym
))
2266 sym_set_change_count(1);
2269 static const char *zconf_tokenname(int token
)
2272 case T_MENU
: return "menu";
2273 case T_ENDMENU
: return "endmenu";
2274 case T_CHOICE
: return "choice";
2275 case T_ENDCHOICE
: return "endchoice";
2276 case T_IF
: return "if";
2277 case T_ENDIF
: return "endif";
2278 case T_DEPENDS
: return "depends";
2279 case T_VISIBLE
: return "visible";
2284 static bool zconf_endtoken(const struct kconf_id
*id
, int starttoken
, int endtoken
)
2286 if (id
->token
!= endtoken
) {
2287 zconf_error("unexpected '%s' within %s block",
2288 id
->name
, zconf_tokenname(starttoken
));
2292 if (current_menu
->file
!= current_file
) {
2293 zconf_error("'%s' in different file than '%s'",
2294 id
->name
, zconf_tokenname(starttoken
));
2295 fprintf(stderr
, "%s:%d: location of the '%s'\n",
2296 current_menu
->file
->name
, current_menu
->lineno
,
2297 zconf_tokenname(starttoken
));
2304 static void zconfprint(const char *err
, ...)
2308 fprintf(stderr
, "%s:%d: ", zconf_curname(), zconf_lineno());
2310 vfprintf(stderr
, err
, ap
);
2312 fprintf(stderr
, "\n");
2315 static void zconf_error(const char *err
, ...)
2320 fprintf(stderr
, "%s:%d: ", zconf_curname(), zconf_lineno());
2322 vfprintf(stderr
, err
, ap
);
2324 fprintf(stderr
, "\n");
2327 static void yyerror(const char *err
)
2329 fprintf(stderr
, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err
);
2332 static void print_quoted_string(FILE *out
, const char *str
)
2338 while ((p
= strchr(str
, '"'))) {
2341 fprintf(out
, "%.*s", len
, str
);
2349 static void print_symbol(FILE *out
, struct menu
*menu
)
2351 struct symbol
*sym
= menu
->sym
;
2352 struct property
*prop
;
2354 if (sym_is_choice(sym
))
2355 fprintf(out
, "\nchoice\n");
2357 fprintf(out
, "\nconfig %s\n", sym
->name
);
2358 switch (sym
->type
) {
2360 fputs(" bool\n", out
);
2363 fputs(" tristate\n", out
);
2366 fputs(" string\n", out
);
2369 fputs(" integer\n", out
);
2372 fputs(" hex\n", out
);
2375 fputs(" ???\n", out
);
2378 for (prop
= sym
->prop
; prop
; prop
= prop
->next
) {
2379 if (prop
->menu
!= menu
)
2381 switch (prop
->type
) {
2383 fputs(" prompt ", out
);
2384 print_quoted_string(out
, prop
->text
);
2385 if (!expr_is_yes(prop
->visible
.expr
)) {
2387 expr_fprint(prop
->visible
.expr
, out
);
2392 fputs( " default ", out
);
2393 expr_fprint(prop
->expr
, out
);
2394 if (!expr_is_yes(prop
->visible
.expr
)) {
2396 expr_fprint(prop
->visible
.expr
, out
);
2401 fputs(" #choice value\n", out
);
2404 fputs( " select ", out
);
2405 expr_fprint(prop
->expr
, out
);
2409 fputs( " imply ", out
);
2410 expr_fprint(prop
->expr
, out
);
2414 fputs( " range ", out
);
2415 expr_fprint(prop
->expr
, out
);
2419 fputs( " menu ", out
);
2420 print_quoted_string(out
, prop
->text
);
2424 fprintf(out
, " unknown prop %d!\n", prop
->type
);
2429 int len
= strlen(menu
->help
);
2430 while (menu
->help
[--len
] == '\n')
2431 menu
->help
[len
] = 0;
2432 fprintf(out
, " help\n%s\n", menu
->help
);
2436 void zconfdump(FILE *out
)
2438 struct property
*prop
;
2442 menu
= rootmenu
.list
;
2444 if ((sym
= menu
->sym
))
2445 print_symbol(out
, menu
);
2446 else if ((prop
= menu
->prompt
)) {
2447 switch (prop
->type
) {
2449 fputs("\ncomment ", out
);
2450 print_quoted_string(out
, prop
->text
);
2454 fputs("\nmenu ", out
);
2455 print_quoted_string(out
, prop
->text
);
2461 if (!expr_is_yes(prop
->visible
.expr
)) {
2462 fputs(" depends ", out
);
2463 expr_fprint(prop
->visible
.expr
, out
);
2470 else if (menu
->next
)
2472 else while ((menu
= menu
->parent
)) {
2473 if (menu
->prompt
&& menu
->prompt
->type
== P_MENU
)
2474 fputs("\nendmenu\n", out
);
2483 #include "zconf.lex.c"
2484 #include "../src/util.c"
2485 #include "confdata.c"
2486 #include "../src/expr.c"
2487 #include "../src/symbol.c"
2488 #include "../src/menu.c"