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