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