1 /* A Bison parser, made by GNU Bison 3.8.2. */
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.8.2"
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 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
383 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
384 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
385 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
386 _Pragma ("GCC diagnostic push") \
387 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
389 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
390 _Pragma ("GCC diagnostic push") \
391 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
392 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
394 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
395 _Pragma ("GCC diagnostic pop")
397 # define YY_INITIAL_VALUE(Value) Value
399 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
400 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
401 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
403 #ifndef YY_INITIAL_VALUE
404 # define YY_INITIAL_VALUE(Value) /* Nothing. */
407 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
408 # define YY_IGNORE_USELESS_CAST_BEGIN \
409 _Pragma ("GCC diagnostic push") \
410 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
411 # define YY_IGNORE_USELESS_CAST_END \
412 _Pragma ("GCC diagnostic pop")
414 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
415 # define YY_IGNORE_USELESS_CAST_BEGIN
416 # define YY_IGNORE_USELESS_CAST_END
420 #define YY_ASSERT(E) ((void) (0 && (E)))
422 #if !defined yyoverflow
424 /* The parser invokes alloca or malloc; define the necessary symbols. */
426 # ifdef YYSTACK_USE_ALLOCA
427 # if YYSTACK_USE_ALLOCA
429 # define YYSTACK_ALLOC __builtin_alloca
430 # elif defined __BUILTIN_VA_ARG_INCR
431 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
433 # define YYSTACK_ALLOC __alloca
434 # elif defined _MSC_VER
435 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
436 # define alloca _alloca
438 # define YYSTACK_ALLOC alloca
439 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
440 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
441 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
442 # ifndef EXIT_SUCCESS
443 # define EXIT_SUCCESS 0
450 # ifdef YYSTACK_ALLOC
451 /* Pacify GCC's 'empty if-body' warning. */
452 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
453 # ifndef YYSTACK_ALLOC_MAXIMUM
454 /* The OS might guarantee only one guard page at the bottom of the stack,
455 and a page size can be as small as 4096 bytes. So we cannot safely
456 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
457 to allow for a few compiler-allocated temporary stack slots. */
458 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
461 # define YYSTACK_ALLOC YYMALLOC
462 # define YYSTACK_FREE YYFREE
463 # ifndef YYSTACK_ALLOC_MAXIMUM
464 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
466 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
467 && ! ((defined YYMALLOC || defined malloc) \
468 && (defined YYFREE || defined free)))
469 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
470 # ifndef EXIT_SUCCESS
471 # define EXIT_SUCCESS 0
475 # define YYMALLOC malloc
476 # if ! defined malloc && ! defined EXIT_SUCCESS
477 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
482 # if ! defined free && ! defined EXIT_SUCCESS
483 void free (void *); /* INFRINGES ON USER NAME SPACE */
487 #endif /* !defined yyoverflow */
489 #if (! defined yyoverflow \
490 && (! defined __cplusplus \
491 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
493 /* A type that is properly aligned for any stack member. */
496 yy_state_t yyss_alloc
;
500 /* The size of the maximum gap between one aligned stack and the next. */
501 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
503 /* The size of an array large to enough to hold all stacks, each with
505 # define YYSTACK_BYTES(N) \
506 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
507 + YYSTACK_GAP_MAXIMUM)
509 # define YYCOPY_NEEDED 1
511 /* Relocate STACK from its old location to the new one. The
512 local variables YYSIZE and YYSTACKSIZE give the old and new number of
513 elements in the stack, and YYPTR gives the new location of the
514 stack. Advance YYPTR to a properly aligned location for the next
516 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
519 YYPTRDIFF_T yynewbytes; \
520 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
521 Stack = &yyptr->Stack_alloc; \
522 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
523 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
529 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
530 /* Copy COUNT objects from SRC to DST. The source and destination do
533 # if defined __GNUC__ && 1 < __GNUC__
534 # define YYCOPY(Dst, Src, Count) \
535 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
537 # define YYCOPY(Dst, Src, Count) \
541 for (yyi = 0; yyi < (Count); yyi++) \
542 (Dst)[yyi] = (Src)[yyi]; \
547 #endif /* !YYCOPY_NEEDED */
549 /* YYFINAL -- State number of the termination state. */
551 /* YYLAST -- Last index in YYTABLE. */
554 /* YYNTOKENS -- Number of terminals. */
556 /* YYNNTS -- Number of nonterminals. */
558 /* YYNRULES -- Number of rules. */
560 /* YYNSTATES -- Number of states. */
561 #define YYNSTATES 187
563 /* YYMAXUTOK -- Last valid token kind. */
564 #define YYMAXUTOK 305
567 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
568 as returned by yylex, with out-of-bounds checking. */
569 #define YYTRANSLATE(YYX) \
570 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
571 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
574 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
575 as returned by yylex. */
576 static const yytype_int8 yytranslate
[] =
578 0, 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, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
604 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
605 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
606 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
607 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
608 45, 46, 47, 48, 49, 50
612 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
613 static const yytype_int16 yyrline
[] =
615 0, 110, 110, 110, 114, 119, 121, 122, 123, 124,
616 125, 126, 127, 128, 129, 130, 133, 135, 136, 137,
617 138, 143, 150, 155, 162, 171, 173, 174, 175, 178,
618 186, 192, 202, 208, 214, 220, 230, 240, 245, 253,
619 256, 258, 259, 260, 263, 269, 276, 282, 287, 295,
620 296, 297, 298, 301, 302, 305, 306, 307, 311, 319,
621 327, 330, 335, 342, 347, 355, 358, 360, 361, 364,
622 373, 380, 383, 385, 390, 396, 408, 415, 422, 424,
623 429, 430, 431, 434, 435, 438, 439, 440, 441, 442,
624 443, 444, 445, 446, 447, 448, 452, 454, 455, 458,
625 459, 463, 466, 467, 468, 472, 473
629 /** Accessing symbol of state STATE. */
630 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
633 /* The user-facing name of the symbol whose (internal) number is
634 YYSYMBOL. No bounds checking. */
635 static const char *yysymbol_name (yysymbol_kind_t yysymbol
) YY_ATTRIBUTE_UNUSED
;
637 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
638 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
639 static const char *const yytname
[] =
641 "\"end of file\"", "error", "\"invalid token\"", "T_HELPTEXT", "T_WORD",
642 "T_WORD_QUOTE", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN", "T_COLON_EQUAL",
643 "T_COMMENT", "T_CONFIG", "T_DEFAULT", "T_DEF_BOOL", "T_DEF_TRISTATE",
644 "T_DEPENDS", "T_ENDCHOICE", "T_ENDIF", "T_ENDMENU", "T_HELP", "T_HEX",
645 "T_IF", "T_IMPLY", "T_INT", "T_MAINMENU", "T_MENU", "T_MENUCONFIG",
646 "T_MODULES", "T_ON", "T_OPEN_PAREN", "T_OPTIONAL", "T_PLUS_EQUAL",
647 "T_PROMPT", "T_RANGE", "T_RESET", "T_SELECT", "T_SOURCE", "T_STRING",
648 "T_TRISTATE", "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND",
649 "T_EQUAL", "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER",
650 "T_GREATER_EQUAL", "T_NOT", "$accept", "input", "mainmenu_stmt",
651 "stmt_list", "stmt_list_in_choice", "config_entry_start", "config_stmt",
652 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
653 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
654 "choice_option_list", "choice_option", "type", "logic_type", "default",
655 "if_entry", "if_end", "if_stmt", "if_stmt_in_choice", "menu",
656 "menu_entry", "menu_end", "menu_stmt", "menu_option_list", "source_stmt",
657 "comment", "comment_stmt", "comment_option_list", "help_start", "help",
658 "depends", "visible", "prompt_stmt_opt", "end", "if_expr", "expr",
659 "nonconst_symbol", "symbol", "word_opt", "assignment_stmt", "assign_op",
660 "assign_val", YY_NULLPTR
664 yysymbol_name (yysymbol_kind_t yysymbol
)
666 return yytname
[yysymbol
];
670 #define YYPACT_NINF (-105)
672 #define yypact_value_is_default(Yyn) \
673 ((Yyn) == YYPACT_NINF)
675 #define YYTABLE_NINF (-4)
677 #define yytable_value_is_error(Yyn) \
680 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
682 static const yytype_int16 yypact
[] =
684 -5, 17, 37, -105, 57, 8, -105, 91, 39, 15,
685 46, 72, 80, 10, 82, 80, 83, -105, -105, -105,
686 -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
687 -105, -105, -105, -105, -105, 45, -105, -105, -105, 48,
688 -105, 50, 59, -105, 60, -105, 10, 10, -7, -105,
689 25, 63, 64, 65, 132, 132, 156, 162, 114, 14,
690 114, 95, -105, -105, 71, -105, -105, -105, 9, -105,
691 -105, 10, 10, 27, 27, 27, 27, 27, 27, -105,
692 -105, -105, -105, -105, -105, -105, 69, 73, -105, 80,
693 -105, 74, 115, 27, 80, -105, -105, -105, 117, -105,
694 10, 116, -105, -105, 80, 86, 118, 107, -105, 117,
695 -105, -105, 89, 93, 94, 96, -105, -105, -105, -105,
696 -105, -105, -105, -105, 107, -105, -105, -105, -105, -105,
697 -105, -105, 98, -105, -105, -105, -105, -105, -105, -105,
698 10, -105, 107, -105, 107, 27, 107, 107, 97, 13,
699 -105, 107, -105, 107, 10, 102, 103, -105, -105, -105,
700 -105, 162, 108, 23, 109, 113, 107, 120, -105, -105,
701 121, 126, 134, 33, -105, -105, -105, -105, -105, -105,
702 -105, 136, -105, -105, -105, -105, -105
705 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
706 Performed when YYTABLE does not specify something else to do. Zero
707 means the default is an error. */
708 static const yytype_int8 yydefact
[] =
710 5, 0, 0, 5, 0, 0, 1, 0, 0, 0,
711 99, 0, 0, 0, 0, 0, 0, 25, 9, 25,
712 12, 40, 16, 7, 5, 10, 66, 5, 11, 13,
713 72, 8, 6, 4, 15, 0, 103, 104, 102, 105,
714 100, 0, 0, 96, 0, 98, 0, 0, 0, 97,
715 85, 0, 0, 0, 22, 24, 37, 0, 0, 63,
716 0, 71, 14, 106, 0, 36, 70, 21, 0, 93,
717 58, 0, 0, 0, 0, 0, 0, 0, 0, 62,
718 23, 69, 53, 55, 56, 57, 0, 0, 51, 0,
719 50, 0, 0, 0, 0, 52, 54, 26, 78, 49,
720 0, 0, 28, 27, 0, 0, 0, 83, 41, 78,
721 43, 42, 0, 0, 0, 0, 18, 39, 16, 19,
722 17, 38, 60, 59, 83, 68, 67, 65, 64, 73,
723 101, 92, 94, 95, 90, 91, 86, 87, 88, 89,
724 0, 74, 83, 35, 83, 0, 83, 83, 0, 83,
725 75, 83, 46, 83, 0, 0, 0, 20, 81, 82,
726 80, 0, 0, 0, 0, 0, 83, 0, 79, 29,
727 0, 0, 0, 84, 47, 45, 61, 77, 76, 33,
728 30, 0, 32, 31, 48, 44, 34
731 /* YYPGOTO[NTERM-NUM]. */
732 static const yytype_int16 yypgoto
[] =
734 -105, -105, -105, 3, 38, -105, -55, -105, -105, 138,
735 -105, -105, -105, -105, -105, -105, -105, -105, 125, -105,
736 -54, -3, -105, -105, -105, -105, -105, -105, -105, -105,
737 -105, -52, -105, -105, 128, -38, -105, 68, -16, -104,
738 -46, -8, -65, -105, -105, -105, -105
741 /* YYDEFGOTO[NTERM-NUM]. */
742 static const yytype_uint8 yydefgoto
[] =
744 0, 2, 3, 4, 57, 17, 18, 19, 20, 54,
745 97, 21, 22, 117, 23, 56, 108, 98, 99, 100,
746 24, 122, 25, 119, 26, 27, 127, 28, 59, 29,
747 30, 31, 61, 101, 102, 103, 126, 148, 123, 155,
748 48, 49, 50, 41, 32, 39, 64
751 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
752 positive, shift that token. If negative, reduce the rule whose
753 number is the opposite. If YYTABLE_NINF, syntax error. */
754 static const yytype_int16 yytable
[] =
756 68, 69, 116, 118, 44, 120, 7, 52, 134, 135,
757 136, 137, 138, 139, 43, 45, 35, 131, 111, 1,
758 162, 125, 5, 129, 36, 132, 133, 58, 145, 86,
759 60, 43, 45, 70, 154, 71, 72, 6, 164, 46,
760 165, 121, 167, 168, 128, 170, 37, 171, 33, 172,
761 40, 71, 72, 124, 149, 71, 72, -3, 8, 38,
762 47, 9, 181, 178, 10, 71, 72, 11, 12, 73,
763 74, 75, 76, 77, 78, 71, 72, 42, 13, 34,
764 166, 142, 14, 15, 43, 62, 146, 51, 53, 63,
765 65, -2, 8, 16, 163, 9, 151, 140, 10, 66,
766 67, 11, 12, 79, 80, 81, 116, 118, 173, 120,
767 86, 130, 13, 141, 143, 8, 14, 15, 9, 150,
768 144, 10, 147, 153, 11, 12, 152, 16, 154, 157,
769 113, 114, 115, 158, 159, 13, 160, 169, 82, 14,
770 15, 72, 174, 175, 83, 84, 85, 86, 177, 179,
771 16, 87, 88, 180, 89, 90, 161, 55, 176, 91,
772 182, 183, 82, 112, 92, 93, 184, 94, 104, 95,
773 96, 86, 11, 12, 185, 87, 186, 156, 113, 114,
774 115, 109, 0, 13, 110, 0, 105, 0, 106, 0,
778 static const yytype_int16 yycheck
[] =
780 46, 47, 57, 57, 12, 57, 3, 15, 73, 74,
781 75, 76, 77, 78, 4, 5, 1, 8, 56, 24,
782 124, 59, 5, 61, 9, 71, 72, 24, 93, 15,
783 27, 4, 5, 40, 21, 42, 43, 0, 142, 29,
784 144, 57, 146, 147, 60, 149, 31, 151, 40, 153,
785 4, 42, 43, 39, 100, 42, 43, 0, 1, 44,
786 50, 4, 166, 40, 7, 42, 43, 10, 11, 44,
787 45, 46, 47, 48, 49, 42, 43, 5, 21, 40,
788 145, 89, 25, 26, 4, 40, 94, 5, 5, 41,
789 40, 0, 1, 36, 140, 4, 104, 28, 7, 40,
790 40, 10, 11, 40, 40, 40, 161, 161, 154, 161,
791 15, 40, 21, 40, 40, 1, 25, 26, 4, 3,
792 5, 7, 5, 5, 10, 11, 40, 36, 21, 40,
793 16, 17, 18, 40, 40, 21, 40, 40, 6, 25,
794 26, 43, 40, 40, 12, 13, 14, 15, 40, 40,
795 36, 19, 20, 40, 22, 23, 118, 19, 161, 27,
796 40, 40, 6, 1, 32, 33, 40, 35, 12, 37,
797 38, 15, 10, 11, 40, 19, 40, 109, 16, 17,
798 18, 56, -1, 21, 56, -1, 30, -1, 32, -1,
802 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
804 static const yytype_int8 yystos
[] =
806 0, 24, 52, 53, 54, 5, 0, 54, 1, 4,
807 7, 10, 11, 21, 25, 26, 36, 56, 57, 58,
808 59, 62, 63, 65, 71, 73, 75, 76, 78, 80,
809 81, 82, 95, 40, 40, 1, 9, 31, 44, 96,
810 4, 94, 5, 4, 92, 5, 29, 50, 91, 92,
811 93, 5, 92, 5, 60, 60, 66, 55, 54, 79,
812 54, 83, 40, 41, 97, 40, 40, 40, 91, 91,
813 40, 42, 43, 44, 45, 46, 47, 48, 49, 40,
814 40, 40, 6, 12, 13, 14, 15, 19, 20, 22,
815 23, 27, 32, 33, 35, 37, 38, 61, 68, 69,
816 70, 84, 85, 86, 12, 30, 32, 34, 67, 69,
817 85, 86, 1, 16, 17, 18, 57, 64, 71, 74,
818 82, 89, 72, 89, 39, 86, 87, 77, 89, 86,
819 40, 8, 91, 91, 93, 93, 93, 93, 93, 93,
820 28, 40, 92, 40, 5, 93, 92, 5, 88, 91,
821 3, 92, 40, 5, 21, 90, 88, 40, 40, 40,
822 40, 55, 90, 91, 90, 90, 93, 90, 90, 40,
823 90, 90, 90, 91, 40, 40, 72, 40, 40, 40,
824 40, 90, 40, 40, 40, 40, 40
827 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
828 static const yytype_int8 yyr1
[] =
830 0, 51, 52, 52, 53, 54, 54, 54, 54, 54,
831 54, 54, 54, 54, 54, 54, 55, 55, 55, 55,
832 55, 56, 57, 58, 59, 60, 60, 60, 60, 61,
833 61, 61, 61, 61, 61, 61, 62, 63, 64, 65,
834 66, 66, 66, 66, 67, 67, 67, 67, 67, 68,
835 68, 68, 68, 69, 69, 70, 70, 70, 71, 72,
836 73, 74, 75, 76, 77, 78, 79, 79, 79, 80,
837 81, 82, 83, 83, 84, 85, 86, 87, 88, 88,
838 89, 89, 89, 90, 90, 91, 91, 91, 91, 91,
839 91, 91, 91, 91, 91, 91, 92, 93, 93, 94,
840 94, 95, 96, 96, 96, 97, 97
843 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
844 static const yytype_int8 yyr2
[] =
846 0, 2, 2, 1, 3, 0, 2, 2, 2, 2,
847 2, 2, 2, 2, 4, 3, 0, 2, 2, 2,
848 3, 3, 2, 3, 2, 0, 2, 2, 2, 3,
849 4, 4, 4, 4, 5, 2, 3, 2, 1, 3,
850 0, 2, 2, 2, 4, 3, 2, 3, 4, 1,
851 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
852 3, 3, 3, 2, 1, 3, 0, 2, 2, 3,
853 3, 2, 0, 2, 2, 2, 4, 3, 0, 2,
854 2, 2, 2, 0, 2, 1, 3, 3, 3, 3,
855 3, 3, 3, 2, 3, 3, 1, 1, 1, 0,
860 enum { YYENOMEM
= -2 };
862 #define yyerrok (yyerrstatus = 0)
863 #define yyclearin (yychar = YYEMPTY)
865 #define YYACCEPT goto yyacceptlab
866 #define YYABORT goto yyabortlab
867 #define YYERROR goto yyerrorlab
868 #define YYNOMEM goto yyexhaustedlab
871 #define YYRECOVERING() (!!yyerrstatus)
873 #define YYBACKUP(Token, Value) \
875 if (yychar == YYEMPTY) \
879 YYPOPSTACK (yylen); \
885 yyerror (YY_("syntax error: cannot back up")); \
890 /* Backward compatibility with an undocumented macro.
891 Use YYerror or YYUNDEF. */
892 #define YYERRCODE YYUNDEF
895 /* Enable debugging if requested. */
899 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
900 # define YYFPRINTF fprintf
903 # define YYDPRINTF(Args) \
912 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
916 YYFPRINTF (stderr, "%s ", Title); \
917 yy_symbol_print (stderr, \
919 YYFPRINTF (stderr, "\n"); \
924 /*-----------------------------------.
925 | Print this symbol's value on YYO. |
926 `-----------------------------------*/
929 yy_symbol_value_print (FILE *yyo
,
930 yysymbol_kind_t yykind
, YYSTYPE
const * const yyvaluep
)
932 FILE *yyoutput
= yyo
;
936 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
938 YY_IGNORE_MAYBE_UNINITIALIZED_END
942 /*---------------------------.
943 | Print this symbol on YYO. |
944 `---------------------------*/
947 yy_symbol_print (FILE *yyo
,
948 yysymbol_kind_t yykind
, YYSTYPE
const * const yyvaluep
)
950 YYFPRINTF (yyo
, "%s %s (",
951 yykind
< YYNTOKENS
? "token" : "nterm", yysymbol_name (yykind
));
953 yy_symbol_value_print (yyo
, yykind
, yyvaluep
);
954 YYFPRINTF (yyo
, ")");
957 /*------------------------------------------------------------------.
958 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
960 `------------------------------------------------------------------*/
963 yy_stack_print (yy_state_t
*yybottom
, yy_state_t
*yytop
)
965 YYFPRINTF (stderr
, "Stack now");
966 for (; yybottom
<= yytop
; yybottom
++)
968 int yybot
= *yybottom
;
969 YYFPRINTF (stderr
, " %d", yybot
);
971 YYFPRINTF (stderr
, "\n");
974 # define YY_STACK_PRINT(Bottom, Top) \
977 yy_stack_print ((Bottom), (Top)); \
981 /*------------------------------------------------.
982 | Report that the YYRULE is going to be reduced. |
983 `------------------------------------------------*/
986 yy_reduce_print (yy_state_t
*yyssp
, YYSTYPE
*yyvsp
,
989 int yylno
= yyrline
[yyrule
];
990 int yynrhs
= yyr2
[yyrule
];
992 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %d):\n",
994 /* The symbols being reduced. */
995 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
997 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
998 yy_symbol_print (stderr
,
999 YY_ACCESSING_SYMBOL (+yyssp
[yyi
+ 1 - yynrhs
]),
1000 &yyvsp
[(yyi
+ 1) - (yynrhs
)]);
1001 YYFPRINTF (stderr
, "\n");
1005 # define YY_REDUCE_PRINT(Rule) \
1008 yy_reduce_print (yyssp, yyvsp, Rule); \
1011 /* Nonzero means print parse trace. It is left uninitialized so that
1012 multiple parsers can coexist. */
1014 #else /* !YYDEBUG */
1015 # define YYDPRINTF(Args) ((void) 0)
1016 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1017 # define YY_STACK_PRINT(Bottom, Top)
1018 # define YY_REDUCE_PRINT(Rule)
1019 #endif /* !YYDEBUG */
1022 /* YYINITDEPTH -- initial size of the parser's stacks. */
1024 # define YYINITDEPTH 200
1027 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1028 if the built-in stack extension method is used).
1030 Do not make this value too large; the results are undefined if
1031 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1032 evaluated with infinite-precision integer arithmetic. */
1035 # define YYMAXDEPTH 10000
1043 /*-----------------------------------------------.
1044 | Release the memory associated to this symbol. |
1045 `-----------------------------------------------*/
1048 yydestruct (const char *yymsg
,
1049 yysymbol_kind_t yykind
, YYSTYPE
*yyvaluep
)
1054 YY_SYMBOL_PRINT (yymsg
, yykind
, yyvaluep
, yylocationp
);
1056 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1059 case YYSYMBOL_choice_entry
: /* choice_entry */
1061 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1062 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1063 if (current_menu
== ((*yyvaluep
).menu
))
1068 case YYSYMBOL_if_entry
: /* if_entry */
1070 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1071 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1072 if (current_menu
== ((*yyvaluep
).menu
))
1077 case YYSYMBOL_menu_entry
: /* menu_entry */
1079 fprintf(stderr
, "%s:%d: missing end statement for this entry\n",
1080 ((*yyvaluep
).menu
)->file
->name
, ((*yyvaluep
).menu
)->lineno
);
1081 if (current_menu
== ((*yyvaluep
).menu
))
1089 YY_IGNORE_MAYBE_UNINITIALIZED_END
1093 /* Lookahead token kind. */
1096 /* The semantic value of the lookahead symbol. */
1098 /* Number of syntax errors so far. */
1111 yy_state_fast_t yystate
= 0;
1112 /* Number of tokens to shift before error messages enabled. */
1113 int yyerrstatus
= 0;
1115 /* Refer to the stacks through separate pointers, to allow yyoverflow
1116 to reallocate them elsewhere. */
1119 YYPTRDIFF_T yystacksize
= YYINITDEPTH
;
1121 /* The state stack: array, bottom, top. */
1122 yy_state_t yyssa
[YYINITDEPTH
];
1123 yy_state_t
*yyss
= yyssa
;
1124 yy_state_t
*yyssp
= yyss
;
1126 /* The semantic value stack: array, bottom, top. */
1127 YYSTYPE yyvsa
[YYINITDEPTH
];
1128 YYSTYPE
*yyvs
= yyvsa
;
1129 YYSTYPE
*yyvsp
= yyvs
;
1132 /* The return value of yyparse. */
1134 /* Lookahead symbol kind. */
1135 yysymbol_kind_t yytoken
= YYSYMBOL_YYEMPTY
;
1136 /* The variables used to return semantic value and location from the
1142 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1144 /* The number of symbols on the RHS of the reduced rule.
1145 Keep to zero when no symbol should be popped. */
1148 YYDPRINTF ((stderr
, "Starting parse\n"));
1150 yychar
= YYEMPTY
; /* Cause a token to be read. */
1155 /*------------------------------------------------------------.
1156 | yynewstate -- push a new state, which is found in yystate. |
1157 `------------------------------------------------------------*/
1159 /* In all cases, when you get here, the value and location stacks
1160 have just been pushed. So pushing a state here evens the stacks. */
1164 /*--------------------------------------------------------------------.
1165 | yysetstate -- set current state (the top of the stack) to yystate. |
1166 `--------------------------------------------------------------------*/
1168 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1169 YY_ASSERT (0 <= yystate
&& yystate
< YYNSTATES
);
1170 YY_IGNORE_USELESS_CAST_BEGIN
1171 *yyssp
= YY_CAST (yy_state_t
, yystate
);
1172 YY_IGNORE_USELESS_CAST_END
1173 YY_STACK_PRINT (yyss
, yyssp
);
1175 if (yyss
+ yystacksize
- 1 <= yyssp
)
1176 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1180 /* Get the current used size of the three stacks, in elements. */
1181 YYPTRDIFF_T yysize
= yyssp
- yyss
+ 1;
1183 # if defined yyoverflow
1185 /* Give user a chance to reallocate the stack. Use copies of
1186 these so that the &'s don't force the real ones into
1188 yy_state_t
*yyss1
= yyss
;
1189 YYSTYPE
*yyvs1
= yyvs
;
1191 /* Each stack pointer address is followed by the size of the
1192 data in use in that stack, in bytes. This used to be a
1193 conditional around just the two extra args, but that might
1194 be undefined if yyoverflow is a macro. */
1195 yyoverflow (YY_("memory exhausted"),
1196 &yyss1
, yysize
* YYSIZEOF (*yyssp
),
1197 &yyvs1
, yysize
* YYSIZEOF (*yyvsp
),
1202 # else /* defined YYSTACK_RELOCATE */
1203 /* Extend the stack our own way. */
1204 if (YYMAXDEPTH
<= yystacksize
)
1207 if (YYMAXDEPTH
< yystacksize
)
1208 yystacksize
= YYMAXDEPTH
;
1211 yy_state_t
*yyss1
= yyss
;
1212 union yyalloc
*yyptr
=
1213 YY_CAST (union yyalloc
*,
1214 YYSTACK_ALLOC (YY_CAST (YYSIZE_T
, YYSTACK_BYTES (yystacksize
))));
1217 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1218 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1219 # undef YYSTACK_RELOCATE
1221 YYSTACK_FREE (yyss1
);
1225 yyssp
= yyss
+ yysize
- 1;
1226 yyvsp
= yyvs
+ yysize
- 1;
1228 YY_IGNORE_USELESS_CAST_BEGIN
1229 YYDPRINTF ((stderr
, "Stack size increased to %ld\n",
1230 YY_CAST (long, yystacksize
)));
1231 YY_IGNORE_USELESS_CAST_END
1233 if (yyss
+ yystacksize
- 1 <= yyssp
)
1236 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1239 if (yystate
== YYFINAL
)
1249 /* Do appropriate processing given the current state. Read a
1250 lookahead token if we need one and don't already have one. */
1252 /* First try to decide what to do without reference to lookahead token. */
1253 yyn
= yypact
[yystate
];
1254 if (yypact_value_is_default (yyn
))
1257 /* Not known => get a lookahead token if don't already have one. */
1259 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1260 if (yychar
== YYEMPTY
)
1262 YYDPRINTF ((stderr
, "Reading a token\n"));
1266 if (yychar
<= YYEOF
)
1269 yytoken
= YYSYMBOL_YYEOF
;
1270 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1272 else if (yychar
== YYerror
)
1274 /* The scanner already issued an error message, process directly
1275 to error recovery. But do not keep the error token as
1276 lookahead, it is too special and may lead us to an endless
1277 loop in error recovery. */
1279 yytoken
= YYSYMBOL_YYerror
;
1284 yytoken
= YYTRANSLATE (yychar
);
1285 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1288 /* If the proper action on seeing token YYTOKEN is to reduce or to
1289 detect an error, take that action. */
1291 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1296 if (yytable_value_is_error (yyn
))
1302 /* Count tokens shifted since error; after three, turn off error
1307 /* Shift the lookahead token. */
1308 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1310 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1312 YY_IGNORE_MAYBE_UNINITIALIZED_END
1314 /* Discard the shifted token. */
1319 /*-----------------------------------------------------------.
1320 | yydefault -- do the default action for the current state. |
1321 `-----------------------------------------------------------*/
1323 yyn
= yydefact
[yystate
];
1329 /*-----------------------------.
1330 | yyreduce -- do a reduction. |
1331 `-----------------------------*/
1333 /* yyn is the number of a rule to reduce with. */
1336 /* If YYLEN is nonzero, implement the default value of the action:
1339 Otherwise, the following line sets YYVAL to garbage.
1340 This behavior is undocumented and Bison
1341 users should not rely upon it. Assigning to YYVAL
1342 unconditionally makes the parser a bit smaller, and it avoids a
1343 GCC warning that YYVAL may be used uninitialized. */
1344 yyval
= yyvsp
[1-yylen
];
1347 YY_REDUCE_PRINT (yyn
);
1350 case 4: /* mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL */
1352 menu_add_prompt(P_MENU
, (yyvsp
[-1].string
), NULL
);
1356 case 14: /* stmt_list: stmt_list T_WORD error T_EOL */
1357 { zconf_error("unknown statement \"%s\"", (yyvsp
[-2].string
)); }
1360 case 15: /* stmt_list: stmt_list error T_EOL */
1361 { zconf_error("invalid statement"); }
1364 case 20: /* stmt_list_in_choice: stmt_list_in_choice error T_EOL */
1365 { zconf_error("invalid statement"); }
1368 case 21: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */
1370 (yyvsp
[-1].symbol
)->flags
|= SYMBOL_OPTIONAL
;
1371 menu_add_entry((yyvsp
[-1].symbol
));
1372 printd(DEBUG_PARSE
, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].symbol
)->name
);
1376 case 22: /* config_stmt: config_entry_start config_option_list */
1378 printd(DEBUG_PARSE
, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1382 case 23: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */
1384 (yyvsp
[-1].symbol
)->flags
|= SYMBOL_OPTIONAL
;
1385 menu_add_entry((yyvsp
[-1].symbol
));
1386 printd(DEBUG_PARSE
, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].symbol
)->name
);
1390 case 24: /* menuconfig_stmt: menuconfig_entry_start config_option_list */
1392 if (current_entry
->prompt
)
1393 current_entry
->prompt
->type
= P_MENU
;
1395 zconfprint("warning: menuconfig statement without prompt");
1396 printd(DEBUG_PARSE
, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1400 case 29: /* config_option: type prompt_stmt_opt T_EOL */
1402 menu_set_type((yyvsp
[-2].type
));
1403 printd(DEBUG_PARSE
, "%s:%d:type(%u)\n",
1404 zconf_curname(), zconf_lineno(),
1409 case 30: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */
1411 menu_add_prompt(P_PROMPT
, (yyvsp
[-2].string
), (yyvsp
[-1].expr
));
1412 printd(DEBUG_PARSE
, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1416 case 31: /* config_option: default expr if_expr T_EOL */
1418 menu_add_expr(P_DEFAULT
, (yyvsp
[-2].expr
), (yyvsp
[-1].expr
));
1419 if ((yyvsp
[-3].type
) != S_UNKNOWN
)
1420 menu_set_type((yyvsp
[-3].type
));
1421 printd(DEBUG_PARSE
, "%s:%d:default(%u)\n",
1422 zconf_curname(), zconf_lineno(),
1427 case 32: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */
1429 menu_add_symbol(P_SELECT
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1430 printd(DEBUG_PARSE
, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1434 case 33: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */
1436 menu_add_symbol(P_IMPLY
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1437 printd(DEBUG_PARSE
, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1441 case 34: /* config_option: T_RANGE symbol symbol if_expr T_EOL */
1443 menu_add_expr(P_RANGE
, expr_alloc_comp(E_RANGE
,(yyvsp
[-3].symbol
), (yyvsp
[-2].symbol
)), (yyvsp
[-1].expr
));
1444 printd(DEBUG_PARSE
, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1448 case 35: /* config_option: T_MODULES T_EOL */
1451 zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'",
1452 current_entry
->sym
->name
, modules_sym
->name
);
1453 modules_sym
= current_entry
->sym
;
1457 case 36: /* choice: T_CHOICE word_opt T_EOL */
1459 struct symbol
*sym
= sym_lookup((yyvsp
[-1].string
), SYMBOL_CHOICE
);
1460 sym
->flags
|= SYMBOL_NO_WRITE
;
1461 menu_add_entry(sym
);
1462 menu_add_expr(P_CHOICE
, NULL
, NULL
);
1463 free((yyvsp
[-1].string
));
1464 printd(DEBUG_PARSE
, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1468 case 37: /* choice_entry: choice choice_option_list */
1470 (yyval
.menu
) = menu_add_menu();
1474 case 38: /* choice_end: end */
1476 if (zconf_endtoken((yyvsp
[0].string
), "choice")) {
1478 printd(DEBUG_PARSE
, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1483 case 44: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */
1485 menu_add_prompt(P_PROMPT
, (yyvsp
[-2].string
), (yyvsp
[-1].expr
));
1486 printd(DEBUG_PARSE
, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1490 case 45: /* choice_option: logic_type prompt_stmt_opt T_EOL */
1492 menu_set_type((yyvsp
[-2].type
));
1493 printd(DEBUG_PARSE
, "%s:%d:type(%u)\n",
1494 zconf_curname(), zconf_lineno(), (yyvsp
[-2].type
));
1498 case 46: /* choice_option: T_OPTIONAL T_EOL */
1500 current_entry
->sym
->flags
|= SYMBOL_OPTIONAL
;
1501 printd(DEBUG_PARSE
, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1505 case 47: /* choice_option: T_RESET if_expr T_EOL */
1507 menu_add_prop(P_RESET
, NULL
, (yyvsp
[-1].expr
));
1511 case 48: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */
1513 menu_add_symbol(P_DEFAULT
, (yyvsp
[-2].symbol
), (yyvsp
[-1].expr
));
1514 printd(DEBUG_PARSE
, "%s:%d:default\n",
1515 zconf_curname(), zconf_lineno());
1519 case 50: /* type: T_INT */
1520 { (yyval
.type
) = S_INT
; }
1523 case 51: /* type: T_HEX */
1524 { (yyval
.type
) = S_HEX
; }
1527 case 52: /* type: T_STRING */
1528 { (yyval
.type
) = S_STRING
; }
1531 case 53: /* logic_type: T_BOOL */
1532 { (yyval
.type
) = S_BOOLEAN
; }
1535 case 54: /* logic_type: T_TRISTATE */
1536 { (yyval
.type
) = S_TRISTATE
; }
1539 case 55: /* default: T_DEFAULT */
1540 { (yyval
.type
) = S_UNKNOWN
; }
1543 case 56: /* default: T_DEF_BOOL */
1544 { (yyval
.type
) = S_BOOLEAN
; }
1547 case 57: /* default: T_DEF_TRISTATE */
1548 { (yyval
.type
) = S_TRISTATE
; }
1551 case 58: /* if_entry: T_IF expr T_EOL */
1553 printd(DEBUG_PARSE
, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1554 menu_add_entry(NULL
);
1555 menu_add_dep((yyvsp
[-1].expr
));
1556 (yyval
.menu
) = menu_add_menu();
1560 case 59: /* if_end: end */
1562 if (zconf_endtoken((yyvsp
[0].string
), "if")) {
1564 printd(DEBUG_PARSE
, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1569 case 62: /* menu: T_MENU T_WORD_QUOTE T_EOL */
1571 menu_add_entry(NULL
);
1572 menu_add_prompt(P_MENU
, (yyvsp
[-1].string
), NULL
);
1573 printd(DEBUG_PARSE
, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1577 case 63: /* menu_entry: menu menu_option_list */
1579 (yyval
.menu
) = menu_add_menu();
1583 case 64: /* menu_end: end */
1585 if (zconf_endtoken((yyvsp
[0].string
), "menu")) {
1587 printd(DEBUG_PARSE
, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1592 case 69: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */
1594 printd(DEBUG_PARSE
, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp
[-1].string
));
1595 zconf_nextfile((yyvsp
[-1].string
));
1596 free((yyvsp
[-1].string
));
1600 case 70: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */
1602 menu_add_entry(NULL
);
1603 menu_add_prompt(P_COMMENT
, (yyvsp
[-1].string
), NULL
);
1604 printd(DEBUG_PARSE
, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1608 case 74: /* help_start: T_HELP T_EOL */
1610 printd(DEBUG_PARSE
, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1615 case 75: /* help: help_start T_HELPTEXT */
1617 /* Is the help text empty or all whitespace? */
1618 if ((yyvsp
[0].string
)[strspn((yyvsp
[0].string
), " \f\n\r\t\v")] == '\0')
1619 zconfprint("warning: '%s' defined with blank help text",
1620 current_entry
->sym
->name
?: "<choice>");
1622 current_entry
->help
= (yyvsp
[0].string
);
1626 case 76: /* depends: T_DEPENDS T_ON expr T_EOL */
1628 menu_add_dep((yyvsp
[-1].expr
));
1629 printd(DEBUG_PARSE
, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1633 case 77: /* visible: T_VISIBLE if_expr T_EOL */
1635 menu_add_visibility((yyvsp
[-1].expr
));
1639 case 79: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */
1641 menu_add_prompt(P_PROMPT
, (yyvsp
[-1].string
), (yyvsp
[0].expr
));
1645 case 80: /* end: T_ENDMENU T_EOL */
1646 { (yyval
.string
) = "menu"; }
1649 case 81: /* end: T_ENDCHOICE T_EOL */
1650 { (yyval
.string
) = "choice"; }
1653 case 82: /* end: T_ENDIF T_EOL */
1654 { (yyval
.string
) = "if"; }
1657 case 83: /* if_expr: %empty */
1658 { (yyval
.expr
) = NULL
; }
1661 case 84: /* if_expr: T_IF expr */
1662 { (yyval
.expr
) = (yyvsp
[0].expr
); }
1665 case 85: /* expr: symbol */
1666 { (yyval
.expr
) = expr_alloc_symbol((yyvsp
[0].symbol
)); }
1669 case 86: /* expr: symbol T_LESS symbol */
1670 { (yyval
.expr
) = expr_alloc_comp(E_LTH
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1673 case 87: /* expr: symbol T_LESS_EQUAL symbol */
1674 { (yyval
.expr
) = expr_alloc_comp(E_LEQ
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1677 case 88: /* expr: symbol T_GREATER symbol */
1678 { (yyval
.expr
) = expr_alloc_comp(E_GTH
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1681 case 89: /* expr: symbol T_GREATER_EQUAL symbol */
1682 { (yyval
.expr
) = expr_alloc_comp(E_GEQ
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1685 case 90: /* expr: symbol T_EQUAL symbol */
1686 { (yyval
.expr
) = expr_alloc_comp(E_EQUAL
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1689 case 91: /* expr: symbol T_UNEQUAL symbol */
1690 { (yyval
.expr
) = expr_alloc_comp(E_UNEQUAL
, (yyvsp
[-2].symbol
), (yyvsp
[0].symbol
)); }
1693 case 92: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */
1694 { (yyval
.expr
) = (yyvsp
[-1].expr
); }
1697 case 93: /* expr: T_NOT expr */
1698 { (yyval
.expr
) = expr_alloc_one(E_NOT
, (yyvsp
[0].expr
)); }
1701 case 94: /* expr: expr T_OR expr */
1702 { (yyval
.expr
) = expr_alloc_two(E_OR
, (yyvsp
[-2].expr
), (yyvsp
[0].expr
)); }
1705 case 95: /* expr: expr T_AND expr */
1706 { (yyval
.expr
) = expr_alloc_two(E_AND
, (yyvsp
[-2].expr
), (yyvsp
[0].expr
)); }
1709 case 96: /* nonconst_symbol: T_WORD */
1710 { (yyval
.symbol
) = sym_lookup((yyvsp
[0].string
), 0); free((yyvsp
[0].string
)); }
1713 case 98: /* symbol: T_WORD_QUOTE */
1714 { (yyval
.symbol
) = sym_lookup((yyvsp
[0].string
), SYMBOL_CONST
); free((yyvsp
[0].string
)); }
1717 case 99: /* word_opt: %empty */
1718 { (yyval
.string
) = NULL
; }
1721 case 101: /* assignment_stmt: T_WORD assign_op assign_val T_EOL */
1722 { variable_add((yyvsp
[-3].string
), (yyvsp
[-1].string
), (yyvsp
[-2].flavor
)); free((yyvsp
[-3].string
)); free((yyvsp
[-1].string
)); }
1725 case 102: /* assign_op: T_EQUAL */
1726 { (yyval
.flavor
) = VAR_RECURSIVE
; }
1729 case 103: /* assign_op: T_COLON_EQUAL */
1730 { (yyval
.flavor
) = VAR_SIMPLE
; }
1733 case 104: /* assign_op: T_PLUS_EQUAL */
1734 { (yyval
.flavor
) = VAR_APPEND
; }
1737 case 105: /* assign_val: %empty */
1738 { (yyval
.string
) = xstrdup(""); }
1745 /* User semantic actions sometimes alter yychar, and that requires
1746 that yytoken be updated with the new translation. We take the
1747 approach of translating immediately before every use of yytoken.
1748 One alternative is translating here after every semantic action,
1749 but that translation would be missed if the semantic action invokes
1750 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1751 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1752 incorrect destructor might then be invoked immediately. In the
1753 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1754 to an incorrect destructor call or verbose syntax error message
1755 before the lookahead is translated. */
1756 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t
, yyr1
[yyn
]), &yyval
, &yyloc
);
1763 /* Now 'shift' the result of the reduction. Determine what state
1764 that goes to, based on the state we popped back to and the rule
1765 number reduced by. */
1767 const int yylhs
= yyr1
[yyn
] - YYNTOKENS
;
1768 const int yyi
= yypgoto
[yylhs
] + *yyssp
;
1769 yystate
= (0 <= yyi
&& yyi
<= YYLAST
&& yycheck
[yyi
] == *yyssp
1771 : yydefgoto
[yylhs
]);
1777 /*--------------------------------------.
1778 | yyerrlab -- here on detecting error. |
1779 `--------------------------------------*/
1781 /* Make sure we have latest lookahead translation. See comments at
1782 user semantic actions for why this is necessary. */
1783 yytoken
= yychar
== YYEMPTY
? YYSYMBOL_YYEMPTY
: YYTRANSLATE (yychar
);
1784 /* If not already recovering from an error, report this error. */
1788 yyerror (YY_("syntax error"));
1791 if (yyerrstatus
== 3)
1793 /* If just tried and failed to reuse lookahead token after an
1794 error, discard it. */
1796 if (yychar
<= YYEOF
)
1798 /* Return failure if at end of input. */
1799 if (yychar
== YYEOF
)
1804 yydestruct ("Error: discarding",
1810 /* Else will try to reuse lookahead token after shifting the error
1815 /*---------------------------------------------------.
1816 | yyerrorlab -- error raised explicitly by YYERROR. |
1817 `---------------------------------------------------*/
1819 /* Pacify compilers when the user code never invokes YYERROR and the
1820 label yyerrorlab therefore never appears in user code. */
1825 /* Do not reclaim the symbols of the rule whose action triggered
1829 YY_STACK_PRINT (yyss
, yyssp
);
1834 /*-------------------------------------------------------------.
1835 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1836 `-------------------------------------------------------------*/
1838 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1840 /* Pop stack until we find a state that shifts the error token. */
1843 yyn
= yypact
[yystate
];
1844 if (!yypact_value_is_default (yyn
))
1846 yyn
+= YYSYMBOL_YYerror
;
1847 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYSYMBOL_YYerror
)
1855 /* Pop the current state because it cannot handle the error token. */
1860 yydestruct ("Error: popping",
1861 YY_ACCESSING_SYMBOL (yystate
), yyvsp
);
1864 YY_STACK_PRINT (yyss
, yyssp
);
1867 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1869 YY_IGNORE_MAYBE_UNINITIALIZED_END
1872 /* Shift the error token. */
1873 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn
), yyvsp
, yylsp
);
1879 /*-------------------------------------.
1880 | yyacceptlab -- YYACCEPT comes here. |
1881 `-------------------------------------*/
1887 /*-----------------------------------.
1888 | yyabortlab -- YYABORT comes here. |
1889 `-----------------------------------*/
1895 /*-----------------------------------------------------------.
1896 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1897 `-----------------------------------------------------------*/
1899 yyerror (YY_("memory exhausted"));
1904 /*----------------------------------------------------------.
1905 | yyreturnlab -- parsing is finished, clean up and return. |
1906 `----------------------------------------------------------*/
1908 if (yychar
!= YYEMPTY
)
1910 /* Make sure we have latest lookahead translation. See comments at
1911 user semantic actions for why this is necessary. */
1912 yytoken
= YYTRANSLATE (yychar
);
1913 yydestruct ("Cleanup: discarding lookahead",
1916 /* Do not reclaim the symbols of the rule whose action triggered
1917 this YYABORT or YYACCEPT. */
1919 YY_STACK_PRINT (yyss
, yyssp
);
1920 while (yyssp
!= yyss
)
1922 yydestruct ("Cleanup: popping",
1923 YY_ACCESSING_SYMBOL (+*yyssp
), yyvsp
);
1928 YYSTACK_FREE (yyss
);
1936 void conf_parse(const char *name
)
1941 zconf_initscan(name
);
1946 if (getenv("ZCONF_DEBUG"))
1951 /* Variables are expanded in the parse phase. We can free them here. */
1957 modules_sym
= sym_find( "n" );
1959 if (!menu_has_prompt(&rootmenu
)) {
1960 current_entry
= &rootmenu
;
1961 menu_add_prompt(P_MENU
, "Main menu", NULL
);
1964 menu_finalize(&rootmenu
);
1965 for_all_symbols(i
, sym
) {
1966 if (sym_check_deps(sym
))
1971 conf_set_changed(true);
1974 static bool zconf_endtoken(const char *tokenname
,
1975 const char *expected_tokenname
)
1977 if (strcmp(tokenname
, expected_tokenname
)) {
1978 zconf_error("unexpected '%s' within %s block",
1979 tokenname
, expected_tokenname
);
1983 if (current_menu
->file
!= current_file
) {
1984 zconf_error("'%s' in different file than '%s'",
1985 tokenname
, expected_tokenname
);
1986 fprintf(stderr
, "%s:%d: location of the '%s'\n",
1987 current_menu
->file
->name
, current_menu
->lineno
,
1988 expected_tokenname
);
1995 static void zconfprint(const char *err
, ...)
1999 fprintf(stderr
, "%s:%d: ", zconf_curname(), zconf_lineno());
2001 vfprintf(stderr
, err
, ap
);
2003 fprintf(stderr
, "\n");
2006 static void zconf_error(const char *err
, ...)
2011 fprintf(stderr
, "%s:%d: ", zconf_curname(), zconf_lineno());
2013 vfprintf(stderr
, err
, ap
);
2015 fprintf(stderr
, "\n");
2018 static void yyerror(const char *err
)
2020 fprintf(stderr
, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err
);
2023 static void print_quoted_string(FILE *out
, const char *str
)
2029 while ((p
= strchr(str
, '"'))) {
2032 fprintf(out
, "%.*s", len
, str
);
2040 static void print_symbol(FILE *out
, struct menu
*menu
)
2042 struct symbol
*sym
= menu
->sym
;
2043 struct property
*prop
;
2045 if (sym_is_choice(sym
))
2046 fprintf(out
, "\nchoice\n");
2048 fprintf(out
, "\nconfig %s\n", sym
->name
);
2049 switch (sym
->type
) {
2051 fputs(" bool\n", out
);
2054 fputs(" tristate\n", out
);
2057 fputs(" string\n", out
);
2060 fputs(" integer\n", out
);
2063 fputs(" hex\n", out
);
2066 fputs(" ???\n", out
);
2069 for (prop
= sym
->prop
; prop
; prop
= prop
->next
) {
2070 if (prop
->menu
!= menu
)
2072 switch (prop
->type
) {
2074 fputs(" prompt ", out
);
2075 print_quoted_string(out
, prop
->text
);
2076 if (!expr_is_yes(prop
->visible
.expr
)) {
2078 expr_fprint(prop
->visible
.expr
, out
);
2083 fputs( " default ", out
);
2084 expr_fprint(prop
->expr
, out
);
2085 if (!expr_is_yes(prop
->visible
.expr
)) {
2087 expr_fprint(prop
->visible
.expr
, out
);
2092 fputs(" #choice value\n", out
);
2095 fputs( " select ", out
);
2096 expr_fprint(prop
->expr
, out
);
2100 fputs( " imply ", out
);
2101 expr_fprint(prop
->expr
, out
);
2105 fputs( " range ", out
);
2106 expr_fprint(prop
->expr
, out
);
2110 fputs( " menu ", out
);
2111 print_quoted_string(out
, prop
->text
);
2115 fputs( " symbol ", out
);
2116 fprintf(out
, "%s\n", prop
->menu
->sym
->name
);
2119 fprintf(out
, " unknown prop %d!\n", prop
->type
);
2124 int len
= strlen(menu
->help
);
2125 while (menu
->help
[--len
] == '\n')
2126 menu
->help
[len
] = 0;
2127 fprintf(out
, " help\n%s\n", menu
->help
);
2131 void zconfdump(FILE *out
)
2133 struct property
*prop
;
2137 menu
= rootmenu
.list
;
2139 if ((sym
= menu
->sym
))
2140 print_symbol(out
, menu
);
2141 else if ((prop
= menu
->prompt
)) {
2142 switch (prop
->type
) {
2144 fputs("\ncomment ", out
);
2145 print_quoted_string(out
, prop
->text
);
2149 fputs("\nmenu ", out
);
2150 print_quoted_string(out
, prop
->text
);
2156 if (!expr_is_yes(prop
->visible
.expr
)) {
2157 fputs(" depends ", out
);
2158 expr_fprint(prop
->visible
.expr
, out
);
2165 else if (menu
->next
)
2167 else while ((menu
= menu
->parent
)) {
2168 if (menu
->prompt
&& menu
->prompt
->type
== P_MENU
)
2169 fputs("\nendmenu\n", out
);