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