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