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