blob: 2fb0a4fc61d01d04bb768a1afb6cd172b5e6643a [file] [log] [blame]
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001/* A Bison parser, made by GNU Bison 2.1. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
3/* Skeleton parser for Yacc-like parsing with Bison,
Roman Zippelf6a88aa2006-06-08 22:12:44 -07004 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
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.
10
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.
15
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
Roman Zippelf6a88aa2006-06-08 22:12:44 -070018 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
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. */
25
26/* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
28
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. */
35
36/* Identify Bison output. */
37#define YYBISON 1
38
Roman Zippelf6a88aa2006-06-08 22:12:44 -070039/* Bison version. */
40#define YYBISON_VERSION "2.1"
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042/* Skeleton name. */
43#define YYSKELETON_NAME "yacc.c"
44
45/* Pure parsers. */
46#define YYPURE 0
47
48/* Using locations. */
49#define YYLSP_NEEDED 0
50
Roman Zippel7a884882005-11-08 21:34:51 -080051/* Substitute the variable and function names. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070052#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
59
60
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,
Roman Zippel3370f9f2005-11-08 21:34:52 -080084 T_TYPE = 275,
85 T_DEFAULT = 276,
86 T_SELECT = 277,
87 T_RANGE = 278,
Roman Zippelf6a88aa2006-06-08 22:12:44 -070088 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 };
101#endif
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700102/* Tokens. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103#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
Roman Zippel3370f9f2005-11-08 21:34:52 -0800120#define T_TYPE 275
121#define T_DEFAULT 276
122#define T_SELECT 277
123#define T_RANGE 278
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700124#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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
137
138
139
140/* Copy the first part of user declarations. */
141
142
143/*
144 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
145 * Released under the terms of the GNU GPL v2.0.
146 */
147
148#include <ctype.h>
149#include <stdarg.h>
150#include <stdio.h>
151#include <stdlib.h>
152#include <string.h>
153#include <stdbool.h>
154
Roman Zippel7a884882005-11-08 21:34:51 -0800155#define LKC_DIRECT_LINK
156#include "lkc.h"
157
158#include "zconf.hash.c"
159
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
161
162#define PRINTD 0x0001
163#define DEBUG_PARSE 0x0002
164
165int cdebug = PRINTD;
166
167extern int zconflex(void);
168static void zconfprint(const char *err, ...);
Roman Zippela02f0572005-11-08 21:34:53 -0800169static void zconf_error(const char *err, ...);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170static void zconferror(const char *err);
Roman Zippela02f0572005-11-08 21:34:53 -0800171static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
173struct symbol *symbol_hash[257];
174
175static struct menu *current_menu, *current_entry;
176
Roman Zippela02f0572005-11-08 21:34:53 -0800177#define YYDEBUG 0
178#if YYDEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179#define YYERROR_VERBOSE
Roman Zippela02f0572005-11-08 21:34:53 -0800180#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181
182
183/* Enabling traces. */
184#ifndef YYDEBUG
185# define YYDEBUG 0
186#endif
187
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
195
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700196/* Enabling the token table. */
197#ifndef YYTOKEN_TABLE
198# define YYTOKEN_TABLE 0
199#endif
200
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
202
203typedef union YYSTYPE {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 char *string;
Roman Zippela02f0572005-11-08 21:34:53 -0800205 struct file *file;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 struct symbol *symbol;
207 struct expr *expr;
208 struct menu *menu;
Roman Zippel3370f9f2005-11-08 21:34:52 -0800209 struct kconf_id *id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210} YYSTYPE;
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700211/* Line 196 of yacc.c. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212
213# define yystype YYSTYPE /* obsolescent; will be withdrawn */
214# define YYSTYPE_IS_DECLARED 1
215# define YYSTYPE_IS_TRIVIAL 1
216#endif
217
218
219
220/* Copy the second part of user declarations. */
221
222
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700223/* Line 219 of yacc.c. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
225
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700226#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
239
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
251
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252#if ! defined (yyoverflow) || YYERROR_VERBOSE
253
254/* The parser invokes alloca or malloc; define the necessary symbols. */
255
Roman Zippel7a884882005-11-08 21:34:51 -0800256# ifdef YYSTACK_USE_ALLOCA
257# if YYSTACK_USE_ALLOCA
258# ifdef __GNUC__
259# define YYSTACK_ALLOC __builtin_alloca
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260# else
Roman Zippel7a884882005-11-08 21:34:51 -0800261# define YYSTACK_ALLOC alloca
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700262# if defined (__STDC__) || defined (__cplusplus)
263# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
264# define YYINCLUDED_STDLIB_H
265# endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266# endif
267# endif
268# endif
269
270# ifdef YYSTACK_ALLOC
271 /* Pacify GCC's `empty if-body' warning. */
272# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700273# 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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279# endif
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700280# else
Roman Zippel7a884882005-11-08 21:34:51 -0800281# define YYSTACK_ALLOC YYMALLOC
282# define YYSTACK_FREE YYFREE
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700283# ifndef YYSTACK_ALLOC_MAXIMUM
284# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
285# endif
286# ifdef __cplusplus
287extern "C" {
288# endif
289# ifndef YYMALLOC
290# define YYMALLOC malloc
291# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
292 && (defined (__STDC__) || defined (__cplusplus)))
293void *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)))
300void free (void *); /* INFRINGES ON USER NAME SPACE */
301# endif
302# endif
303# ifdef __cplusplus
304}
305# endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306# endif
307#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
308
309
310#if (! defined (yyoverflow) \
311 && (! defined (__cplusplus) \
Roman Zippel7a884882005-11-08 21:34:51 -0800312 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313
314/* A type that is properly aligned for any stack member. */
315union yyalloc
316{
Roman Zippel7a884882005-11-08 21:34:51 -0800317 short int yyss;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 YYSTYPE yyvs;
319 };
320
321/* The size of the maximum gap between one aligned stack and the next. */
322# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
323
324/* The size of an array large to enough to hold all stacks, each with
325 N elements. */
326# define YYSTACK_BYTES(N) \
Roman Zippel7a884882005-11-08 21:34:51 -0800327 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 + YYSTACK_GAP_MAXIMUM)
329
330/* Copy COUNT objects from FROM to TO. The source and destination do
331 not overlap. */
332# ifndef YYCOPY
Roman Zippel7a884882005-11-08 21:34:51 -0800333# if defined (__GNUC__) && 1 < __GNUC__
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334# define YYCOPY(To, From, Count) \
335 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
336# else
337# define YYCOPY(To, From, Count) \
338 do \
339 { \
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700340 YYSIZE_T yyi; \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 for (yyi = 0; yyi < (Count); yyi++) \
342 (To)[yyi] = (From)[yyi]; \
343 } \
344 while (0)
345# endif
346# endif
347
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)
363
364#endif
365
366#if defined (__STDC__) || defined (__cplusplus)
367 typedef signed char yysigned_char;
368#else
Roman Zippel7a884882005-11-08 21:34:51 -0800369 typedef short int yysigned_char;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370#endif
371
372/* YYFINAL -- State number of the termination state. */
Roman Zippela02f0572005-11-08 21:34:53 -0800373#define YYFINAL 3
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374/* YYLAST -- Last index in YYTABLE. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700375#define YYLAST 275
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376
377/* YYNTOKENS -- Number of terminals. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700378#define YYNTOKENS 36
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379/* YYNNTS -- Number of nonterminals. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700380#define YYNNTS 45
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381/* YYNRULES -- Number of rules. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700382#define YYNRULES 110
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383/* YYNRULES -- Number of states. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700384#define YYNSTATES 183
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385
386/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
387#define YYUNDEFTOK 2
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700388#define YYMAXUTOK 290
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700390#define YYTRANSLATE(YYX) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
392
393/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
394static const unsigned char yytranslate[] =
395{
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,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700424 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
425 35
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426};
427
428#if YYDEBUG
429/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
430 YYRHS. */
Roman Zippel7a884882005-11-08 21:34:51 -0800431static const unsigned short int yyprhs[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432{
Roman Zippela02f0572005-11-08 21:34:53 -0800433 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,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700436 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445};
446
447/* YYRHS -- A `-1'-separated list of the rules' RHS. */
448static const yysigned_char yyrhs[] =
449{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700450 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,
Roman Zippela02f0572005-11-08 21:34:53 -0800454 -1, 20, -1, 22, -1, 18, -1, 23, -1, 21,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700455 -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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483};
484
485/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Roman Zippel7a884882005-11-08 21:34:51 -0800486static const unsigned short int yyrline[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700488 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500};
501#endif
502
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700503#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
504/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
506static const char *const yytname[] =
507{
Roman Zippel7a884882005-11-08 21:34:51 -0800508 "$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",
Roman Zippel3370f9f2005-11-08 21:34:52 -0800511 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700512 "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",
Roman Zippela02f0572005-11-08 21:34:53 -0800516 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700517 "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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524};
525#endif
526
527# ifdef YYPRINT
528/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
529 token YYLEX-NUM. */
Roman Zippel7a884882005-11-08 21:34:51 -0800530static const unsigned short int yytoknum[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531{
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,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700535 285, 286, 287, 288, 289, 290
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536};
537# endif
538
539/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
540static const unsigned char yyr1[] =
541{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700542 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554};
555
556/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
557static const unsigned char yyr2[] =
558{
Roman Zippela02f0572005-11-08 21:34:53 -0800559 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,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700562 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571};
572
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. */
576static const unsigned char yydefact[] =
577{
Roman Zippela02f0572005-11-08 21:34:53 -0800578 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,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700581 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597};
598
599/* YYDEFGOTO[NTERM-NUM]. */
Roman Zippel7a884882005-11-08 21:34:51 -0800600static const short int yydefgoto[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700602 -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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607};
608
609/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
610 STATE-NUM. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700611#define YYPACT_NINF -135
Roman Zippel7a884882005-11-08 21:34:51 -0800612static const short int yypact[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700614 -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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633};
634
635/* YYPGOTO[NTERM-NUM]. */
Roman Zippel7a884882005-11-08 21:34:51 -0800636static const short int yypgoto[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700638 -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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643};
644
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. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700649#define YYTABLE_NINF -82
Roman Zippel7a884882005-11-08 21:34:51 -0800650static const short int yytable[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700652 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680};
681
Roman Zippel3370f9f2005-11-08 21:34:52 -0800682static const short int yycheck[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700684 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712};
713
714/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
715 symbol of state STATE-NUM. */
716static const unsigned char yystos[] =
717{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700718 0, 37, 38, 0, 1, 3, 4, 5, 6, 7,
Roman Zippela02f0572005-11-08 21:34:53 -0800719 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700720 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737};
738
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739#define yyerrok (yyerrstatus = 0)
740#define yyclearin (yychar = YYEMPTY)
741#define YYEMPTY (-2)
742#define YYEOF 0
743
744#define YYACCEPT goto yyacceptlab
745#define YYABORT goto yyabortlab
Roman Zippel7a884882005-11-08 21:34:51 -0800746#define YYERROR goto yyerrorlab
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747
748
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. */
752
753#define YYFAIL goto yyerrlab
754
755#define YYRECOVERING() (!!yyerrstatus)
756
757#define YYBACKUP(Token, Value) \
758do \
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 \
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700768 { \
769 yyerror (YY_("syntax error: cannot back up")); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 YYERROR; \
771 } \
772while (0)
773
Roman Zippel7a884882005-11-08 21:34:51 -0800774
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775#define YYTERROR 1
776#define YYERRCODE 256
777
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778
Roman Zippel7a884882005-11-08 21:34:51 -0800779/* 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). */
782
783#define YYRHSLOC(Rhs, K) ((Rhs)[K])
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784#ifndef YYLLOC_DEFAULT
Roman Zippel7a884882005-11-08 21:34:51 -0800785# 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)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802#endif
803
Roman Zippel7a884882005-11-08 21:34:51 -0800804
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. */
808
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
819
820
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821/* YYLEX -- calling `yylex' with the right arguments. */
822
823#ifdef YYLEX_PARAM
824# define YYLEX yylex (YYLEX_PARAM)
825#else
826# define YYLEX yylex ()
827#endif
828
829/* Enable debugging if requested. */
830#if YYDEBUG
831
832# ifndef YYFPRINTF
833# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
834# define YYFPRINTF fprintf
835# endif
836
837# define YYDPRINTF(Args) \
838do { \
839 if (yydebug) \
840 YYFPRINTF Args; \
841} while (0)
842
Roman Zippel7a884882005-11-08 21:34:51 -0800843# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844do { \
845 if (yydebug) \
846 { \
847 YYFPRINTF (stderr, "%s ", Title); \
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700848 yysymprint (stderr, \
Roman Zippel7a884882005-11-08 21:34:51 -0800849 Type, Value); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850 YYFPRINTF (stderr, "\n"); \
851 } \
852} while (0)
853
854/*------------------------------------------------------------------.
855| yy_stack_print -- Print the state stack from its BOTTOM up to its |
Roman Zippel7a884882005-11-08 21:34:51 -0800856| TOP (included). |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857`------------------------------------------------------------------*/
858
859#if defined (__STDC__) || defined (__cplusplus)
860static void
Roman Zippel7a884882005-11-08 21:34:51 -0800861yy_stack_print (short int *bottom, short int *top)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862#else
863static void
864yy_stack_print (bottom, top)
Roman Zippel7a884882005-11-08 21:34:51 -0800865 short int *bottom;
866 short int *top;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867#endif
868{
869 YYFPRINTF (stderr, "Stack now");
870 for (/* Nothing. */; bottom <= top; ++bottom)
871 YYFPRINTF (stderr, " %d", *bottom);
872 YYFPRINTF (stderr, "\n");
873}
874
875# define YY_STACK_PRINT(Bottom, Top) \
876do { \
877 if (yydebug) \
878 yy_stack_print ((Bottom), (Top)); \
879} while (0)
880
881
882/*------------------------------------------------.
883| Report that the YYRULE is going to be reduced. |
884`------------------------------------------------*/
885
886#if defined (__STDC__) || defined (__cplusplus)
887static void
888yy_reduce_print (int yyrule)
889#else
890static void
891yy_reduce_print (yyrule)
892 int yyrule;
893#endif
894{
895 int yyi;
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700896 unsigned long int yylno = yyrline[yyrule];
897 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
Roman Zippel7a884882005-11-08 21:34:51 -0800898 yyrule - 1, yylno);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700899 /* Print the symbols being reduced, and their result. */
900 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700901 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
902 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700903}
904
905# define YY_REDUCE_PRINT(Rule) \
906do { \
907 if (yydebug) \
908 yy_reduce_print (Rule); \
909} while (0)
910
911/* Nonzero means print parse trace. It is left uninitialized so that
912 multiple parsers can coexist. */
913int yydebug;
914#else /* !YYDEBUG */
915# define YYDPRINTF(Args)
Roman Zippel7a884882005-11-08 21:34:51 -0800916# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917# define YY_STACK_PRINT(Bottom, Top)
918# define YY_REDUCE_PRINT(Rule)
919#endif /* !YYDEBUG */
920
921
922/* YYINITDEPTH -- initial size of the parser's stacks. */
923#ifndef YYINITDEPTH
924# define YYINITDEPTH 200
925#endif
926
927/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
928 if the built-in stack extension method is used).
929
930 Do not make this value too large; the results are undefined if
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700931 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700932 evaluated with infinite-precision integer arithmetic. */
933
Linus Torvalds1da177e2005-04-16 15:20:36 -0700934#ifndef YYMAXDEPTH
935# define YYMAXDEPTH 10000
936#endif
937
938
939
940#if YYERROR_VERBOSE
941
942# ifndef yystrlen
943# if defined (__GLIBC__) && defined (_STRING_H)
944# define yystrlen strlen
945# else
946/* Return the length of YYSTR. */
947static YYSIZE_T
948# if defined (__STDC__) || defined (__cplusplus)
949yystrlen (const char *yystr)
950# else
951yystrlen (yystr)
952 const char *yystr;
953# endif
954{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700955 const char *yys = yystr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956
957 while (*yys++ != '\0')
958 continue;
959
960 return yys - yystr - 1;
961}
962# endif
963# endif
964
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. */
971static char *
972# if defined (__STDC__) || defined (__cplusplus)
973yystpcpy (char *yydest, const char *yysrc)
974# else
975yystpcpy (yydest, yysrc)
976 char *yydest;
977 const char *yysrc;
978# endif
979{
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700980 char *yyd = yydest;
981 const char *yys = yysrc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700982
983 while ((*yyd++ = *yys++) != '\0')
984 continue;
985
986 return yyd - 1;
987}
988# endif
989# endif
990
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700991# 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. */
999static YYSIZE_T
1000yytnamerr (char *yyres, const char *yystr)
1001{
1002 if (*yystr == '"')
1003 {
1004 size_t yyn = 0;
1005 char const *yyp = yystr;
1006
1007 for (;;)
1008 switch (*++yyp)
1009 {
1010 case '\'':
1011 case ',':
1012 goto do_not_strip_quotes;
1013
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;
1023
1024 case '"':
1025 if (yyres)
1026 yyres[yyn] = '\0';
1027 return yyn;
1028 }
1029 do_not_strip_quotes: ;
1030 }
1031
1032 if (! yyres)
1033 return yystrlen (yystr);
1034
1035 return yystpcpy (yyres, yystr) - yyres;
1036}
1037# endif
1038
1039#endif /* YYERROR_VERBOSE */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040
1041
1042
1043#if YYDEBUG
1044/*--------------------------------.
1045| Print this symbol on YYOUTPUT. |
1046`--------------------------------*/
1047
1048#if defined (__STDC__) || defined (__cplusplus)
1049static void
1050yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1051#else
1052static void
1053yysymprint (yyoutput, yytype, yyvaluep)
1054 FILE *yyoutput;
1055 int yytype;
1056 YYSTYPE *yyvaluep;
1057#endif
1058{
1059 /* Pacify ``unused variable'' warnings. */
1060 (void) yyvaluep;
1061
1062 if (yytype < YYNTOKENS)
Roman Zippel7a884882005-11-08 21:34:51 -08001063 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001064 else
1065 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1066
Roman Zippel7a884882005-11-08 21:34:51 -08001067
1068# ifdef YYPRINT
1069 if (yytype < YYNTOKENS)
1070 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1071# endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072 switch (yytype)
1073 {
1074 default:
1075 break;
1076 }
1077 YYFPRINTF (yyoutput, ")");
1078}
1079
1080#endif /* ! YYDEBUG */
1081/*-----------------------------------------------.
1082| Release the memory associated to this symbol. |
1083`-----------------------------------------------*/
1084
1085#if defined (__STDC__) || defined (__cplusplus)
1086static void
Roman Zippel7a884882005-11-08 21:34:51 -08001087yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001088#else
1089static void
Roman Zippel7a884882005-11-08 21:34:51 -08001090yydestruct (yymsg, yytype, yyvaluep)
1091 const char *yymsg;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092 int yytype;
1093 YYSTYPE *yyvaluep;
1094#endif
1095{
1096 /* Pacify ``unused variable'' warnings. */
1097 (void) yyvaluep;
1098
Roman Zippel7a884882005-11-08 21:34:51 -08001099 if (!yymsg)
1100 yymsg = "Deleting";
1101 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1102
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103 switch (yytype)
1104 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001105 case 52: /* "choice_entry" */
Roman Zippela02f0572005-11-08 21:34:53 -08001106
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();
1112};
1113
1114 break;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001115 case 58: /* "if_entry" */
Roman Zippela02f0572005-11-08 21:34:53 -08001116
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();
1122};
1123
1124 break;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001125 case 63: /* "menu_entry" */
Roman Zippela02f0572005-11-08 21:34:53 -08001126
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();
1132};
1133
1134 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001135
1136 default:
1137 break;
1138 }
1139}
1140
1141
1142/* Prevent warnings from -Wmissing-prototypes. */
1143
1144#ifdef YYPARSE_PARAM
1145# if defined (__STDC__) || defined (__cplusplus)
1146int yyparse (void *YYPARSE_PARAM);
1147# else
1148int yyparse ();
1149# endif
1150#else /* ! YYPARSE_PARAM */
1151#if defined (__STDC__) || defined (__cplusplus)
1152int yyparse (void);
1153#else
1154int yyparse ();
1155#endif
1156#endif /* ! YYPARSE_PARAM */
1157
1158
1159
Roman Zippel7a884882005-11-08 21:34:51 -08001160/* The look-ahead symbol. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001161int yychar;
1162
Roman Zippel7a884882005-11-08 21:34:51 -08001163/* The semantic value of the look-ahead symbol. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164YYSTYPE yylval;
1165
1166/* Number of syntax errors so far. */
1167int yynerrs;
1168
1169
1170
1171/*----------.
1172| yyparse. |
1173`----------*/
1174
1175#ifdef YYPARSE_PARAM
1176# if defined (__STDC__) || defined (__cplusplus)
1177int yyparse (void *YYPARSE_PARAM)
1178# else
1179int yyparse (YYPARSE_PARAM)
1180 void *YYPARSE_PARAM;
1181# endif
1182#else /* ! YYPARSE_PARAM */
1183#if defined (__STDC__) || defined (__cplusplus)
1184int
1185yyparse (void)
1186#else
1187int
1188yyparse ()
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001189 ;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001190#endif
1191#endif
1192{
1193
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001194 int yystate;
1195 int yyn;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001196 int yyresult;
1197 /* Number of tokens to shift before error messages enabled. */
1198 int yyerrstatus;
Roman Zippel7a884882005-11-08 21:34:51 -08001199 /* Look-ahead token as an internal (translated) token number. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001200 int yytoken = 0;
1201
1202 /* Three stacks and their tools:
1203 `yyss': related to states,
1204 `yyvs': related to semantic values,
1205 `yyls': related to locations.
1206
1207 Refer to the stacks thru separate pointers, to allow yyoverflow
1208 to reallocate them elsewhere. */
1209
1210 /* The state stack. */
Roman Zippel7a884882005-11-08 21:34:51 -08001211 short int yyssa[YYINITDEPTH];
1212 short int *yyss = yyssa;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001213 short int *yyssp;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001214
1215 /* The semantic value stack. */
1216 YYSTYPE yyvsa[YYINITDEPTH];
1217 YYSTYPE *yyvs = yyvsa;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001218 YYSTYPE *yyvsp;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001219
1220
1221
1222#define YYPOPSTACK (yyvsp--, yyssp--)
1223
1224 YYSIZE_T yystacksize = YYINITDEPTH;
1225
1226 /* The variables used to return semantic value and location from the
1227 action routines. */
1228 YYSTYPE yyval;
1229
1230
1231 /* When reducing, the number of symbols on the RHS of the reduced
1232 rule. */
1233 int yylen;
1234
1235 YYDPRINTF ((stderr, "Starting parse\n"));
1236
1237 yystate = 0;
1238 yyerrstatus = 0;
1239 yynerrs = 0;
1240 yychar = YYEMPTY; /* Cause a token to be read. */
1241
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. */
1246
1247 yyssp = yyss;
1248 yyvsp = yyvs;
1249
1250 goto yysetstate;
1251
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++;
1260
1261 yysetstate:
1262 *yyssp = yystate;
1263
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;
1268
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;
Roman Zippel7a884882005-11-08 21:34:51 -08001275 short int *yyss1 = yyss;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001276
1277
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. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001282 yyoverflow (YY_("memory exhausted"),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001283 &yyss1, yysize * sizeof (*yyssp),
1284 &yyvs1, yysize * sizeof (*yyvsp),
1285
1286 &yystacksize);
1287
1288 yyss = yyss1;
1289 yyvs = yyvs1;
1290 }
1291#else /* no yyoverflow */
1292# ifndef YYSTACK_RELOCATE
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001293 goto yyexhaustedlab;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001294# else
1295 /* Extend the stack our own way. */
1296 if (YYMAXDEPTH <= yystacksize)
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001297 goto yyexhaustedlab;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001298 yystacksize *= 2;
1299 if (YYMAXDEPTH < yystacksize)
1300 yystacksize = YYMAXDEPTH;
1301
1302 {
Roman Zippel7a884882005-11-08 21:34:51 -08001303 short int *yyss1 = yyss;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001304 union yyalloc *yyptr =
1305 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1306 if (! yyptr)
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001307 goto yyexhaustedlab;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001308 YYSTACK_RELOCATE (yyss);
1309 YYSTACK_RELOCATE (yyvs);
1310
1311# undef YYSTACK_RELOCATE
1312 if (yyss1 != yyssa)
1313 YYSTACK_FREE (yyss1);
1314 }
1315# endif
1316#endif /* no yyoverflow */
1317
1318 yyssp = yyss + yysize - 1;
1319 yyvsp = yyvs + yysize - 1;
1320
1321
1322 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1323 (unsigned long int) yystacksize));
1324
1325 if (yyss + yystacksize - 1 <= yyssp)
1326 YYABORT;
1327 }
1328
1329 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1330
1331 goto yybackup;
1332
1333/*-----------.
1334| yybackup. |
1335`-----------*/
1336yybackup:
1337
1338/* Do appropriate processing given the current state. */
Roman Zippel7a884882005-11-08 21:34:51 -08001339/* Read a look-ahead token if we need one and don't already have one. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001340/* yyresume: */
1341
Roman Zippel7a884882005-11-08 21:34:51 -08001342 /* First try to decide what to do without reference to look-ahead token. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001343
1344 yyn = yypact[yystate];
1345 if (yyn == YYPACT_NINF)
1346 goto yydefault;
1347
Roman Zippel7a884882005-11-08 21:34:51 -08001348 /* Not known => get a look-ahead token if don't already have one. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001349
Roman Zippel7a884882005-11-08 21:34:51 -08001350 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001351 if (yychar == YYEMPTY)
1352 {
1353 YYDPRINTF ((stderr, "Reading a token: "));
1354 yychar = YYLEX;
1355 }
1356
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);
Roman Zippel7a884882005-11-08 21:34:51 -08001365 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366 }
1367
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 }
1381
1382 if (yyn == YYFINAL)
1383 YYACCEPT;
1384
Roman Zippel7a884882005-11-08 21:34:51 -08001385 /* Shift the look-ahead token. */
1386 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387
1388 /* Discard the token being shifted unless it is eof. */
1389 if (yychar != YYEOF)
1390 yychar = YYEMPTY;
1391
1392 *++yyvsp = yylval;
1393
1394
1395 /* Count tokens shifted since error; after three, turn off error
1396 status. */
1397 if (yyerrstatus)
1398 yyerrstatus--;
1399
1400 yystate = yyn;
1401 goto yynewstate;
1402
1403
1404/*-----------------------------------------------------------.
1405| yydefault -- do the default action for the current state. |
1406`-----------------------------------------------------------*/
1407yydefault:
1408 yyn = yydefact[yystate];
1409 if (yyn == 0)
1410 goto yyerrlab;
1411 goto yyreduce;
1412
1413
1414/*-----------------------------.
1415| yyreduce -- Do a reduction. |
1416`-----------------------------*/
1417yyreduce:
1418 /* yyn is the number of a rule to reduce with. */
1419 yylen = yyr2[yyn];
1420
1421 /* If YYLEN is nonzero, implement the default value of the action:
1422 `$$ = $1'.
1423
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];
1430
1431
1432 YY_REDUCE_PRINT (yyn);
1433 switch (yyn)
1434 {
1435 case 8:
1436
Roman Zippela02f0572005-11-08 21:34:53 -08001437 { zconf_error("unexpected end statement"); ;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 break;
1439
1440 case 9:
1441
Roman Zippela02f0572005-11-08 21:34:53 -08001442 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001443 break;
1444
1445 case 10:
1446
Roman Zippela02f0572005-11-08 21:34:53 -08001447 {
1448 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1449;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450 break;
1451
1452 case 11:
1453
Roman Zippela02f0572005-11-08 21:34:53 -08001454 { zconf_error("invalid statement"); ;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001455 break;
1456
Roman Zippela02f0572005-11-08 21:34:53 -08001457 case 25:
1458
1459 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1460 break;
1461
1462 case 26:
1463
1464 { zconf_error("invalid option"); ;}
1465 break;
1466
1467 case 27:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001468
1469 {
Roman Zippel7a884882005-11-08 21:34:51 -08001470 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001471 sym->flags |= SYMBOL_OPTIONAL;
1472 menu_add_entry(sym);
Roman Zippel7a884882005-11-08 21:34:51 -08001473 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474;}
1475 break;
1476
Roman Zippela02f0572005-11-08 21:34:53 -08001477 case 28:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001478
1479 {
1480 menu_end_entry();
1481 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1482;}
1483 break;
1484
Roman Zippela02f0572005-11-08 21:34:53 -08001485 case 29:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001486
1487 {
Roman Zippel7a884882005-11-08 21:34:51 -08001488 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001489 sym->flags |= SYMBOL_OPTIONAL;
1490 menu_add_entry(sym);
Roman Zippel7a884882005-11-08 21:34:51 -08001491 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001492;}
1493 break;
1494
Roman Zippela02f0572005-11-08 21:34:53 -08001495 case 30:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001496
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());
1504;}
1505 break;
1506
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001507 case 38:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001508
1509 {
Roman Zippel3370f9f2005-11-08 21:34:52 -08001510 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);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001514;}
1515 break;
1516
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001517 case 39:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001518
1519 {
Roman Zippel7a884882005-11-08 21:34:51 -08001520 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001521 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1522;}
1523 break;
1524
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001525 case 40:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001526
1527 {
Roman Zippel7a884882005-11-08 21:34:51 -08001528 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
Roman Zippel3370f9f2005-11-08 21:34:52 -08001529 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);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001534;}
1535 break;
1536
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001537 case 41:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538
1539 {
Roman Zippel7a884882005-11-08 21:34:51 -08001540 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001541 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1542;}
1543 break;
1544
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001545 case 42:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001546
1547 {
Roman Zippel7a884882005-11-08 21:34:51 -08001548 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001549 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1550;}
1551 break;
1552
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001553 case 45:
1554
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));
1562;}
1563 break;
1564
1565 case 46:
1566
1567 { (yyval.string) = NULL; ;}
1568 break;
1569
1570 case 47:
1571
1572 { (yyval.string) = (yyvsp[0].string); ;}
1573 break;
1574
1575 case 48:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001576
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());
1583;}
1584 break;
1585
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001586 case 49:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001587
1588 {
Roman Zippela02f0572005-11-08 21:34:53 -08001589 (yyval.menu) = menu_add_menu();
Linus Torvalds1da177e2005-04-16 15:20:36 -07001590;}
1591 break;
1592
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001593 case 50:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001594
1595 {
Roman Zippela02f0572005-11-08 21:34:53 -08001596 if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001597 menu_end_menu();
1598 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1599 }
1600;}
1601 break;
1602
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001603 case 58:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001604
1605 {
Roman Zippel7a884882005-11-08 21:34:51 -08001606 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001607 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1608;}
1609 break;
1610
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001611 case 59:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001612
1613 {
Roman Zippel3370f9f2005-11-08 21:34:52 -08001614 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;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001621;}
1622 break;
1623
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001624 case 60:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001625
1626 {
1627 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1628 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1629;}
1630 break;
1631
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001632 case 61:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001633
1634 {
Roman Zippel3370f9f2005-11-08 21:34:52 -08001635 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;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001641;}
1642 break;
1643
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001644 case 64:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001645
1646 {
1647 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1648 menu_add_entry(NULL);
Roman Zippel7a884882005-11-08 21:34:51 -08001649 menu_add_dep((yyvsp[-1].expr));
Roman Zippela02f0572005-11-08 21:34:53 -08001650 (yyval.menu) = menu_add_menu();
Linus Torvalds1da177e2005-04-16 15:20:36 -07001651;}
1652 break;
1653
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001654 case 65:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001655
1656 {
Roman Zippela02f0572005-11-08 21:34:53 -08001657 if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001658 menu_end_menu();
1659 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1660 }
1661;}
1662 break;
1663
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001664 case 71:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001665
1666 {
1667 menu_add_entry(NULL);
Roman Zippel7a884882005-11-08 21:34:51 -08001668 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001669 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1670;}
1671 break;
1672
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001673 case 72:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001674
1675 {
Roman Zippela02f0572005-11-08 21:34:53 -08001676 (yyval.menu) = menu_add_menu();
Linus Torvalds1da177e2005-04-16 15:20:36 -07001677;}
1678 break;
1679
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001680 case 73:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001681
1682 {
Roman Zippela02f0572005-11-08 21:34:53 -08001683 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 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001687;}
1688 break;
1689
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001690 case 79:
Roman Zippela02f0572005-11-08 21:34:53 -08001691
1692 {
1693 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1694 zconf_nextfile((yyvsp[-1].string));
1695;}
1696 break;
1697
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001698 case 80:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001699
1700 {
1701 menu_add_entry(NULL);
Roman Zippel7a884882005-11-08 21:34:51 -08001702 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001703 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1704;}
1705 break;
1706
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001707 case 81:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001708
1709 {
1710 menu_end_entry();
1711;}
1712 break;
1713
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001714 case 82:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001715
1716 {
1717 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1718 zconf_starthelp();
1719;}
1720 break;
1721
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001722 case 83:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001723
1724 {
Roman Zippel7a884882005-11-08 21:34:51 -08001725 current_entry->sym->help = (yyvsp[0].string);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001726;}
1727 break;
1728
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001729 case 88:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001730
1731 {
Roman Zippel7a884882005-11-08 21:34:51 -08001732 menu_add_dep((yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001733 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1734;}
1735 break;
1736
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001737 case 89:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001738
1739 {
Roman Zippel7a884882005-11-08 21:34:51 -08001740 menu_add_dep((yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001741 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1742;}
1743 break;
1744
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001745 case 90:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001746
1747 {
Roman Zippel7a884882005-11-08 21:34:51 -08001748 menu_add_dep((yyvsp[-1].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001749 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1750;}
1751 break;
1752
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001753 case 92:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001754
1755 {
Roman Zippel7a884882005-11-08 21:34:51 -08001756 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001757;}
1758 break;
1759
Roman Zippel3370f9f2005-11-08 21:34:52 -08001760 case 95:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001761
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001762 { (yyval.id) = (yyvsp[-1].id); ;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001763 break;
1764
Roman Zippel3370f9f2005-11-08 21:34:52 -08001765 case 96:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001766
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001767 { (yyval.id) = (yyvsp[-1].id); ;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001768 break;
1769
Roman Zippel3370f9f2005-11-08 21:34:52 -08001770 case 97:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001771
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001772 { (yyval.id) = (yyvsp[-1].id); ;}
Roman Zippela02f0572005-11-08 21:34:53 -08001773 break;
1774
1775 case 100:
1776
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001777 { (yyval.expr) = NULL; ;}
Roman Zippela02f0572005-11-08 21:34:53 -08001778 break;
1779
1780 case 101:
1781
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001782 { (yyval.expr) = (yyvsp[0].expr); ;}
Roman Zippela02f0572005-11-08 21:34:53 -08001783 break;
1784
1785 case 102:
1786
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001787 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
Roman Zippela02f0572005-11-08 21:34:53 -08001788 break;
1789
1790 case 103:
1791
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001792 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
Roman Zippela02f0572005-11-08 21:34:53 -08001793 break;
1794
1795 case 104:
1796
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001797 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1798 break;
1799
1800 case 105:
1801
1802 { (yyval.expr) = (yyvsp[-1].expr); ;}
1803 break;
1804
1805 case 106:
1806
1807 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1808 break;
1809
1810 case 107:
1811
1812 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1813 break;
1814
1815 case 108:
1816
1817 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1818 break;
1819
1820 case 109:
1821
1822 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1823 break;
1824
1825 case 110:
1826
Roman Zippel7a884882005-11-08 21:34:51 -08001827 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001828 break;
1829
1830
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001831 default: break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001832 }
1833
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001834/* Line 1126 of yacc.c. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001835
1836
1837 yyvsp -= yylen;
1838 yyssp -= yylen;
1839
1840
1841 YY_STACK_PRINT (yyss, yyssp);
1842
1843 *++yyvsp = yyval;
1844
1845
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. */
1849
1850 yyn = yyr1[yyn];
1851
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];
1857
1858 goto yynewstate;
1859
1860
1861/*------------------------------------.
1862| yyerrlab -- here on detecting error |
1863`------------------------------------*/
1864yyerrlab:
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];
1871
1872 if (YYPACT_NINF < yyn && yyn < YYLAST)
1873 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001874 int yytype = YYTRANSLATE (yychar);
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001875 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];
Roman Zippel7a884882005-11-08 21:34:51 -08001882 int yyx;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001883
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001884#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;
1903
Linus Torvalds1da177e2005-04-16 15:20:36 -07001904 /* Start YYX at -YYN if negative to avoid negative indexes in
1905 YYCHECK. */
Roman Zippel7a884882005-11-08 21:34:51 -08001906 int yyxbegin = yyn < 0 ? -yyn : 0;
1907
1908 /* Stay within bounds of both yycheck and yytname. */
1909 int yychecklim = YYLAST - yyn;
1910 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001911 int yycount = 1;
Roman Zippel7a884882005-11-08 21:34:51 -08001912
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001913 yyarg[0] = yytname[yytype];
1914 yyfmt = yystpcpy (yyformat, yyunexpected);
1915
Roman Zippel7a884882005-11-08 21:34:51 -08001916 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001917 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
Roman Zippel7a884882005-11-08 21:34:51 -08001918 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001919 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
Roman Zippel7a884882005-11-08 21:34:51 -08001920 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001921 yycount = 1;
1922 yysize = yysize0;
1923 yyformat[sizeof yyunexpected - 1] = '\0';
Roman Zippel7a884882005-11-08 21:34:51 -08001924 break;
1925 }
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001926 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;
Roman Zippel7a884882005-11-08 21:34:51 -08001932 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001933
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001934 yyf = YY_(yyformat);
1935 yysize1 = yysize + yystrlen (yyf);
1936 yysize_overflow |= yysize1 < yysize;
1937 yysize = yysize1;
1938
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))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001949 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001950 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 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001960 }
1961 yyerror (yymsg);
1962 YYSTACK_FREE (yymsg);
1963 }
1964 else
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001965 {
1966 yyerror (YY_("syntax error"));
1967 goto yyexhaustedlab;
1968 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001969 }
1970 else
1971#endif /* YYERROR_VERBOSE */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001972 yyerror (YY_("syntax error"));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001973 }
1974
1975
1976
1977 if (yyerrstatus == 3)
1978 {
Roman Zippel7a884882005-11-08 21:34:51 -08001979 /* If just tried and failed to reuse look-ahead token after an
Linus Torvalds1da177e2005-04-16 15:20:36 -07001980 error, discard it. */
1981
Roman Zippel7a884882005-11-08 21:34:51 -08001982 if (yychar <= YYEOF)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001983 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001984 /* Return failure if at end of input. */
Roman Zippel7a884882005-11-08 21:34:51 -08001985 if (yychar == YYEOF)
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001986 YYABORT;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001987 }
Roman Zippel7a884882005-11-08 21:34:51 -08001988 else
1989 {
1990 yydestruct ("Error: discarding", yytoken, &yylval);
1991 yychar = YYEMPTY;
1992 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001993 }
1994
Roman Zippel7a884882005-11-08 21:34:51 -08001995 /* Else will try to reuse look-ahead token after shifting the error
Linus Torvalds1da177e2005-04-16 15:20:36 -07001996 token. */
1997 goto yyerrlab1;
1998
1999
Roman Zippel7a884882005-11-08 21:34:51 -08002000/*---------------------------------------------------.
2001| yyerrorlab -- error raised explicitly by YYERROR. |
2002`---------------------------------------------------*/
2003yyerrorlab:
2004
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002005 /* Pacify compilers like GCC when the user code never invokes
2006 YYERROR and the label yyerrorlab therefore never appears in user
2007 code. */
Roman Zippel7a884882005-11-08 21:34:51 -08002008 if (0)
2009 goto yyerrorlab;
Roman Zippel7a884882005-11-08 21:34:51 -08002010
2011yyvsp -= yylen;
2012 yyssp -= yylen;
2013 yystate = *yyssp;
2014 goto yyerrlab1;
2015
2016
2017/*-------------------------------------------------------------.
2018| yyerrlab1 -- common code for both syntax error and YYERROR. |
2019`-------------------------------------------------------------*/
Linus Torvalds1da177e2005-04-16 15:20:36 -07002020yyerrlab1:
2021 yyerrstatus = 3; /* Each real token shifted decrements this. */
2022
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 }
2036
2037 /* Pop the current state because it cannot handle the error token. */
2038 if (yyssp == yyss)
2039 YYABORT;
2040
Linus Torvalds1da177e2005-04-16 15:20:36 -07002041
Roman Zippel7a884882005-11-08 21:34:51 -08002042 yydestruct ("Error: popping", yystos[yystate], yyvsp);
2043 YYPOPSTACK;
2044 yystate = *yyssp;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002045 YY_STACK_PRINT (yyss, yyssp);
2046 }
2047
2048 if (yyn == YYFINAL)
2049 YYACCEPT;
2050
Linus Torvalds1da177e2005-04-16 15:20:36 -07002051 *++yyvsp = yylval;
2052
2053
Roman Zippel7a884882005-11-08 21:34:51 -08002054 /* Shift the error token. */
2055 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2056
Linus Torvalds1da177e2005-04-16 15:20:36 -07002057 yystate = yyn;
2058 goto yynewstate;
2059
2060
2061/*-------------------------------------.
2062| yyacceptlab -- YYACCEPT comes here. |
2063`-------------------------------------*/
2064yyacceptlab:
2065 yyresult = 0;
2066 goto yyreturn;
2067
2068/*-----------------------------------.
2069| yyabortlab -- YYABORT comes here. |
2070`-----------------------------------*/
2071yyabortlab:
2072 yyresult = 1;
2073 goto yyreturn;
2074
2075#ifndef yyoverflow
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002076/*-------------------------------------------------.
2077| yyexhaustedlab -- memory exhaustion comes here. |
2078`-------------------------------------------------*/
2079yyexhaustedlab:
2080 yyerror (YY_("memory exhausted"));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002081 yyresult = 2;
2082 /* Fall through. */
2083#endif
2084
2085yyreturn:
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002086 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 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002095#ifndef yyoverflow
2096 if (yyss != yyssa)
2097 YYSTACK_FREE (yyss);
2098#endif
2099 return yyresult;
2100}
2101
2102
2103
2104
2105
2106void conf_parse(const char *name)
2107{
2108 struct symbol *sym;
2109 int i;
2110
2111 zconf_initscan(name);
2112
2113 sym_init();
2114 menu_init();
Roman Zippelface4372006-06-08 22:12:45 -07002115 modules_sym = sym_lookup(NULL, 0);
2116 modules_sym->type = S_BOOLEAN;
2117 modules_sym->flags |= SYMBOL_AUTO;
blaisorblade@yahoo.itfb7f6ff2005-07-28 17:56:25 +02002118 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002119
Roman Zippela02f0572005-11-08 21:34:53 -08002120#if YYDEBUG
2121 if (getenv("ZCONF_DEBUG"))
2122 zconfdebug = 1;
2123#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07002124 zconfparse();
2125 if (zconfnerrs)
2126 exit(1);
Roman Zippelface4372006-06-08 22:12:45 -07002127 if (!modules_sym->prop) {
2128 struct property *prop;
2129
2130 prop = prop_alloc(P_DEFAULT, modules_sym);
2131 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2132 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002133 menu_finalize(&rootmenu);
2134 for_all_symbols(i, sym) {
David Gibson3f04e7d2005-11-08 21:34:46 -08002135 sym_check_deps(sym);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002136 }
2137
2138 sym_change_count = 1;
2139}
2140
2141const char *zconf_tokenname(int token)
2142{
2143 switch (token) {
2144 case T_MENU: return "menu";
2145 case T_ENDMENU: return "endmenu";
2146 case T_CHOICE: return "choice";
2147 case T_ENDCHOICE: return "endchoice";
2148 case T_IF: return "if";
2149 case T_ENDIF: return "endif";
Roman Zippela02f0572005-11-08 21:34:53 -08002150 case T_DEPENDS: return "depends";
Linus Torvalds1da177e2005-04-16 15:20:36 -07002151 }
2152 return "<token>";
2153}
2154
Roman Zippela02f0572005-11-08 21:34:53 -08002155static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002156{
Roman Zippela02f0572005-11-08 21:34:53 -08002157 if (id->token != endtoken) {
2158 zconf_error("unexpected '%s' within %s block",
2159 kconf_id_strings + id->name, zconf_tokenname(starttoken));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002160 zconfnerrs++;
2161 return false;
2162 }
2163 if (current_menu->file != current_file) {
Roman Zippela02f0572005-11-08 21:34:53 -08002164 zconf_error("'%s' in different file than '%s'",
2165 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2166 fprintf(stderr, "%s:%d: location of the '%s'\n",
2167 current_menu->file->name, current_menu->lineno,
2168 zconf_tokenname(starttoken));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002169 zconfnerrs++;
2170 return false;
2171 }
2172 return true;
2173}
2174
2175static void zconfprint(const char *err, ...)
2176{
2177 va_list ap;
2178
Roman Zippela02f0572005-11-08 21:34:53 -08002179 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2180 va_start(ap, err);
2181 vfprintf(stderr, err, ap);
2182 va_end(ap);
2183 fprintf(stderr, "\n");
2184}
2185
2186static void zconf_error(const char *err, ...)
2187{
2188 va_list ap;
2189
2190 zconfnerrs++;
2191 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
Linus Torvalds1da177e2005-04-16 15:20:36 -07002192 va_start(ap, err);
2193 vfprintf(stderr, err, ap);
2194 va_end(ap);
2195 fprintf(stderr, "\n");
2196}
2197
2198static void zconferror(const char *err)
2199{
Roman Zippela02f0572005-11-08 21:34:53 -08002200#if YYDEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -07002201 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
Roman Zippela02f0572005-11-08 21:34:53 -08002202#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07002203}
2204
2205void print_quoted_string(FILE *out, const char *str)
2206{
2207 const char *p;
2208 int len;
2209
2210 putc('"', out);
2211 while ((p = strchr(str, '"'))) {
2212 len = p - str;
2213 if (len)
2214 fprintf(out, "%.*s", len, str);
2215 fputs("\\\"", out);
2216 str = p + 1;
2217 }
2218 fputs(str, out);
2219 putc('"', out);
2220}
2221
2222void print_symbol(FILE *out, struct menu *menu)
2223{
2224 struct symbol *sym = menu->sym;
2225 struct property *prop;
2226
2227 if (sym_is_choice(sym))
2228 fprintf(out, "choice\n");
2229 else
2230 fprintf(out, "config %s\n", sym->name);
2231 switch (sym->type) {
2232 case S_BOOLEAN:
2233 fputs(" boolean\n", out);
2234 break;
2235 case S_TRISTATE:
2236 fputs(" tristate\n", out);
2237 break;
2238 case S_STRING:
2239 fputs(" string\n", out);
2240 break;
2241 case S_INT:
2242 fputs(" integer\n", out);
2243 break;
2244 case S_HEX:
2245 fputs(" hex\n", out);
2246 break;
2247 default:
2248 fputs(" ???\n", out);
2249 break;
2250 }
2251 for (prop = sym->prop; prop; prop = prop->next) {
2252 if (prop->menu != menu)
2253 continue;
2254 switch (prop->type) {
2255 case P_PROMPT:
2256 fputs(" prompt ", out);
2257 print_quoted_string(out, prop->text);
2258 if (!expr_is_yes(prop->visible.expr)) {
2259 fputs(" if ", out);
2260 expr_fprint(prop->visible.expr, out);
2261 }
2262 fputc('\n', out);
2263 break;
2264 case P_DEFAULT:
2265 fputs( " default ", out);
2266 expr_fprint(prop->expr, out);
2267 if (!expr_is_yes(prop->visible.expr)) {
2268 fputs(" if ", out);
2269 expr_fprint(prop->visible.expr, out);
2270 }
2271 fputc('\n', out);
2272 break;
2273 case P_CHOICE:
2274 fputs(" #choice value\n", out);
2275 break;
2276 default:
2277 fprintf(out, " unknown prop %d!\n", prop->type);
2278 break;
2279 }
2280 }
2281 if (sym->help) {
2282 int len = strlen(sym->help);
2283 while (sym->help[--len] == '\n')
2284 sym->help[len] = 0;
2285 fprintf(out, " help\n%s\n", sym->help);
2286 }
2287 fputc('\n', out);
2288}
2289
2290void zconfdump(FILE *out)
2291{
2292 struct property *prop;
2293 struct symbol *sym;
2294 struct menu *menu;
2295
2296 menu = rootmenu.list;
2297 while (menu) {
2298 if ((sym = menu->sym))
2299 print_symbol(out, menu);
2300 else if ((prop = menu->prompt)) {
2301 switch (prop->type) {
2302 case P_COMMENT:
2303 fputs("\ncomment ", out);
2304 print_quoted_string(out, prop->text);
2305 fputs("\n", out);
2306 break;
2307 case P_MENU:
2308 fputs("\nmenu ", out);
2309 print_quoted_string(out, prop->text);
2310 fputs("\n", out);
2311 break;
2312 default:
2313 ;
2314 }
2315 if (!expr_is_yes(prop->visible.expr)) {
2316 fputs(" depends ", out);
2317 expr_fprint(prop->visible.expr, out);
2318 fputc('\n', out);
2319 }
2320 fputs("\n", out);
2321 }
2322
2323 if (menu->list)
2324 menu = menu->list;
2325 else if (menu->next)
2326 menu = menu->next;
2327 else while ((menu = menu->parent)) {
2328 if (menu->prompt && menu->prompt->type == P_MENU)
2329 fputs("\nendmenu\n", out);
2330 if (menu->next) {
2331 menu = menu->next;
2332 break;
2333 }
2334 }
2335 }
2336}
2337
2338#include "lex.zconf.c"
2339#include "util.c"
2340#include "confdata.c"
2341#include "expr.c"
2342#include "symbol.c"
2343#include "menu.c"
2344
2345