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