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