Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


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