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