1 /* A Bison parser, made by GNU Bison 3.7.6. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
48 /* Identify Bison output, and Bison version. */
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.7.6"
55 #define YYSKELETON_NAME "yacc.c"
69 /* First part of user prologue. */
82 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
85 #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 char *tokenname
,
93 const char *expected_tokenname
);
95 struct symbol
*symbol_hash
[SYMBOL_HASHSIZE
];
97 struct menu
*current_menu
, *current_entry
;
103 # define YY_CAST(Type, Val) static_cast<Type> (Val)
104 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
106 # define YY_CAST(Type, Val) ((Type) (Val))
107 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
111 # if defined __cplusplus
112 # if 201103L <= __cplusplus
113 # define YY_NULLPTR nullptr
115 # define YY_NULLPTR 0
118 # define YY_NULLPTR ((void*)0)
122 #include "parser.tab.h"
126 YYSYMBOL_YYEMPTY
= -2,
127 YYSYMBOL_YYEOF
= 0, /* "end of file" */
128 YYSYMBOL_YYerror
= 1, /* error */
129 YYSYMBOL_YYUNDEF
= 2, /* "invalid token" */
130 YYSYMBOL_T_HELPTEXT
= 3, /* T_HELPTEXT */
131 YYSYMBOL_T_WORD
= 4, /* T_WORD */
132 YYSYMBOL_T_WORD_QUOTE
= 5, /* T_WORD_QUOTE */
133 YYSYMBOL_T_BOOL
= 6, /* T_BOOL */
134 YYSYMBOL_T_CHOICE
= 7, /* T_CHOICE */
135 YYSYMBOL_T_CLOSE_PAREN
= 8, /* T_CLOSE_PAREN */
136 YYSYMBOL_T_COLON_EQUAL
= 9, /* T_COLON_EQUAL */
137 YYSYMBOL_T_COMMENT
= 10, /* T_COMMENT */
138 YYSYMBOL_T_CONFIG
= 11, /* T_CONFIG */
139 YYSYMBOL_T_DEFAULT
= 12, /* T_DEFAULT */
140 YYSYMBOL_T_DEF_BOOL
= 13, /* T_DEF_BOOL */
141 YYSYMBOL_T_DEF_TRISTATE
= 14, /* T_DEF_TRISTATE */
142 YYSYMBOL_T_DEPENDS
= 15, /* T_DEPENDS */
143 YYSYMBOL_T_ENDCHOICE
= 16, /* T_ENDCHOICE */
144 YYSYMBOL_T_ENDIF
= 17, /* T_ENDIF */
145 YYSYMBOL_T_ENDMENU
= 18, /* T_ENDMENU */
146 YYSYMBOL_T_HELP
= 19, /* T_HELP */
147 YYSYMBOL_T_HEX
= 20, /* T_HEX */
148 YYSYMBOL_T_IF
= 21, /* T_IF */
149 YYSYMBOL_T_IMPLY
= 22, /* T_IMPLY */
150 YYSYMBOL_T_INT
= 23, /* T_INT */
151 YYSYMBOL_T_MAINMENU
= 24, /* T_MAINMENU */
152 YYSYMBOL_T_MENU
= 25, /* T_MENU */
153 YYSYMBOL_T_MENUCONFIG
= 26, /* T_MENUCONFIG */
154 YYSYMBOL_T_MODULES
= 27, /* T_MODULES */
155 YYSYMBOL_T_ON
= 28, /* T_ON */
156 YYSYMBOL_T_OPEN_PAREN
= 29, /* T_OPEN_PAREN */
157 YYSYMBOL_T_OPTIONAL
= 30, /* T_OPTIONAL */
158 YYSYMBOL_T_PLUS_EQUAL
= 31, /* T_PLUS_EQUAL */
159 YYSYMBOL_T_PROMPT
= 32, /* T_PROMPT */
160 YYSYMBOL_T_RANGE
= 33, /* T_RANGE */
161 YYSYMBOL_T_RESET
= 34, /* T_RESET */
162 YYSYMBOL_T_SELECT
= 35, /* T_SELECT */
163 YYSYMBOL_T_SOURCE
= 36, /* T_SOURCE */
164 YYSYMBOL_T_STRING
= 37, /* T_STRING */
165 YYSYMBOL_T_TRISTATE
= 38, /* T_TRISTATE */
166 YYSYMBOL_T_VISIBLE
= 39, /* T_VISIBLE */
167 YYSYMBOL_T_EOL
= 40, /* T_EOL */
168 YYSYMBOL_T_ASSIGN_VAL
= 41, /* T_ASSIGN_VAL */
169 YYSYMBOL_T_OR
= 42, /* T_OR */
170 YYSYMBOL_T_AND
= 43, /* T_AND */
171 YYSYMBOL_T_EQUAL
= 44, /* T_EQUAL */
172 YYSYMBOL_T_UNEQUAL
= 45, /* T_UNEQUAL */
173 YYSYMBOL_T_LESS
= 46, /* T_LESS */
174 YYSYMBOL_T_LESS_EQUAL
= 47, /* T_LESS_EQUAL */
175 YYSYMBOL_T_GREATER
= 48, /* T_GREATER */
176 YYSYMBOL_T_GREATER_EQUAL
= 49, /* T_GREATER_EQUAL */
177 YYSYMBOL_T_NOT
= 50, /* T_NOT */
178 YYSYMBOL_YYACCEPT
= 51, /* $accept */
179 YYSYMBOL_input
= 52, /* input */
180 YYSYMBOL_mainmenu_stmt
= 53, /* mainmenu_stmt */
181 YYSYMBOL_stmt_list
= 54, /* stmt_list */
182 YYSYMBOL_stmt_list_in_choice
= 55, /* stmt_list_in_choice */
183 YYSYMBOL_config_entry_start
= 56, /* config_entry_start */
184 YYSYMBOL_config_stmt
= 57, /* config_stmt */
185 YYSYMBOL_menuconfig_entry_start
= 58, /* menuconfig_entry_start */
186 YYSYMBOL_menuconfig_stmt
= 59, /* menuconfig_stmt */
187 YYSYMBOL_config_option_list
= 60, /* config_option_list */
188 YYSYMBOL_config_option
= 61, /* config_option */
189 YYSYMBOL_choice
= 62, /* choice */
190 YYSYMBOL_choice_entry
= 63, /* choice_entry */
191 YYSYMBOL_choice_end
= 64, /* choice_end */
192 YYSYMBOL_choice_stmt
= 65, /* choice_stmt */
193 YYSYMBOL_choice_option_list
= 66, /* choice_option_list */
194 YYSYMBOL_choice_option
= 67, /* choice_option */
195 YYSYMBOL_type
= 68, /* type */
196 YYSYMBOL_logic_type
= 69, /* logic_type */
197 YYSYMBOL_default
= 70, /* default */
198 YYSYMBOL_if_entry
= 71, /* if_entry */
199 YYSYMBOL_if_end
= 72, /* if_end */
200 YYSYMBOL_if_stmt
= 73, /* if_stmt */
201 YYSYMBOL_if_stmt_in_choice
= 74, /* if_stmt_in_choice */
202 YYSYMBOL_menu
= 75, /* menu */
203 YYSYMBOL_menu_entry
= 76, /* menu_entry */
204 YYSYMBOL_menu_end
= 77, /* menu_end */
205 YYSYMBOL_menu_stmt
= 78, /* menu_stmt */
206 YYSYMBOL_menu_option_list
= 79, /* menu_option_list */
207 YYSYMBOL_source_stmt
= 80, /* source_stmt */
208 YYSYMBOL_comment
= 81, /* comment */
209 YYSYMBOL_comment_stmt
= 82, /* comment_stmt */
210 YYSYMBOL_comment_option_list
= 83, /* comment_option_list */
211 YYSYMBOL_help_start
= 84, /* help_start */
212 YYSYMBOL_help
= 85, /* help */
213 YYSYMBOL_depends
= 86, /* depends */
214 YYSYMBOL_visible
= 87, /* visible */
215 YYSYMBOL_prompt_stmt_opt
= 88, /* prompt_stmt_opt */
216 YYSYMBOL_end
= 89, /* end */
217 YYSYMBOL_if_expr
= 90, /* if_expr */
218 YYSYMBOL_expr
= 91, /* expr */
219 YYSYMBOL_nonconst_symbol
= 92, /* nonconst_symbol */
220 YYSYMBOL_symbol
= 93, /* symbol */
221 YYSYMBOL_word_opt
= 94, /* word_opt */
222 YYSYMBOL_assignment_stmt
= 95, /* assignment_stmt */
223 YYSYMBOL_assign_op
= 96, /* assign_op */
224 YYSYMBOL_assign_val
= 97 /* assign_val */
226 typedef enum yysymbol_kind_t yysymbol_kind_t
;
235 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
236 <limits.h> and (if available) <stdint.h> are included
237 so that the code can choose integer types of a good width. */
239 #ifndef __PTRDIFF_MAX__
240 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
241 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
242 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
247 /* Narrow types that promote to a signed type and that can represent a
248 signed or unsigned integer of at least N bits. In tables they can
249 save space and decrease cache pressure. Promoting to a signed type
250 helps avoid bugs in integer arithmetic. */
252 #ifdef __INT_LEAST8_MAX__
253 typedef __INT_LEAST8_TYPE__ yytype_int8
;
254 #elif defined YY_STDINT_H
255 typedef int_least8_t yytype_int8
;
257 typedef signed char yytype_int8
;
260 #ifdef __INT_LEAST16_MAX__
261 typedef __INT_LEAST16_TYPE__ yytype_int16
;
262 #elif defined YY_STDINT_H
263 typedef int_least16_t yytype_int16
;
265 typedef short yytype_int16
;
268 /* Work around bug in HP-UX 11.23, which defines these macros
269 incorrectly for preprocessor constants. This workaround can likely
270 be removed in 2023, as HPE has promised support for HP-UX 11.23
271 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
272 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
274 # undef UINT_LEAST8_MAX
275 # undef UINT_LEAST16_MAX
276 # define UINT_LEAST8_MAX 255
277 # define UINT_LEAST16_MAX 65535
280 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
281 typedef __UINT_LEAST8_TYPE__ yytype_uint8
;
282 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
283 && UINT_LEAST8_MAX <= INT_MAX)
284 typedef uint_least8_t yytype_uint8
;
285 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
286 typedef unsigned char yytype_uint8
;
288 typedef short yytype_uint8
;
291 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
292 typedef __UINT_LEAST16_TYPE__ yytype_uint16
;
293 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
294 && UINT_LEAST16_MAX <= INT_MAX)
295 typedef uint_least16_t yytype_uint16
;
296 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
297 typedef unsigned short yytype_uint16
;
299 typedef int yytype_uint16
;
303 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
304 # define YYPTRDIFF_T __PTRDIFF_TYPE__
305 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
306 # elif defined PTRDIFF_MAX
308 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
310 # define YYPTRDIFF_T ptrdiff_t
311 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
313 # define YYPTRDIFF_T long
314 # define YYPTRDIFF_MAXIMUM LONG_MAX
319 # ifdef __SIZE_TYPE__
320 # define YYSIZE_T __SIZE_TYPE__
321 # elif defined size_t
322 # define YYSIZE_T size_t
323 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
324 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
325 # define YYSIZE_T size_t
327 # define YYSIZE_T unsigned
331 #define YYSIZE_MAXIMUM \
332 YY_CAST (YYPTRDIFF_T, \
333 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
334 ? YYPTRDIFF_MAXIMUM \
335 : YY_CAST (YYSIZE_T, -1)))
337 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
340 /* Stored state numbers (used for stacks). */
341 typedef yytype_uint8 yy_state_t
;
343 /* State numbers in computations. */
344 typedef int yy_state_fast_t
;
347 # if defined YYENABLE_NLS && YYENABLE_NLS
349 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
350 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
354 # define YY_(Msgid) Msgid
359 #ifndef YY_ATTRIBUTE_PURE
360 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
361 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
363 # define YY_ATTRIBUTE_PURE
367 #ifndef YY_ATTRIBUTE_UNUSED
368 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
369 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
371 # define YY_ATTRIBUTE_UNUSED
375 /* Suppress unused-variable warnings by "using" E. */
376 #if ! defined lint || defined __GNUC__
377 # define YY_USE(E) ((void) (E))
379 # define YY_USE(E) /* empty */
382 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
383 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
384 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
385 _Pragma ("GCC diagnostic push") \
386 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
387 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
388 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
389 _Pragma ("GCC diagnostic pop")
391 # define YY_INITIAL_VALUE(Value) Value
393 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
394 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
395 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
397 #ifndef YY_INITIAL_VALUE
398 # define YY_INITIAL_VALUE(Value) /* Nothing. */
401 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
402 # define YY_IGNORE_USELESS_CAST_BEGIN \
403 _Pragma ("GCC diagnostic push") \
404 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
405 # define YY_IGNORE_USELESS_CAST_END \
406 _Pragma ("GCC diagnostic pop")
408 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
409 # define YY_IGNORE_USELESS_CAST_BEGIN
410 # define YY_IGNORE_USELESS_CAST_END
414 #define YY_ASSERT(E) ((void) (0 && (E)))
416 #if !defined yyoverflow
418 /* The parser invokes alloca or malloc; define the necessary symbols. */
420 # ifdef YYSTACK_USE_ALLOCA
421 # if YYSTACK_USE_ALLOCA
423 # define YYSTACK_ALLOC __builtin_alloca
424 # elif defined __BUILTIN_VA_ARG_INCR
425 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
427 # define YYSTACK_ALLOC __alloca
428 # elif defined _MSC_VER
429 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
430 # define alloca _alloca
432 # define YYSTACK_ALLOC alloca
433 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
434 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
435 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
436 # ifndef EXIT_SUCCESS
437 # define EXIT_SUCCESS 0
444 # ifdef YYSTACK_ALLOC
445 /* Pacify GCC's 'empty if-body' warning. */
446 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
447 # ifndef YYSTACK_ALLOC_MAXIMUM
448 /* The OS might guarantee only one guard page at the bottom of the stack,
449 and a page size can be as small as 4096 bytes. So we cannot safely
450 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
451 to allow for a few compiler-allocated temporary stack slots. */
452 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
455 # define YYSTACK_ALLOC YYMALLOC
456 # define YYSTACK_FREE YYFREE
457 # ifndef YYSTACK_ALLOC_MAXIMUM
458 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
460 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
461 && ! ((defined YYMALLOC || defined malloc) \
462 && (defined YYFREE || defined free)))
463 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
464 # ifndef EXIT_SUCCESS
465 # define EXIT_SUCCESS 0
469 # define YYMALLOC malloc
470 # if ! defined malloc && ! defined EXIT_SUCCESS
471 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
476 # if ! defined free && ! defined EXIT_SUCCESS
477 void free (void *); /* INFRINGES ON USER NAME SPACE */
481 #endif /* !defined yyoverflow */
483 #if (! defined yyoverflow \
484 && (! defined __cplusplus \
485 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
487 /* A type that is properly aligned for any stack member. */
490 yy_state_t yyss_alloc
;
494 /* The size of the maximum gap between one aligned stack and the next. */
495 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
497 /* The size of an array large to enough to hold all stacks, each with
499 # define YYSTACK_BYTES(N) \
500 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
501 + YYSTACK_GAP_MAXIMUM)
503 # define YYCOPY_NEEDED 1
505 /* Relocate STACK from its old location to the new one. The
506 local variables YYSIZE and YYSTACKSIZE give the old and new number of
507 elements in the stack, and YYPTR gives the new location of the
508 stack. Advance YYPTR to a properly aligned location for the next
510 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
513 YYPTRDIFF_T yynewbytes; \
514 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
515 Stack = &yyptr->Stack_alloc; \
516 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
517 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
523 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
524 /* Copy COUNT objects from SRC to DST. The source and destination do
527 # if defined __GNUC__ && 1 < __GNUC__
528 # define YYCOPY(Dst, Src, Count) \
529 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
531 # define YYCOPY(Dst, Src, Count) \
535 for (yyi = 0; yyi < (Count); yyi++) \
536 (Dst)[yyi] = (Src)[yyi]; \
541 #endif /* !YYCOPY_NEEDED */
543 /* YYFINAL -- State number of the termination state. */
545 /* YYLAST -- Last index in YYTABLE. */
548 /* YYNTOKENS -- Number of terminals. */
550 /* YYNNTS -- Number of nonterminals. */
552 /* YYNRULES -- Number of rules. */
554 /* YYNSTATES -- Number of states. */
555 #define YYNSTATES 187
557 /* YYMAXUTOK -- Last valid token kind. */
558 #define YYMAXUTOK 305
561 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
562 as returned by yylex, with out-of-bounds checking. */
563 #define YYTRANSLATE(YYX) \
564 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
565 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
568 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
569 as returned by yylex. */
570 static const yytype_int8 yytranslate
[] =
572 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
598 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
599 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
600 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
601 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
602 45, 46, 47, 48, 49, 50
606 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
607 static const yytype_int16 yyrline
[] =
609 0, 110, 110, 110, 114, 119, 121, 122, 123, 124,
610 125, 126, 127, 128, 129, 130, 133, 135, 136, 137,
611 138, 143, 150, 155, 162, 171, 173, 174, 175, 178,
612 186, 192, 202, 208, 214, 220, 230, 240, 245, 253,
613 256, 258, 259, 260, 263, 269, 276, 282, 287, 295,
614 296, 297, 298, 301, 302, 305, 306, 307, 311, 319,
615 327, 330, 335, 342, 347, 355, 358, 360, 361, 364,
616 373, 380, 383, 385, 390, 396, 408, 415, 422, 424,
617 429, 430, 431, 434, 435, 438, 439, 440, 441, 442,
618 443, 444, 445, 446, 447, 448, 452, 454, 455, 458,
619 459, 463, 466, 467, 468, 472, 473
623 /** Accessing symbol of state STATE. */
624 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
627 /* The user-facing name of the symbol whose (internal) number is
628 YYSYMBOL. No bounds checking. */
629 static const char *yysymbol_name (yysymbol_kind_t yysymbol
) YY_ATTRIBUTE_UNUSED
;
631 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
632 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
633 static const char *const yytname
[] =
635 "\"end of file\"", "error", "\"invalid token\"", "T_HELPTEXT", "T_WORD",
636 "T_WORD_QUOTE", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN", "T_COLON_EQUAL",
637 "T_COMMENT", "T_CONFIG", "T_DEFAULT", "T_DEF_BOOL", "T_DEF_TRISTATE",
638 "T_DEPENDS", "T_ENDCHOICE", "T_ENDIF", "T_ENDMENU", "T_HELP", "T_HEX",
639 "T_IF", "T_IMPLY", "T_INT", "T_MAINMENU", "T_MENU", "T_MENUCONFIG",
640 "T_MODULES", "T_ON", "T_OPEN_PAREN", "T_OPTIONAL", "T_PLUS_EQUAL",
641 "T_PROMPT", "T_RANGE", "T_RESET", "T_SELECT", "T_SOURCE", "T_STRING",
642 "T_TRISTATE", "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND",
643 "T_EQUAL", "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER",
644 "T_GREATER_EQUAL", "T_NOT", "$accept", "input", "mainmenu_stmt",
645 "stmt_list", "stmt_list_in_choice", "config_entry_start", "config_stmt",
646 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
647 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
648 "choice_option_list", "choice_option", "type", "logic_type", "default",
649 "if_entry", "if_end", "if_stmt", "if_stmt_in_choice", "menu",
650 "menu_entry", "menu_end", "menu_stmt", "menu_option_list", "source_stmt",
651 "comment", "comment_stmt", "comment_option_list", "help_start", "help",
652 "depends", "visible", "prompt_stmt_opt", "end", "if_expr", "expr",
653 "nonconst_symbol", "symbol", "word_opt", "assignment_stmt", "assign_op",
654 "assign_val", YY_NULLPTR
658 yysymbol_name (yysymbol_kind_t yysymbol
)
660 return yytname
[yysymbol
];
665 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
666 (internal) symbol number NUM (which must be that of a token). */
667 static const yytype_int16 yytoknum
[] =
669 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
670 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
671 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
672 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
673 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
678 #define YYPACT_NINF (-105)
680 #define yypact_value_is_default(Yyn) \
681 ((Yyn) == YYPACT_NINF)
683 #define YYTABLE_NINF (-4)
685 #define yytable_value_is_error(Yyn) \
688 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
690 static const yytype_int16 yypact
[] =
692 -5, 17, 37, -105, 57, 8, -105, 91, 39, 15,
693 46, 72, 80, 10, 82, 80, 83, -105, -105, -105,
694 -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
695 -105, -105, -105, -105, -105, 45, -105, -105, -105, 48,
696 -105, 50, 59, -105, 60, -105, 10, 10, -7, -105,
697 25, 63, 64, 65, 132, 132, 156, 162, 114, 14,
698 114, 95, -105, -105, 71, -105, -105, -105, 9, -105,
699 -105, 10, 10, 27, 27, 27, 27, 27, 27, -105,
700 -105, -105, -105, -105, -105, -105, 69, 73, -105, 80,
701 -105, 74, 115, 27, 80, -105, -105, -105, 117, -105,
702 10, 116, -105, -105, 80, 86, 118, 107, -105, 117,
703 -105, -105, 89, 93, 94, 96, -105, -105, -105, -105,
704 -105, -105, -105, -105, 107, -105, -105, -105, -105, -105,
705 -105, -105, 98, -105, -105, -105, -105, -105, -105, -105,
706 10, -105, 107, -105, 107, 27, 107, 107, 97, 13,
707 -105, 107, -105, 107, 10, 102, 103, -105, -105, -105,
708 -105, 162, 108, 23, 109, 113, 107, 120, -105, -105,
709 121, 126, 134, 33, -105, -105, -105, -105, -105, -105,
710 -105, 136, -105, -105, -105, -105, -105
713 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
714 Performed when YYTABLE does not specify something else to do. Zero
715 means the default is an error. */
716 static const yytype_int8 yydefact
[] =
718 5, 0, 0, 5, 0, 0, 1, 0, 0, 0,
719 99, 0, 0, 0, 0, 0, 0, 25, 9, 25,
720 12, 40, 16, 7, 5, 10, 66, 5, 11, 13,
721 72, 8, 6, 4, 15, 0, 103, 104, 102, 105,
722 100, 0, 0, 96, 0, 98, 0, 0, 0, 97,
723 85, 0, 0, 0, 22, 24, 37, 0, 0, 63,
724 0, 71, 14, 106, 0, 36, 70, 21, 0, 93,
725 58, 0, 0, 0, 0, 0, 0, 0, 0, 62,
726 23, 69, 53, 55, 56, 57, 0, 0, 51, 0,
727 50, 0, 0, 0, 0, 52, 54, 26, 78, 49,
728 0, 0, 28, 27, 0, 0, 0, 83, 41, 78,
729 43, 42, 0, 0, 0, 0, 18, 39, 16, 19,
730 17, 38, 60, 59, 83, 68, 67, 65, 64, 73,
731 101, 92, 94, 95, 90, 91, 86, 87, 88, 89,
732 0, 74, 83, 35, 83, 0, 83, 83, 0, 83,
733 75, 83, 46, 83, 0, 0, 0, 20, 81, 82,
734 80, 0, 0, 0, 0, 0, 83, 0, 79, 29,
735 0, 0, 0, 84, 47, 45, 61, 77, 76, 33,
736 30, 0, 32, 31, 48, 44, 34
739 /* YYPGOTO[NTERM-NUM]. */
740 static const yytype_int16 yypgoto
[] =
742 -105, -105, -105, 3, 38, -105, -55, -105, -105, 138,
743 -105, -105, -105, -105, -105, -105, -105, -105, 125, -105,
744 -54, -3, -105, -105, -105, -105, -105, -105, -105, -105,
745 -105, -52, -105, -105, 128, -38, -105, 68, -16, -104,
746 -46, -8, -65, -105, -105, -105, -105
749 /* YYDEFGOTO[NTERM-NUM]. */
750 static const yytype_uint8 yydefgoto
[] =
752 0, 2, 3, 4, 57, 17, 18, 19, 20, 54,
753 97, 21, 22, 117, 23, 56, 108, 98, 99, 100,
754 24, 122, 25, 119, 26, 27, 127, 28, 59, 29,
755 30, 31, 61, 101, 102, 103, 126, 148, 123, 155,
756 48, 49, 50, 41, 32, 39, 64
759 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
760 positive, shift that token. If negative, reduce the rule whose
761 number is the opposite. If YYTABLE_NINF, syntax error. */
762 static const yytype_int16 yytable
[] =
764 68, 69, 116, 118, 44, 120, 7, 52, 134, 135,
765 136, 137, 138, 139, 43, 45, 35, 131, 111, 1,
766 162, 125, 5, 129, 36, 132, 133, 58, 145, 86,
767 60, 43, 45, 70, 154, 71, 72, 6, 164, 46,
768 165, 121, 167, 168, 128, 170, 37, 171, 33, 172,
769 40, 71, 72, 124, 149, 71, 72, -3, 8, 38,
770 47, 9, 181, 178, 10, 71, 72, 11, 12, 73,
771 74, 75, 76, 77, 78, 71, 72, 42, 13, 34,
772 166, 142, 14, 15, 43, 62, 146, 51, 53, 63,
773 65, -2, 8, 16, 163, 9, 151, 140, 10, 66,
774 67, 11, 12, 79, 80, 81, 116, 118, 173, 120,
775 86, 130, 13, 141, 143, 8, 14, 15, 9, 150,
776 144, 10, 147, 153, 11, 12, 152, 16, 154, 157,
777 113, 114, 115, 158, 159, 13, 160, 169, 82, 14,
778 15, 72, 174, 175, 83, 84, 85, 86, 177, 179,
779 16, 87, 88, 180, 89, 90, 161, 55, 176, 91,
780 182, 183, 82, 112, 92, 93, 184, 94, 104, 95,
781 96, 86, 11, 12, 185, 87, 186, 156, 113, 114,
782 115, 109, 0, 13, 110, 0, 105, 0, 106, 0,
786 static const yytype_int16 yycheck
[] =
788 46, 47, 57, 57, 12, 57, 3, 15, 73, 74,
789 75, 76, 77, 78, 4, 5, 1, 8, 56, 24,
790 124, 59, 5, 61, 9, 71, 72, 24, 93, 15,
791 27, 4, 5, 40, 21, 42, 43, 0, 142, 29,
792 144, 57, 146, 147, 60, 149, 31, 151, 40, 153,
793 4, 42, 43, 39, 100, 42, 43, 0, 1, 44,
794 50, 4, 166, 40, 7, 42, 43, 10, 11, 44,
795 45, 46, 47, 48, 49, 42, 43, 5, 21, 40,
796 145, 89, 25, 26, 4, 40, 94, 5, 5, 41,
797 40, 0, 1, 36, 140, 4, 104, 28, 7, 40,
798 40, 10, 11, 40, 40, 40, 161, 161, 154, 161,
799 15, 40, 21, 40, 40, 1, 25, 26, 4, 3,
800 5, 7, 5, 5, 10, 11, 40, 36, 21, 40,
801 16, 17, 18, 40, 40, 21, 40, 40, 6, 25,
802 26, 43, 40, 40, 12, 13, 14, 15, 40, 40,
803 36, 19, 20, 40, 22, 23, 118, 19, 161, 27,
804 40, 40, 6, 1, 32, 33, 40, 35, 12, 37,
805 38, 15, 10, 11, 40, 19, 40, 109, 16, 17,
806 18, 56, -1, 21, 56, -1, 30, -1, 32, -1,
810 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
811 symbol of state STATE-NUM. */
812 static const yytype_int8 yystos
[] =
814 0, 24, 52, 53, 54, 5, 0, 54, 1, 4,
815 7, 10, 11, 21, 25, 26, 36, 56, 57, 58,
816 59, 62, 63, 65, 71, 73, 75, 76, 78, 80,
817 81, 82, 95, 40, 40, 1, 9, 31, 44, 96,
818 4, 94, 5, 4, 92, 5, 29, 50, 91, 92,
819 93, 5, 92, 5, 60, 60, 66, 55, 54, 79,
820 54, 83, 40, 41, 97, 40, 40, 40, 91, 91,
821 40, 42, 43, 44, 45, 46, 47, 48, 49, 40,
822 40, 40, 6, 12, 13, 14, 15, 19, 20, 22,
823 23, 27, 32, 33, 35, 37, 38, 61, 68, 69,
824 70, 84, 85, 86, 12, 30, 32, 34, 67, 69,
825 85, 86, 1, 16, 17, 18, 57, 64, 71, 74,
826 82, 89, 72, 89, 39, 86, 87, 77, 89, 86,
827 40, 8, 91, 91, 93, 93, 93, 93, 93, 93,
828 28, 40, 92, 40, 5, 93, 92, 5, 88, 91,
829 3, 92, 40, 5, 21, 90, 88, 40, 40, 40,
830 40, 55, 90, 91, 90, 90, 93, 90, 90, 40,
831 90, 90, 90, 91, 40, 40, 72, 40, 40, 40,
832 40, 90, 40, 40, 40, 40, 40
835 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
836 static const yytype_int8 yyr1
[] =
838 0, 51, 52, 52, 53, 54, 54, 54, 54, 54,
839 54, 54, 54, 54, 54, 54, 55, 55, 55, 55,
840 55, 56, 57, 58, 59, 60, 60, 60, 60, 61,
841 61, 61, 61, 61, 61, 61, 62, 63, 64, 65,
842 66, 66, 66, 66, 67, 67, 67, 67, 67, 68,
843 68, 68, 68, 69, 69, 70, 70, 70, 71, 72,
844 73, 74, 75, 76, 77, 78, 79, 79, 79, 80,
845 81, 82, 83, 83, 84, 85, 86, 87, 88, 88,
846 89, 89, 89, 90, 90, 91, 91, 91, 91, 91,
847 91, 91, 91, 91, 91, 91, 92, 93, 93, 94,
848 94, 95, 96, 96, 96, 97, 97
851 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
852 static const yytype_int8 yyr2
[] =
854 0, 2, 2, 1, 3, 0, 2, 2, 2, 2,
855 2, 2, 2, 2, 4, 3, 0, 2, 2, 2,
856 3, 3, 2, 3, 2, 0, 2, 2, 2, 3,
857 4, 4, 4, 4, 5, 2, 3, 2, 1, 3,
858 0, 2, 2, 2, 4, 3, 2, 3, 4, 1,
859 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
860 3, 3, 3, 2, 1, 3, 0, 2, 2, 3,
861 3, 2, 0, 2, 2, 2, 4, 3, 0, 2,
862 2, 2, 2, 0, 2, 1, 3, 3, 3, 3,
863 3, 3, 3, 2, 3, 3, 1, 1, 1, 0,
868 enum { YYENOMEM
= -2 };
870 #define yyerrok (yyerrstatus = 0)
871 #define yyclearin (yychar = YYEMPTY)
873 #define YYACCEPT goto yyacceptlab
874 #define YYABORT goto yyabortlab
875 #define YYERROR goto yyerrorlab
878 #define YYRECOVERING() (!!yyerrstatus)
880 #define YYBACKUP(Token, Value) \
882 if (yychar == YYEMPTY) \
886 YYPOPSTACK (yylen); \
892 yyerror (YY_("syntax error: cannot back up")); \
897 /* Backward compatibility with an undocumented macro.
898 Use YYerror or YYUNDEF. */
899 #define YYERRCODE YYUNDEF
902 /* Enable debugging if requested. */
906 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
907 # define YYFPRINTF fprintf
910 # define YYDPRINTF(Args) \
916 /* This macro is provided for backward compatibility. */
917 # ifndef YY_LOCATION_PRINT
918 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
922 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
926 YYFPRINTF (stderr, "%s ", Title); \
927 yy_symbol_print (stderr, \
929 YYFPRINTF (stderr, "\n"); \
934 /*-----------------------------------.
935 | Print this symbol's value on YYO. |
936 `-----------------------------------*/
939 yy_symbol_value_print (FILE *yyo
,
940 yysymbol_kind_t yykind
, YYSTYPE
const * const yyvaluep
)
942 FILE *yyoutput
= yyo
;
947 if (yykind
< YYNTOKENS
)
948 YYPRINT (yyo
, yytoknum
[yykind
], *yyvaluep
);
950 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
952 YY_IGNORE_MAYBE_UNINITIALIZED_END
956 /*---------------------------.
957 | Print this symbol on YYO. |
958 `---------------------------*/
961 yy_symbol_print (FILE *yyo
,
962 yysymbol_kind_t yykind
, YYSTYPE
const * const yyvaluep
)
964 YYFPRINTF (yyo
, "%s %s (",
965 yykind
< YYNTOKENS
? "token" : "nterm", yysymbol_name (yykind
));
967 yy_symbol_value_print (yyo
, yykind
, yyvaluep
);
968 YYFPRINTF (yyo
, ")");
971 /*------------------------------------------------------------------.
972 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
974 `------------------------------------------------------------------*/
977 yy_stack_print (yy_state_t
*yybottom
, yy_state_t
*yytop
)
979 YYFPRINTF (stderr
, "Stack now");
980 for (; yybottom
<= yytop
; yybottom
++)
982 int yybot
= *yybottom
;
983 YYFPRINTF (stderr
, " %d", yybot
);
985 YYFPRINTF (stderr
, "\n");
988 # define YY_STACK_PRINT(Bottom, Top) \
991 yy_stack_print ((Bottom), (Top)); \
995 /*------------------------------------------------.
996 | Report that the YYRULE is going to be reduced. |
997 `------------------------------------------------*/
1000 yy_reduce_print (yy_state_t
*yyssp
, YYSTYPE
*yyvsp
,
1003 int yylno
= yyrline
[yyrule
];
1004 int yynrhs
= yyr2
[yyrule
];
1006 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %d):\n",
1008 /* The symbols being reduced. */
1009 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1011 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1012 yy_symbol_print (stderr
,
1013 YY_ACCESSING_SYMBOL (+yyssp
[yyi
+ 1 - yynrhs
]),
1014 &yyvsp
[(yyi
+ 1) - (yynrhs
)]);
1015 YYFPRINTF (stderr
, "\n");
1019 # define YY_REDUCE_PRINT(Rule) \
1022 yy_reduce_print (yyssp, yyvsp, Rule); \
1025 /* Nonzero means print parse trace. It is left uninitialized so that
1026 multiple parsers can coexist. */
1028 #else /* !YYDEBUG */
1029 # define YYDPRINTF(Args) ((void) 0)
1030 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1031 # define YY_STACK_PRINT(Bottom, Top)
1032 # define YY_REDUCE_PRINT(Rule)
1033 #endif /* !YYDEBUG */
1036 /* YYINITDEPTH -- initial size of the parser's stacks. */
1038 # define YYINITDEPTH 200
1041 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1042 if the built-in stack extension method is used).
1044 Do not make this value too large; the results are undefined if
1045 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1046 evaluated with infinite-precision integer arithmetic. */
1049 # define YYMAXDEPTH 10000
1057 /*-----------------------------------------------.
1058 | Release the memory associated to this symbol. |
1059 `-----------------------------------------------*/
1062 yydestruct (const char *yymsg
,
1063 yysymbol_kind_t yykind
, YYSTYPE
*yyvaluep
)
1068 YY_SYMBOL_PRINT (yymsg
, yykind
, yyvaluep
, yylocationp
);
1070 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1073 case YYSYMBOL_choice_entry
: /* choice_entry */
1075 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1076 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1077 if (current_menu
== ((*yyvaluep
).menu
))
1082 case YYSYMBOL_if_entry
: /* if_entry */
1084 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1085 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1086 if (current_menu
== ((*yyvaluep
).menu
))
1091 case YYSYMBOL_menu_entry
: /* menu_entry */
1093 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1094 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1095 if (current_menu
== ((*yyvaluep
).menu
))
1103 YY_IGNORE_MAYBE_UNINITIALIZED_END
1107 /* Lookahead token kind. */
1110 /* The semantic value of the lookahead symbol. */
1112 /* Number of syntax errors so far. */
1125 yy_state_fast_t yystate
= 0;
1126 /* Number of tokens to shift before error messages enabled. */
1127 int yyerrstatus
= 0;
1129 /* Refer to the stacks through separate pointers, to allow yyoverflow
1130 to reallocate them elsewhere. */
1133 YYPTRDIFF_T yystacksize
= YYINITDEPTH
;
1135 /* The state stack: array, bottom, top. */
1136 yy_state_t yyssa
[YYINITDEPTH
];
1137 yy_state_t
*yyss
= yyssa
;
1138 yy_state_t
*yyssp
= yyss
;
1140 /* The semantic value stack: array, bottom, top. */
1141 YYSTYPE yyvsa
[YYINITDEPTH
];
1142 YYSTYPE
*yyvs
= yyvsa
;
1143 YYSTYPE
*yyvsp
= yyvs
;
1146 /* The return value of yyparse. */
1148 /* Lookahead symbol kind. */
1149 yysymbol_kind_t yytoken
= YYSYMBOL_YYEMPTY
;
1150 /* The variables used to return semantic value and location from the
1156 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1158 /* The number of symbols on the RHS of the reduced rule.
1159 Keep to zero when no symbol should be popped. */
1162 YYDPRINTF ((stderr
, "Starting parse\n"));
1164 yychar
= YYEMPTY
; /* Cause a token to be read. */
1168 /*------------------------------------------------------------.
1169 | yynewstate -- push a new state, which is found in yystate. |
1170 `------------------------------------------------------------*/
1172 /* In all cases, when you get here, the value and location stacks
1173 have just been pushed. So pushing a state here evens the stacks. */
1177 /*--------------------------------------------------------------------.
1178 | yysetstate -- set current state (the top of the stack) to yystate. |
1179 `--------------------------------------------------------------------*/
1181 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1182 YY_ASSERT (0 <= yystate
&& yystate
< YYNSTATES
);
1183 YY_IGNORE_USELESS_CAST_BEGIN
1184 *yyssp
= YY_CAST (yy_state_t
, yystate
);
1185 YY_IGNORE_USELESS_CAST_END
1186 YY_STACK_PRINT (yyss
, yyssp
);
1188 if (yyss
+ yystacksize
- 1 <= yyssp
)
1189 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1190 goto yyexhaustedlab
;
1193 /* Get the current used size of the three stacks, in elements. */
1194 YYPTRDIFF_T yysize
= yyssp
- yyss
+ 1;
1196 # if defined yyoverflow
1198 /* Give user a chance to reallocate the stack. Use copies of
1199 these so that the &'s don't force the real ones into
1201 yy_state_t
*yyss1
= yyss
;
1202 YYSTYPE
*yyvs1
= yyvs
;
1204 /* Each stack pointer address is followed by the size of the
1205 data in use in that stack, in bytes. This used to be a
1206 conditional around just the two extra args, but that might
1207 be undefined if yyoverflow is a macro. */
1208 yyoverflow (YY_("memory exhausted"),
1209 &yyss1
, yysize
* YYSIZEOF (*yyssp
),
1210 &yyvs1
, yysize
* YYSIZEOF (*yyvsp
),
1215 # else /* defined YYSTACK_RELOCATE */
1216 /* Extend the stack our own way. */
1217 if (YYMAXDEPTH
<= yystacksize
)
1218 goto yyexhaustedlab
;
1220 if (YYMAXDEPTH
< yystacksize
)
1221 yystacksize
= YYMAXDEPTH
;
1224 yy_state_t
*yyss1
= yyss
;
1225 union yyalloc
*yyptr
=
1226 YY_CAST (union yyalloc
*,
1227 YYSTACK_ALLOC (YY_CAST (YYSIZE_T
, YYSTACK_BYTES (yystacksize
))));
1229 goto yyexhaustedlab
;
1230 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1231 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1232 # undef YYSTACK_RELOCATE
1234 YYSTACK_FREE (yyss1
);
1238 yyssp
= yyss
+ yysize
- 1;
1239 yyvsp
= yyvs
+ yysize
- 1;
1241 YY_IGNORE_USELESS_CAST_BEGIN
1242 YYDPRINTF ((stderr
, "Stack size increased to %ld\n",
1243 YY_CAST (long, yystacksize
)));
1244 YY_IGNORE_USELESS_CAST_END
1246 if (yyss
+ yystacksize
- 1 <= yyssp
)
1249 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1251 if (yystate
== YYFINAL
)
1261 /* Do appropriate processing given the current state. Read a
1262 lookahead token if we need one and don't already have one. */
1264 /* First try to decide what to do without reference to lookahead token. */
1265 yyn
= yypact
[yystate
];
1266 if (yypact_value_is_default (yyn
))
1269 /* Not known => get a lookahead token if don't already have one. */
1271 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1272 if (yychar
== YYEMPTY
)
1274 YYDPRINTF ((stderr
, "Reading a token\n"));
1278 if (yychar
<= YYEOF
)
1281 yytoken
= YYSYMBOL_YYEOF
;
1282 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1284 else if (yychar
== YYerror
)
1286 /* The scanner already issued an error message, process directly
1287 to error recovery. But do not keep the error token as
1288 lookahead, it is too special and may lead us to an endless
1289 loop in error recovery. */
1291 yytoken
= YYSYMBOL_YYerror
;
1296 yytoken
= YYTRANSLATE (yychar
);
1297 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1300 /* If the proper action on seeing token YYTOKEN is to reduce or to
1301 detect an error, take that action. */
1303 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1308 if (yytable_value_is_error (yyn
))
1314 /* Count tokens shifted since error; after three, turn off error
1319 /* Shift the lookahead token. */
1320 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1322 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1324 YY_IGNORE_MAYBE_UNINITIALIZED_END
1326 /* Discard the shifted token. */
1331 /*-----------------------------------------------------------.
1332 | yydefault -- do the default action for the current state. |
1333 `-----------------------------------------------------------*/
1335 yyn
= yydefact
[yystate
];
1341 /*-----------------------------.
1342 | yyreduce -- do a reduction. |
1343 `-----------------------------*/
1345 /* yyn is the number of a rule to reduce with. */
1348 /* If YYLEN is nonzero, implement the default value of the action:
1351 Otherwise, the following line sets YYVAL to garbage.
1352 This behavior is undocumented and Bison
1353 users should not rely upon it. Assigning to YYVAL
1354 unconditionally makes the parser a bit smaller, and it avoids a
1355 GCC warning that YYVAL may be used uninitialized. */
1356 yyval
= yyvsp
[1-yylen
];
1359 YY_REDUCE_PRINT (yyn
);
1362 case 4: /* mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL */
1364 menu_add_prompt(P_MENU
, (yyvsp
[-1].string
), NULL
);
1368 case 14: /* stmt_list: stmt_list T_WORD error T_EOL */
1369 { zconf_error("unknown statement \"%s\"", (yyvsp
[-2].string
)); }
1372 case 15: /* stmt_list: stmt_list error T_EOL */
1373 { zconf_error("invalid statement"); }
1376 case 20: /* stmt_list_in_choice: stmt_list_in_choice error T_EOL */
1377 { zconf_error("invalid statement"); }
1380 case 21: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */
1382 (yyvsp
[-1].symbol
)->flags
|= SYMBOL_OPTIONAL
;
1383 menu_add_entry((yyvsp
[-1].symbol
));
1384 printd(DEBUG_PARSE
, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].symbol
)->name
);
1388 case 22: /* config_stmt: config_entry_start config_option_list */
1390 printd(DEBUG_PARSE
, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1394 case 23: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */
1396 (yyvsp
[-1].symbol
)->flags
|= SYMBOL_OPTIONAL
;
1397 menu_add_entry((yyvsp
[-1].symbol
));
1398 printd(DEBUG_PARSE
, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].symbol
)->name
);
1402 case 24: /* menuconfig_stmt: menuconfig_entry_start config_option_list */
1404 if (current_entry
->prompt
)
1405 current_entry
->prompt
->type
= P_MENU
;
1407 zconfprint("warning: menuconfig statement without prompt");
1408 printd(DEBUG_PARSE
, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1412 case 29: /* config_option: type prompt_stmt_opt T_EOL */
1414 menu_set_type((yyvsp
[-2].type
));
1415 printd(DEBUG_PARSE
, "%s:%d:type(%u)\n",
1416 zconf_curname(), zconf_lineno(),
1421 case 30: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */
1423 menu_add_prompt(P_PROMPT
, (yyvsp
[-2].string
), (yyvsp
[-1].expr
));
1424 printd(DEBUG_PARSE
, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1428 case 31: /* config_option: default expr if_expr T_EOL */
1430 menu_add_expr(P_DEFAULT
, (yyvsp
[-2].expr
), (yyvsp
[-1].expr
));
1431 if ((yyvsp
[-3].type
) != S_UNKNOWN
)
1432 menu_set_type((yyvsp
[-3].type
));
1433 printd(DEBUG_PARSE
, "%s:%d:default(%u)\n",
1434 zconf_curname(), zconf_lineno(),
1439 case 32: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */
1441 menu_add_symbol(P_SELECT
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1442 printd(DEBUG_PARSE
, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1446 case 33: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */
1448 menu_add_symbol(P_IMPLY
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1449 printd(DEBUG_PARSE
, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1453 case 34: /* config_option: T_RANGE symbol symbol if_expr T_EOL */
1455 menu_add_expr(P_RANGE
, expr_alloc_comp(E_RANGE
,(yyvsp
[-3].symbol
), (yyvsp
[-2].symbol
)), (yyvsp
[-1].expr
));
1456 printd(DEBUG_PARSE
, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1460 case 35: /* config_option: T_MODULES T_EOL */
1463 zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'",
1464 current_entry
->sym
->name
, modules_sym
->name
);
1465 modules_sym
= current_entry
->sym
;
1469 case 36: /* choice: T_CHOICE word_opt T_EOL */
1471 struct symbol
*sym
= sym_lookup((yyvsp
[-1].string
), SYMBOL_CHOICE
);
1472 sym
->flags
|= SYMBOL_NO_WRITE
;
1473 menu_add_entry(sym
);
1474 menu_add_expr(P_CHOICE
, NULL
, NULL
);
1475 free((yyvsp
[-1].string
));
1476 printd(DEBUG_PARSE
, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1480 case 37: /* choice_entry: choice choice_option_list */
1482 (yyval
.menu
) = menu_add_menu();
1486 case 38: /* choice_end: end */
1488 if (zconf_endtoken((yyvsp
[0].string
), "choice")) {
1490 printd(DEBUG_PARSE
, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1495 case 44: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */
1497 menu_add_prompt(P_PROMPT
, (yyvsp
[-2].string
), (yyvsp
[-1].expr
));
1498 printd(DEBUG_PARSE
, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1502 case 45: /* choice_option: logic_type prompt_stmt_opt T_EOL */
1504 menu_set_type((yyvsp
[-2].type
));
1505 printd(DEBUG_PARSE
, "%s:%d:type(%u)\n",
1506 zconf_curname(), zconf_lineno(), (yyvsp
[-2].type
));
1510 case 46: /* choice_option: T_OPTIONAL T_EOL */
1512 current_entry
->sym
->flags
|= SYMBOL_OPTIONAL
;
1513 printd(DEBUG_PARSE
, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1517 case 47: /* choice_option: T_RESET if_expr T_EOL */
1519 menu_add_prop(P_RESET
, NULL
, (yyvsp
[-1].expr
));
1523 case 48: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */
1525 menu_add_symbol(P_DEFAULT
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1526 printd(DEBUG_PARSE
, "%s:%d:default\n",
1527 zconf_curname(), zconf_lineno());
1531 case 50: /* type: T_INT */
1532 { (yyval
.type
) = S_INT
; }
1535 case 51: /* type: T_HEX */
1536 { (yyval
.type
) = S_HEX
; }
1539 case 52: /* type: T_STRING */
1540 { (yyval
.type
) = S_STRING
; }
1543 case 53: /* logic_type: T_BOOL */
1544 { (yyval
.type
) = S_BOOLEAN
; }
1547 case 54: /* logic_type: T_TRISTATE */
1548 { (yyval
.type
) = S_TRISTATE
; }
1551 case 55: /* default: T_DEFAULT */
1552 { (yyval
.type
) = S_UNKNOWN
; }
1555 case 56: /* default: T_DEF_BOOL */
1556 { (yyval
.type
) = S_BOOLEAN
; }
1559 case 57: /* default: T_DEF_TRISTATE */
1560 { (yyval
.type
) = S_TRISTATE
; }
1563 case 58: /* if_entry: T_IF expr T_EOL */
1565 printd(DEBUG_PARSE
, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1566 menu_add_entry(NULL
);
1567 menu_add_dep((yyvsp
[-1].expr
));
1568 (yyval
.menu
) = menu_add_menu();
1572 case 59: /* if_end: end */
1574 if (zconf_endtoken((yyvsp
[0].string
), "if")) {
1576 printd(DEBUG_PARSE
, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1581 case 62: /* menu: T_MENU T_WORD_QUOTE T_EOL */
1583 menu_add_entry(NULL
);
1584 menu_add_prompt(P_MENU
, (yyvsp
[-1].string
), NULL
);
1585 printd(DEBUG_PARSE
, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1589 case 63: /* menu_entry: menu menu_option_list */
1591 (yyval
.menu
) = menu_add_menu();
1595 case 64: /* menu_end: end */
1597 if (zconf_endtoken((yyvsp
[0].string
), "menu")) {
1599 printd(DEBUG_PARSE
, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1604 case 69: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */
1606 printd(DEBUG_PARSE
, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].string
));
1607 zconf_nextfile((yyvsp
[-1].string
));
1608 free((yyvsp
[-1].string
));
1612 case 70: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */
1614 menu_add_entry(NULL
);
1615 menu_add_prompt(P_COMMENT
, (yyvsp
[-1].string
), NULL
);
1616 printd(DEBUG_PARSE
, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1620 case 74: /* help_start: T_HELP T_EOL */
1622 printd(DEBUG_PARSE
, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1627 case 75: /* help: help_start T_HELPTEXT */
1629 /* Is the help text empty or all whitespace? */
1630 if ((yyvsp
[0].string
)[strspn((yyvsp
[0].string
), " \f\n\r\t\v")] == '\0')
1631 zconfprint("warning: '%s' defined with blank help text",
1632 current_entry
->sym
->name
?: "<choice>");
1634 current_entry
->help
= (yyvsp
[0].string
);
1638 case 76: /* depends: T_DEPENDS T_ON expr T_EOL */
1640 menu_add_dep((yyvsp
[-1].expr
));
1641 printd(DEBUG_PARSE
, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1645 case 77: /* visible: T_VISIBLE if_expr T_EOL */
1647 menu_add_visibility((yyvsp
[-1].expr
));
1651 case 79: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */
1653 menu_add_prompt(P_PROMPT
, (yyvsp
[-1].string
), (yyvsp
[0].expr
));
1657 case 80: /* end: T_ENDMENU T_EOL */
1658 { (yyval
.string
) = "menu"; }
1661 case 81: /* end: T_ENDCHOICE T_EOL */
1662 { (yyval
.string
) = "choice"; }
1665 case 82: /* end: T_ENDIF T_EOL */
1666 { (yyval
.string
) = "if"; }
1669 case 83: /* if_expr: %empty */
1670 { (yyval
.expr
) = NULL
; }
1673 case 84: /* if_expr: T_IF expr */
1674 { (yyval
.expr
) = (yyvsp
[0].expr
); }
1677 case 85: /* expr: symbol */
1678 { (yyval
.expr
) = expr_alloc_symbol((yyvsp
[0].symbol
)); }
1681 case 86: /* expr: symbol T_LESS symbol */
1682 { (yyval
.expr
) = expr_alloc_comp(E_LTH
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1685 case 87: /* expr: symbol T_LESS_EQUAL symbol */
1686 { (yyval
.expr
) = expr_alloc_comp(E_LEQ
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1689 case 88: /* expr: symbol T_GREATER symbol */
1690 { (yyval
.expr
) = expr_alloc_comp(E_GTH
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1693 case 89: /* expr: symbol T_GREATER_EQUAL symbol */
1694 { (yyval
.expr
) = expr_alloc_comp(E_GEQ
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1697 case 90: /* expr: symbol T_EQUAL symbol */
1698 { (yyval
.expr
) = expr_alloc_comp(E_EQUAL
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1701 case 91: /* expr: symbol T_UNEQUAL symbol */
1702 { (yyval
.expr
) = expr_alloc_comp(E_UNEQUAL
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1705 case 92: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */
1706 { (yyval
.expr
) = (yyvsp
[-1].expr
); }
1709 case 93: /* expr: T_NOT expr */
1710 { (yyval
.expr
) = expr_alloc_one(E_NOT
, (yyvsp
[0].expr
)); }
1713 case 94: /* expr: expr T_OR expr */
1714 { (yyval
.expr
) = expr_alloc_two(E_OR
, (yyvsp
[-2].expr
), (yyvsp
[0].expr
)); }
1717 case 95: /* expr: expr T_AND expr */
1718 { (yyval
.expr
) = expr_alloc_two(E_AND
, (yyvsp
[-2].expr
), (yyvsp
[0].expr
)); }
1721 case 96: /* nonconst_symbol: T_WORD */
1722 { (yyval
.symbol
) = sym_lookup((yyvsp
[0].string
), 0); free((yyvsp
[0].string
)); }
1725 case 98: /* symbol: T_WORD_QUOTE */
1726 { (yyval
.symbol
) = sym_lookup((yyvsp
[0].string
), SYMBOL_CONST
); free((yyvsp
[0].string
)); }
1729 case 99: /* word_opt: %empty */
1730 { (yyval
.string
) = NULL
; }
1733 case 101: /* assignment_stmt: T_WORD assign_op assign_val T_EOL */
1734 { variable_add((yyvsp
[-3].string
), (yyvsp
[-1].string
), (yyvsp
[-2].flavor
)); free((yyvsp
[-3].string
)); free((yyvsp
[-1].string
)); }
1737 case 102: /* assign_op: T_EQUAL */
1738 { (yyval
.flavor
) = VAR_RECURSIVE
; }
1741 case 103: /* assign_op: T_COLON_EQUAL */
1742 { (yyval
.flavor
) = VAR_SIMPLE
; }
1745 case 104: /* assign_op: T_PLUS_EQUAL */
1746 { (yyval
.flavor
) = VAR_APPEND
; }
1749 case 105: /* assign_val: %empty */
1750 { (yyval
.string
) = xstrdup(""); }
1757 /* User semantic actions sometimes alter yychar, and that requires
1758 that yytoken be updated with the new translation. We take the
1759 approach of translating immediately before every use of yytoken.
1760 One alternative is translating here after every semantic action,
1761 but that translation would be missed if the semantic action invokes
1762 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1763 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1764 incorrect destructor might then be invoked immediately. In the
1765 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1766 to an incorrect destructor call or verbose syntax error message
1767 before the lookahead is translated. */
1768 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t
, yyr1
[yyn
]), &yyval
, &yyloc
);
1775 /* Now 'shift' the result of the reduction. Determine what state
1776 that goes to, based on the state we popped back to and the rule
1777 number reduced by. */
1779 const int yylhs
= yyr1
[yyn
] - YYNTOKENS
;
1780 const int yyi
= yypgoto
[yylhs
] + *yyssp
;
1781 yystate
= (0 <= yyi
&& yyi
<= YYLAST
&& yycheck
[yyi
] == *yyssp
1783 : yydefgoto
[yylhs
]);
1789 /*--------------------------------------.
1790 | yyerrlab -- here on detecting error. |
1791 `--------------------------------------*/
1793 /* Make sure we have latest lookahead translation. See comments at
1794 user semantic actions for why this is necessary. */
1795 yytoken
= yychar
== YYEMPTY
? YYSYMBOL_YYEMPTY
: YYTRANSLATE (yychar
);
1796 /* If not already recovering from an error, report this error. */
1800 yyerror (YY_("syntax error"));
1803 if (yyerrstatus
== 3)
1805 /* If just tried and failed to reuse lookahead token after an
1806 error, discard it. */
1808 if (yychar
<= YYEOF
)
1810 /* Return failure if at end of input. */
1811 if (yychar
== YYEOF
)
1816 yydestruct ("Error: discarding",
1822 /* Else will try to reuse lookahead token after shifting the error
1827 /*---------------------------------------------------.
1828 | yyerrorlab -- error raised explicitly by YYERROR. |
1829 `---------------------------------------------------*/
1831 /* Pacify compilers when the user code never invokes YYERROR and the
1832 label yyerrorlab therefore never appears in user code. */
1836 /* Do not reclaim the symbols of the rule whose action triggered
1840 YY_STACK_PRINT (yyss
, yyssp
);
1845 /*-------------------------------------------------------------.
1846 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1847 `-------------------------------------------------------------*/
1849 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1851 /* Pop stack until we find a state that shifts the error token. */
1854 yyn
= yypact
[yystate
];
1855 if (!yypact_value_is_default (yyn
))
1857 yyn
+= YYSYMBOL_YYerror
;
1858 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYSYMBOL_YYerror
)
1866 /* Pop the current state because it cannot handle the error token. */
1871 yydestruct ("Error: popping",
1872 YY_ACCESSING_SYMBOL (yystate
), yyvsp
);
1875 YY_STACK_PRINT (yyss
, yyssp
);
1878 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1880 YY_IGNORE_MAYBE_UNINITIALIZED_END
1883 /* Shift the error token. */
1884 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn
), yyvsp
, yylsp
);
1890 /*-------------------------------------.
1891 | yyacceptlab -- YYACCEPT comes here. |
1892 `-------------------------------------*/
1898 /*-----------------------------------.
1899 | yyabortlab -- YYABORT comes here. |
1900 `-----------------------------------*/
1906 #if !defined yyoverflow
1907 /*-------------------------------------------------.
1908 | yyexhaustedlab -- memory exhaustion comes here. |
1909 `-------------------------------------------------*/
1911 yyerror (YY_("memory exhausted"));
1917 /*-------------------------------------------------------.
1918 | yyreturn -- parsing is finished, clean up and return. |
1919 `-------------------------------------------------------*/
1921 if (yychar
!= YYEMPTY
)
1923 /* Make sure we have latest lookahead translation. See comments at
1924 user semantic actions for why this is necessary. */
1925 yytoken
= YYTRANSLATE (yychar
);
1926 yydestruct ("Cleanup: discarding lookahead",
1929 /* Do not reclaim the symbols of the rule whose action triggered
1930 this YYABORT or YYACCEPT. */
1932 YY_STACK_PRINT (yyss
, yyssp
);
1933 while (yyssp
!= yyss
)
1935 yydestruct ("Cleanup: popping",
1936 YY_ACCESSING_SYMBOL (+*yyssp
), yyvsp
);
1941 YYSTACK_FREE (yyss
);
1949 void conf_parse(const char *name
)
1954 zconf_initscan(name
);
1959 if (getenv("ZCONF_DEBUG"))
1964 /* Variables are expanded in the parse phase. We can free them here. */
1970 modules_sym
= sym_find( "n" );
1972 if (!menu_has_prompt(&rootmenu
)) {
1973 current_entry
= &rootmenu
;
1974 menu_add_prompt(P_MENU
, "Main menu", NULL
);
1977 menu_finalize(&rootmenu
);
1978 for_all_symbols(i
, sym
) {
1979 if (sym_check_deps(sym
))
1984 conf_set_changed(true);
1987 static bool zconf_endtoken(const char *tokenname
,
1988 const char *expected_tokenname
)
1990 if (strcmp(tokenname
, expected_tokenname
)) {
1991 zconf_error("unexpected '%s' within %s block",
1992 tokenname
, expected_tokenname
);
1996 if (current_menu
->file
!= current_file
) {
1997 zconf_error("'%s' in different file than '%s'",
1998 tokenname
, expected_tokenname
);
1999 fprintf(stderr
, "%s:%d: location of the '%s'\n",
2000 current_menu
->file
->name
, current_menu
->lineno
,
2001 expected_tokenname
);
2008 static void zconfprint(const char *err
, ...)
2012 fprintf(stderr
, "%s:%d: ", zconf_curname(), zconf_lineno());
2014 vfprintf(stderr
, err
, ap
);
2016 fprintf(stderr
, "\n");
2019 static void zconf_error(const char *err
, ...)
2024 fprintf(stderr
, "%s:%d: ", zconf_curname(), zconf_lineno());
2026 vfprintf(stderr
, err
, ap
);
2028 fprintf(stderr
, "\n");
2031 static void yyerror(const char *err
)
2033 fprintf(stderr
, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err
);
2036 static void print_quoted_string(FILE *out
, const char *str
)
2042 while ((p
= strchr(str
, '"'))) {
2045 fprintf(out
, "%.*s", len
, str
);
2053 static void print_symbol(FILE *out
, struct menu
*menu
)
2055 struct symbol
*sym
= menu
->sym
;
2056 struct property
*prop
;
2058 if (sym_is_choice(sym
))
2059 fprintf(out
, "\nchoice\n");
2061 fprintf(out
, "\nconfig %s\n", sym
->name
);
2062 switch (sym
->type
) {
2064 fputs(" bool\n", out
);
2067 fputs(" tristate\n", out
);
2070 fputs(" string\n", out
);
2073 fputs(" integer\n", out
);
2076 fputs(" hex\n", out
);
2079 fputs(" ???\n", out
);
2082 for (prop
= sym
->prop
; prop
; prop
= prop
->next
) {
2083 if (prop
->menu
!= menu
)
2085 switch (prop
->type
) {
2087 fputs(" prompt ", out
);
2088 print_quoted_string(out
, prop
->text
);
2089 if (!expr_is_yes(prop
->visible
.expr
)) {
2091 expr_fprint(prop
->visible
.expr
, out
);
2096 fputs( " default ", out
);
2097 expr_fprint(prop
->expr
, out
);
2098 if (!expr_is_yes(prop
->visible
.expr
)) {
2100 expr_fprint(prop
->visible
.expr
, out
);
2105 fputs(" #choice value\n", out
);
2108 fputs( " select ", out
);
2109 expr_fprint(prop
->expr
, out
);
2113 fputs( " imply ", out
);
2114 expr_fprint(prop
->expr
, out
);
2118 fputs( " range ", out
);
2119 expr_fprint(prop
->expr
, out
);
2123 fputs( " menu ", out
);
2124 print_quoted_string(out
, prop
->text
);
2128 fputs( " symbol ", out
);
2129 fprintf(out
, "%s\n", prop
->menu
->sym
->name
);
2132 fprintf(out
, " unknown prop %d!\n", prop
->type
);
2137 int len
= strlen(menu
->help
);
2138 while (menu
->help
[--len
] == '\n')
2139 menu
->help
[len
] = 0;
2140 fprintf(out
, " help\n%s\n", menu
->help
);
2144 void zconfdump(FILE *out
)
2146 struct property
*prop
;
2150 menu
= rootmenu
.list
;
2152 if ((sym
= menu
->sym
))
2153 print_symbol(out
, menu
);
2154 else if ((prop
= menu
->prompt
)) {
2155 switch (prop
->type
) {
2157 fputs("\ncomment ", out
);
2158 print_quoted_string(out
, prop
->text
);
2162 fputs("\nmenu ", out
);
2163 print_quoted_string(out
, prop
->text
);
2169 if (!expr_is_yes(prop
->visible
.expr
)) {
2170 fputs(" depends ", out
);
2171 expr_fprint(prop
->visible
.expr
, out
);
2178 else if (menu
->next
)
2180 else while ((menu
= menu
->parent
)) {
2181 if (menu
->prompt
&& menu
->prompt
->type
== P_MENU
)
2182 fputs("\nendmenu\n", out
);