build: scripts/config - update to kconfig-v5.14
[openwrt/staging/noltari.git] / scripts / config / parser.tab.c
1 /* A Bison parser, made by GNU Bison 3.7.6. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
7
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.
12
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.
17
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/>. */
20
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.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
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. */
40
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. */
47
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30706
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.7.6"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67
68
69 /* First part of user prologue. */
70
71
72 #include <ctype.h>
73 #include <stdarg.h>
74 #include <stdio.h>
75 #include <stdlib.h>
76 #include <string.h>
77 #include <stdbool.h>
78
79 #include "lkc.h"
80 #include "internal.h"
81
82 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
83
84 #define PRINTD 0x0001
85 #define DEBUG_PARSE 0x0002
86
87 int cdebug = PRINTD;
88
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);
94
95 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
96
97 struct menu *current_menu, *current_entry;
98
99
100
101 # ifndef YY_CAST
102 # ifdef __cplusplus
103 # define YY_CAST(Type, Val) static_cast<Type> (Val)
104 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
105 # else
106 # define YY_CAST(Type, Val) ((Type) (Val))
107 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
108 # endif
109 # endif
110 # ifndef YY_NULLPTR
111 # if defined __cplusplus
112 # if 201103L <= __cplusplus
113 # define YY_NULLPTR nullptr
114 # else
115 # define YY_NULLPTR 0
116 # endif
117 # else
118 # define YY_NULLPTR ((void*)0)
119 # endif
120 # endif
121
122 #include "parser.tab.h"
123 /* Symbol kind. */
124 enum yysymbol_kind_t
125 {
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 */
225 };
226 typedef enum yysymbol_kind_t yysymbol_kind_t;
227
228
229
230
231 #ifdef short
232 # undef short
233 #endif
234
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. */
238
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 */
243 # define YY_STDINT_H
244 # endif
245 #endif
246
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. */
251
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;
256 #else
257 typedef signed char yytype_int8;
258 #endif
259
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;
264 #else
265 typedef short yytype_int16;
266 #endif
267
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>. */
273 #ifdef __hpux
274 # undef UINT_LEAST8_MAX
275 # undef UINT_LEAST16_MAX
276 # define UINT_LEAST8_MAX 255
277 # define UINT_LEAST16_MAX 65535
278 #endif
279
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;
287 #else
288 typedef short yytype_uint8;
289 #endif
290
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;
298 #else
299 typedef int yytype_uint16;
300 #endif
301
302 #ifndef YYPTRDIFF_T
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
307 # ifndef ptrdiff_t
308 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
309 # endif
310 # define YYPTRDIFF_T ptrdiff_t
311 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
312 # else
313 # define YYPTRDIFF_T long
314 # define YYPTRDIFF_MAXIMUM LONG_MAX
315 # endif
316 #endif
317
318 #ifndef YYSIZE_T
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
326 # else
327 # define YYSIZE_T unsigned
328 # endif
329 #endif
330
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)))
336
337 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
338
339
340 /* Stored state numbers (used for stacks). */
341 typedef yytype_uint8 yy_state_t;
342
343 /* State numbers in computations. */
344 typedef int yy_state_fast_t;
345
346 #ifndef YY_
347 # if defined YYENABLE_NLS && YYENABLE_NLS
348 # if ENABLE_NLS
349 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
350 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
351 # endif
352 # endif
353 # ifndef YY_
354 # define YY_(Msgid) Msgid
355 # endif
356 #endif
357
358
359 #ifndef YY_ATTRIBUTE_PURE
360 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
361 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
362 # else
363 # define YY_ATTRIBUTE_PURE
364 # endif
365 #endif
366
367 #ifndef YY_ATTRIBUTE_UNUSED
368 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
369 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
370 # else
371 # define YY_ATTRIBUTE_UNUSED
372 # endif
373 #endif
374
375 /* Suppress unused-variable warnings by "using" E. */
376 #if ! defined lint || defined __GNUC__
377 # define YY_USE(E) ((void) (E))
378 #else
379 # define YY_USE(E) /* empty */
380 #endif
381
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")
390 #else
391 # define YY_INITIAL_VALUE(Value) Value
392 #endif
393 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
394 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
395 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
396 #endif
397 #ifndef YY_INITIAL_VALUE
398 # define YY_INITIAL_VALUE(Value) /* Nothing. */
399 #endif
400
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")
407 #endif
408 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
409 # define YY_IGNORE_USELESS_CAST_BEGIN
410 # define YY_IGNORE_USELESS_CAST_END
411 #endif
412
413
414 #define YY_ASSERT(E) ((void) (0 && (E)))
415
416 #if !defined yyoverflow
417
418 /* The parser invokes alloca or malloc; define the necessary symbols. */
419
420 # ifdef YYSTACK_USE_ALLOCA
421 # if YYSTACK_USE_ALLOCA
422 # ifdef __GNUC__
423 # define YYSTACK_ALLOC __builtin_alloca
424 # elif defined __BUILTIN_VA_ARG_INCR
425 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
426 # elif defined _AIX
427 # define YYSTACK_ALLOC __alloca
428 # elif defined _MSC_VER
429 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
430 # define alloca _alloca
431 # else
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
438 # endif
439 # endif
440 # endif
441 # endif
442 # endif
443
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 */
453 # endif
454 # else
455 # define YYSTACK_ALLOC YYMALLOC
456 # define YYSTACK_FREE YYFREE
457 # ifndef YYSTACK_ALLOC_MAXIMUM
458 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
459 # endif
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
466 # endif
467 # endif
468 # ifndef YYMALLOC
469 # define YYMALLOC malloc
470 # if ! defined malloc && ! defined EXIT_SUCCESS
471 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
472 # endif
473 # endif
474 # ifndef YYFREE
475 # define YYFREE free
476 # if ! defined free && ! defined EXIT_SUCCESS
477 void free (void *); /* INFRINGES ON USER NAME SPACE */
478 # endif
479 # endif
480 # endif
481 #endif /* !defined yyoverflow */
482
483 #if (! defined yyoverflow \
484 && (! defined __cplusplus \
485 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
486
487 /* A type that is properly aligned for any stack member. */
488 union yyalloc
489 {
490 yy_state_t yyss_alloc;
491 YYSTYPE yyvs_alloc;
492 };
493
494 /* The size of the maximum gap between one aligned stack and the next. */
495 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
496
497 /* The size of an array large to enough to hold all stacks, each with
498 N elements. */
499 # define YYSTACK_BYTES(N) \
500 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
501 + YYSTACK_GAP_MAXIMUM)
502
503 # define YYCOPY_NEEDED 1
504
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
509 stack. */
510 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
511 do \
512 { \
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); \
518 } \
519 while (0)
520
521 #endif
522
523 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
524 /* Copy COUNT objects from SRC to DST. The source and destination do
525 not overlap. */
526 # ifndef YYCOPY
527 # if defined __GNUC__ && 1 < __GNUC__
528 # define YYCOPY(Dst, Src, Count) \
529 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
530 # else
531 # define YYCOPY(Dst, Src, Count) \
532 do \
533 { \
534 YYPTRDIFF_T yyi; \
535 for (yyi = 0; yyi < (Count); yyi++) \
536 (Dst)[yyi] = (Src)[yyi]; \
537 } \
538 while (0)
539 # endif
540 # endif
541 #endif /* !YYCOPY_NEEDED */
542
543 /* YYFINAL -- State number of the termination state. */
544 #define YYFINAL 6
545 /* YYLAST -- Last index in YYTABLE. */
546 #define YYLAST 194
547
548 /* YYNTOKENS -- Number of terminals. */
549 #define YYNTOKENS 51
550 /* YYNNTS -- Number of nonterminals. */
551 #define YYNNTS 47
552 /* YYNRULES -- Number of rules. */
553 #define YYNRULES 106
554 /* YYNSTATES -- Number of states. */
555 #define YYNSTATES 187
556
557 /* YYMAXUTOK -- Last valid token kind. */
558 #define YYMAXUTOK 305
559
560
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]) \
566 : YYSYMBOL_YYUNDEF)
567
568 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
569 as returned by yylex. */
570 static const yytype_int8 yytranslate[] =
571 {
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
603 };
604
605 #if YYDEBUG
606 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
607 static const yytype_int16 yyrline[] =
608 {
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
620 };
621 #endif
622
623 /** Accessing symbol of state STATE. */
624 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
625
626 #if YYDEBUG || 0
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;
630
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[] =
634 {
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
655 };
656
657 static const char *
658 yysymbol_name (yysymbol_kind_t yysymbol)
659 {
660 return yytname[yysymbol];
661 }
662 #endif
663
664 #ifdef YYPRINT
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[] =
668 {
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,
674 305
675 };
676 #endif
677
678 #define YYPACT_NINF (-105)
679
680 #define yypact_value_is_default(Yyn) \
681 ((Yyn) == YYPACT_NINF)
682
683 #define YYTABLE_NINF (-4)
684
685 #define yytable_value_is_error(Yyn) \
686 0
687
688 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
689 STATE-NUM. */
690 static const yytype_int16 yypact[] =
691 {
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
711 };
712
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[] =
717 {
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
737 };
738
739 /* YYPGOTO[NTERM-NUM]. */
740 static const yytype_int16 yypgoto[] =
741 {
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
747 };
748
749 /* YYDEFGOTO[NTERM-NUM]. */
750 static const yytype_uint8 yydefgoto[] =
751 {
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
757 };
758
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[] =
763 {
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,
783 107, 0, 0, 0, 96
784 };
785
786 static const yytype_int16 yycheck[] =
787 {
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,
807 34, -1, -1, -1, 38
808 };
809
810 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
811 symbol of state STATE-NUM. */
812 static const yytype_int8 yystos[] =
813 {
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
833 };
834
835 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
836 static const yytype_int8 yyr1[] =
837 {
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
849 };
850
851 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
852 static const yytype_int8 yyr2[] =
853 {
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,
864 1, 4, 1, 1, 1, 0, 1
865 };
866
867
868 enum { YYENOMEM = -2 };
869
870 #define yyerrok (yyerrstatus = 0)
871 #define yyclearin (yychar = YYEMPTY)
872
873 #define YYACCEPT goto yyacceptlab
874 #define YYABORT goto yyabortlab
875 #define YYERROR goto yyerrorlab
876
877
878 #define YYRECOVERING() (!!yyerrstatus)
879
880 #define YYBACKUP(Token, Value) \
881 do \
882 if (yychar == YYEMPTY) \
883 { \
884 yychar = (Token); \
885 yylval = (Value); \
886 YYPOPSTACK (yylen); \
887 yystate = *yyssp; \
888 goto yybackup; \
889 } \
890 else \
891 { \
892 yyerror (YY_("syntax error: cannot back up")); \
893 YYERROR; \
894 } \
895 while (0)
896
897 /* Backward compatibility with an undocumented macro.
898 Use YYerror or YYUNDEF. */
899 #define YYERRCODE YYUNDEF
900
901
902 /* Enable debugging if requested. */
903 #if YYDEBUG
904
905 # ifndef YYFPRINTF
906 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
907 # define YYFPRINTF fprintf
908 # endif
909
910 # define YYDPRINTF(Args) \
911 do { \
912 if (yydebug) \
913 YYFPRINTF Args; \
914 } while (0)
915
916 /* This macro is provided for backward compatibility. */
917 # ifndef YY_LOCATION_PRINT
918 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
919 # endif
920
921
922 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
923 do { \
924 if (yydebug) \
925 { \
926 YYFPRINTF (stderr, "%s ", Title); \
927 yy_symbol_print (stderr, \
928 Kind, Value); \
929 YYFPRINTF (stderr, "\n"); \
930 } \
931 } while (0)
932
933
934 /*-----------------------------------.
935 | Print this symbol's value on YYO. |
936 `-----------------------------------*/
937
938 static void
939 yy_symbol_value_print (FILE *yyo,
940 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
941 {
942 FILE *yyoutput = yyo;
943 YY_USE (yyoutput);
944 if (!yyvaluep)
945 return;
946 # ifdef YYPRINT
947 if (yykind < YYNTOKENS)
948 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
949 # endif
950 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
951 YY_USE (yykind);
952 YY_IGNORE_MAYBE_UNINITIALIZED_END
953 }
954
955
956 /*---------------------------.
957 | Print this symbol on YYO. |
958 `---------------------------*/
959
960 static void
961 yy_symbol_print (FILE *yyo,
962 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
963 {
964 YYFPRINTF (yyo, "%s %s (",
965 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
966
967 yy_symbol_value_print (yyo, yykind, yyvaluep);
968 YYFPRINTF (yyo, ")");
969 }
970
971 /*------------------------------------------------------------------.
972 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
973 | TOP (included). |
974 `------------------------------------------------------------------*/
975
976 static void
977 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
978 {
979 YYFPRINTF (stderr, "Stack now");
980 for (; yybottom <= yytop; yybottom++)
981 {
982 int yybot = *yybottom;
983 YYFPRINTF (stderr, " %d", yybot);
984 }
985 YYFPRINTF (stderr, "\n");
986 }
987
988 # define YY_STACK_PRINT(Bottom, Top) \
989 do { \
990 if (yydebug) \
991 yy_stack_print ((Bottom), (Top)); \
992 } while (0)
993
994
995 /*------------------------------------------------.
996 | Report that the YYRULE is going to be reduced. |
997 `------------------------------------------------*/
998
999 static void
1000 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1001 int yyrule)
1002 {
1003 int yylno = yyrline[yyrule];
1004 int yynrhs = yyr2[yyrule];
1005 int yyi;
1006 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1007 yyrule - 1, yylno);
1008 /* The symbols being reduced. */
1009 for (yyi = 0; yyi < yynrhs; yyi++)
1010 {
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");
1016 }
1017 }
1018
1019 # define YY_REDUCE_PRINT(Rule) \
1020 do { \
1021 if (yydebug) \
1022 yy_reduce_print (yyssp, yyvsp, Rule); \
1023 } while (0)
1024
1025 /* Nonzero means print parse trace. It is left uninitialized so that
1026 multiple parsers can coexist. */
1027 int yydebug;
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 */
1034
1035
1036 /* YYINITDEPTH -- initial size of the parser's stacks. */
1037 #ifndef YYINITDEPTH
1038 # define YYINITDEPTH 200
1039 #endif
1040
1041 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1042 if the built-in stack extension method is used).
1043
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. */
1047
1048 #ifndef YYMAXDEPTH
1049 # define YYMAXDEPTH 10000
1050 #endif
1051
1052
1053
1054
1055
1056
1057 /*-----------------------------------------------.
1058 | Release the memory associated to this symbol. |
1059 `-----------------------------------------------*/
1060
1061 static void
1062 yydestruct (const char *yymsg,
1063 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1064 {
1065 YY_USE (yyvaluep);
1066 if (!yymsg)
1067 yymsg = "Deleting";
1068 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1069
1070 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1071 switch (yykind)
1072 {
1073 case YYSYMBOL_choice_entry: /* choice_entry */
1074 {
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))
1078 menu_end_menu();
1079 }
1080 break;
1081
1082 case YYSYMBOL_if_entry: /* if_entry */
1083 {
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))
1087 menu_end_menu();
1088 }
1089 break;
1090
1091 case YYSYMBOL_menu_entry: /* menu_entry */
1092 {
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))
1096 menu_end_menu();
1097 }
1098 break;
1099
1100 default:
1101 break;
1102 }
1103 YY_IGNORE_MAYBE_UNINITIALIZED_END
1104 }
1105
1106
1107 /* Lookahead token kind. */
1108 int yychar;
1109
1110 /* The semantic value of the lookahead symbol. */
1111 YYSTYPE yylval;
1112 /* Number of syntax errors so far. */
1113 int yynerrs;
1114
1115
1116
1117
1118 /*----------.
1119 | yyparse. |
1120 `----------*/
1121
1122 int
1123 yyparse (void)
1124 {
1125 yy_state_fast_t yystate = 0;
1126 /* Number of tokens to shift before error messages enabled. */
1127 int yyerrstatus = 0;
1128
1129 /* Refer to the stacks through separate pointers, to allow yyoverflow
1130 to reallocate them elsewhere. */
1131
1132 /* Their size. */
1133 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1134
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;
1139
1140 /* The semantic value stack: array, bottom, top. */
1141 YYSTYPE yyvsa[YYINITDEPTH];
1142 YYSTYPE *yyvs = yyvsa;
1143 YYSTYPE *yyvsp = yyvs;
1144
1145 int yyn;
1146 /* The return value of yyparse. */
1147 int yyresult;
1148 /* Lookahead symbol kind. */
1149 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1150 /* The variables used to return semantic value and location from the
1151 action routines. */
1152 YYSTYPE yyval;
1153
1154
1155
1156 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1157
1158 /* The number of symbols on the RHS of the reduced rule.
1159 Keep to zero when no symbol should be popped. */
1160 int yylen = 0;
1161
1162 YYDPRINTF ((stderr, "Starting parse\n"));
1163
1164 yychar = YYEMPTY; /* Cause a token to be read. */
1165 goto yysetstate;
1166
1167
1168 /*------------------------------------------------------------.
1169 | yynewstate -- push a new state, which is found in yystate. |
1170 `------------------------------------------------------------*/
1171 yynewstate:
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. */
1174 yyssp++;
1175
1176
1177 /*--------------------------------------------------------------------.
1178 | yysetstate -- set current state (the top of the stack) to yystate. |
1179 `--------------------------------------------------------------------*/
1180 yysetstate:
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);
1187
1188 if (yyss + yystacksize - 1 <= yyssp)
1189 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1190 goto yyexhaustedlab;
1191 #else
1192 {
1193 /* Get the current used size of the three stacks, in elements. */
1194 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1195
1196 # if defined yyoverflow
1197 {
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
1200 memory. */
1201 yy_state_t *yyss1 = yyss;
1202 YYSTYPE *yyvs1 = yyvs;
1203
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),
1211 &yystacksize);
1212 yyss = yyss1;
1213 yyvs = yyvs1;
1214 }
1215 # else /* defined YYSTACK_RELOCATE */
1216 /* Extend the stack our own way. */
1217 if (YYMAXDEPTH <= yystacksize)
1218 goto yyexhaustedlab;
1219 yystacksize *= 2;
1220 if (YYMAXDEPTH < yystacksize)
1221 yystacksize = YYMAXDEPTH;
1222
1223 {
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))));
1228 if (! yyptr)
1229 goto yyexhaustedlab;
1230 YYSTACK_RELOCATE (yyss_alloc, yyss);
1231 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1232 # undef YYSTACK_RELOCATE
1233 if (yyss1 != yyssa)
1234 YYSTACK_FREE (yyss1);
1235 }
1236 # endif
1237
1238 yyssp = yyss + yysize - 1;
1239 yyvsp = yyvs + yysize - 1;
1240
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
1245
1246 if (yyss + yystacksize - 1 <= yyssp)
1247 YYABORT;
1248 }
1249 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1250
1251 if (yystate == YYFINAL)
1252 YYACCEPT;
1253
1254 goto yybackup;
1255
1256
1257 /*-----------.
1258 | yybackup. |
1259 `-----------*/
1260 yybackup:
1261 /* Do appropriate processing given the current state. Read a
1262 lookahead token if we need one and don't already have one. */
1263
1264 /* First try to decide what to do without reference to lookahead token. */
1265 yyn = yypact[yystate];
1266 if (yypact_value_is_default (yyn))
1267 goto yydefault;
1268
1269 /* Not known => get a lookahead token if don't already have one. */
1270
1271 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1272 if (yychar == YYEMPTY)
1273 {
1274 YYDPRINTF ((stderr, "Reading a token\n"));
1275 yychar = yylex ();
1276 }
1277
1278 if (yychar <= YYEOF)
1279 {
1280 yychar = YYEOF;
1281 yytoken = YYSYMBOL_YYEOF;
1282 YYDPRINTF ((stderr, "Now at end of input.\n"));
1283 }
1284 else if (yychar == YYerror)
1285 {
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. */
1290 yychar = YYUNDEF;
1291 yytoken = YYSYMBOL_YYerror;
1292 goto yyerrlab1;
1293 }
1294 else
1295 {
1296 yytoken = YYTRANSLATE (yychar);
1297 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1298 }
1299
1300 /* If the proper action on seeing token YYTOKEN is to reduce or to
1301 detect an error, take that action. */
1302 yyn += yytoken;
1303 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1304 goto yydefault;
1305 yyn = yytable[yyn];
1306 if (yyn <= 0)
1307 {
1308 if (yytable_value_is_error (yyn))
1309 goto yyerrlab;
1310 yyn = -yyn;
1311 goto yyreduce;
1312 }
1313
1314 /* Count tokens shifted since error; after three, turn off error
1315 status. */
1316 if (yyerrstatus)
1317 yyerrstatus--;
1318
1319 /* Shift the lookahead token. */
1320 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1321 yystate = yyn;
1322 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1323 *++yyvsp = yylval;
1324 YY_IGNORE_MAYBE_UNINITIALIZED_END
1325
1326 /* Discard the shifted token. */
1327 yychar = YYEMPTY;
1328 goto yynewstate;
1329
1330
1331 /*-----------------------------------------------------------.
1332 | yydefault -- do the default action for the current state. |
1333 `-----------------------------------------------------------*/
1334 yydefault:
1335 yyn = yydefact[yystate];
1336 if (yyn == 0)
1337 goto yyerrlab;
1338 goto yyreduce;
1339
1340
1341 /*-----------------------------.
1342 | yyreduce -- do a reduction. |
1343 `-----------------------------*/
1344 yyreduce:
1345 /* yyn is the number of a rule to reduce with. */
1346 yylen = yyr2[yyn];
1347
1348 /* If YYLEN is nonzero, implement the default value of the action:
1349 '$$ = $1'.
1350
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];
1357
1358
1359 YY_REDUCE_PRINT (yyn);
1360 switch (yyn)
1361 {
1362 case 4: /* mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL */
1363 {
1364 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1365 }
1366 break;
1367
1368 case 14: /* stmt_list: stmt_list T_WORD error T_EOL */
1369 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); }
1370 break;
1371
1372 case 15: /* stmt_list: stmt_list error T_EOL */
1373 { zconf_error("invalid statement"); }
1374 break;
1375
1376 case 20: /* stmt_list_in_choice: stmt_list_in_choice error T_EOL */
1377 { zconf_error("invalid statement"); }
1378 break;
1379
1380 case 21: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */
1381 {
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);
1385 }
1386 break;
1387
1388 case 22: /* config_stmt: config_entry_start config_option_list */
1389 {
1390 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1391 }
1392 break;
1393
1394 case 23: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */
1395 {
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);
1399 }
1400 break;
1401
1402 case 24: /* menuconfig_stmt: menuconfig_entry_start config_option_list */
1403 {
1404 if (current_entry->prompt)
1405 current_entry->prompt->type = P_MENU;
1406 else
1407 zconfprint("warning: menuconfig statement without prompt");
1408 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1409 }
1410 break;
1411
1412 case 29: /* config_option: type prompt_stmt_opt T_EOL */
1413 {
1414 menu_set_type((yyvsp[-2].type));
1415 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1416 zconf_curname(), zconf_lineno(),
1417 (yyvsp[-2].type));
1418 }
1419 break;
1420
1421 case 30: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */
1422 {
1423 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1424 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1425 }
1426 break;
1427
1428 case 31: /* config_option: default expr if_expr T_EOL */
1429 {
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(),
1435 (yyvsp[-3].type));
1436 }
1437 break;
1438
1439 case 32: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */
1440 {
1441 menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1442 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1443 }
1444 break;
1445
1446 case 33: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */
1447 {
1448 menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1449 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1450 }
1451 break;
1452
1453 case 34: /* config_option: T_RANGE symbol symbol if_expr T_EOL */
1454 {
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());
1457 }
1458 break;
1459
1460 case 35: /* config_option: T_MODULES T_EOL */
1461 {
1462 if (modules_sym)
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;
1466 }
1467 break;
1468
1469 case 36: /* choice: T_CHOICE word_opt T_EOL */
1470 {
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());
1477 }
1478 break;
1479
1480 case 37: /* choice_entry: choice choice_option_list */
1481 {
1482 (yyval.menu) = menu_add_menu();
1483 }
1484 break;
1485
1486 case 38: /* choice_end: end */
1487 {
1488 if (zconf_endtoken((yyvsp[0].string), "choice")) {
1489 menu_end_menu();
1490 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1491 }
1492 }
1493 break;
1494
1495 case 44: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */
1496 {
1497 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1498 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1499 }
1500 break;
1501
1502 case 45: /* choice_option: logic_type prompt_stmt_opt T_EOL */
1503 {
1504 menu_set_type((yyvsp[-2].type));
1505 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1506 zconf_curname(), zconf_lineno(), (yyvsp[-2].type));
1507 }
1508 break;
1509
1510 case 46: /* choice_option: T_OPTIONAL T_EOL */
1511 {
1512 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1513 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1514 }
1515 break;
1516
1517 case 47: /* choice_option: T_RESET if_expr T_EOL */
1518 {
1519 menu_add_prop(P_RESET, NULL, (yyvsp[-1].expr));
1520 }
1521 break;
1522
1523 case 48: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */
1524 {
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());
1528 }
1529 break;
1530
1531 case 50: /* type: T_INT */
1532 { (yyval.type) = S_INT; }
1533 break;
1534
1535 case 51: /* type: T_HEX */
1536 { (yyval.type) = S_HEX; }
1537 break;
1538
1539 case 52: /* type: T_STRING */
1540 { (yyval.type) = S_STRING; }
1541 break;
1542
1543 case 53: /* logic_type: T_BOOL */
1544 { (yyval.type) = S_BOOLEAN; }
1545 break;
1546
1547 case 54: /* logic_type: T_TRISTATE */
1548 { (yyval.type) = S_TRISTATE; }
1549 break;
1550
1551 case 55: /* default: T_DEFAULT */
1552 { (yyval.type) = S_UNKNOWN; }
1553 break;
1554
1555 case 56: /* default: T_DEF_BOOL */
1556 { (yyval.type) = S_BOOLEAN; }
1557 break;
1558
1559 case 57: /* default: T_DEF_TRISTATE */
1560 { (yyval.type) = S_TRISTATE; }
1561 break;
1562
1563 case 58: /* if_entry: T_IF expr T_EOL */
1564 {
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();
1569 }
1570 break;
1571
1572 case 59: /* if_end: end */
1573 {
1574 if (zconf_endtoken((yyvsp[0].string), "if")) {
1575 menu_end_menu();
1576 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1577 }
1578 }
1579 break;
1580
1581 case 62: /* menu: T_MENU T_WORD_QUOTE T_EOL */
1582 {
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());
1586 }
1587 break;
1588
1589 case 63: /* menu_entry: menu menu_option_list */
1590 {
1591 (yyval.menu) = menu_add_menu();
1592 }
1593 break;
1594
1595 case 64: /* menu_end: end */
1596 {
1597 if (zconf_endtoken((yyvsp[0].string), "menu")) {
1598 menu_end_menu();
1599 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1600 }
1601 }
1602 break;
1603
1604 case 69: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */
1605 {
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));
1609 }
1610 break;
1611
1612 case 70: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */
1613 {
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());
1617 }
1618 break;
1619
1620 case 74: /* help_start: T_HELP T_EOL */
1621 {
1622 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1623 zconf_starthelp();
1624 }
1625 break;
1626
1627 case 75: /* help: help_start T_HELPTEXT */
1628 {
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>");
1633
1634 current_entry->help = (yyvsp[0].string);
1635 }
1636 break;
1637
1638 case 76: /* depends: T_DEPENDS T_ON expr T_EOL */
1639 {
1640 menu_add_dep((yyvsp[-1].expr));
1641 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1642 }
1643 break;
1644
1645 case 77: /* visible: T_VISIBLE if_expr T_EOL */
1646 {
1647 menu_add_visibility((yyvsp[-1].expr));
1648 }
1649 break;
1650
1651 case 79: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */
1652 {
1653 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1654 }
1655 break;
1656
1657 case 80: /* end: T_ENDMENU T_EOL */
1658 { (yyval.string) = "menu"; }
1659 break;
1660
1661 case 81: /* end: T_ENDCHOICE T_EOL */
1662 { (yyval.string) = "choice"; }
1663 break;
1664
1665 case 82: /* end: T_ENDIF T_EOL */
1666 { (yyval.string) = "if"; }
1667 break;
1668
1669 case 83: /* if_expr: %empty */
1670 { (yyval.expr) = NULL; }
1671 break;
1672
1673 case 84: /* if_expr: T_IF expr */
1674 { (yyval.expr) = (yyvsp[0].expr); }
1675 break;
1676
1677 case 85: /* expr: symbol */
1678 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); }
1679 break;
1680
1681 case 86: /* expr: symbol T_LESS symbol */
1682 { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1683 break;
1684
1685 case 87: /* expr: symbol T_LESS_EQUAL symbol */
1686 { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1687 break;
1688
1689 case 88: /* expr: symbol T_GREATER symbol */
1690 { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1691 break;
1692
1693 case 89: /* expr: symbol T_GREATER_EQUAL symbol */
1694 { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1695 break;
1696
1697 case 90: /* expr: symbol T_EQUAL symbol */
1698 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1699 break;
1700
1701 case 91: /* expr: symbol T_UNEQUAL symbol */
1702 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1703 break;
1704
1705 case 92: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */
1706 { (yyval.expr) = (yyvsp[-1].expr); }
1707 break;
1708
1709 case 93: /* expr: T_NOT expr */
1710 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); }
1711 break;
1712
1713 case 94: /* expr: expr T_OR expr */
1714 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1715 break;
1716
1717 case 95: /* expr: expr T_AND expr */
1718 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1719 break;
1720
1721 case 96: /* nonconst_symbol: T_WORD */
1722 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); }
1723 break;
1724
1725 case 98: /* symbol: T_WORD_QUOTE */
1726 { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); }
1727 break;
1728
1729 case 99: /* word_opt: %empty */
1730 { (yyval.string) = NULL; }
1731 break;
1732
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)); }
1735 break;
1736
1737 case 102: /* assign_op: T_EQUAL */
1738 { (yyval.flavor) = VAR_RECURSIVE; }
1739 break;
1740
1741 case 103: /* assign_op: T_COLON_EQUAL */
1742 { (yyval.flavor) = VAR_SIMPLE; }
1743 break;
1744
1745 case 104: /* assign_op: T_PLUS_EQUAL */
1746 { (yyval.flavor) = VAR_APPEND; }
1747 break;
1748
1749 case 105: /* assign_val: %empty */
1750 { (yyval.string) = xstrdup(""); }
1751 break;
1752
1753
1754
1755 default: break;
1756 }
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);
1769
1770 YYPOPSTACK (yylen);
1771 yylen = 0;
1772
1773 *++yyvsp = yyval;
1774
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. */
1778 {
1779 const int yylhs = yyr1[yyn] - YYNTOKENS;
1780 const int yyi = yypgoto[yylhs] + *yyssp;
1781 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1782 ? yytable[yyi]
1783 : yydefgoto[yylhs]);
1784 }
1785
1786 goto yynewstate;
1787
1788
1789 /*--------------------------------------.
1790 | yyerrlab -- here on detecting error. |
1791 `--------------------------------------*/
1792 yyerrlab:
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. */
1797 if (!yyerrstatus)
1798 {
1799 ++yynerrs;
1800 yyerror (YY_("syntax error"));
1801 }
1802
1803 if (yyerrstatus == 3)
1804 {
1805 /* If just tried and failed to reuse lookahead token after an
1806 error, discard it. */
1807
1808 if (yychar <= YYEOF)
1809 {
1810 /* Return failure if at end of input. */
1811 if (yychar == YYEOF)
1812 YYABORT;
1813 }
1814 else
1815 {
1816 yydestruct ("Error: discarding",
1817 yytoken, &yylval);
1818 yychar = YYEMPTY;
1819 }
1820 }
1821
1822 /* Else will try to reuse lookahead token after shifting the error
1823 token. */
1824 goto yyerrlab1;
1825
1826
1827 /*---------------------------------------------------.
1828 | yyerrorlab -- error raised explicitly by YYERROR. |
1829 `---------------------------------------------------*/
1830 yyerrorlab:
1831 /* Pacify compilers when the user code never invokes YYERROR and the
1832 label yyerrorlab therefore never appears in user code. */
1833 if (0)
1834 YYERROR;
1835
1836 /* Do not reclaim the symbols of the rule whose action triggered
1837 this YYERROR. */
1838 YYPOPSTACK (yylen);
1839 yylen = 0;
1840 YY_STACK_PRINT (yyss, yyssp);
1841 yystate = *yyssp;
1842 goto yyerrlab1;
1843
1844
1845 /*-------------------------------------------------------------.
1846 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1847 `-------------------------------------------------------------*/
1848 yyerrlab1:
1849 yyerrstatus = 3; /* Each real token shifted decrements this. */
1850
1851 /* Pop stack until we find a state that shifts the error token. */
1852 for (;;)
1853 {
1854 yyn = yypact[yystate];
1855 if (!yypact_value_is_default (yyn))
1856 {
1857 yyn += YYSYMBOL_YYerror;
1858 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1859 {
1860 yyn = yytable[yyn];
1861 if (0 < yyn)
1862 break;
1863 }
1864 }
1865
1866 /* Pop the current state because it cannot handle the error token. */
1867 if (yyssp == yyss)
1868 YYABORT;
1869
1870
1871 yydestruct ("Error: popping",
1872 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1873 YYPOPSTACK (1);
1874 yystate = *yyssp;
1875 YY_STACK_PRINT (yyss, yyssp);
1876 }
1877
1878 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1879 *++yyvsp = yylval;
1880 YY_IGNORE_MAYBE_UNINITIALIZED_END
1881
1882
1883 /* Shift the error token. */
1884 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1885
1886 yystate = yyn;
1887 goto yynewstate;
1888
1889
1890 /*-------------------------------------.
1891 | yyacceptlab -- YYACCEPT comes here. |
1892 `-------------------------------------*/
1893 yyacceptlab:
1894 yyresult = 0;
1895 goto yyreturn;
1896
1897
1898 /*-----------------------------------.
1899 | yyabortlab -- YYABORT comes here. |
1900 `-----------------------------------*/
1901 yyabortlab:
1902 yyresult = 1;
1903 goto yyreturn;
1904
1905
1906 #if !defined yyoverflow
1907 /*-------------------------------------------------.
1908 | yyexhaustedlab -- memory exhaustion comes here. |
1909 `-------------------------------------------------*/
1910 yyexhaustedlab:
1911 yyerror (YY_("memory exhausted"));
1912 yyresult = 2;
1913 goto yyreturn;
1914 #endif
1915
1916
1917 /*-------------------------------------------------------.
1918 | yyreturn -- parsing is finished, clean up and return. |
1919 `-------------------------------------------------------*/
1920 yyreturn:
1921 if (yychar != YYEMPTY)
1922 {
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",
1927 yytoken, &yylval);
1928 }
1929 /* Do not reclaim the symbols of the rule whose action triggered
1930 this YYABORT or YYACCEPT. */
1931 YYPOPSTACK (yylen);
1932 YY_STACK_PRINT (yyss, yyssp);
1933 while (yyssp != yyss)
1934 {
1935 yydestruct ("Cleanup: popping",
1936 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1937 YYPOPSTACK (1);
1938 }
1939 #ifndef yyoverflow
1940 if (yyss != yyssa)
1941 YYSTACK_FREE (yyss);
1942 #endif
1943
1944 return yyresult;
1945 }
1946
1947
1948
1949 void conf_parse(const char *name)
1950 {
1951 struct symbol *sym;
1952 int i;
1953
1954 zconf_initscan(name);
1955
1956 _menu_init();
1957
1958 #if YYDEBUG
1959 if (getenv("ZCONF_DEBUG"))
1960 yydebug = 1;
1961 #endif
1962 yyparse();
1963
1964 /* Variables are expanded in the parse phase. We can free them here. */
1965 variable_all_del();
1966
1967 if (yynerrs)
1968 exit(1);
1969 if (!modules_sym)
1970 modules_sym = sym_find( "n" );
1971
1972 if (!menu_has_prompt(&rootmenu)) {
1973 current_entry = &rootmenu;
1974 menu_add_prompt(P_MENU, "Main menu", NULL);
1975 }
1976
1977 menu_finalize(&rootmenu);
1978 for_all_symbols(i, sym) {
1979 if (sym_check_deps(sym))
1980 yynerrs++;
1981 }
1982 if (yynerrs)
1983 exit(1);
1984 conf_set_changed(true);
1985 }
1986
1987 static bool zconf_endtoken(const char *tokenname,
1988 const char *expected_tokenname)
1989 {
1990 if (strcmp(tokenname, expected_tokenname)) {
1991 zconf_error("unexpected '%s' within %s block",
1992 tokenname, expected_tokenname);
1993 yynerrs++;
1994 return false;
1995 }
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);
2002 yynerrs++;
2003 return false;
2004 }
2005 return true;
2006 }
2007
2008 static void zconfprint(const char *err, ...)
2009 {
2010 va_list ap;
2011
2012 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2013 va_start(ap, err);
2014 vfprintf(stderr, err, ap);
2015 va_end(ap);
2016 fprintf(stderr, "\n");
2017 }
2018
2019 static void zconf_error(const char *err, ...)
2020 {
2021 va_list ap;
2022
2023 yynerrs++;
2024 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2025 va_start(ap, err);
2026 vfprintf(stderr, err, ap);
2027 va_end(ap);
2028 fprintf(stderr, "\n");
2029 }
2030
2031 static void yyerror(const char *err)
2032 {
2033 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2034 }
2035
2036 static void print_quoted_string(FILE *out, const char *str)
2037 {
2038 const char *p;
2039 int len;
2040
2041 putc('"', out);
2042 while ((p = strchr(str, '"'))) {
2043 len = p - str;
2044 if (len)
2045 fprintf(out, "%.*s", len, str);
2046 fputs("\\\"", out);
2047 str = p + 1;
2048 }
2049 fputs(str, out);
2050 putc('"', out);
2051 }
2052
2053 static void print_symbol(FILE *out, struct menu *menu)
2054 {
2055 struct symbol *sym = menu->sym;
2056 struct property *prop;
2057
2058 if (sym_is_choice(sym))
2059 fprintf(out, "\nchoice\n");
2060 else
2061 fprintf(out, "\nconfig %s\n", sym->name);
2062 switch (sym->type) {
2063 case S_BOOLEAN:
2064 fputs(" bool\n", out);
2065 break;
2066 case S_TRISTATE:
2067 fputs(" tristate\n", out);
2068 break;
2069 case S_STRING:
2070 fputs(" string\n", out);
2071 break;
2072 case S_INT:
2073 fputs(" integer\n", out);
2074 break;
2075 case S_HEX:
2076 fputs(" hex\n", out);
2077 break;
2078 default:
2079 fputs(" ???\n", out);
2080 break;
2081 }
2082 for (prop = sym->prop; prop; prop = prop->next) {
2083 if (prop->menu != menu)
2084 continue;
2085 switch (prop->type) {
2086 case P_PROMPT:
2087 fputs(" prompt ", out);
2088 print_quoted_string(out, prop->text);
2089 if (!expr_is_yes(prop->visible.expr)) {
2090 fputs(" if ", out);
2091 expr_fprint(prop->visible.expr, out);
2092 }
2093 fputc('\n', out);
2094 break;
2095 case P_DEFAULT:
2096 fputs( " default ", out);
2097 expr_fprint(prop->expr, out);
2098 if (!expr_is_yes(prop->visible.expr)) {
2099 fputs(" if ", out);
2100 expr_fprint(prop->visible.expr, out);
2101 }
2102 fputc('\n', out);
2103 break;
2104 case P_CHOICE:
2105 fputs(" #choice value\n", out);
2106 break;
2107 case P_SELECT:
2108 fputs( " select ", out);
2109 expr_fprint(prop->expr, out);
2110 fputc('\n', out);
2111 break;
2112 case P_IMPLY:
2113 fputs( " imply ", out);
2114 expr_fprint(prop->expr, out);
2115 fputc('\n', out);
2116 break;
2117 case P_RANGE:
2118 fputs( " range ", out);
2119 expr_fprint(prop->expr, out);
2120 fputc('\n', out);
2121 break;
2122 case P_MENU:
2123 fputs( " menu ", out);
2124 print_quoted_string(out, prop->text);
2125 fputc('\n', out);
2126 break;
2127 case P_SYMBOL:
2128 fputs( " symbol ", out);
2129 fprintf(out, "%s\n", prop->menu->sym->name);
2130 break;
2131 default:
2132 fprintf(out, " unknown prop %d!\n", prop->type);
2133 break;
2134 }
2135 }
2136 if (menu->help) {
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);
2141 }
2142 }
2143
2144 void zconfdump(FILE *out)
2145 {
2146 struct property *prop;
2147 struct symbol *sym;
2148 struct menu *menu;
2149
2150 menu = rootmenu.list;
2151 while (menu) {
2152 if ((sym = menu->sym))
2153 print_symbol(out, menu);
2154 else if ((prop = menu->prompt)) {
2155 switch (prop->type) {
2156 case P_COMMENT:
2157 fputs("\ncomment ", out);
2158 print_quoted_string(out, prop->text);
2159 fputs("\n", out);
2160 break;
2161 case P_MENU:
2162 fputs("\nmenu ", out);
2163 print_quoted_string(out, prop->text);
2164 fputs("\n", out);
2165 break;
2166 default:
2167 ;
2168 }
2169 if (!expr_is_yes(prop->visible.expr)) {
2170 fputs(" depends ", out);
2171 expr_fprint(prop->visible.expr, out);
2172 fputc('\n', out);
2173 }
2174 }
2175
2176 if (menu->list)
2177 menu = menu->list;
2178 else if (menu->next)
2179 menu = menu->next;
2180 else while ((menu = menu->parent)) {
2181 if (menu->prompt && menu->prompt->type == P_MENU)
2182 fputs("\nendmenu\n", out);
2183 if (menu->next) {
2184 menu = menu->next;
2185 break;
2186 }
2187 }
2188 }
2189 }