source: freewrt/package/config/zconf.tab.c_shipped@ 475ad56

freewrt_1_0 freewrt_2_0
Last change on this file since 475ad56 was 475ad56, checked in by Waldemar Brodkorb <wbx@…>, 20 years ago

add OpenWrt trunk revision 3830.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 56.6 KB
Line 
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
169int cdebug = PRINTD;
170
171extern int zconflex(void);
172static void zconfprint(const char *err, ...);
173static void zconferror(const char *err);
174static bool zconf_endtoken(int token, int starttoken, int endtoken);
175
176struct 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
196typedef 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. */
259union 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. */
338static 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. */
375static 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. */
391static 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. */
428static 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. */
447static 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. */
471static 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. */
482static 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. */
498static 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. */
516static 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]. */
540static 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
552static 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]. */
576static 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
590static 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
615static 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. */
642static 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) \
700do \
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 } \
714while (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) \
747do { \
748 if (yydebug) \
749 YYFPRINTF Args; \
750} while (0)
751
752# define YYDSYMPRINT(Args) \
753do { \
754 if (yydebug) \
755 yysymprint Args; \
756} while (0)
757
758# define YYDSYMPRINTF(Title, Token, Value, Location) \
759do { \
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)
775static void
776yy_stack_print (short *bottom, short *top)
777#else
778static void
779yy_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) \
791do { \
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)
802static void
803yy_reduce_print (int yyrule)
804#else
805static void
806yy_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) \
821do { \
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. */
828int 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
859
860
861#if YYERROR_VERBOSE
862
863# ifndef yystrlen
864# if defined (__GLIBC__) && defined (_STRING_H)
865# define yystrlen strlen
866# else
867/* Return the length of YYSTR. */
868static YYSIZE_T
869# if defined (__STDC__) || defined (__cplusplus)
870yystrlen (const char *yystr)
871# else
872yystrlen (yystr)
873 const char *yystr;
874# endif
875{
876 register const char *yys = yystr;
877
878 while (*yys++ != '\0')
879 continue;
880
881 return yys - yystr - 1;
882}
883# endif
884# endif
885
886# ifndef yystpcpy
887# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
888# define yystpcpy stpcpy
889# else
890/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
891 YYDEST. */
892static char *
893# if defined (__STDC__) || defined (__cplusplus)
894yystpcpy (char *yydest, const char *yysrc)
895# else
896yystpcpy (yydest, yysrc)
897 char *yydest;
898 const char *yysrc;
899# endif
900{
901 register char *yyd = yydest;
902 register const char *yys = yysrc;
903
904 while ((*yyd++ = *yys++) != '\0')
905 continue;
906
907 return yyd - 1;
908}
909# endif
910# endif
911
912#endif /* !YYERROR_VERBOSE */
913
914
915
916
917#if YYDEBUG
918/*--------------------------------.
919| Print this symbol on YYOUTPUT. |
920`--------------------------------*/
921
922#if defined (__STDC__) || defined (__cplusplus)
923static void
924yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
925#else
926static void
927yysymprint (yyoutput, yytype, yyvaluep)
928 FILE *yyoutput;
929 int yytype;
930 YYSTYPE *yyvaluep;
931#endif
932{
933 /* Pacify ``unused variable'' warnings. */
934 (void) yyvaluep;
935
936 if (yytype < YYNTOKENS)
937 {
938 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
939# ifdef YYPRINT
940 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
941# endif
942 }
943 else
944 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
945
946 switch (yytype)
947 {
948 default:
949 break;
950 }
951 YYFPRINTF (yyoutput, ")");
952}
953
954#endif /* ! YYDEBUG */
955/*-----------------------------------------------.
956| Release the memory associated to this symbol. |
957`-----------------------------------------------*/
958
959#if defined (__STDC__) || defined (__cplusplus)
960static void
961yydestruct (int yytype, YYSTYPE *yyvaluep)
962#else
963static void
964yydestruct (yytype, yyvaluep)
965 int yytype;
966 YYSTYPE *yyvaluep;
967#endif
968{
969 /* Pacify ``unused variable'' warnings. */
970 (void) yyvaluep;
971
972 switch (yytype)
973 {
974
975 default:
976 break;
977 }
978}
979
980
981
982/* Prevent warnings from -Wmissing-prototypes. */
983
984#ifdef YYPARSE_PARAM
985# if defined (__STDC__) || defined (__cplusplus)
986int yyparse (void *YYPARSE_PARAM);
987# else
988int yyparse ();
989# endif
990#else /* ! YYPARSE_PARAM */
991#if defined (__STDC__) || defined (__cplusplus)
992int yyparse (void);
993#else
994int yyparse ();
995#endif
996#endif /* ! YYPARSE_PARAM */
997
998
999
1000/* The lookahead symbol. */
1001int yychar;
1002
1003/* The semantic value of the lookahead symbol. */
1004YYSTYPE yylval;
1005
1006/* Number of syntax errors so far. */
1007int yynerrs;
1008
1009
1010
1011/*----------.
1012| yyparse. |
1013`----------*/
1014
1015#ifdef YYPARSE_PARAM
1016# if defined (__STDC__) || defined (__cplusplus)
1017int yyparse (void *YYPARSE_PARAM)
1018# else
1019int yyparse (YYPARSE_PARAM)
1020 void *YYPARSE_PARAM;
1021# endif
1022#else /* ! YYPARSE_PARAM */
1023#if defined (__STDC__) || defined (__cplusplus)
1024int
1025yyparse (void)
1026#else
1027int
1028yyparse ()
1029
1030#endif
1031#endif
1032{
1033
1034 register int yystate;
1035 register int yyn;
1036 int yyresult;
1037 /* Number of tokens to shift before error messages enabled. */
1038 int yyerrstatus;
1039 /* Lookahead token as an internal (translated) token number. */
1040 int yytoken = 0;
1041
1042 /* Three stacks and their tools:
1043 `yyss': related to states,
1044 `yyvs': related to semantic values,
1045 `yyls': related to locations.
1046
1047 Refer to the stacks thru separate pointers, to allow yyoverflow
1048 to reallocate them elsewhere. */
1049
1050 /* The state stack. */
1051 short yyssa[YYINITDEPTH];
1052 short *yyss = yyssa;
1053 register short *yyssp;
1054
1055 /* The semantic value stack. */
1056 YYSTYPE yyvsa[YYINITDEPTH];
1057 YYSTYPE *yyvs = yyvsa;
1058 register YYSTYPE *yyvsp;
1059
1060
1061
1062#define YYPOPSTACK (yyvsp--, yyssp--)
1063
1064 YYSIZE_T yystacksize = YYINITDEPTH;
1065
1066 /* The variables used to return semantic value and location from the
1067 action routines. */
1068 YYSTYPE yyval;
1069
1070
1071 /* When reducing, the number of symbols on the RHS of the reduced
1072 rule. */
1073 int yylen;
1074
1075 YYDPRINTF ((stderr, "Starting parse\n"));
1076
1077 yystate = 0;
1078 yyerrstatus = 0;
1079 yynerrs = 0;
1080 yychar = YYEMPTY; /* Cause a token to be read. */
1081
1082 /* Initialize stack pointers.
1083 Waste one element of value and location stack
1084 so that they stay on the same level as the state stack.
1085 The wasted elements are never initialized. */
1086
1087 yyssp = yyss;
1088 yyvsp = yyvs;
1089
1090 goto yysetstate;
1091
1092/*------------------------------------------------------------.
1093| yynewstate -- Push a new state, which is found in yystate. |
1094`------------------------------------------------------------*/
1095 yynewstate:
1096 /* In all cases, when you get here, the value and location stacks
1097 have just been pushed. so pushing a state here evens the stacks.
1098 */
1099 yyssp++;
1100
1101 yysetstate:
1102 *yyssp = yystate;
1103
1104 if (yyss + yystacksize - 1 <= yyssp)
1105 {
1106 /* Get the current used size of the three stacks, in elements. */
1107 YYSIZE_T yysize = yyssp - yyss + 1;
1108
1109#ifdef yyoverflow
1110 {
1111 /* Give user a chance to reallocate the stack. Use copies of
1112 these so that the &'s don't force the real ones into
1113 memory. */
1114 YYSTYPE *yyvs1 = yyvs;
1115 short *yyss1 = yyss;
1116
1117
1118 /* Each stack pointer address is followed by the size of the
1119 data in use in that stack, in bytes. This used to be a
1120 conditional around just the two extra args, but that might
1121 be undefined if yyoverflow is a macro. */
1122 yyoverflow ("parser stack overflow",
1123 &yyss1, yysize * sizeof (*yyssp),
1124 &yyvs1, yysize * sizeof (*yyvsp),
1125
1126 &yystacksize);
1127
1128 yyss = yyss1;
1129 yyvs = yyvs1;
1130 }
1131#else /* no yyoverflow */
1132# ifndef YYSTACK_RELOCATE
1133 goto yyoverflowlab;
1134# else
1135 /* Extend the stack our own way. */
1136 if (YYMAXDEPTH <= yystacksize)
1137 goto yyoverflowlab;
1138 yystacksize *= 2;
1139 if (YYMAXDEPTH < yystacksize)
1140 yystacksize = YYMAXDEPTH;
1141
1142 {
1143 short *yyss1 = yyss;
1144 union yyalloc *yyptr =
1145 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1146 if (! yyptr)
1147 goto yyoverflowlab;
1148 YYSTACK_RELOCATE (yyss);
1149 YYSTACK_RELOCATE (yyvs);
1150
1151# undef YYSTACK_RELOCATE
1152 if (yyss1 != yyssa)
1153 YYSTACK_FREE (yyss1);
1154 }
1155# endif
1156#endif /* no yyoverflow */
1157
1158 yyssp = yyss + yysize - 1;
1159 yyvsp = yyvs + yysize - 1;
1160
1161
1162 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1163 (unsigned long int) yystacksize));
1164
1165 if (yyss + yystacksize - 1 <= yyssp)
1166 YYABORT;
1167 }
1168
1169 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1170
1171 goto yybackup;
1172
1173/*-----------.
1174| yybackup. |
1175`-----------*/
1176yybackup:
1177
1178/* Do appropriate processing given the current state. */
1179/* Read a lookahead token if we need one and don't already have one. */
1180/* yyresume: */
1181
1182 /* First try to decide what to do without reference to lookahead token. */
1183
1184 yyn = yypact[yystate];
1185 if (yyn == YYPACT_NINF)
1186 goto yydefault;
1187
1188 /* Not known => get a lookahead token if don't already have one. */
1189
1190 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1191 if (yychar == YYEMPTY)
1192 {
1193 YYDPRINTF ((stderr, "Reading a token: "));
1194 yychar = YYLEX;
1195 }
1196
1197 if (yychar <= YYEOF)
1198 {
1199 yychar = yytoken = YYEOF;
1200 YYDPRINTF ((stderr, "Now at end of input.\n"));
1201 }
1202 else
1203 {
1204 yytoken = YYTRANSLATE (yychar);
1205 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1206 }
1207
1208 /* If the proper action on seeing token YYTOKEN is to reduce or to
1209 detect an error, take that action. */
1210 yyn += yytoken;
1211 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1212 goto yydefault;
1213 yyn = yytable[yyn];
1214 if (yyn <= 0)
1215 {
1216 if (yyn == 0 || yyn == YYTABLE_NINF)
1217 goto yyerrlab;
1218 yyn = -yyn;
1219 goto yyreduce;
1220 }
1221
1222 if (yyn == YYFINAL)
1223 YYACCEPT;
1224
1225 /* Shift the lookahead token. */
1226 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1227
1228 /* Discard the token being shifted unless it is eof. */
1229 if (yychar != YYEOF)
1230 yychar = YYEMPTY;
1231
1232 *++yyvsp = yylval;
1233
1234
1235 /* Count tokens shifted since error; after three, turn off error
1236 status. */
1237 if (yyerrstatus)
1238 yyerrstatus--;
1239
1240 yystate = yyn;
1241 goto yynewstate;
1242
1243
1244/*-----------------------------------------------------------.
1245| yydefault -- do the default action for the current state. |
1246`-----------------------------------------------------------*/
1247yydefault:
1248 yyn = yydefact[yystate];
1249 if (yyn == 0)
1250 goto yyerrlab;
1251 goto yyreduce;
1252
1253
1254/*-----------------------------.
1255| yyreduce -- Do a reduction. |
1256`-----------------------------*/
1257yyreduce:
1258 /* yyn is the number of a rule to reduce with. */
1259 yylen = yyr2[yyn];
1260
1261 /* If YYLEN is nonzero, implement the default value of the action:
1262 `$$ = $1'.
1263
1264 Otherwise, the following line sets YYVAL to garbage.
1265 This behavior is undocumented and Bison
1266 users should not rely upon it. Assigning to YYVAL
1267 unconditionally makes the parser a bit smaller, and it avoids a
1268 GCC warning that YYVAL may be used uninitialized. */
1269 yyval = yyvsp[1-yylen];
1270
1271
1272 YY_REDUCE_PRINT (yyn);
1273 switch (yyn)
1274 {
1275 case 8:
1276
1277 { zconfprint("unexpected 'endmenu' statement"); ;}
1278 break;
1279
1280 case 9:
1281
1282 { zconfprint("unexpected 'endif' statement"); ;}
1283 break;
1284
1285 case 10:
1286
1287 { zconfprint("unexpected 'endchoice' statement"); ;}
1288 break;
1289
1290 case 11:
1291
1292 { zconfprint("syntax error"); yyerrok; ;}
1293 break;
1294
1295 case 18:
1296
1297 {
1298 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1299 sym->flags |= SYMBOL_OPTIONAL;
1300 menu_add_entry(sym);
1301 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1302;}
1303 break;
1304
1305 case 19:
1306
1307 {
1308 menu_end_entry();
1309 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1310;}
1311 break;
1312
1313 case 20:
1314
1315 {
1316 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
1317 sym->flags |= SYMBOL_OPTIONAL;
1318 menu_add_entry(sym);
1319 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1320;}
1321 break;
1322
1323 case 21:
1324
1325 {
1326 if (current_entry->prompt)
1327 current_entry->prompt->type = P_MENU;
1328 else
1329 zconfprint("warning: menuconfig statement without prompt");
1330 menu_end_entry();
1331 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1332;}
1333 break;
1334
1335 case 27:
1336
1337 {
1338 menu_set_type(S_TRISTATE);
1339 printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
1340;}
1341 break;
1342
1343 case 28:
1344
1345 {
1346 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
1347 menu_set_type(S_TRISTATE);
1348 printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
1349;}
1350 break;
1351
1352 case 29:
1353
1354 {
1355 menu_set_type(S_BOOLEAN);
1356 printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
1357;}
1358 break;
1359
1360 case 30:
1361
1362 {
1363 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
1364 menu_set_type(S_BOOLEAN);
1365 printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
1366;}
1367 break;
1368
1369 case 31:
1370
1371 {
1372 menu_set_type(S_INT);
1373 printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno());
1374;}
1375 break;
1376
1377 case 32:
1378
1379 {
1380 menu_set_type(S_HEX);
1381 printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno());
1382;}
1383 break;
1384
1385 case 33:
1386
1387 {
1388 menu_set_type(S_STRING);
1389 printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno());
1390;}
1391 break;
1392
1393 case 34:
1394
1395 {
1396 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1397 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1398;}
1399 break;
1400
1401 case 35:
1402
1403 {
1404 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
1405 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
1406;}
1407 break;
1408
1409 case 36:
1410
1411 {
1412 menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1413 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1414;}
1415 break;
1416
1417 case 37:
1418
1419 {
1420 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr);
1421 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1422;}
1423 break;
1424
1425 case 38:
1426
1427 {
1428 struct symbol *sym = sym_lookup(NULL, 0);
1429 sym->flags |= SYMBOL_CHOICE;
1430 menu_add_entry(sym);
1431 menu_add_expr(P_CHOICE, NULL, NULL);
1432 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1433;}
1434 break;
1435
1436 case 39:
1437
1438 {
1439 menu_end_entry();
1440 menu_add_menu();
1441;}
1442 break;
1443
1444 case 40:
1445
1446 {
1447 if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) {
1448 menu_end_menu();
1449 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1450 }
1451;}
1452 break;
1453
1454 case 42:
1455
1456 {
1457 printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
1458 zconfnerrs++;
1459;}
1460 break;
1461
1462 case 48:
1463
1464 {
1465 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
1466 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1467;}
1468 break;
1469
1470 case 49:
1471
1472 {
1473 menu_set_type(S_TRISTATE);
1474 printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
1475;}
1476 break;
1477
1478 case 50:
1479
1480 {
1481 menu_set_type(S_BOOLEAN);
1482 printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
1483;}
1484 break;
1485
1486 case 51:
1487
1488 {
1489 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1490 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1491;}
1492 break;
1493
1494 case 52:
1495
1496 {
1497 menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
1498 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
1499;}
1500 break;
1501
1502 case 55:
1503
1504 {
1505 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1506 menu_add_entry(NULL);
1507 menu_add_dep(yyvsp[-1].expr);
1508 menu_end_entry();
1509 menu_add_menu();
1510;}
1511 break;
1512
1513 case 56:
1514
1515 {
1516 if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) {
1517 menu_end_menu();
1518 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1519 }
1520;}
1521 break;
1522
1523 case 58:
1524
1525 {
1526 printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
1527 zconfnerrs++;
1528;}
1529 break;
1530
1531 case 63:
1532
1533 {
1534 menu_add_entry(NULL);
1535 menu_add_prop(P_MENU, yyvsp[-1].string, NULL, NULL);
1536 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1537;}
1538 break;
1539
1540 case 64:
1541
1542 {
1543 menu_end_entry();
1544 menu_add_menu();
1545;}
1546 break;
1547
1548 case 65:
1549
1550 {
1551 if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) {
1552 menu_end_menu();
1553 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1554 }
1555;}
1556 break;
1557
1558 case 67:
1559
1560 {
1561 printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
1562 zconfnerrs++;
1563;}
1564 break;
1565
1566 case 72:
1567
1568 { zconfprint("invalid menu option"); yyerrok; ;}
1569 break;
1570
1571 case 73:
1572
1573 {
1574 yyval.string = yyvsp[-1].string;
1575 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
1576;}
1577 break;
1578
1579 case 74:
1580
1581 {
1582 zconf_nextfile(yyvsp[0].string);
1583;}
1584 break;
1585
1586 case 75:
1587
1588 {
1589 menu_add_entry(NULL);
1590 menu_add_prop(P_COMMENT, yyvsp[-1].string, NULL, NULL);
1591 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1592;}
1593 break;
1594
1595 case 76:
1596
1597 {
1598 menu_end_entry();
1599;}
1600 break;
1601
1602 case 77:
1603
1604 {
1605 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1606 zconf_starthelp();
1607;}
1608 break;
1609
1610 case 78:
1611
1612 {
1613 current_entry->sym->help = yyvsp[0].string;
1614;}
1615 break;
1616
1617 case 82:
1618
1619 {
1620 menu_add_dep(yyvsp[-1].expr);
1621 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1622;}
1623 break;
1624
1625 case 83:
1626
1627 {
1628 menu_add_dep(yyvsp[-1].expr);
1629 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1630;}
1631 break;
1632
1633 case 84:
1634
1635 {
1636 menu_add_dep(yyvsp[-1].expr);
1637 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1638;}
1639 break;
1640
1641 case 86:
1642
1643 {
1644 menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
1645;}
1646 break;
1647
1648 case 89:
1649
1650 { yyval.token = T_ENDMENU; ;}
1651 break;
1652
1653 case 90:
1654
1655 { yyval.token = T_ENDCHOICE; ;}
1656 break;
1657
1658 case 91:
1659
1660 { yyval.token = T_ENDIF; ;}
1661 break;
1662
1663 case 94:
1664
1665 { yyval.expr = NULL; ;}
1666 break;
1667
1668 case 95:
1669
1670 { yyval.expr = yyvsp[0].expr; ;}
1671 break;
1672
1673 case 96:
1674
1675 { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;}
1676 break;
1677
1678 case 97:
1679
1680 { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1681 break;
1682
1683 case 98:
1684
1685 { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
1686 break;
1687
1688 case 99:
1689
1690 { yyval.expr = yyvsp[-1].expr; ;}
1691 break;
1692
1693 case 100:
1694
1695 { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;}
1696 break;
1697
1698 case 101:
1699
1700 { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;}
1701 break;
1702
1703 case 102:
1704
1705 { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;}
1706 break;
1707
1708 case 103:
1709
1710 { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;}
1711 break;
1712
1713 case 104:
1714
1715 { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;}
1716 break;
1717
1718
1719 }
1720
1721/* Line 999 of yacc.c. */
1722
1723
1724
1725 yyvsp -= yylen;
1726 yyssp -= yylen;
1727
1728
1729 YY_STACK_PRINT (yyss, yyssp);
1730
1731 *++yyvsp = yyval;
1732
1733
1734 /* Now `shift' the result of the reduction. Determine what state
1735 that goes to, based on the state we popped back to and the rule
1736 number reduced by. */
1737
1738 yyn = yyr1[yyn];
1739
1740 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1741 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1742 yystate = yytable[yystate];
1743 else
1744 yystate = yydefgoto[yyn - YYNTOKENS];
1745
1746 goto yynewstate;
1747
1748
1749/*------------------------------------.
1750| yyerrlab -- here on detecting error |
1751`------------------------------------*/
1752yyerrlab:
1753 /* If not already recovering from an error, report this error. */
1754 if (!yyerrstatus)
1755 {
1756 ++yynerrs;
1757#if YYERROR_VERBOSE
1758 yyn = yypact[yystate];
1759
1760 if (YYPACT_NINF < yyn && yyn < YYLAST)
1761 {
1762 YYSIZE_T yysize = 0;
1763 int yytype = YYTRANSLATE (yychar);
1764 char *yymsg;
1765 int yyx, yycount;
1766
1767 yycount = 0;
1768 /* Start YYX at -YYN if negative to avoid negative indexes in
1769 YYCHECK. */
1770 for (yyx = yyn < 0 ? -yyn : 0;
1771 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1772 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1773 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1774 yysize += yystrlen ("syntax error, unexpected ") + 1;
1775 yysize += yystrlen (yytname[yytype]);
1776 yymsg = (char *) YYSTACK_ALLOC (yysize);
1777 if (yymsg != 0)
1778 {
1779 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1780 yyp = yystpcpy (yyp, yytname[yytype]);
1781
1782 if (yycount < 5)
1783 {
1784 yycount = 0;
1785 for (yyx = yyn < 0 ? -yyn : 0;
1786 yyx < (int) (sizeof (yytname) / sizeof (char *));
1787 yyx++)
1788 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1789 {
1790 const char *yyq = ! yycount ? ", expecting " : " or ";
1791 yyp = yystpcpy (yyp, yyq);
1792 yyp = yystpcpy (yyp, yytname[yyx]);
1793 yycount++;
1794 }
1795 }
1796 yyerror (yymsg);
1797 YYSTACK_FREE (yymsg);
1798 }
1799 else
1800 yyerror ("syntax error; also virtual memory exhausted");
1801 }
1802 else
1803#endif /* YYERROR_VERBOSE */
1804 yyerror ("syntax error");
1805 }
1806
1807
1808
1809 if (yyerrstatus == 3)
1810 {
1811 /* If just tried and failed to reuse lookahead token after an
1812 error, discard it. */
1813
1814 /* Return failure if at end of input. */
1815 if (yychar == YYEOF)
1816 {
1817 /* Pop the error token. */
1818 YYPOPSTACK;
1819 /* Pop the rest of the stack. */
1820 while (yyss < yyssp)
1821 {
1822 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1823 yydestruct (yystos[*yyssp], yyvsp);
1824 YYPOPSTACK;
1825 }
1826 YYABORT;
1827 }
1828
1829 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1830 yydestruct (yytoken, &yylval);
1831 yychar = YYEMPTY;
1832
1833 }
1834
1835 /* Else will try to reuse lookahead token after shifting the error
1836 token. */
1837 goto yyerrlab1;
1838
1839
1840/*----------------------------------------------------.
1841| yyerrlab1 -- error raised explicitly by an action. |
1842`----------------------------------------------------*/
1843yyerrlab1:
1844 yyerrstatus = 3; /* Each real token shifted decrements this. */
1845
1846 for (;;)
1847 {
1848 yyn = yypact[yystate];
1849 if (yyn != YYPACT_NINF)
1850 {
1851 yyn += YYTERROR;
1852 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1853 {
1854 yyn = yytable[yyn];
1855 if (0 < yyn)
1856 break;
1857 }
1858 }
1859
1860 /* Pop the current state because it cannot handle the error token. */
1861 if (yyssp == yyss)
1862 YYABORT;
1863
1864 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1865 yydestruct (yystos[yystate], yyvsp);
1866 yyvsp--;
1867 yystate = *--yyssp;
1868
1869 YY_STACK_PRINT (yyss, yyssp);
1870 }
1871
1872 if (yyn == YYFINAL)
1873 YYACCEPT;
1874
1875 YYDPRINTF ((stderr, "Shifting error token, "));
1876
1877 *++yyvsp = yylval;
1878
1879
1880 yystate = yyn;
1881 goto yynewstate;
1882
1883
1884/*-------------------------------------.
1885| yyacceptlab -- YYACCEPT comes here. |
1886`-------------------------------------*/
1887yyacceptlab:
1888 yyresult = 0;
1889 goto yyreturn;
1890
1891/*-----------------------------------.
1892| yyabortlab -- YYABORT comes here. |
1893`-----------------------------------*/
1894yyabortlab:
1895 yyresult = 1;
1896 goto yyreturn;
1897
1898#ifndef yyoverflow
1899/*----------------------------------------------.
1900| yyoverflowlab -- parser overflow comes here. |
1901`----------------------------------------------*/
1902yyoverflowlab:
1903 yyerror ("parser stack overflow");
1904 yyresult = 2;
1905 /* Fall through. */
1906#endif
1907
1908yyreturn:
1909#ifndef yyoverflow
1910 if (yyss != yyssa)
1911 YYSTACK_FREE (yyss);
1912#endif
1913 return yyresult;
1914}
1915
1916
1917
1918
1919
1920void conf_parse(const char *name)
1921{
1922 struct symbol *sym;
1923 int i;
1924
1925 zconf_initscan(name);
1926
1927 sym_init();
1928 menu_init();
1929 modules_sym = sym_lookup("MODULES", 0);
1930 rootmenu.prompt = menu_add_prop(P_MENU, "Buildroot Configuration", NULL, NULL);
1931
1932 //zconfdebug = 1;
1933 zconfparse();
1934 if (zconfnerrs)
1935 exit(1);
1936 menu_finalize(&rootmenu);
1937 for_all_symbols(i, sym) {
1938 if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym))
1939 printf("\n");
1940 else
1941 sym->flags |= SYMBOL_CHECK_DONE;
1942 }
1943
1944 sym_change_count = 1;
1945}
1946
1947const char *zconf_tokenname(int token)
1948{
1949 switch (token) {
1950 case T_MENU: return "menu";
1951 case T_ENDMENU: return "endmenu";
1952 case T_CHOICE: return "choice";
1953 case T_ENDCHOICE: return "endchoice";
1954 case T_IF: return "if";
1955 case T_ENDIF: return "endif";
1956 }
1957 return "<token>";
1958}
1959
1960static bool zconf_endtoken(int token, int starttoken, int endtoken)
1961{
1962 if (token != endtoken) {
1963 zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken));
1964 zconfnerrs++;
1965 return false;
1966 }
1967 if (current_menu->file != current_file) {
1968 zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken));
1969 zconfprint("location of the '%s'", zconf_tokenname(starttoken));
1970 zconfnerrs++;
1971 return false;
1972 }
1973 return true;
1974}
1975
1976static void zconfprint(const char *err, ...)
1977{
1978 va_list ap;
1979
1980 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1);
1981 va_start(ap, err);
1982 vfprintf(stderr, err, ap);
1983 va_end(ap);
1984 fprintf(stderr, "\n");
1985}
1986
1987static void zconferror(const char *err)
1988{
1989 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
1990}
1991
1992void print_quoted_string(FILE *out, const char *str)
1993{
1994 const char *p;
1995 int len;
1996
1997 putc('"', out);
1998 while ((p = strchr(str, '"'))) {
1999 len = p - str;
2000 if (len)
2001 fprintf(out, "%.*s", len, str);
2002 fputs("\\\"", out);
2003 str = p + 1;
2004 }
2005 fputs(str, out);
2006 putc('"', out);
2007}
2008
2009void print_symbol(FILE *out, struct menu *menu)
2010{
2011 struct symbol *sym = menu->sym;
2012 struct property *prop;
2013
2014 if (sym_is_choice(sym))
2015 fprintf(out, "choice\n");
2016 else
2017 fprintf(out, "config %s\n", sym->name);
2018 switch (sym->type) {
2019 case S_BOOLEAN:
2020 fputs(" boolean\n", out);
2021 break;
2022 case S_TRISTATE:
2023 fputs(" tristate\n", out);
2024 break;
2025 case S_STRING:
2026 fputs(" string\n", out);
2027 break;
2028 case S_INT:
2029 fputs(" integer\n", out);
2030 break;
2031 case S_HEX:
2032 fputs(" hex\n", out);
2033 break;
2034 default:
2035 fputs(" ???\n", out);
2036 break;
2037 }
2038 for (prop = sym->prop; prop; prop = prop->next) {
2039 if (prop->menu != menu)
2040 continue;
2041 switch (prop->type) {
2042 case P_PROMPT:
2043 fputs(" prompt ", out);
2044 print_quoted_string(out, prop->text);
2045 if (!expr_is_yes(prop->visible.expr)) {
2046 fputs(" if ", out);
2047 expr_fprint(prop->visible.expr, out);
2048 }
2049 fputc('\n', out);
2050 break;
2051 case P_DEFAULT:
2052 fputs( " default ", out);
2053 expr_fprint(prop->expr, out);
2054 if (!expr_is_yes(prop->visible.expr)) {
2055 fputs(" if ", out);
2056 expr_fprint(prop->visible.expr, out);
2057 }
2058 fputc('\n', out);
2059 break;
2060 case P_CHOICE:
2061 fputs(" #choice value\n", out);
2062 break;
2063 default:
2064 fprintf(out, " unknown prop %d!\n", prop->type);
2065 break;
2066 }
2067 }
2068 if (sym->help) {
2069 int len = strlen(sym->help);
2070 while (sym->help[--len] == '\n')
2071 sym->help[len] = 0;
2072 fprintf(out, " help\n%s\n", sym->help);
2073 }
2074 fputc('\n', out);
2075}
2076
2077void zconfdump(FILE *out)
2078{
2079 struct property *prop;
2080 struct symbol *sym;
2081 struct menu *menu;
2082
2083 menu = rootmenu.list;
2084 while (menu) {
2085 if ((sym = menu->sym))
2086 print_symbol(out, menu);
2087 else if ((prop = menu->prompt)) {
2088 switch (prop->type) {
2089 case P_COMMENT:
2090 fputs("\ncomment ", out);
2091 print_quoted_string(out, prop->text);
2092 fputs("\n", out);
2093 break;
2094 case P_MENU:
2095 fputs("\nmenu ", out);
2096 print_quoted_string(out, prop->text);
2097 fputs("\n", out);
2098 break;
2099 default:
2100 ;
2101 }
2102 if (!expr_is_yes(prop->visible.expr)) {
2103 fputs(" depends ", out);
2104 expr_fprint(prop->visible.expr, out);
2105 fputc('\n', out);
2106 }
2107 fputs("\n", out);
2108 }
2109
2110 if (menu->list)
2111 menu = menu->list;
2112 else if (menu->next)
2113 menu = menu->next;
2114 else while ((menu = menu->parent)) {
2115 if (menu->prompt && menu->prompt->type == P_MENU)
2116 fputs("\nendmenu\n", out);
2117 if (menu->next) {
2118 menu = menu->next;
2119 break;
2120 }
2121 }
2122 }
2123}
2124
2125#include "lex.zconf.c"
2126#include "confdata.c"
2127#include "expr.c"
2128#include "symbol.c"
2129#include "menu.c"
2130
2131
Note: See TracBrowser for help on using the repository browser.