xenomai: new package, only mercury for now supported
[openadk.git] / adk / config / zconf.tab.c_shipped
blob1f6c1bb4a3d633131687ba28ca2f37184df31313
1 /* A Bison parser, made by GNU Bison 2.5.  */
3 /* Bison implementation for Yacc-like parsers in C
4    
5       Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6    
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29    
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
43 /* Identify Bison output.  */
44 #define YYBISON 1
46 /* Bison version.  */
47 #define YYBISON_VERSION "2.5"
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
52 /* Pure parsers.  */
53 #define YYPURE 0
55 /* Push parsers.  */
56 #define YYPUSH 0
58 /* Pull parsers.  */
59 #define YYPULL 1
61 /* Using locations.  */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names.  */
65 #define yyparse         zconfparse
66 #define yylex           zconflex
67 #define yyerror         zconferror
68 #define yylval          zconflval
69 #define yychar          zconfchar
70 #define yydebug         zconfdebug
71 #define yynerrs         zconfnerrs
74 /* Copy the first part of user declarations.  */
76 /* Line 268 of yacc.c  */
77 #line 1 "zconf.y"
80  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
81  * Released under the terms of the GNU GPL v2.0.
82  */
84 #include <ctype.h>
85 #include <stdarg.h>
86 #include <stdio.h>
87 #include <stdlib.h>
88 #include <string.h>
89 #include <stdbool.h>
91 #include "lkc.h"
93 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
95 #define PRINTD          0x0001
96 #define DEBUG_PARSE     0x0002
98 int cdebug = PRINTD;
100 extern int zconflex(void);
101 static void zconfprint(const char *err, ...);
102 static void zconf_error(const char *err, ...);
103 static void zconferror(const char *err);
104 static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
106 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
108 static struct menu *current_menu, *current_entry;
112 /* Line 268 of yacc.c  */
113 #line 114 "zconf.tab.c"
115 /* Enabling traces.  */
116 #ifndef YYDEBUG
117 # define YYDEBUG 1
118 #endif
120 /* Enabling verbose error messages.  */
121 #ifdef YYERROR_VERBOSE
122 # undef YYERROR_VERBOSE
123 # define YYERROR_VERBOSE 1
124 #else
125 # define YYERROR_VERBOSE 0
126 #endif
128 /* Enabling the token table.  */
129 #ifndef YYTOKEN_TABLE
130 # define YYTOKEN_TABLE 0
131 #endif
134 /* Tokens.  */
135 #ifndef YYTOKENTYPE
136 # define YYTOKENTYPE
137    /* Put the tokens into the symbol table, so that GDB and other debuggers
138       know about them.  */
139    enum yytokentype {
140      T_MAINMENU = 258,
141      T_MENU = 259,
142      T_ENDMENU = 260,
143      T_SOURCE = 261,
144      T_CHOICE = 262,
145      T_ENDCHOICE = 263,
146      T_COMMENT = 264,
147      T_CONFIG = 265,
148      T_MENUCONFIG = 266,
149      T_HELP = 267,
150      T_HELPTEXT = 268,
151      T_IF = 269,
152      T_ENDIF = 270,
153      T_DEPENDS = 271,
154      T_OPTIONAL = 272,
155      T_PROMPT = 273,
156      T_TYPE = 274,
157      T_DEFAULT = 275,
158      T_SELECT = 276,
159      T_RANGE = 277,
160      T_VISIBLE = 278,
161      T_OPTION = 279,
162      T_ON = 280,
163      T_WORD = 281,
164      T_WORD_QUOTE = 282,
165      T_UNEQUAL = 283,
166      T_CLOSE_PAREN = 284,
167      T_OPEN_PAREN = 285,
168      T_EOL = 286,
169      T_OR = 287,
170      T_AND = 288,
171      T_EQUAL = 289,
172      T_NOT = 290
173    };
174 #endif
178 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
179 typedef union YYSTYPE
182 /* Line 293 of yacc.c  */
183 #line 37 "zconf.y"
185         char *string;
186         struct file *file;
187         struct symbol *symbol;
188         struct expr *expr;
189         struct menu *menu;
190         const struct kconf_id *id;
194 /* Line 293 of yacc.c  */
195 #line 196 "zconf.tab.c"
196 } YYSTYPE;
197 # define YYSTYPE_IS_TRIVIAL 1
198 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
199 # define YYSTYPE_IS_DECLARED 1
200 #endif
203 /* Copy the second part of user declarations.  */
205 /* Line 343 of yacc.c  */
206 #line 97 "zconf.y"
208 /* Include zconf.hash.c here so it can see the token constants. */
209 #include "zconf.hash.c"
212 /* Line 343 of yacc.c  */
213 #line 214 "zconf.tab.c"
215 #ifdef short
216 # undef short
217 #endif
219 #ifdef YYTYPE_UINT8
220 typedef YYTYPE_UINT8 yytype_uint8;
221 #else
222 typedef unsigned char yytype_uint8;
223 #endif
225 #ifdef YYTYPE_INT8
226 typedef YYTYPE_INT8 yytype_int8;
227 #elif (defined __STDC__ || defined __C99__FUNC__ \
228      || defined __cplusplus || defined _MSC_VER)
229 typedef signed char yytype_int8;
230 #else
231 typedef short int yytype_int8;
232 #endif
234 #ifdef YYTYPE_UINT16
235 typedef YYTYPE_UINT16 yytype_uint16;
236 #else
237 typedef unsigned short int yytype_uint16;
238 #endif
240 #ifdef YYTYPE_INT16
241 typedef YYTYPE_INT16 yytype_int16;
242 #else
243 typedef short int yytype_int16;
244 #endif
246 #ifndef YYSIZE_T
247 # ifdef __SIZE_TYPE__
248 #  define YYSIZE_T __SIZE_TYPE__
249 # elif defined size_t
250 #  define YYSIZE_T size_t
251 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
252      || defined __cplusplus || defined _MSC_VER)
253 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
254 #  define YYSIZE_T size_t
255 # else
256 #  define YYSIZE_T unsigned int
257 # endif
258 #endif
260 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
262 #ifndef YY_
263 # if defined YYENABLE_NLS && YYENABLE_NLS
264 #  if ENABLE_NLS
265 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
266 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
267 #  endif
268 # endif
269 # ifndef YY_
270 #  define YY_(msgid) msgid
271 # endif
272 #endif
274 /* Suppress unused-variable warnings by "using" E.  */
275 #if ! defined lint || defined __GNUC__
276 # define YYUSE(e) ((void) (e))
277 #else
278 # define YYUSE(e) /* empty */
279 #endif
281 /* Identity function, used to suppress warnings about constant conditions.  */
282 #ifndef lint
283 # define YYID(n) (n)
284 #else
285 #if (defined __STDC__ || defined __C99__FUNC__ \
286      || defined __cplusplus || defined _MSC_VER)
287 static int
288 YYID (int yyi)
289 #else
290 static int
291 YYID (yyi)
292     int yyi;
293 #endif
295   return yyi;
297 #endif
299 #if ! defined yyoverflow || YYERROR_VERBOSE
301 /* The parser invokes alloca or malloc; define the necessary symbols.  */
303 # ifdef YYSTACK_USE_ALLOCA
304 #  if YYSTACK_USE_ALLOCA
305 #   ifdef __GNUC__
306 #    define YYSTACK_ALLOC __builtin_alloca
307 #   elif defined __BUILTIN_VA_ARG_INCR
308 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
309 #   elif defined _AIX
310 #    define YYSTACK_ALLOC __alloca
311 #   elif defined _MSC_VER
312 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
313 #    define alloca _alloca
314 #   else
315 #    define YYSTACK_ALLOC alloca
316 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
317      || defined __cplusplus || defined _MSC_VER)
318 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
319 #     ifndef EXIT_SUCCESS
320 #      define EXIT_SUCCESS 0
321 #     endif
322 #    endif
323 #   endif
324 #  endif
325 # endif
327 # ifdef YYSTACK_ALLOC
328    /* Pacify GCC's `empty if-body' warning.  */
329 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
330 #  ifndef YYSTACK_ALLOC_MAXIMUM
331     /* The OS might guarantee only one guard page at the bottom of the stack,
332        and a page size can be as small as 4096 bytes.  So we cannot safely
333        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
334        to allow for a few compiler-allocated temporary stack slots.  */
335 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
336 #  endif
337 # else
338 #  define YYSTACK_ALLOC YYMALLOC
339 #  define YYSTACK_FREE YYFREE
340 #  ifndef YYSTACK_ALLOC_MAXIMUM
341 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
342 #  endif
343 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
344        && ! ((defined YYMALLOC || defined malloc) \
345              && (defined YYFREE || defined free)))
346 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
347 #   ifndef EXIT_SUCCESS
348 #    define EXIT_SUCCESS 0
349 #   endif
350 #  endif
351 #  ifndef YYMALLOC
352 #   define YYMALLOC malloc
353 #   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
354      || defined __cplusplus || defined _MSC_VER)
355 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
356 #   endif
357 #  endif
358 #  ifndef YYFREE
359 #   define YYFREE free
360 #   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
361      || defined __cplusplus || defined _MSC_VER)
362 void free (void *); /* INFRINGES ON USER NAME SPACE */
363 #   endif
364 #  endif
365 # endif
366 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
369 #if (! defined yyoverflow \
370      && (! defined __cplusplus \
371          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
373 /* A type that is properly aligned for any stack member.  */
374 union yyalloc
376   yytype_int16 yyss_alloc;
377   YYSTYPE yyvs_alloc;
380 /* The size of the maximum gap between one aligned stack and the next.  */
381 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
383 /* The size of an array large to enough to hold all stacks, each with
384    N elements.  */
385 # define YYSTACK_BYTES(N) \
386      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
387       + YYSTACK_GAP_MAXIMUM)
389 # define YYCOPY_NEEDED 1
391 /* Relocate STACK from its old location to the new one.  The
392    local variables YYSIZE and YYSTACKSIZE give the old and new number of
393    elements in the stack, and YYPTR gives the new location of the
394    stack.  Advance YYPTR to a properly aligned location for the next
395    stack.  */
396 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
397     do                                                                  \
398       {                                                                 \
399         YYSIZE_T yynewbytes;                                            \
400         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
401         Stack = &yyptr->Stack_alloc;                                    \
402         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
403         yyptr += yynewbytes / sizeof (*yyptr);                          \
404       }                                                                 \
405     while (YYID (0))
407 #endif
409 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
410 /* Copy COUNT objects from FROM to TO.  The source and destination do
411    not overlap.  */
412 # ifndef YYCOPY
413 #  if defined __GNUC__ && 1 < __GNUC__
414 #   define YYCOPY(To, From, Count) \
415       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
416 #  else
417 #   define YYCOPY(To, From, Count)              \
418       do                                        \
419         {                                       \
420           YYSIZE_T yyi;                         \
421           for (yyi = 0; yyi < (Count); yyi++)   \
422             (To)[yyi] = (From)[yyi];            \
423         }                                       \
424       while (YYID (0))
425 #  endif
426 # endif
427 #endif /* !YYCOPY_NEEDED */
429 /* YYFINAL -- State number of the termination state.  */
430 #define YYFINAL  11
431 /* YYLAST -- Last index in YYTABLE.  */
432 #define YYLAST   296
434 /* YYNTOKENS -- Number of terminals.  */
435 #define YYNTOKENS  36
436 /* YYNNTS -- Number of nonterminals.  */
437 #define YYNNTS  50
438 /* YYNRULES -- Number of rules.  */
439 #define YYNRULES  119
440 /* YYNRULES -- Number of states.  */
441 #define YYNSTATES  194
443 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
444 #define YYUNDEFTOK  2
445 #define YYMAXUTOK   290
447 #define YYTRANSLATE(YYX)                                                \
448   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
450 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
451 static const yytype_uint8 yytranslate[] =
453        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
454        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
455        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
457        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
458        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
464        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
465        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
466        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
467        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
468        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
469        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
470        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
471        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
472        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
473        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
474        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
475        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
476        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
477        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
478        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
479        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
480       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
481       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
482       35
485 #if YYDEBUG
486 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
487    YYRHS.  */
488 static const yytype_uint16 yyprhs[] =
490        0,     0,     3,     6,     8,    11,    13,    14,    17,    20,
491       23,    26,    31,    36,    40,    42,    44,    46,    48,    50,
492       52,    54,    56,    58,    60,    62,    64,    66,    68,    72,
493       75,    79,    82,    86,    89,    90,    93,    96,    99,   102,
494      105,   108,   112,   117,   122,   127,   133,   139,   143,   144,
495      148,   149,   152,   156,   159,   161,   165,   166,   169,   172,
496      175,   178,   181,   186,   190,   193,   198,   199,   202,   206,
497      208,   212,   213,   216,   219,   222,   226,   230,   234,   236,
498      240,   241,   244,   247,   250,   254,   258,   261,   264,   267,
499      268,   271,   274,   277,   282,   283,   286,   289,   292,   293,
500      296,   298,   300,   303,   306,   309,   311,   314,   315,   318,
501      320,   324,   328,   332,   335,   339,   343,   345,   347,   348
504 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
505 static const yytype_int8 yyrhs[] =
507       37,     0,    -1,    81,    38,    -1,    38,    -1,    63,    39,
508       -1,    39,    -1,    -1,    39,    41,    -1,    39,    55,    -1,
509       39,    67,    -1,    39,    80,    -1,    39,    26,     1,    31,
510       -1,    39,    40,     1,    31,    -1,    39,     1,    31,    -1,
511       16,    -1,    18,    -1,    19,    -1,    21,    -1,    17,    -1,
512       22,    -1,    20,    -1,    23,    -1,    31,    -1,    61,    -1,
513       71,    -1,    44,    -1,    46,    -1,    69,    -1,    26,     1,
514       31,    -1,     1,    31,    -1,    10,    26,    31,    -1,    43,
515       47,    -1,    11,    26,    31,    -1,    45,    47,    -1,    -1,
516       47,    48,    -1,    47,    49,    -1,    47,    75,    -1,    47,
517       73,    -1,    47,    42,    -1,    47,    31,    -1,    19,    78,
518       31,    -1,    18,    79,    82,    31,    -1,    20,    83,    82,
519       31,    -1,    21,    26,    82,    31,    -1,    21,    26,    83,
520       82,    31,    -1,    22,    84,    84,    82,    31,    -1,    24,
521       50,    31,    -1,    -1,    50,    26,    51,    -1,    -1,    34,
522       79,    -1,     7,    85,    31,    -1,    52,    56,    -1,    80,
523       -1,    53,    58,    54,    -1,    -1,    56,    57,    -1,    56,
524       75,    -1,    56,    73,    -1,    56,    31,    -1,    56,    42,
525       -1,    18,    79,    82,    31,    -1,    19,    78,    31,    -1,
526       17,    31,    -1,    20,    26,    82,    31,    -1,    -1,    58,
527       41,    -1,    14,    83,    81,    -1,    80,    -1,    59,    62,
528       60,    -1,    -1,    62,    41,    -1,    62,    67,    -1,    62,
529       55,    -1,     3,    79,    81,    -1,     4,    79,    31,    -1,
530       64,    76,    74,    -1,    80,    -1,    65,    68,    66,    -1,
531       -1,    68,    41,    -1,    68,    67,    -1,    68,    55,    -1,
532        6,    79,    31,    -1,     9,    79,    31,    -1,    70,    74,
533       -1,    12,    31,    -1,    72,    13,    -1,    -1,    74,    75,
534       -1,    74,    31,    -1,    74,    42,    -1,    16,    25,    83,
535       31,    -1,    -1,    76,    77,    -1,    76,    31,    -1,    23,
536       82,    -1,    -1,    79,    82,    -1,    26,    -1,    27,    -1,
537        5,    31,    -1,     8,    31,    -1,    15,    31,    -1,    31,
538       -1,    81,    31,    -1,    -1,    14,    83,    -1,    84,    -1,
539       84,    34,    84,    -1,    84,    28,    84,    -1,    30,    83,
540       29,    -1,    35,    83,    -1,    83,    32,    83,    -1,    83,
541       33,    83,    -1,    26,    -1,    27,    -1,    -1,    26,    -1
544 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
545 static const yytype_uint16 yyrline[] =
547        0,   103,   103,   103,   105,   105,   107,   109,   110,   111,
548      112,   113,   114,   118,   122,   122,   122,   122,   122,   122,
549      122,   122,   126,   127,   128,   129,   130,   131,   135,   136,
550      142,   150,   156,   164,   174,   176,   177,   178,   179,   180,
551      181,   184,   192,   198,   208,   214,   220,   226,   229,   231,
552      242,   243,   248,   257,   262,   270,   273,   275,   276,   277,
553      278,   279,   282,   288,   299,   305,   315,   317,   322,   330,
554      338,   341,   343,   344,   345,   350,   357,   364,   369,   377,
555      380,   382,   383,   384,   387,   395,   402,   409,   415,   422,
556      424,   425,   426,   429,   437,   439,   440,   443,   450,   452,
557      457,   458,   461,   462,   463,   467,   468,   471,   472,   475,
558      476,   477,   478,   479,   480,   481,   484,   485,   488,   489
560 #endif
562 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
563 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
564    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
565 static const char *const yytname[] =
567   "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
568   "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
569   "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
570   "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
571   "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
572   "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
573   "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
574   "common_stmt", "option_error", "config_entry_start", "config_stmt",
575   "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
576   "config_option", "symbol_option", "symbol_option_list",
577   "symbol_option_arg", "choice", "choice_entry", "choice_end",
578   "choice_stmt", "choice_option_list", "choice_option", "choice_block",
579   "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
580   "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
581   "comment", "comment_stmt", "help_start", "help", "depends_list",
582   "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
583   "end", "nl", "if_expr", "expr", "symbol", "word_opt", 0
585 #endif
587 # ifdef YYPRINT
588 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
589    token YYLEX-NUM.  */
590 static const yytype_uint16 yytoknum[] =
592        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
593      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
594      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
595      285,   286,   287,   288,   289,   290
597 # endif
599 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
600 static const yytype_uint8 yyr1[] =
602        0,    36,    37,    37,    38,    38,    39,    39,    39,    39,
603       39,    39,    39,    39,    40,    40,    40,    40,    40,    40,
604       40,    40,    41,    41,    41,    41,    41,    41,    42,    42,
605       43,    44,    45,    46,    47,    47,    47,    47,    47,    47,
606       47,    48,    48,    48,    48,    48,    48,    49,    50,    50,
607       51,    51,    52,    53,    54,    55,    56,    56,    56,    56,
608       56,    56,    57,    57,    57,    57,    58,    58,    59,    60,
609       61,    62,    62,    62,    62,    63,    64,    65,    66,    67,
610       68,    68,    68,    68,    69,    70,    71,    72,    73,    74,
611       74,    74,    74,    75,    76,    76,    76,    77,    78,    78,
612       79,    79,    80,    80,    80,    81,    81,    82,    82,    83,
613       83,    83,    83,    83,    83,    83,    84,    84,    85,    85
616 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
617 static const yytype_uint8 yyr2[] =
619        0,     2,     2,     1,     2,     1,     0,     2,     2,     2,
620        2,     4,     4,     3,     1,     1,     1,     1,     1,     1,
621        1,     1,     1,     1,     1,     1,     1,     1,     3,     2,
622        3,     2,     3,     2,     0,     2,     2,     2,     2,     2,
623        2,     3,     4,     4,     4,     5,     5,     3,     0,     3,
624        0,     2,     3,     2,     1,     3,     0,     2,     2,     2,
625        2,     2,     4,     3,     2,     4,     0,     2,     3,     1,
626        3,     0,     2,     2,     2,     3,     3,     3,     1,     3,
627        0,     2,     2,     2,     3,     3,     2,     2,     2,     0,
628        2,     2,     2,     4,     0,     2,     2,     2,     0,     2,
629        1,     1,     2,     2,     2,     1,     2,     0,     2,     1,
630        3,     3,     3,     2,     3,     3,     1,     1,     0,     1
633 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
634    Performed when YYTABLE doesn't specify something else to do.  Zero
635    means the default is an error.  */
636 static const yytype_uint8 yydefact[] =
638        6,     0,   105,     0,     3,     0,     6,     6,   100,   101,
639        0,     1,     0,     0,     0,     0,   118,     0,     0,     0,
640        0,     0,     0,    14,    18,    15,    16,    20,    17,    19,
641       21,     0,    22,     0,     7,    34,    25,    34,    26,    56,
642       66,     8,    71,    23,    94,    80,     9,    27,    89,    24,
643       10,     0,   106,     2,    75,    13,     0,   102,     0,   119,
644        0,   103,     0,     0,     0,   116,   117,     0,     0,     0,
645      109,   104,     0,     0,     0,     0,     0,     0,     0,    89,
646        0,     0,    76,    84,    52,    85,    30,    32,     0,   113,
647        0,     0,    68,     0,     0,    11,    12,     0,     0,     0,
648        0,    98,     0,     0,     0,    48,     0,    40,    39,    35,
649       36,     0,    38,    37,     0,     0,    98,     0,    60,    61,
650       57,    59,    58,    67,    55,    54,    72,    74,    70,    73,
651       69,   107,    96,     0,    95,    81,    83,    79,    82,    78,
652       91,    92,    90,   112,   114,   115,   111,   110,    29,    87,
653        0,   107,     0,   107,   107,   107,     0,     0,     0,    88,
654       64,   107,     0,   107,     0,    97,     0,     0,    41,    99,
655        0,     0,   107,   107,    50,    47,    28,     0,    63,     0,
656      108,    93,    42,    43,    44,     0,     0,     0,    49,    62,
657       65,    45,    46,    51
660 /* YYDEFGOTO[NTERM-NUM].  */
661 static const yytype_int16 yydefgoto[] =
663       -1,     3,     4,     5,    33,    34,   108,    35,    36,    37,
664       38,    74,   109,   110,   157,   188,    39,    40,   124,    41,
665       76,   120,    77,    42,   128,    43,    78,     6,    44,    45,
666      137,    46,    80,    47,    48,    49,   111,   112,    81,   113,
667       79,   134,   152,   153,    50,     7,   165,    69,    70,    60
670 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
671    STATE-NUM.  */
672 #define YYPACT_NINF -90
673 static const yytype_int16 yypact[] =
675        4,    77,   -90,    61,   -90,   129,   -90,    15,   -90,   -90,
676       37,   -90,    47,    77,    51,    77,    59,    63,    77,    66,
677       71,    60,    69,   -90,   -90,   -90,   -90,   -90,   -90,   -90,
678      -90,   125,   -90,   127,   -90,   -90,   -90,   -90,   -90,   -90,
679      -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,
680      -90,   157,   -90,   -90,   100,   -90,   128,   -90,   154,   -90,
681      156,   -90,   160,   161,   170,   -90,   -90,    60,    60,   203,
682       49,   -90,   171,   182,    33,   101,   213,   252,   241,    -2,
683      241,   189,   -90,   -90,   -90,   -90,   -90,   -90,   -13,   -90,
684       60,    60,   100,   115,   115,   -90,   -90,   185,   186,   201,
685       77,    77,    60,   211,   115,   -90,   237,   -90,   -90,   -90,
686      -90,   230,   -90,   -90,   222,    77,    77,   228,   -90,   -90,
687      -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,
688      -90,   245,   -90,    65,   -90,   -90,   -90,   -90,   -90,   -90,
689      -90,   -90,   -90,   -90,   231,   -90,   -90,   -90,   -90,   -90,
690       60,   245,   234,   245,    -5,    -4,   115,    62,   238,   -90,
691      -90,   245,   239,   245,    60,   -90,   209,   240,   -90,   -90,
692      242,   244,    -5,   245,   246,   -90,   -90,   248,   -90,   250,
693      137,   -90,   -90,   -90,   -90,   251,   254,    77,   -90,   -90,
694      -90,   -90,   -90,   -90
697 /* YYPGOTO[NTERM-NUM].  */
698 static const yytype_int16 yypgoto[] =
700      -90,   -90,   261,   281,   -90,    76,   -70,   -90,   -90,   -90,
701      -90,   253,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -48,
702      -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,
703      -90,   -20,   -90,   -90,   -90,   -90,   -90,   212,   210,   -68,
704      -90,   -90,   175,    -1,   104,    -7,   123,   -66,   -89,   -90
707 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
708    positive, shift that token.  If negative, reduce the rule which
709    number is the opposite.  If YYTABLE_NINF, syntax error.  */
710 #define YYTABLE_NINF -87
711 static const yytype_int16 yytable[] =
713       10,    88,    89,    54,   146,   147,   119,     1,   122,   164,
714      164,   141,    56,   142,    58,   156,   143,    62,     1,    90,
715       91,   131,    65,    66,   144,   145,    67,    90,    91,   132,
716      127,    68,   136,   -31,    97,     2,   154,   -31,   -31,   -31,
717      -31,   -31,   -31,   -31,   -31,    98,    52,   -31,   -31,    99,
718      -31,   100,   101,   102,   103,   104,   -31,   105,   129,   106,
719      138,    11,    92,   141,   107,   142,    97,   173,     2,   -77,
720      -77,   -77,   -77,   -77,   -77,   -77,   -77,    93,    55,   -77,
721      -77,    99,    57,    94,   166,    59,    65,    66,   174,   172,
722       67,   106,    63,   175,    61,    68,   140,    64,   180,   151,
723       71,   -33,    97,     8,     9,   -33,   -33,   -33,   -33,   -33,
724      -33,   -33,   -33,    98,   161,   -33,   -33,    99,   -33,   100,
725      101,   102,   103,   104,   -33,   105,    72,   106,    73,    -5,
726       12,    52,   107,    13,    14,    15,    16,    17,    18,    19,
727       20,    65,    66,    21,    22,    23,    24,    25,    26,    27,
728       28,    29,    30,   123,   126,    31,   135,    -4,    12,    82,
729       32,    13,    14,    15,    16,    17,    18,    19,    20,    90,
730       91,    21,    22,    23,    24,    25,    26,    27,    28,    29,
731       30,   125,   130,    31,   139,    83,   193,    84,    32,   -86,
732       97,    85,    86,   -86,   -86,   -86,   -86,   -86,   -86,   -86,
733      -86,    87,    95,   -86,   -86,    99,   -86,   -86,   -86,   -86,
734      -86,   -86,   -86,    96,    97,   106,   148,   149,   -53,   -53,
735      140,   -53,   -53,   -53,   -53,    98,   150,   -53,   -53,    99,
736      114,   115,   116,   117,     2,    90,    91,   155,   158,   106,
737      181,    90,    91,   159,   118,    13,    14,    15,    16,    17,
738       18,    19,    20,   160,   163,    21,    22,    14,    15,   164,
739       17,    18,    19,    20,    91,   168,    21,    22,    53,   176,
740      178,   182,    32,   183,   167,   184,   169,   170,   171,   189,
741      187,   190,   191,    32,   177,   192,   179,    51,   121,   133,
742       75,   162,     0,     0,     0,   185,   186
745 #define yypact_value_is_default(yystate) \
746   ((yystate) == (-90))
748 #define yytable_value_is_error(yytable_value) \
749   YYID (0)
751 static const yytype_int16 yycheck[] =
753        1,    67,    68,    10,    93,    94,    76,     3,    76,    14,
754       14,    81,    13,    81,    15,   104,    29,    18,     3,    32,
755       33,    23,    26,    27,    90,    91,    30,    32,    33,    31,
756       78,    35,    80,     0,     1,    31,   102,     4,     5,     6,
757        7,     8,     9,    10,    11,    12,    31,    14,    15,    16,
758       17,    18,    19,    20,    21,    22,    23,    24,    78,    26,
759       80,     0,    69,   133,    31,   133,     1,   156,    31,     4,
760        5,     6,     7,     8,     9,    10,    11,    28,    31,    14,
761       15,    16,    31,    34,   150,    26,    26,    27,    26,   155,
762       30,    26,    26,    31,    31,    35,    31,    26,   164,   100,
763       31,     0,     1,    26,    27,     4,     5,     6,     7,     8,
764        9,    10,    11,    12,   115,    14,    15,    16,    17,    18,
765       19,    20,    21,    22,    23,    24,     1,    26,     1,     0,
766        1,    31,    31,     4,     5,     6,     7,     8,     9,    10,
767       11,    26,    27,    14,    15,    16,    17,    18,    19,    20,
768       21,    22,    23,    77,    78,    26,    80,     0,     1,    31,
769       31,     4,     5,     6,     7,     8,     9,    10,    11,    32,
770       33,    14,    15,    16,    17,    18,    19,    20,    21,    22,
771       23,    77,    78,    26,    80,    31,   187,    31,    31,     0,
772        1,    31,    31,     4,     5,     6,     7,     8,     9,    10,
773       11,    31,    31,    14,    15,    16,    17,    18,    19,    20,
774       21,    22,    23,    31,     1,    26,    31,    31,     5,     6,
775       31,     8,     9,    10,    11,    12,    25,    14,    15,    16,
776       17,    18,    19,    20,    31,    32,    33,    26,     1,    26,
777       31,    32,    33,    13,    31,     4,     5,     6,     7,     8,
778        9,    10,    11,    31,    26,    14,    15,     5,     6,    14,
779        8,     9,    10,    11,    33,    31,    14,    15,     7,    31,
780       31,    31,    31,    31,   151,    31,   153,   154,   155,    31,
781       34,    31,    31,    31,   161,    31,   163,     6,    76,    79,
782       37,   116,    -1,    -1,    -1,   172,   173
785 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
786    symbol of state STATE-NUM.  */
787 static const yytype_uint8 yystos[] =
789        0,     3,    31,    37,    38,    39,    63,    81,    26,    27,
790       79,     0,     1,     4,     5,     6,     7,     8,     9,    10,
791       11,    14,    15,    16,    17,    18,    19,    20,    21,    22,
792       23,    26,    31,    40,    41,    43,    44,    45,    46,    52,
793       53,    55,    59,    61,    64,    65,    67,    69,    70,    71,
794       80,    39,    31,    38,    81,    31,    79,    31,    79,    26,
795       85,    31,    79,    26,    26,    26,    27,    30,    35,    83,
796       84,    31,     1,     1,    47,    47,    56,    58,    62,    76,
797       68,    74,    31,    31,    31,    31,    31,    31,    83,    83,
798       32,    33,    81,    28,    34,    31,    31,     1,    12,    16,
799       18,    19,    20,    21,    22,    24,    26,    31,    42,    48,
800       49,    72,    73,    75,    17,    18,    19,    20,    31,    42,
801       57,    73,    75,    41,    54,    80,    41,    55,    60,    67,
802       80,    23,    31,    74,    77,    41,    55,    66,    67,    80,
803       31,    42,    75,    29,    83,    83,    84,    84,    31,    31,
804       25,    79,    78,    79,    83,    26,    84,    50,     1,    13,
805       31,    79,    78,    26,    14,    82,    83,    82,    31,    82,
806       82,    82,    83,    84,    26,    31,    31,    82,    31,    82,
807       83,    31,    31,    31,    31,    82,    82,    34,    51,    31,
808       31,    31,    31,    79
811 #define yyerrok         (yyerrstatus = 0)
812 #define yyclearin       (yychar = YYEMPTY)
813 #define YYEMPTY         (-2)
814 #define YYEOF           0
816 #define YYACCEPT        goto yyacceptlab
817 #define YYABORT         goto yyabortlab
818 #define YYERROR         goto yyerrorlab
821 /* Like YYERROR except do call yyerror.  This remains here temporarily
822    to ease the transition to the new meaning of YYERROR, for GCC.
823    Once GCC version 2 has supplanted version 1, this can go.  However,
824    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
825    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
826    discussed.  */
828 #define YYFAIL          goto yyerrlab
829 #if defined YYFAIL
830   /* This is here to suppress warnings from the GCC cpp's
831      -Wunused-macros.  Normally we don't worry about that warning, but
832      some users do, and we want to make it easy for users to remove
833      YYFAIL uses, which will produce warnings from Bison 2.5.  */
834 #endif
836 #define YYRECOVERING()  (!!yyerrstatus)
838 #define YYBACKUP(Token, Value)                                  \
839 do                                                              \
840   if (yychar == YYEMPTY && yylen == 1)                          \
841     {                                                           \
842       yychar = (Token);                                         \
843       yylval = (Value);                                         \
844       YYPOPSTACK (1);                                           \
845       goto yybackup;                                            \
846     }                                                           \
847   else                                                          \
848     {                                                           \
849       yyerror (YY_("syntax error: cannot back up")); \
850       YYERROR;                                                  \
851     }                                                           \
852 while (YYID (0))
855 #define YYTERROR        1
856 #define YYERRCODE       256
859 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
860    If N is 0, then set CURRENT to the empty location which ends
861    the previous symbol: RHS[0] (always defined).  */
863 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
864 #ifndef YYLLOC_DEFAULT
865 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
866     do                                                                  \
867       if (YYID (N))                                                    \
868         {                                                               \
869           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
870           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
871           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
872           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
873         }                                                               \
874       else                                                              \
875         {                                                               \
876           (Current).first_line   = (Current).last_line   =              \
877             YYRHSLOC (Rhs, 0).last_line;                                \
878           (Current).first_column = (Current).last_column =              \
879             YYRHSLOC (Rhs, 0).last_column;                              \
880         }                                                               \
881     while (YYID (0))
882 #endif
885 /* This macro is provided for backward compatibility. */
887 #ifndef YY_LOCATION_PRINT
888 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
889 #endif
892 /* YYLEX -- calling `yylex' with the right arguments.  */
894 #ifdef YYLEX_PARAM
895 # define YYLEX yylex (YYLEX_PARAM)
896 #else
897 # define YYLEX yylex ()
898 #endif
900 /* Enable debugging if requested.  */
901 #if YYDEBUG
903 # ifndef YYFPRINTF
904 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
905 #  define YYFPRINTF fprintf
906 # endif
908 # define YYDPRINTF(Args)                        \
909 do {                                            \
910   if (yydebug)                                  \
911     YYFPRINTF Args;                             \
912 } while (YYID (0))
914 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
915 do {                                                                      \
916   if (yydebug)                                                            \
917     {                                                                     \
918       YYFPRINTF (stderr, "%s ", Title);                                   \
919       yy_symbol_print (stderr,                                            \
920                   Type, Value); \
921       YYFPRINTF (stderr, "\n");                                           \
922     }                                                                     \
923 } while (YYID (0))
926 /*--------------------------------.
927 | Print this symbol on YYOUTPUT.  |
928 `--------------------------------*/
930 /*ARGSUSED*/
931 #if (defined __STDC__ || defined __C99__FUNC__ \
932      || defined __cplusplus || defined _MSC_VER)
933 static void
934 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
935 #else
936 static void
937 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
938     FILE *yyoutput;
939     int yytype;
940     YYSTYPE const * const yyvaluep;
941 #endif
943   if (!yyvaluep)
944     return;
945 # ifdef YYPRINT
946   if (yytype < YYNTOKENS)
947     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
948 # else
949   YYUSE (yyoutput);
950 # endif
951   switch (yytype)
952     {
953       default:
954         break;
955     }
959 /*--------------------------------.
960 | Print this symbol on YYOUTPUT.  |
961 `--------------------------------*/
963 #if (defined __STDC__ || defined __C99__FUNC__ \
964      || defined __cplusplus || defined _MSC_VER)
965 static void
966 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
967 #else
968 static void
969 yy_symbol_print (yyoutput, yytype, yyvaluep)
970     FILE *yyoutput;
971     int yytype;
972     YYSTYPE const * const yyvaluep;
973 #endif
975   if (yytype < YYNTOKENS)
976     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
977   else
978     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
980   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
981   YYFPRINTF (yyoutput, ")");
984 /*------------------------------------------------------------------.
985 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
986 | TOP (included).                                                   |
987 `------------------------------------------------------------------*/
989 #if (defined __STDC__ || defined __C99__FUNC__ \
990      || defined __cplusplus || defined _MSC_VER)
991 static void
992 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
993 #else
994 static void
995 yy_stack_print (yybottom, yytop)
996     yytype_int16 *yybottom;
997     yytype_int16 *yytop;
998 #endif
1000   YYFPRINTF (stderr, "Stack now");
1001   for (; yybottom <= yytop; yybottom++)
1002     {
1003       int yybot = *yybottom;
1004       YYFPRINTF (stderr, " %d", yybot);
1005     }
1006   YYFPRINTF (stderr, "\n");
1009 # define YY_STACK_PRINT(Bottom, Top)                            \
1010 do {                                                            \
1011   if (yydebug)                                                  \
1012     yy_stack_print ((Bottom), (Top));                           \
1013 } while (YYID (0))
1016 /*------------------------------------------------.
1017 | Report that the YYRULE is going to be reduced.  |
1018 `------------------------------------------------*/
1020 #if (defined __STDC__ || defined __C99__FUNC__ \
1021      || defined __cplusplus || defined _MSC_VER)
1022 static void
1023 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1024 #else
1025 static void
1026 yy_reduce_print (yyvsp, yyrule)
1027     YYSTYPE *yyvsp;
1028     int yyrule;
1029 #endif
1031   int yynrhs = yyr2[yyrule];
1032   int yyi;
1033   unsigned long int yylno = yyrline[yyrule];
1034   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1035              yyrule - 1, yylno);
1036   /* The symbols being reduced.  */
1037   for (yyi = 0; yyi < yynrhs; yyi++)
1038     {
1039       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1040       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1041                        &(yyvsp[(yyi + 1) - (yynrhs)])
1042                                        );
1043       YYFPRINTF (stderr, "\n");
1044     }
1047 # define YY_REDUCE_PRINT(Rule)          \
1048 do {                                    \
1049   if (yydebug)                          \
1050     yy_reduce_print (yyvsp, Rule); \
1051 } while (YYID (0))
1053 /* Nonzero means print parse trace.  It is left uninitialized so that
1054    multiple parsers can coexist.  */
1055 int yydebug;
1056 #else /* !YYDEBUG */
1057 # define YYDPRINTF(Args)
1058 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1059 # define YY_STACK_PRINT(Bottom, Top)
1060 # define YY_REDUCE_PRINT(Rule)
1061 #endif /* !YYDEBUG */
1064 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1065 #ifndef YYINITDEPTH
1066 # define YYINITDEPTH 200
1067 #endif
1069 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1070    if the built-in stack extension method is used).
1072    Do not make this value too large; the results are undefined if
1073    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1074    evaluated with infinite-precision integer arithmetic.  */
1076 #ifndef YYMAXDEPTH
1077 # define YYMAXDEPTH 10000
1078 #endif
1081 #if YYERROR_VERBOSE
1083 # ifndef yystrlen
1084 #  if defined __GLIBC__ && defined _STRING_H
1085 #   define yystrlen strlen
1086 #  else
1087 /* Return the length of YYSTR.  */
1088 #if (defined __STDC__ || defined __C99__FUNC__ \
1089      || defined __cplusplus || defined _MSC_VER)
1090 static YYSIZE_T
1091 yystrlen (const char *yystr)
1092 #else
1093 static YYSIZE_T
1094 yystrlen (yystr)
1095     const char *yystr;
1096 #endif
1098   YYSIZE_T yylen;
1099   for (yylen = 0; yystr[yylen]; yylen++)
1100     continue;
1101   return yylen;
1103 #  endif
1104 # endif
1106 # ifndef yystpcpy
1107 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1108 #   define yystpcpy stpcpy
1109 #  else
1110 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1111    YYDEST.  */
1112 #if (defined __STDC__ || defined __C99__FUNC__ \
1113      || defined __cplusplus || defined _MSC_VER)
1114 static char *
1115 yystpcpy (char *yydest, const char *yysrc)
1116 #else
1117 static char *
1118 yystpcpy (yydest, yysrc)
1119     char *yydest;
1120     const char *yysrc;
1121 #endif
1123   char *yyd = yydest;
1124   const char *yys = yysrc;
1126   while ((*yyd++ = *yys++) != '\0')
1127     continue;
1129   return yyd - 1;
1131 #  endif
1132 # endif
1134 # ifndef yytnamerr
1135 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1136    quotes and backslashes, so that it's suitable for yyerror.  The
1137    heuristic is that double-quoting is unnecessary unless the string
1138    contains an apostrophe, a comma, or backslash (other than
1139    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1140    null, do not copy; instead, return the length of what the result
1141    would have been.  */
1142 static YYSIZE_T
1143 yytnamerr (char *yyres, const char *yystr)
1145   if (*yystr == '"')
1146     {
1147       YYSIZE_T yyn = 0;
1148       char const *yyp = yystr;
1150       for (;;)
1151         switch (*++yyp)
1152           {
1153           case '\'':
1154           case ',':
1155             goto do_not_strip_quotes;
1157           case '\\':
1158             if (*++yyp != '\\')
1159               goto do_not_strip_quotes;
1160             /* Fall through.  */
1161           default:
1162             if (yyres)
1163               yyres[yyn] = *yyp;
1164             yyn++;
1165             break;
1167           case '"':
1168             if (yyres)
1169               yyres[yyn] = '\0';
1170             return yyn;
1171           }
1172     do_not_strip_quotes: ;
1173     }
1175   if (! yyres)
1176     return yystrlen (yystr);
1178   return yystpcpy (yyres, yystr) - yyres;
1180 # endif
1182 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1183    about the unexpected token YYTOKEN for the state stack whose top is
1184    YYSSP.
1186    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1187    not large enough to hold the message.  In that case, also set
1188    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1189    required number of bytes is too large to store.  */
1190 static int
1191 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1192                 yytype_int16 *yyssp, int yytoken)
1194   YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1195   YYSIZE_T yysize = yysize0;
1196   YYSIZE_T yysize1;
1197   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1198   /* Internationalized format string. */
1199   const char *yyformat = 0;
1200   /* Arguments of yyformat. */
1201   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1202   /* Number of reported tokens (one for the "unexpected", one per
1203      "expected"). */
1204   int yycount = 0;
1206   /* There are many possibilities here to consider:
1207      - Assume YYFAIL is not used.  It's too flawed to consider.  See
1208        <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1209        for details.  YYERROR is fine as it does not invoke this
1210        function.
1211      - If this state is a consistent state with a default action, then
1212        the only way this function was invoked is if the default action
1213        is an error action.  In that case, don't check for expected
1214        tokens because there are none.
1215      - The only way there can be no lookahead present (in yychar) is if
1216        this state is a consistent state with a default action.  Thus,
1217        detecting the absence of a lookahead is sufficient to determine
1218        that there is no unexpected or expected token to report.  In that
1219        case, just report a simple "syntax error".
1220      - Don't assume there isn't a lookahead just because this state is a
1221        consistent state with a default action.  There might have been a
1222        previous inconsistent state, consistent state with a non-default
1223        action, or user semantic action that manipulated yychar.
1224      - Of course, the expected token list depends on states to have
1225        correct lookahead information, and it depends on the parser not
1226        to perform extra reductions after fetching a lookahead from the
1227        scanner and before detecting a syntax error.  Thus, state merging
1228        (from LALR or IELR) and default reductions corrupt the expected
1229        token list.  However, the list is correct for canonical LR with
1230        one exception: it will still contain any token that will not be
1231        accepted due to an error action in a later state.
1232   */
1233   if (yytoken != YYEMPTY)
1234     {
1235       int yyn = yypact[*yyssp];
1236       yyarg[yycount++] = yytname[yytoken];
1237       if (!yypact_value_is_default (yyn))
1238         {
1239           /* Start YYX at -YYN if negative to avoid negative indexes in
1240              YYCHECK.  In other words, skip the first -YYN actions for
1241              this state because they are default actions.  */
1242           int yyxbegin = yyn < 0 ? -yyn : 0;
1243           /* Stay within bounds of both yycheck and yytname.  */
1244           int yychecklim = YYLAST - yyn + 1;
1245           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1246           int yyx;
1248           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1249             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1250                 && !yytable_value_is_error (yytable[yyx + yyn]))
1251               {
1252                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1253                   {
1254                     yycount = 1;
1255                     yysize = yysize0;
1256                     break;
1257                   }
1258                 yyarg[yycount++] = yytname[yyx];
1259                 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1260                 if (! (yysize <= yysize1
1261                        && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1262                   return 2;
1263                 yysize = yysize1;
1264               }
1265         }
1266     }
1268   switch (yycount)
1269     {
1270 # define YYCASE_(N, S)                      \
1271       case N:                               \
1272         yyformat = S;                       \
1273       break
1274       YYCASE_(0, YY_("syntax error"));
1275       YYCASE_(1, YY_("syntax error, unexpected %s"));
1276       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1277       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1278       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1279       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1280 # undef YYCASE_
1281     }
1283   yysize1 = yysize + yystrlen (yyformat);
1284   if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1285     return 2;
1286   yysize = yysize1;
1288   if (*yymsg_alloc < yysize)
1289     {
1290       *yymsg_alloc = 2 * yysize;
1291       if (! (yysize <= *yymsg_alloc
1292              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1293         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1294       return 1;
1295     }
1297   /* Avoid sprintf, as that infringes on the user's name space.
1298      Don't have undefined behavior even if the translation
1299      produced a string with the wrong number of "%s"s.  */
1300   {
1301     char *yyp = *yymsg;
1302     int yyi = 0;
1303     while ((*yyp = *yyformat) != '\0')
1304       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1305         {
1306           yyp += yytnamerr (yyp, yyarg[yyi++]);
1307           yyformat += 2;
1308         }
1309       else
1310         {
1311           yyp++;
1312           yyformat++;
1313         }
1314   }
1315   return 0;
1317 #endif /* YYERROR_VERBOSE */
1319 /*-----------------------------------------------.
1320 | Release the memory associated to this symbol.  |
1321 `-----------------------------------------------*/
1323 /*ARGSUSED*/
1324 #if (defined __STDC__ || defined __C99__FUNC__ \
1325      || defined __cplusplus || defined _MSC_VER)
1326 static void
1327 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1328 #else
1329 static void
1330 yydestruct (yymsg, yytype, yyvaluep)
1331     const char *yymsg;
1332     int yytype;
1333     YYSTYPE *yyvaluep;
1334 #endif
1336   YYUSE (yyvaluep);
1338   if (!yymsg)
1339     yymsg = "Deleting";
1340   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1342   switch (yytype)
1343     {
1344       case 53: /* "choice_entry" */
1346 /* Line 1391 of yacc.c  */
1347 #line 90 "zconf.y"
1348         {
1349         fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1350                 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1351         if (current_menu == (yyvaluep->menu))
1352                 menu_end_menu();
1355 /* Line 1391 of yacc.c  */
1356 #line 1357 "zconf.tab.c"
1357         break;
1358       case 59: /* "if_entry" */
1360 /* Line 1391 of yacc.c  */
1361 #line 90 "zconf.y"
1362         {
1363         fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1364                 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1365         if (current_menu == (yyvaluep->menu))
1366                 menu_end_menu();
1369 /* Line 1391 of yacc.c  */
1370 #line 1371 "zconf.tab.c"
1371         break;
1372       case 65: /* "menu_entry" */
1374 /* Line 1391 of yacc.c  */
1375 #line 90 "zconf.y"
1376         {
1377         fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1378                 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1379         if (current_menu == (yyvaluep->menu))
1380                 menu_end_menu();
1383 /* Line 1391 of yacc.c  */
1384 #line 1385 "zconf.tab.c"
1385         break;
1387       default:
1388         break;
1389     }
1393 /* Prevent warnings from -Wmissing-prototypes.  */
1394 #ifdef YYPARSE_PARAM
1395 #if defined __STDC__ || defined __cplusplus
1396 int yyparse (void *YYPARSE_PARAM);
1397 #else
1398 int yyparse ();
1399 #endif
1400 #else /* ! YYPARSE_PARAM */
1401 #if defined __STDC__ || defined __cplusplus
1402 int yyparse (void);
1403 #else
1404 int yyparse ();
1405 #endif
1406 #endif /* ! YYPARSE_PARAM */
1409 /* The lookahead symbol.  */
1410 int yychar;
1412 /* The semantic value of the lookahead symbol.  */
1413 YYSTYPE yylval;
1415 /* Number of syntax errors so far.  */
1416 int yynerrs;
1419 /*----------.
1420 | yyparse.  |
1421 `----------*/
1423 #ifdef YYPARSE_PARAM
1424 #if (defined __STDC__ || defined __C99__FUNC__ \
1425      || defined __cplusplus || defined _MSC_VER)
1427 yyparse (void *YYPARSE_PARAM)
1428 #else
1430 yyparse (YYPARSE_PARAM)
1431     void *YYPARSE_PARAM;
1432 #endif
1433 #else /* ! YYPARSE_PARAM */
1434 #if (defined __STDC__ || defined __C99__FUNC__ \
1435      || defined __cplusplus || defined _MSC_VER)
1437 yyparse (void)
1438 #else
1440 yyparse ()
1442 #endif
1443 #endif
1445     int yystate;
1446     /* Number of tokens to shift before error messages enabled.  */
1447     int yyerrstatus;
1449     /* The stacks and their tools:
1450        `yyss': related to states.
1451        `yyvs': related to semantic values.
1453        Refer to the stacks thru separate pointers, to allow yyoverflow
1454        to reallocate them elsewhere.  */
1456     /* The state stack.  */
1457     yytype_int16 yyssa[YYINITDEPTH];
1458     yytype_int16 *yyss;
1459     yytype_int16 *yyssp;
1461     /* The semantic value stack.  */
1462     YYSTYPE yyvsa[YYINITDEPTH];
1463     YYSTYPE *yyvs;
1464     YYSTYPE *yyvsp;
1466     YYSIZE_T yystacksize;
1468   int yyn;
1469   int yyresult;
1470   /* Lookahead token as an internal (translated) token number.  */
1471   int yytoken;
1472   /* The variables used to return semantic value and location from the
1473      action routines.  */
1474   YYSTYPE yyval;
1476 #if YYERROR_VERBOSE
1477   /* Buffer for error messages, and its allocated size.  */
1478   char yymsgbuf[128];
1479   char *yymsg = yymsgbuf;
1480   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1481 #endif
1483 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1485   /* The number of symbols on the RHS of the reduced rule.
1486      Keep to zero when no symbol should be popped.  */
1487   int yylen = 0;
1489   yytoken = 0;
1490   yyss = yyssa;
1491   yyvs = yyvsa;
1492   yystacksize = YYINITDEPTH;
1494   YYDPRINTF ((stderr, "Starting parse\n"));
1496   yystate = 0;
1497   yyerrstatus = 0;
1498   yynerrs = 0;
1499   yychar = YYEMPTY; /* Cause a token to be read.  */
1501   /* Initialize stack pointers.
1502      Waste one element of value and location stack
1503      so that they stay on the same level as the state stack.
1504      The wasted elements are never initialized.  */
1505   yyssp = yyss;
1506   yyvsp = yyvs;
1508   goto yysetstate;
1510 /*------------------------------------------------------------.
1511 | yynewstate -- Push a new state, which is found in yystate.  |
1512 `------------------------------------------------------------*/
1513  yynewstate:
1514   /* In all cases, when you get here, the value and location stacks
1515      have just been pushed.  So pushing a state here evens the stacks.  */
1516   yyssp++;
1518  yysetstate:
1519   *yyssp = yystate;
1521   if (yyss + yystacksize - 1 <= yyssp)
1522     {
1523       /* Get the current used size of the three stacks, in elements.  */
1524       YYSIZE_T yysize = yyssp - yyss + 1;
1526 #ifdef yyoverflow
1527       {
1528         /* Give user a chance to reallocate the stack.  Use copies of
1529            these so that the &'s don't force the real ones into
1530            memory.  */
1531         YYSTYPE *yyvs1 = yyvs;
1532         yytype_int16 *yyss1 = yyss;
1534         /* Each stack pointer address is followed by the size of the
1535            data in use in that stack, in bytes.  This used to be a
1536            conditional around just the two extra args, but that might
1537            be undefined if yyoverflow is a macro.  */
1538         yyoverflow (YY_("memory exhausted"),
1539                     &yyss1, yysize * sizeof (*yyssp),
1540                     &yyvs1, yysize * sizeof (*yyvsp),
1541                     &yystacksize);
1543         yyss = yyss1;
1544         yyvs = yyvs1;
1545       }
1546 #else /* no yyoverflow */
1547 # ifndef YYSTACK_RELOCATE
1548       goto yyexhaustedlab;
1549 # else
1550       /* Extend the stack our own way.  */
1551       if (YYMAXDEPTH <= yystacksize)
1552         goto yyexhaustedlab;
1553       yystacksize *= 2;
1554       if (YYMAXDEPTH < yystacksize)
1555         yystacksize = YYMAXDEPTH;
1557       {
1558         yytype_int16 *yyss1 = yyss;
1559         union yyalloc *yyptr =
1560           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1561         if (! yyptr)
1562           goto yyexhaustedlab;
1563         YYSTACK_RELOCATE (yyss_alloc, yyss);
1564         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1565 #  undef YYSTACK_RELOCATE
1566         if (yyss1 != yyssa)
1567           YYSTACK_FREE (yyss1);
1568       }
1569 # endif
1570 #endif /* no yyoverflow */
1572       yyssp = yyss + yysize - 1;
1573       yyvsp = yyvs + yysize - 1;
1575       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1576                   (unsigned long int) yystacksize));
1578       if (yyss + yystacksize - 1 <= yyssp)
1579         YYABORT;
1580     }
1582   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1584   if (yystate == YYFINAL)
1585     YYACCEPT;
1587   goto yybackup;
1589 /*-----------.
1590 | yybackup.  |
1591 `-----------*/
1592 yybackup:
1594   /* Do appropriate processing given the current state.  Read a
1595      lookahead token if we need one and don't already have one.  */
1597   /* First try to decide what to do without reference to lookahead token.  */
1598   yyn = yypact[yystate];
1599   if (yypact_value_is_default (yyn))
1600     goto yydefault;
1602   /* Not known => get a lookahead token if don't already have one.  */
1604   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1605   if (yychar == YYEMPTY)
1606     {
1607       YYDPRINTF ((stderr, "Reading a token: "));
1608       yychar = YYLEX;
1609     }
1611   if (yychar <= YYEOF)
1612     {
1613       yychar = yytoken = YYEOF;
1614       YYDPRINTF ((stderr, "Now at end of input.\n"));
1615     }
1616   else
1617     {
1618       yytoken = YYTRANSLATE (yychar);
1619       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1620     }
1622   /* If the proper action on seeing token YYTOKEN is to reduce or to
1623      detect an error, take that action.  */
1624   yyn += yytoken;
1625   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1626     goto yydefault;
1627   yyn = yytable[yyn];
1628   if (yyn <= 0)
1629     {
1630       if (yytable_value_is_error (yyn))
1631         goto yyerrlab;
1632       yyn = -yyn;
1633       goto yyreduce;
1634     }
1636   /* Count tokens shifted since error; after three, turn off error
1637      status.  */
1638   if (yyerrstatus)
1639     yyerrstatus--;
1641   /* Shift the lookahead token.  */
1642   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1644   /* Discard the shifted token.  */
1645   yychar = YYEMPTY;
1647   yystate = yyn;
1648   *++yyvsp = yylval;
1650   goto yynewstate;
1653 /*-----------------------------------------------------------.
1654 | yydefault -- do the default action for the current state.  |
1655 `-----------------------------------------------------------*/
1656 yydefault:
1657   yyn = yydefact[yystate];
1658   if (yyn == 0)
1659     goto yyerrlab;
1660   goto yyreduce;
1663 /*-----------------------------.
1664 | yyreduce -- Do a reduction.  |
1665 `-----------------------------*/
1666 yyreduce:
1667   /* yyn is the number of a rule to reduce with.  */
1668   yylen = yyr2[yyn];
1670   /* If YYLEN is nonzero, implement the default value of the action:
1671      `$$ = $1'.
1673      Otherwise, the following line sets YYVAL to garbage.
1674      This behavior is undocumented and Bison
1675      users should not rely upon it.  Assigning to YYVAL
1676      unconditionally makes the parser a bit smaller, and it avoids a
1677      GCC warning that YYVAL may be used uninitialized.  */
1678   yyval = yyvsp[1-yylen];
1681   YY_REDUCE_PRINT (yyn);
1682   switch (yyn)
1683     {
1684         case 10:
1686 /* Line 1806 of yacc.c  */
1687 #line 112 "zconf.y"
1688     { zconf_error("unexpected end statement"); }
1689     break;
1691   case 11:
1693 /* Line 1806 of yacc.c  */
1694 #line 113 "zconf.y"
1695     { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); }
1696     break;
1698   case 12:
1700 /* Line 1806 of yacc.c  */
1701 #line 115 "zconf.y"
1702     {
1703         zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
1705     break;
1707   case 13:
1709 /* Line 1806 of yacc.c  */
1710 #line 118 "zconf.y"
1711     { zconf_error("invalid statement"); }
1712     break;
1714   case 28:
1716 /* Line 1806 of yacc.c  */
1717 #line 135 "zconf.y"
1718     { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); }
1719     break;
1721   case 29:
1723 /* Line 1806 of yacc.c  */
1724 #line 136 "zconf.y"
1725     { zconf_error("invalid option"); }
1726     break;
1728   case 30:
1730 /* Line 1806 of yacc.c  */
1731 #line 143 "zconf.y"
1732     {
1733         struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
1734         sym->flags |= SYMBOL_OPTIONAL;
1735         menu_add_entry(sym);
1736         printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1738     break;
1740   case 31:
1742 /* Line 1806 of yacc.c  */
1743 #line 151 "zconf.y"
1744     {
1745         menu_end_entry();
1746         printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1748     break;
1750   case 32:
1752 /* Line 1806 of yacc.c  */
1753 #line 157 "zconf.y"
1754     {
1755         struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
1756         sym->flags |= SYMBOL_OPTIONAL;
1757         menu_add_entry(sym);
1758         printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1760     break;
1762   case 33:
1764 /* Line 1806 of yacc.c  */
1765 #line 165 "zconf.y"
1766     {
1767         if (current_entry->prompt)
1768                 current_entry->prompt->type = P_MENU;
1769         else
1770                 zconfprint("warning: menuconfig statement without prompt");
1771         menu_end_entry();
1772         printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1774     break;
1776   case 41:
1778 /* Line 1806 of yacc.c  */
1779 #line 185 "zconf.y"
1780     {
1781         menu_set_type((yyvsp[(1) - (3)].id)->stype);
1782         printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1783                 zconf_curname(), zconf_lineno(),
1784                 (yyvsp[(1) - (3)].id)->stype);
1786     break;
1788   case 42:
1790 /* Line 1806 of yacc.c  */
1791 #line 193 "zconf.y"
1792     {
1793         menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1794         printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1796     break;
1798   case 43:
1800 /* Line 1806 of yacc.c  */
1801 #line 199 "zconf.y"
1802     {
1803         menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
1804         if ((yyvsp[(1) - (4)].id)->stype != S_UNKNOWN)
1805                 menu_set_type((yyvsp[(1) - (4)].id)->stype);
1806         printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1807                 zconf_curname(), zconf_lineno(),
1808                 (yyvsp[(1) - (4)].id)->stype);
1810     break;
1812   case 44:
1814 /* Line 1806 of yacc.c  */
1815 #line 209 "zconf.y"
1816     {
1817         menu_add_select(sym_lookup((yyvsp[(2) - (4)].string), 0), NULL, (yyvsp[(3) - (4)].expr));
1818         printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1820     break;
1822   case 45:
1824 /* Line 1806 of yacc.c  */
1825 #line 215 "zconf.y"
1826     {
1827         menu_add_select(sym_lookup((yyvsp[(2) - (5)].string), 0), (yyvsp[(3) - (5)].expr), (yyvsp[(4) - (5)].expr));
1828         printd(DEBUG_PARSE, "%s:%d:select with value\n", zconf_curname(), zconf_lineno());
1830     break;
1832   case 46:
1834 /* Line 1806 of yacc.c  */
1835 #line 221 "zconf.y"
1836     {
1837         menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
1838         printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1840     break;
1842   case 49:
1844 /* Line 1806 of yacc.c  */
1845 #line 232 "zconf.y"
1846     {
1847         const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
1848         if (id && id->flags & TF_OPTION)
1849                 menu_add_option(id->token, (yyvsp[(3) - (3)].string));
1850         else
1851                 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
1852         free((yyvsp[(2) - (3)].string));
1854     break;
1856   case 50:
1858 /* Line 1806 of yacc.c  */
1859 #line 242 "zconf.y"
1860     { (yyval.string) = NULL; }
1861     break;
1863   case 51:
1865 /* Line 1806 of yacc.c  */
1866 #line 243 "zconf.y"
1867     { (yyval.string) = (yyvsp[(2) - (2)].string); }
1868     break;
1870   case 52:
1872 /* Line 1806 of yacc.c  */
1873 #line 249 "zconf.y"
1874     {
1875         struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
1876         sym->flags |= SYMBOL_AUTO;
1877         menu_add_entry(sym);
1878         menu_add_expr(P_CHOICE, NULL, NULL);
1879         printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1881     break;
1883   case 53:
1885 /* Line 1806 of yacc.c  */
1886 #line 258 "zconf.y"
1887     {
1888         (yyval.menu) = menu_add_menu();
1890     break;
1892   case 54:
1894 /* Line 1806 of yacc.c  */
1895 #line 263 "zconf.y"
1896     {
1897         if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
1898                 menu_end_menu();
1899                 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1900         }
1902     break;
1904   case 62:
1906 /* Line 1806 of yacc.c  */
1907 #line 283 "zconf.y"
1908     {
1909         menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1910         printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1912     break;
1914   case 63:
1916 /* Line 1806 of yacc.c  */
1917 #line 289 "zconf.y"
1918     {
1919         if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
1920                 menu_set_type((yyvsp[(1) - (3)].id)->stype);
1921                 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1922                         zconf_curname(), zconf_lineno(),
1923                         (yyvsp[(1) - (3)].id)->stype);
1924         } else
1925                 YYERROR;
1927     break;
1929   case 64:
1931 /* Line 1806 of yacc.c  */
1932 #line 300 "zconf.y"
1933     {
1934         current_entry->sym->flags |= SYMBOL_OPTIONAL;
1935         printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1937     break;
1939   case 65:
1941 /* Line 1806 of yacc.c  */
1942 #line 306 "zconf.y"
1943     {
1944         if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
1945                 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
1946                 printd(DEBUG_PARSE, "%s:%d:default\n",
1947                         zconf_curname(), zconf_lineno());
1948         } else
1949                 YYERROR;
1951     break;
1953   case 68:
1955 /* Line 1806 of yacc.c  */
1956 #line 323 "zconf.y"
1957     {
1958         printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1959         menu_add_entry(NULL);
1960         menu_add_dep((yyvsp[(2) - (3)].expr));
1961         (yyval.menu) = menu_add_menu();
1963     break;
1965   case 69:
1967 /* Line 1806 of yacc.c  */
1968 #line 331 "zconf.y"
1969     {
1970         if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
1971                 menu_end_menu();
1972                 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1973         }
1975     break;
1977   case 75:
1979 /* Line 1806 of yacc.c  */
1980 #line 351 "zconf.y"
1981     {
1982         menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1984     break;
1986   case 76:
1988 /* Line 1806 of yacc.c  */
1989 #line 358 "zconf.y"
1990     {
1991         menu_add_entry(NULL);
1992         menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1993         printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1995     break;
1997   case 77:
1999 /* Line 1806 of yacc.c  */
2000 #line 365 "zconf.y"
2001     {
2002         (yyval.menu) = menu_add_menu();
2004     break;
2006   case 78:
2008 /* Line 1806 of yacc.c  */
2009 #line 370 "zconf.y"
2010     {
2011         if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
2012                 menu_end_menu();
2013                 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
2014         }
2016     break;
2018   case 84:
2020 /* Line 1806 of yacc.c  */
2021 #line 388 "zconf.y"
2022     {
2023         printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
2024         zconf_nextfile((yyvsp[(2) - (3)].string));
2026     break;
2028   case 85:
2030 /* Line 1806 of yacc.c  */
2031 #line 396 "zconf.y"
2032     {
2033         menu_add_entry(NULL);
2034         menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
2035         printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
2037     break;
2039   case 86:
2041 /* Line 1806 of yacc.c  */
2042 #line 403 "zconf.y"
2043     {
2044         menu_end_entry();
2046     break;
2048   case 87:
2050 /* Line 1806 of yacc.c  */
2051 #line 410 "zconf.y"
2052     {
2053         printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
2054         zconf_starthelp();
2056     break;
2058   case 88:
2060 /* Line 1806 of yacc.c  */
2061 #line 416 "zconf.y"
2062     {
2063         current_entry->help = (yyvsp[(2) - (2)].string);
2065     break;
2067   case 93:
2069 /* Line 1806 of yacc.c  */
2070 #line 430 "zconf.y"
2071     {
2072         menu_add_dep((yyvsp[(3) - (4)].expr));
2073         printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
2075     break;
2077   case 97:
2079 /* Line 1806 of yacc.c  */
2080 #line 444 "zconf.y"
2081     {
2082         menu_add_visibility((yyvsp[(2) - (2)].expr));
2084     break;
2086   case 99:
2088 /* Line 1806 of yacc.c  */
2089 #line 453 "zconf.y"
2090     {
2091         menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
2093     break;
2095   case 102:
2097 /* Line 1806 of yacc.c  */
2098 #line 461 "zconf.y"
2099     { (yyval.id) = (yyvsp[(1) - (2)].id); }
2100     break;
2102   case 103:
2104 /* Line 1806 of yacc.c  */
2105 #line 462 "zconf.y"
2106     { (yyval.id) = (yyvsp[(1) - (2)].id); }
2107     break;
2109   case 104:
2111 /* Line 1806 of yacc.c  */
2112 #line 463 "zconf.y"
2113     { (yyval.id) = (yyvsp[(1) - (2)].id); }
2114     break;
2116   case 107:
2118 /* Line 1806 of yacc.c  */
2119 #line 471 "zconf.y"
2120     { (yyval.expr) = NULL; }
2121     break;
2123   case 108:
2125 /* Line 1806 of yacc.c  */
2126 #line 472 "zconf.y"
2127     { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
2128     break;
2130   case 109:
2132 /* Line 1806 of yacc.c  */
2133 #line 475 "zconf.y"
2134     { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); }
2135     break;
2137   case 110:
2139 /* Line 1806 of yacc.c  */
2140 #line 476 "zconf.y"
2141     { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
2142     break;
2144   case 111:
2146 /* Line 1806 of yacc.c  */
2147 #line 477 "zconf.y"
2148     { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
2149     break;
2151   case 112:
2153 /* Line 1806 of yacc.c  */
2154 #line 478 "zconf.y"
2155     { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
2156     break;
2158   case 113:
2160 /* Line 1806 of yacc.c  */
2161 #line 479 "zconf.y"
2162     { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); }
2163     break;
2165   case 114:
2167 /* Line 1806 of yacc.c  */
2168 #line 480 "zconf.y"
2169     { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2170     break;
2172   case 115:
2174 /* Line 1806 of yacc.c  */
2175 #line 481 "zconf.y"
2176     { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2177     break;
2179   case 116:
2181 /* Line 1806 of yacc.c  */
2182 #line 484 "zconf.y"
2183     { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); }
2184     break;
2186   case 117:
2188 /* Line 1806 of yacc.c  */
2189 #line 485 "zconf.y"
2190     { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); }
2191     break;
2193   case 118:
2195 /* Line 1806 of yacc.c  */
2196 #line 488 "zconf.y"
2197     { (yyval.string) = NULL; }
2198     break;
2202 /* Line 1806 of yacc.c  */
2203 #line 2204 "zconf.tab.c"
2204       default: break;
2205     }
2206   /* User semantic actions sometimes alter yychar, and that requires
2207      that yytoken be updated with the new translation.  We take the
2208      approach of translating immediately before every use of yytoken.
2209      One alternative is translating here after every semantic action,
2210      but that translation would be missed if the semantic action invokes
2211      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2212      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2213      incorrect destructor might then be invoked immediately.  In the
2214      case of YYERROR or YYBACKUP, subsequent parser actions might lead
2215      to an incorrect destructor call or verbose syntax error message
2216      before the lookahead is translated.  */
2217   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2219   YYPOPSTACK (yylen);
2220   yylen = 0;
2221   YY_STACK_PRINT (yyss, yyssp);
2223   *++yyvsp = yyval;
2225   /* Now `shift' the result of the reduction.  Determine what state
2226      that goes to, based on the state we popped back to and the rule
2227      number reduced by.  */
2229   yyn = yyr1[yyn];
2231   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2232   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2233     yystate = yytable[yystate];
2234   else
2235     yystate = yydefgoto[yyn - YYNTOKENS];
2237   goto yynewstate;
2240 /*------------------------------------.
2241 | yyerrlab -- here on detecting error |
2242 `------------------------------------*/
2243 yyerrlab:
2244   /* Make sure we have latest lookahead translation.  See comments at
2245      user semantic actions for why this is necessary.  */
2246   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2248   /* If not already recovering from an error, report this error.  */
2249   if (!yyerrstatus)
2250     {
2251       ++yynerrs;
2252 #if ! YYERROR_VERBOSE
2253       yyerror (YY_("syntax error"));
2254 #else
2255 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2256                                         yyssp, yytoken)
2257       {
2258         char const *yymsgp = YY_("syntax error");
2259         int yysyntax_error_status;
2260         yysyntax_error_status = YYSYNTAX_ERROR;
2261         if (yysyntax_error_status == 0)
2262           yymsgp = yymsg;
2263         else if (yysyntax_error_status == 1)
2264           {
2265             if (yymsg != yymsgbuf)
2266               YYSTACK_FREE (yymsg);
2267             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2268             if (!yymsg)
2269               {
2270                 yymsg = yymsgbuf;
2271                 yymsg_alloc = sizeof yymsgbuf;
2272                 yysyntax_error_status = 2;
2273               }
2274             else
2275               {
2276                 yysyntax_error_status = YYSYNTAX_ERROR;
2277                 yymsgp = yymsg;
2278               }
2279           }
2280         yyerror (yymsgp);
2281         if (yysyntax_error_status == 2)
2282           goto yyexhaustedlab;
2283       }
2284 # undef YYSYNTAX_ERROR
2285 #endif
2286     }
2290   if (yyerrstatus == 3)
2291     {
2292       /* If just tried and failed to reuse lookahead token after an
2293          error, discard it.  */
2295       if (yychar <= YYEOF)
2296         {
2297           /* Return failure if at end of input.  */
2298           if (yychar == YYEOF)
2299             YYABORT;
2300         }
2301       else
2302         {
2303           yydestruct ("Error: discarding",
2304                       yytoken, &yylval);
2305           yychar = YYEMPTY;
2306         }
2307     }
2309   /* Else will try to reuse lookahead token after shifting the error
2310      token.  */
2311   goto yyerrlab1;
2314 /*---------------------------------------------------.
2315 | yyerrorlab -- error raised explicitly by YYERROR.  |
2316 `---------------------------------------------------*/
2317 yyerrorlab:
2319   /* Pacify compilers like GCC when the user code never invokes
2320      YYERROR and the label yyerrorlab therefore never appears in user
2321      code.  */
2322   if (/*CONSTCOND*/ 0)
2323      goto yyerrorlab;
2325   /* Do not reclaim the symbols of the rule which action triggered
2326      this YYERROR.  */
2327   YYPOPSTACK (yylen);
2328   yylen = 0;
2329   YY_STACK_PRINT (yyss, yyssp);
2330   yystate = *yyssp;
2331   goto yyerrlab1;
2334 /*-------------------------------------------------------------.
2335 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2336 `-------------------------------------------------------------*/
2337 yyerrlab1:
2338   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2340   for (;;)
2341     {
2342       yyn = yypact[yystate];
2343       if (!yypact_value_is_default (yyn))
2344         {
2345           yyn += YYTERROR;
2346           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2347             {
2348               yyn = yytable[yyn];
2349               if (0 < yyn)
2350                 break;
2351             }
2352         }
2354       /* Pop the current state because it cannot handle the error token.  */
2355       if (yyssp == yyss)
2356         YYABORT;
2359       yydestruct ("Error: popping",
2360                   yystos[yystate], yyvsp);
2361       YYPOPSTACK (1);
2362       yystate = *yyssp;
2363       YY_STACK_PRINT (yyss, yyssp);
2364     }
2366   *++yyvsp = yylval;
2369   /* Shift the error token.  */
2370   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2372   yystate = yyn;
2373   goto yynewstate;
2376 /*-------------------------------------.
2377 | yyacceptlab -- YYACCEPT comes here.  |
2378 `-------------------------------------*/
2379 yyacceptlab:
2380   yyresult = 0;
2381   goto yyreturn;
2383 /*-----------------------------------.
2384 | yyabortlab -- YYABORT comes here.  |
2385 `-----------------------------------*/
2386 yyabortlab:
2387   yyresult = 1;
2388   goto yyreturn;
2390 #if !defined(yyoverflow) || YYERROR_VERBOSE
2391 /*-------------------------------------------------.
2392 | yyexhaustedlab -- memory exhaustion comes here.  |
2393 `-------------------------------------------------*/
2394 yyexhaustedlab:
2395   yyerror (YY_("memory exhausted"));
2396   yyresult = 2;
2397   /* Fall through.  */
2398 #endif
2400 yyreturn:
2401   if (yychar != YYEMPTY)
2402     {
2403       /* Make sure we have latest lookahead translation.  See comments at
2404          user semantic actions for why this is necessary.  */
2405       yytoken = YYTRANSLATE (yychar);
2406       yydestruct ("Cleanup: discarding lookahead",
2407                   yytoken, &yylval);
2408     }
2409   /* Do not reclaim the symbols of the rule which action triggered
2410      this YYABORT or YYACCEPT.  */
2411   YYPOPSTACK (yylen);
2412   YY_STACK_PRINT (yyss, yyssp);
2413   while (yyssp != yyss)
2414     {
2415       yydestruct ("Cleanup: popping",
2416                   yystos[*yyssp], yyvsp);
2417       YYPOPSTACK (1);
2418     }
2419 #ifndef yyoverflow
2420   if (yyss != yyssa)
2421     YYSTACK_FREE (yyss);
2422 #endif
2423 #if YYERROR_VERBOSE
2424   if (yymsg != yymsgbuf)
2425     YYSTACK_FREE (yymsg);
2426 #endif
2427   /* Make sure YYID is used.  */
2428   return YYID (yyresult);
2433 /* Line 2067 of yacc.c  */
2434 #line 491 "zconf.y"
2437 void conf_parse(const char *name)
2439         struct symbol *sym;
2440         int i;
2442         zconf_initscan(name);
2444         sym_init();
2445         _menu_init();
2446         rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
2448         if (getenv("ZCONF_DEBUG"))
2449                 zconfdebug = 1;
2450         zconfparse();
2451         if (zconfnerrs)
2452                 exit(1);
2453         if (!modules_sym)
2454                 modules_sym = sym_find( "n" );
2456         rootmenu.prompt->text = _(rootmenu.prompt->text);
2457         rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
2459         menu_finalize(&rootmenu);
2460         for_all_symbols(i, sym) {
2461                 if (sym_check_deps(sym))
2462                         zconfnerrs++;
2463         }
2464         if (zconfnerrs)
2465                 exit(1);
2466         sym_set_change_count(1);
2469 static const char *zconf_tokenname(int token)
2471         switch (token) {
2472         case T_MENU:            return "menu";
2473         case T_ENDMENU:         return "endmenu";
2474         case T_CHOICE:          return "choice";
2475         case T_ENDCHOICE:       return "endchoice";
2476         case T_IF:              return "if";
2477         case T_ENDIF:           return "endif";
2478         case T_DEPENDS:         return "depends";
2479         case T_VISIBLE:         return "visible";
2480         }
2481         return "<token>";
2484 static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
2486         if (id->token != endtoken) {
2487                 zconf_error("unexpected '%s' within %s block",
2488                         kconf_id_strings + id->name, zconf_tokenname(starttoken));
2489                 zconfnerrs++;
2490                 return false;
2491         }
2492         if (current_menu->file != current_file) {
2493                 zconf_error("'%s' in different file than '%s'",
2494                         kconf_id_strings + id->name, zconf_tokenname(starttoken));
2495                 fprintf(stderr, "%s:%d: location of the '%s'\n",
2496                         current_menu->file->name, current_menu->lineno,
2497                         zconf_tokenname(starttoken));
2498                 zconfnerrs++;
2499                 return false;
2500         }
2501         return true;
2504 static void zconfprint(const char *err, ...)
2506         va_list ap;
2508         fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2509         va_start(ap, err);
2510         vfprintf(stderr, err, ap);
2511         va_end(ap);
2512         fprintf(stderr, "\n");
2515 static void zconf_error(const char *err, ...)
2517         va_list ap;
2519         zconfnerrs++;
2520         fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2521         va_start(ap, err);
2522         vfprintf(stderr, err, ap);
2523         va_end(ap);
2524         fprintf(stderr, "\n");
2527 static void zconferror(const char *err)
2529         fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2532 static void print_quoted_string(FILE *out, const char *str)
2534         const char *p;
2535         int len;
2537         putc('"', out);
2538         while ((p = strchr(str, '"'))) {
2539                 len = p - str;
2540                 if (len)
2541                         fprintf(out, "%.*s", len, str);
2542                 fputs("\\\"", out);
2543                 str = p + 1;
2544         }
2545         fputs(str, out);
2546         putc('"', out);
2549 static void print_symbol(FILE *out, struct menu *menu)
2551         struct symbol *sym = menu->sym;
2552         struct property *prop;
2554         if (sym_is_choice(sym))
2555                 fprintf(out, "\nchoice\n");
2556         else
2557                 fprintf(out, "\nconfig %s\n", sym->name);
2558         switch (sym->type) {
2559         case S_BOOLEAN:
2560                 fputs("  boolean\n", out);
2561                 break;
2562         case S_TRISTATE:
2563                 fputs("  tristate\n", out);
2564                 break;
2565         case S_STRING:
2566                 fputs("  string\n", out);
2567                 break;
2568         case S_INT:
2569                 fputs("  integer\n", out);
2570                 break;
2571         case S_HEX:
2572                 fputs("  hex\n", out);
2573                 break;
2574         default:
2575                 fputs("  ???\n", out);
2576                 break;
2577         }
2578         for (prop = sym->prop; prop; prop = prop->next) {
2579                 if (prop->menu != menu)
2580                         continue;
2581                 switch (prop->type) {
2582                 case P_PROMPT:
2583                         fputs("  prompt ", out);
2584                         print_quoted_string(out, prop->text);
2585                         if (!expr_is_yes(prop->visible.expr)) {
2586                                 fputs(" if ", out);
2587                                 expr_fprint(prop->visible.expr, out);
2588                         }
2589                         fputc('\n', out);
2590                         break;
2591                 case P_DEFAULT:
2592                         fputs( "  default ", out);
2593                         expr_fprint(prop->expr, out);
2594                         if (!expr_is_yes(prop->visible.expr)) {
2595                                 fputs(" if ", out);
2596                                 expr_fprint(prop->visible.expr, out);
2597                         }
2598                         fputc('\n', out);
2599                         break;
2600                 case P_CHOICE:
2601                         fputs("  #choice value\n", out);
2602                         break;
2603                 case P_SELECT:
2604                         fputs( "  select ", out);
2605                         expr_fprint(prop->expr, out);
2606                         if (prop->value) {
2607                                 fputs(" (value=", out);
2608                                 expr_fprint(prop->value, out);
2609                                 fputc(')', out);
2610                         }
2611                         if (!expr_is_yes(prop->visible.expr)) {
2612                                 fputs(" if ", out);
2613                                 expr_fprint(prop->visible.expr, out);
2614                         }
2615                         fputc('\n', out);
2616                         break;
2617                 case P_RANGE:
2618                         fputs( "  range ", out);
2619                         expr_fprint(prop->expr, out);
2620                         fputc('\n', out);
2621                         break;
2622                 case P_MENU:
2623                         fputs( "  menu ", out);
2624                         print_quoted_string(out, prop->text);
2625                         fputc('\n', out);
2626                         break;
2627                 default:
2628                         fprintf(out, "  unknown prop %d!\n", prop->type);
2629                         break;
2630                 }
2631         }
2632         if (menu->help) {
2633                 int len = strlen(menu->help);
2634                 while (menu->help[--len] == '\n')
2635                         menu->help[len] = 0;
2636                 fprintf(out, "  help\n%s\n", menu->help);
2637         }
2640 void zconfdump(FILE *out)
2642         struct property *prop;
2643         struct symbol *sym;
2644         struct menu *menu;
2646         menu = rootmenu.list;
2647         while (menu) {
2648                 if ((sym = menu->sym))
2649                         print_symbol(out, menu);
2650                 else if ((prop = menu->prompt)) {
2651                         switch (prop->type) {
2652                         case P_COMMENT:
2653                                 fputs("\ncomment ", out);
2654                                 print_quoted_string(out, prop->text);
2655                                 fputs("\n", out);
2656                                 break;
2657                         case P_MENU:
2658                                 fputs("\nmenu ", out);
2659                                 print_quoted_string(out, prop->text);
2660                                 fputs("\n", out);
2661                                 break;
2662                         default:
2663                                 ;
2664                         }
2665                         if (!expr_is_yes(prop->visible.expr)) {
2666                                 fputs("  depends ", out);
2667                                 expr_fprint(prop->visible.expr, out);
2668                                 fputc('\n', out);
2669                         }
2670                 }
2672                 if (menu->list)
2673                         menu = menu->list;
2674                 else if (menu->next)
2675                         menu = menu->next;
2676                 else while ((menu = menu->parent)) {
2677                         if (menu->prompt && menu->prompt->type == P_MENU)
2678                                 fputs("\nendmenu\n", out);
2679                         if (menu->next) {
2680                                 menu = menu->next;
2681                                 break;
2682                         }
2683                 }
2684         }
2687 #include "zconf.lex.c"
2688 #include "util.c"
2689 #include "confdata.c"
2690 #include "expr.c"
2691 #include "symbol.c"
2692 #include "menu.c"