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