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