blob: 069a71b1f98cfb3bd535010bab2cae8beb11cd09 [file] [log] [blame]
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001/* A Bison parser, made by GNU Bison 2.7. */
Patrick Georgi0588d192009-08-12 15:00:51 +00002
Patrick Georgid5208402014-04-11 20:24:06 +02003/* Bison implementation for Yacc-like parsers in C
4
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02005 Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
Patrick Georgid5208402014-04-11 20:24:06 +02006
7 This program is free software: you can redistribute it and/or modify
Patrick Georgi0588d192009-08-12 15:00:51 +00008 it under the terms of the GNU General Public License as published by
Patrick Georgid5208402014-04-11 20:24:06 +02009 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
Patrick Georgi0588d192009-08-12 15:00:51 +000012 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
Patrick Georgid5208402014-04-11 20:24:06 +020016
Patrick Georgi0588d192009-08-12 15:00:51 +000017 You should have received a copy of the GNU General Public License
Patrick Georgid5208402014-04-11 20:24:06 +020018 along with this program. If not, see <http://www.gnu.org/licenses/>. */
Patrick Georgi0588d192009-08-12 15:00:51 +000019
20/* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
Patrick Georgid5208402014-04-11 20:24:06 +020029
Patrick Georgi0588d192009-08-12 15:00:51 +000030 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33/* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36/* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43/* Identify Bison output. */
44#define YYBISON 1
45
46/* Bison version. */
Stefan Reinauerf78a09b2015-04-03 20:01:38 +020047#define YYBISON_VERSION "2.7"
Patrick Georgi0588d192009-08-12 15:00:51 +000048
49/* Skeleton name. */
50#define YYSKELETON_NAME "yacc.c"
51
52/* Pure parsers. */
53#define YYPURE 0
54
Patrick Georgid5208402014-04-11 20:24:06 +020055/* Push parsers. */
56#define YYPUSH 0
57
58/* Pull parsers. */
59#define YYPULL 1
60
Patrick Georgi0588d192009-08-12 15:00:51 +000061
62/* Substitute the variable and function names. */
Patrick Georgid5208402014-04-11 20:24:06 +020063#define yyparse zconfparse
64#define yylex zconflex
65#define yyerror zconferror
66#define yylval zconflval
67#define yychar zconfchar
68#define yydebug zconfdebug
69#define yynerrs zconfnerrs
70
Patrick Georgid5208402014-04-11 20:24:06 +020071/* Copy the first part of user declarations. */
72
73
74/*
75 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
76 * Released under the terms of the GNU GPL v2.0.
77 */
78
79#include <ctype.h>
80#include <stdarg.h>
81#include <stdio.h>
82#include <stdlib.h>
83#include <string.h>
84#include <stdbool.h>
85
86#include "lkc.h"
87
88#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
89
90#define PRINTD 0x0001
91#define DEBUG_PARSE 0x0002
92
93int cdebug = PRINTD;
94
95extern int zconflex(void);
96static void zconfprint(const char *err, ...);
97static void zconf_error(const char *err, ...);
98static void zconferror(const char *err);
99static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
100
101struct symbol *symbol_hash[SYMBOL_HASHSIZE];
102
103static struct menu *current_menu, *current_entry;
104
105
106
107
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200108# ifndef YY_NULL
109# if defined __cplusplus && 201103L <= __cplusplus
110# define YY_NULL nullptr
111# else
112# define YY_NULL 0
113# endif
114# endif
Patrick Georgid5208402014-04-11 20:24:06 +0200115
116/* Enabling verbose error messages. */
117#ifdef YYERROR_VERBOSE
118# undef YYERROR_VERBOSE
119# define YYERROR_VERBOSE 1
120#else
121# define YYERROR_VERBOSE 0
122#endif
123
Patrick Georgi0588d192009-08-12 15:00:51 +0000124
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200125/* Enabling traces. */
126#ifndef YYDEBUG
127# define YYDEBUG 1
128#endif
129#if YYDEBUG
130extern int zconfdebug;
131#endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000132
133/* Tokens. */
134#ifndef YYTOKENTYPE
135# define YYTOKENTYPE
136 /* Put the tokens into the symbol table, so that GDB and other debuggers
137 know about them. */
138 enum yytokentype {
139 T_MAINMENU = 258,
140 T_MENU = 259,
141 T_ENDMENU = 260,
142 T_SOURCE = 261,
143 T_CHOICE = 262,
144 T_ENDCHOICE = 263,
145 T_COMMENT = 264,
146 T_CONFIG = 265,
147 T_MENUCONFIG = 266,
148 T_HELP = 267,
149 T_HELPTEXT = 268,
150 T_IF = 269,
151 T_ENDIF = 270,
152 T_DEPENDS = 271,
153 T_OPTIONAL = 272,
154 T_PROMPT = 273,
155 T_TYPE = 274,
156 T_DEFAULT = 275,
157 T_SELECT = 276,
158 T_RANGE = 277,
Patrick Georgid5208402014-04-11 20:24:06 +0200159 T_VISIBLE = 278,
160 T_OPTION = 279,
161 T_ON = 280,
162 T_WORD = 281,
163 T_WORD_QUOTE = 282,
164 T_UNEQUAL = 283,
165 T_CLOSE_PAREN = 284,
166 T_OPEN_PAREN = 285,
167 T_EOL = 286,
168 T_OR = 287,
169 T_AND = 288,
170 T_EQUAL = 289,
171 T_NOT = 290
Patrick Georgi0588d192009-08-12 15:00:51 +0000172 };
173#endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000174
175
Patrick Georgi0588d192009-08-12 15:00:51 +0000176#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
177typedef union YYSTYPE
Patrick Georgi0588d192009-08-12 15:00:51 +0000178{
Patrick Georgid5208402014-04-11 20:24:06 +0200179
180
Patrick Georgi0588d192009-08-12 15:00:51 +0000181 char *string;
182 struct file *file;
183 struct symbol *symbol;
184 struct expr *expr;
185 struct menu *menu;
Patrick Georgid5208402014-04-11 20:24:06 +0200186 const struct kconf_id *id;
Patrick Georgi0588d192009-08-12 15:00:51 +0000187
Patrick Georgid5208402014-04-11 20:24:06 +0200188
189
190} YYSTYPE;
191# define YYSTYPE_IS_TRIVIAL 1
Patrick Georgi0588d192009-08-12 15:00:51 +0000192# define yystype YYSTYPE /* obsolescent; will be withdrawn */
193# define YYSTYPE_IS_DECLARED 1
Patrick Georgi0588d192009-08-12 15:00:51 +0000194#endif
195
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200196extern YYSTYPE zconflval;
197
198#ifdef YYPARSE_PARAM
199#if defined __STDC__ || defined __cplusplus
200int zconfparse (void *YYPARSE_PARAM);
201#else
202int zconfparse ();
203#endif
204#else /* ! YYPARSE_PARAM */
205#if defined __STDC__ || defined __cplusplus
206int zconfparse (void);
207#else
208int zconfparse ();
209#endif
210#endif /* ! YYPARSE_PARAM */
211
212
Patrick Georgi0588d192009-08-12 15:00:51 +0000213
Patrick Georgi0588d192009-08-12 15:00:51 +0000214/* Copy the second part of user declarations. */
215
216
Patrick Georgid5208402014-04-11 20:24:06 +0200217/* Include zconf.hash.c here so it can see the token constants. */
218#include "zconf.hash.c"
219
Patrick Georgi0588d192009-08-12 15:00:51 +0000220
221
222#ifdef short
223# undef short
224#endif
225
226#ifdef YYTYPE_UINT8
227typedef YYTYPE_UINT8 yytype_uint8;
228#else
229typedef unsigned char yytype_uint8;
230#endif
231
232#ifdef YYTYPE_INT8
233typedef YYTYPE_INT8 yytype_int8;
234#elif (defined __STDC__ || defined __C99__FUNC__ \
235 || defined __cplusplus || defined _MSC_VER)
236typedef signed char yytype_int8;
237#else
238typedef short int yytype_int8;
239#endif
240
241#ifdef YYTYPE_UINT16
242typedef YYTYPE_UINT16 yytype_uint16;
243#else
244typedef unsigned short int yytype_uint16;
245#endif
246
247#ifdef YYTYPE_INT16
248typedef YYTYPE_INT16 yytype_int16;
249#else
250typedef short int yytype_int16;
251#endif
252
253#ifndef YYSIZE_T
254# ifdef __SIZE_TYPE__
255# define YYSIZE_T __SIZE_TYPE__
256# elif defined size_t
257# define YYSIZE_T size_t
258# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
259 || defined __cplusplus || defined _MSC_VER)
260# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
261# define YYSIZE_T size_t
262# else
263# define YYSIZE_T unsigned int
264# endif
265#endif
266
267#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
268
269#ifndef YY_
Patrick Georgid5208402014-04-11 20:24:06 +0200270# if defined YYENABLE_NLS && YYENABLE_NLS
Patrick Georgi0588d192009-08-12 15:00:51 +0000271# if ENABLE_NLS
272# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200273# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
Patrick Georgi0588d192009-08-12 15:00:51 +0000274# endif
275# endif
276# ifndef YY_
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200277# define YY_(Msgid) Msgid
Patrick Georgi0588d192009-08-12 15:00:51 +0000278# endif
279#endif
280
281/* Suppress unused-variable warnings by "using" E. */
282#if ! defined lint || defined __GNUC__
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200283# define YYUSE(E) ((void) (E))
Patrick Georgi0588d192009-08-12 15:00:51 +0000284#else
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200285# define YYUSE(E) /* empty */
Patrick Georgi0588d192009-08-12 15:00:51 +0000286#endif
287
288/* Identity function, used to suppress warnings about constant conditions. */
289#ifndef lint
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200290# define YYID(N) (N)
Patrick Georgi0588d192009-08-12 15:00:51 +0000291#else
292#if (defined __STDC__ || defined __C99__FUNC__ \
293 || defined __cplusplus || defined _MSC_VER)
294static int
Patrick Georgid5208402014-04-11 20:24:06 +0200295YYID (int yyi)
Patrick Georgi0588d192009-08-12 15:00:51 +0000296#else
297static int
Patrick Georgid5208402014-04-11 20:24:06 +0200298YYID (yyi)
299 int yyi;
Patrick Georgi0588d192009-08-12 15:00:51 +0000300#endif
301{
Patrick Georgid5208402014-04-11 20:24:06 +0200302 return yyi;
Patrick Georgi0588d192009-08-12 15:00:51 +0000303}
304#endif
305
306#if ! defined yyoverflow || YYERROR_VERBOSE
307
308/* The parser invokes alloca or malloc; define the necessary symbols. */
309
310# ifdef YYSTACK_USE_ALLOCA
311# if YYSTACK_USE_ALLOCA
312# ifdef __GNUC__
313# define YYSTACK_ALLOC __builtin_alloca
314# elif defined __BUILTIN_VA_ARG_INCR
315# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
316# elif defined _AIX
317# define YYSTACK_ALLOC __alloca
318# elif defined _MSC_VER
319# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
320# define alloca _alloca
321# else
322# define YYSTACK_ALLOC alloca
Patrick Georgid5208402014-04-11 20:24:06 +0200323# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
Patrick Georgi0588d192009-08-12 15:00:51 +0000324 || defined __cplusplus || defined _MSC_VER)
325# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200326 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
Patrick Georgid5208402014-04-11 20:24:06 +0200327# ifndef EXIT_SUCCESS
328# define EXIT_SUCCESS 0
Patrick Georgi0588d192009-08-12 15:00:51 +0000329# endif
330# endif
331# endif
332# endif
333# endif
334
335# ifdef YYSTACK_ALLOC
336 /* Pacify GCC's `empty if-body' warning. */
337# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
338# ifndef YYSTACK_ALLOC_MAXIMUM
339 /* The OS might guarantee only one guard page at the bottom of the stack,
340 and a page size can be as small as 4096 bytes. So we cannot safely
341 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
342 to allow for a few compiler-allocated temporary stack slots. */
343# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
344# endif
345# else
346# define YYSTACK_ALLOC YYMALLOC
347# define YYSTACK_FREE YYFREE
348# ifndef YYSTACK_ALLOC_MAXIMUM
349# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
350# endif
Patrick Georgid5208402014-04-11 20:24:06 +0200351# if (defined __cplusplus && ! defined EXIT_SUCCESS \
Patrick Georgi0588d192009-08-12 15:00:51 +0000352 && ! ((defined YYMALLOC || defined malloc) \
353 && (defined YYFREE || defined free)))
354# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Patrick Georgid5208402014-04-11 20:24:06 +0200355# ifndef EXIT_SUCCESS
356# define EXIT_SUCCESS 0
Patrick Georgi0588d192009-08-12 15:00:51 +0000357# endif
358# endif
359# ifndef YYMALLOC
360# define YYMALLOC malloc
Patrick Georgid5208402014-04-11 20:24:06 +0200361# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
Patrick Georgi0588d192009-08-12 15:00:51 +0000362 || defined __cplusplus || defined _MSC_VER)
363void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
364# endif
365# endif
366# ifndef YYFREE
367# define YYFREE free
Patrick Georgid5208402014-04-11 20:24:06 +0200368# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
Patrick Georgi0588d192009-08-12 15:00:51 +0000369 || defined __cplusplus || defined _MSC_VER)
370void free (void *); /* INFRINGES ON USER NAME SPACE */
371# endif
372# endif
373# endif
374#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
375
376
377#if (! defined yyoverflow \
378 && (! defined __cplusplus \
379 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
380
381/* A type that is properly aligned for any stack member. */
382union yyalloc
383{
Patrick Georgid5208402014-04-11 20:24:06 +0200384 yytype_int16 yyss_alloc;
385 YYSTYPE yyvs_alloc;
386};
Patrick Georgi0588d192009-08-12 15:00:51 +0000387
388/* The size of the maximum gap between one aligned stack and the next. */
389# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
390
391/* The size of an array large to enough to hold all stacks, each with
392 N elements. */
393# define YYSTACK_BYTES(N) \
394 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
395 + YYSTACK_GAP_MAXIMUM)
396
Patrick Georgid5208402014-04-11 20:24:06 +0200397# define YYCOPY_NEEDED 1
398
399/* Relocate STACK from its old location to the new one. The
400 local variables YYSIZE and YYSTACKSIZE give the old and new number of
401 elements in the stack, and YYPTR gives the new location of the
402 stack. Advance YYPTR to a properly aligned location for the next
403 stack. */
404# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
405 do \
406 { \
407 YYSIZE_T yynewbytes; \
408 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
409 Stack = &yyptr->Stack_alloc; \
410 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
411 yyptr += yynewbytes / sizeof (*yyptr); \
412 } \
413 while (YYID (0))
414
415#endif
416
417#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200418/* Copy COUNT objects from SRC to DST. The source and destination do
Patrick Georgi0588d192009-08-12 15:00:51 +0000419 not overlap. */
420# ifndef YYCOPY
421# if defined __GNUC__ && 1 < __GNUC__
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200422# define YYCOPY(Dst, Src, Count) \
423 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
Patrick Georgi0588d192009-08-12 15:00:51 +0000424# else
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200425# define YYCOPY(Dst, Src, Count) \
426 do \
427 { \
428 YYSIZE_T yyi; \
429 for (yyi = 0; yyi < (Count); yyi++) \
430 (Dst)[yyi] = (Src)[yyi]; \
431 } \
Patrick Georgi0588d192009-08-12 15:00:51 +0000432 while (YYID (0))
433# endif
434# endif
Patrick Georgid5208402014-04-11 20:24:06 +0200435#endif /* !YYCOPY_NEEDED */
Patrick Georgi0588d192009-08-12 15:00:51 +0000436
437/* YYFINAL -- State number of the termination state. */
Patrick Georgid5208402014-04-11 20:24:06 +0200438#define YYFINAL 11
Patrick Georgi0588d192009-08-12 15:00:51 +0000439/* YYLAST -- Last index in YYTABLE. */
Patrick Georgid5208402014-04-11 20:24:06 +0200440#define YYLAST 290
Patrick Georgi0588d192009-08-12 15:00:51 +0000441
442/* YYNTOKENS -- Number of terminals. */
Patrick Georgid5208402014-04-11 20:24:06 +0200443#define YYNTOKENS 36
Patrick Georgi0588d192009-08-12 15:00:51 +0000444/* YYNNTS -- Number of nonterminals. */
Patrick Georgid5208402014-04-11 20:24:06 +0200445#define YYNNTS 50
Patrick Georgi0588d192009-08-12 15:00:51 +0000446/* YYNRULES -- Number of rules. */
Patrick Georgid5208402014-04-11 20:24:06 +0200447#define YYNRULES 118
Patrick Georgi0588d192009-08-12 15:00:51 +0000448/* YYNRULES -- Number of states. */
Patrick Georgid5208402014-04-11 20:24:06 +0200449#define YYNSTATES 191
Patrick Georgi0588d192009-08-12 15:00:51 +0000450
451/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
452#define YYUNDEFTOK 2
Patrick Georgid5208402014-04-11 20:24:06 +0200453#define YYMAXUTOK 290
Patrick Georgi0588d192009-08-12 15:00:51 +0000454
455#define YYTRANSLATE(YYX) \
456 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
457
458/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
459static const yytype_uint8 yytranslate[] =
460{
461 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
487 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
488 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
Patrick Georgid5208402014-04-11 20:24:06 +0200489 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
490 35
Patrick Georgi0588d192009-08-12 15:00:51 +0000491};
492
493#if YYDEBUG
494/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
495 YYRHS. */
496static const yytype_uint16 yyprhs[] =
497{
Patrick Georgid5208402014-04-11 20:24:06 +0200498 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
499 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
500 52, 54, 56, 58, 60, 62, 64, 66, 68, 72,
501 75, 79, 82, 86, 89, 90, 93, 96, 99, 102,
502 105, 108, 112, 117, 122, 127, 133, 137, 138, 142,
503 143, 146, 150, 153, 155, 159, 160, 163, 166, 169,
504 172, 175, 180, 184, 187, 192, 193, 196, 200, 202,
505 206, 207, 210, 213, 216, 220, 224, 228, 230, 234,
506 235, 238, 241, 244, 248, 252, 255, 258, 261, 262,
507 265, 268, 271, 276, 277, 280, 283, 286, 287, 290,
508 292, 294, 297, 300, 303, 305, 308, 309, 312, 314,
509 318, 322, 326, 329, 333, 337, 339, 341, 342
Patrick Georgi0588d192009-08-12 15:00:51 +0000510};
511
512/* YYRHS -- A `-1'-separated list of the rules' RHS. */
513static const yytype_int8 yyrhs[] =
514{
Patrick Georgid5208402014-04-11 20:24:06 +0200515 37, 0, -1, 81, 38, -1, 38, -1, 63, 39,
516 -1, 39, -1, -1, 39, 41, -1, 39, 55, -1,
517 39, 67, -1, 39, 80, -1, 39, 26, 1, 31,
518 -1, 39, 40, 1, 31, -1, 39, 1, 31, -1,
519 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
520 22, -1, 20, -1, 23, -1, 31, -1, 61, -1,
521 71, -1, 44, -1, 46, -1, 69, -1, 26, 1,
522 31, -1, 1, 31, -1, 10, 26, 31, -1, 43,
523 47, -1, 11, 26, 31, -1, 45, 47, -1, -1,
524 47, 48, -1, 47, 49, -1, 47, 75, -1, 47,
525 73, -1, 47, 42, -1, 47, 31, -1, 19, 78,
526 31, -1, 18, 79, 82, 31, -1, 20, 83, 82,
527 31, -1, 21, 26, 82, 31, -1, 22, 84, 84,
528 82, 31, -1, 24, 50, 31, -1, -1, 50, 26,
529 51, -1, -1, 34, 79, -1, 7, 85, 31, -1,
530 52, 56, -1, 80, -1, 53, 58, 54, -1, -1,
531 56, 57, -1, 56, 75, -1, 56, 73, -1, 56,
532 31, -1, 56, 42, -1, 18, 79, 82, 31, -1,
533 19, 78, 31, -1, 17, 31, -1, 20, 26, 82,
534 31, -1, -1, 58, 41, -1, 14, 83, 81, -1,
535 80, -1, 59, 62, 60, -1, -1, 62, 41, -1,
536 62, 67, -1, 62, 55, -1, 3, 79, 81, -1,
537 4, 79, 31, -1, 64, 76, 74, -1, 80, -1,
538 65, 68, 66, -1, -1, 68, 41, -1, 68, 67,
539 -1, 68, 55, -1, 6, 79, 31, -1, 9, 79,
540 31, -1, 70, 74, -1, 12, 31, -1, 72, 13,
541 -1, -1, 74, 75, -1, 74, 31, -1, 74, 42,
542 -1, 16, 25, 83, 31, -1, -1, 76, 77, -1,
543 76, 31, -1, 23, 82, -1, -1, 79, 82, -1,
544 26, -1, 27, -1, 5, 31, -1, 8, 31, -1,
545 15, 31, -1, 31, -1, 81, 31, -1, -1, 14,
546 83, -1, 84, -1, 84, 34, 84, -1, 84, 28,
547 84, -1, 30, 83, 29, -1, 35, 83, -1, 83,
548 32, 83, -1, 83, 33, 83, -1, 26, -1, 27,
549 -1, -1, 26, -1
Patrick Georgi0588d192009-08-12 15:00:51 +0000550};
551
552/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
553static const yytype_uint16 yyrline[] =
554{
Patrick Georgid5208402014-04-11 20:24:06 +0200555 0, 103, 103, 103, 105, 105, 107, 109, 110, 111,
556 112, 113, 114, 118, 122, 122, 122, 122, 122, 122,
557 122, 122, 126, 127, 128, 129, 130, 131, 135, 136,
558 142, 150, 156, 164, 174, 176, 177, 178, 179, 180,
559 181, 184, 192, 198, 208, 214, 220, 223, 225, 236,
560 237, 242, 251, 256, 264, 267, 269, 270, 271, 272,
561 273, 276, 282, 293, 299, 309, 311, 316, 324, 332,
562 335, 337, 338, 339, 344, 351, 358, 363, 371, 374,
563 376, 377, 378, 381, 389, 396, 403, 409, 416, 418,
564 419, 420, 423, 431, 433, 434, 437, 444, 446, 451,
565 452, 455, 456, 457, 461, 462, 465, 466, 469, 470,
566 471, 472, 473, 474, 475, 478, 479, 482, 483
Patrick Georgi0588d192009-08-12 15:00:51 +0000567};
568#endif
569
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200570#if YYDEBUG || YYERROR_VERBOSE || 0
Patrick Georgi0588d192009-08-12 15:00:51 +0000571/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
572 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
573static const char *const yytname[] =
574{
575 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
576 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
577 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
578 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
Patrick Georgid5208402014-04-11 20:24:06 +0200579 "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
Patrick Georgi0588d192009-08-12 15:00:51 +0000580 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
Patrick Georgid5208402014-04-11 20:24:06 +0200581 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
582 "common_stmt", "option_error", "config_entry_start", "config_stmt",
Patrick Georgi0588d192009-08-12 15:00:51 +0000583 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
584 "config_option", "symbol_option", "symbol_option_list",
585 "symbol_option_arg", "choice", "choice_entry", "choice_end",
586 "choice_stmt", "choice_option_list", "choice_option", "choice_block",
Patrick Georgid5208402014-04-11 20:24:06 +0200587 "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
588 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
589 "comment", "comment_stmt", "help_start", "help", "depends_list",
590 "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200591 "end", "nl", "if_expr", "expr", "symbol", "word_opt", YY_NULL
Patrick Georgi0588d192009-08-12 15:00:51 +0000592};
593#endif
594
595# ifdef YYPRINT
596/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
597 token YYLEX-NUM. */
598static const yytype_uint16 yytoknum[] =
599{
600 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
601 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
602 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
Patrick Georgid5208402014-04-11 20:24:06 +0200603 285, 286, 287, 288, 289, 290
Patrick Georgi0588d192009-08-12 15:00:51 +0000604};
605# endif
606
607/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
608static const yytype_uint8 yyr1[] =
609{
Patrick Georgid5208402014-04-11 20:24:06 +0200610 0, 36, 37, 37, 38, 38, 39, 39, 39, 39,
611 39, 39, 39, 39, 40, 40, 40, 40, 40, 40,
612 40, 40, 41, 41, 41, 41, 41, 41, 42, 42,
613 43, 44, 45, 46, 47, 47, 47, 47, 47, 47,
614 47, 48, 48, 48, 48, 48, 49, 50, 50, 51,
615 51, 52, 53, 54, 55, 56, 56, 56, 56, 56,
616 56, 57, 57, 57, 57, 58, 58, 59, 60, 61,
617 62, 62, 62, 62, 63, 64, 65, 66, 67, 68,
618 68, 68, 68, 69, 70, 71, 72, 73, 74, 74,
619 74, 74, 75, 76, 76, 76, 77, 78, 78, 79,
620 79, 80, 80, 80, 81, 81, 82, 82, 83, 83,
621 83, 83, 83, 83, 83, 84, 84, 85, 85
Patrick Georgi0588d192009-08-12 15:00:51 +0000622};
623
624/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
625static const yytype_uint8 yyr2[] =
626{
Patrick Georgid5208402014-04-11 20:24:06 +0200627 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
628 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
629 1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
630 3, 2, 3, 2, 0, 2, 2, 2, 2, 2,
631 2, 3, 4, 4, 4, 5, 3, 0, 3, 0,
632 2, 3, 2, 1, 3, 0, 2, 2, 2, 2,
633 2, 4, 3, 2, 4, 0, 2, 3, 1, 3,
634 0, 2, 2, 2, 3, 3, 3, 1, 3, 0,
635 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
636 2, 2, 4, 0, 2, 2, 2, 0, 2, 1,
637 1, 2, 2, 2, 1, 2, 0, 2, 1, 3,
638 3, 3, 2, 3, 3, 1, 1, 0, 1
Patrick Georgi0588d192009-08-12 15:00:51 +0000639};
640
Patrick Georgid5208402014-04-11 20:24:06 +0200641/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
642 Performed when YYTABLE doesn't specify something else to do. Zero
Patrick Georgi0588d192009-08-12 15:00:51 +0000643 means the default is an error. */
644static const yytype_uint8 yydefact[] =
645{
Patrick Georgid5208402014-04-11 20:24:06 +0200646 6, 0, 104, 0, 3, 0, 6, 6, 99, 100,
647 0, 1, 0, 0, 0, 0, 117, 0, 0, 0,
648 0, 0, 0, 14, 18, 15, 16, 20, 17, 19,
649 21, 0, 22, 0, 7, 34, 25, 34, 26, 55,
650 65, 8, 70, 23, 93, 79, 9, 27, 88, 24,
651 10, 0, 105, 2, 74, 13, 0, 101, 0, 118,
652 0, 102, 0, 0, 0, 115, 116, 0, 0, 0,
653 108, 103, 0, 0, 0, 0, 0, 0, 0, 88,
654 0, 0, 75, 83, 51, 84, 30, 32, 0, 112,
655 0, 0, 67, 0, 0, 11, 12, 0, 0, 0,
656 0, 97, 0, 0, 0, 47, 0, 40, 39, 35,
657 36, 0, 38, 37, 0, 0, 97, 0, 59, 60,
658 56, 58, 57, 66, 54, 53, 71, 73, 69, 72,
659 68, 106, 95, 0, 94, 80, 82, 78, 81, 77,
660 90, 91, 89, 111, 113, 114, 110, 109, 29, 86,
661 0, 106, 0, 106, 106, 106, 0, 0, 0, 87,
662 63, 106, 0, 106, 0, 96, 0, 0, 41, 98,
663 0, 0, 106, 49, 46, 28, 0, 62, 0, 107,
664 92, 42, 43, 44, 0, 0, 48, 61, 64, 45,
665 50
Patrick Georgi0588d192009-08-12 15:00:51 +0000666};
667
668/* YYDEFGOTO[NTERM-NUM]. */
669static const yytype_int16 yydefgoto[] =
670{
Patrick Georgid5208402014-04-11 20:24:06 +0200671 -1, 3, 4, 5, 33, 34, 108, 35, 36, 37,
672 38, 74, 109, 110, 157, 186, 39, 40, 124, 41,
673 76, 120, 77, 42, 128, 43, 78, 6, 44, 45,
674 137, 46, 80, 47, 48, 49, 111, 112, 81, 113,
675 79, 134, 152, 153, 50, 7, 165, 69, 70, 60
Patrick Georgi0588d192009-08-12 15:00:51 +0000676};
677
678/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
679 STATE-NUM. */
Patrick Georgid5208402014-04-11 20:24:06 +0200680#define YYPACT_NINF -90
Patrick Georgi0588d192009-08-12 15:00:51 +0000681static const yytype_int16 yypact[] =
682{
Patrick Georgid5208402014-04-11 20:24:06 +0200683 4, 42, -90, 96, -90, 111, -90, 15, -90, -90,
684 75, -90, 82, 42, 104, 42, 110, 107, 42, 115,
685 125, -4, 121, -90, -90, -90, -90, -90, -90, -90,
686 -90, 162, -90, 163, -90, -90, -90, -90, -90, -90,
687 -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
688 -90, 139, -90, -90, 138, -90, 142, -90, 143, -90,
689 152, -90, 164, 167, 168, -90, -90, -4, -4, 77,
690 -18, -90, 177, 185, 33, 71, 195, 247, 236, -2,
691 236, 171, -90, -90, -90, -90, -90, -90, 41, -90,
692 -4, -4, 138, 97, 97, -90, -90, 186, 187, 194,
693 42, 42, -4, 196, 97, -90, 219, -90, -90, -90,
694 -90, 210, -90, -90, 204, 42, 42, 199, -90, -90,
695 -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
696 -90, 222, -90, 223, -90, -90, -90, -90, -90, -90,
697 -90, -90, -90, -90, 215, -90, -90, -90, -90, -90,
698 -4, 222, 228, 222, -5, 222, 97, 35, 229, -90,
699 -90, 222, 232, 222, -4, -90, 135, 233, -90, -90,
700 234, 235, 222, 240, -90, -90, 237, -90, 239, -13,
701 -90, -90, -90, -90, 244, 42, -90, -90, -90, -90,
702 -90
Patrick Georgi0588d192009-08-12 15:00:51 +0000703};
704
705/* YYPGOTO[NTERM-NUM]. */
706static const yytype_int16 yypgoto[] =
707{
Patrick Georgid5208402014-04-11 20:24:06 +0200708 -90, -90, 269, 271, -90, 23, -70, -90, -90, -90,
709 -90, 243, -90, -90, -90, -90, -90, -90, -90, -48,
710 -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
711 -90, -20, -90, -90, -90, -90, -90, 206, 205, -68,
712 -90, -90, 169, -1, 27, -7, 118, -66, -89, -90
Patrick Georgi0588d192009-08-12 15:00:51 +0000713};
714
715/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
716 positive, shift that token. If negative, reduce the rule which
Patrick Georgid5208402014-04-11 20:24:06 +0200717 number is the opposite. If YYTABLE_NINF, syntax error. */
718#define YYTABLE_NINF -86
Patrick Georgi0588d192009-08-12 15:00:51 +0000719static const yytype_int16 yytable[] =
720{
Patrick Georgid5208402014-04-11 20:24:06 +0200721 10, 88, 89, 54, 146, 147, 119, 1, 122, 164,
722 93, 141, 56, 142, 58, 156, 94, 62, 1, 90,
723 91, 131, 65, 66, 144, 145, 67, 90, 91, 132,
724 127, 68, 136, -31, 97, 2, 154, -31, -31, -31,
725 -31, -31, -31, -31, -31, 98, 52, -31, -31, 99,
726 -31, 100, 101, 102, 103, 104, -31, 105, 129, 106,
727 138, 173, 92, 141, 107, 142, 174, 172, 8, 9,
728 143, -33, 97, 90, 91, -33, -33, -33, -33, -33,
729 -33, -33, -33, 98, 166, -33, -33, 99, -33, 100,
730 101, 102, 103, 104, -33, 105, 11, 106, 179, 151,
731 123, 126, 107, 135, 125, 130, 2, 139, 2, 90,
732 91, -5, 12, 55, 161, 13, 14, 15, 16, 17,
733 18, 19, 20, 65, 66, 21, 22, 23, 24, 25,
734 26, 27, 28, 29, 30, 57, 59, 31, 61, -4,
735 12, 63, 32, 13, 14, 15, 16, 17, 18, 19,
736 20, 64, 71, 21, 22, 23, 24, 25, 26, 27,
737 28, 29, 30, 72, 73, 31, 180, 90, 91, 52,
738 32, -85, 97, 82, 83, -85, -85, -85, -85, -85,
739 -85, -85, -85, 84, 190, -85, -85, 99, -85, -85,
740 -85, -85, -85, -85, -85, 85, 97, 106, 86, 87,
741 -52, -52, 140, -52, -52, -52, -52, 98, 95, -52,
742 -52, 99, 114, 115, 116, 117, 96, 148, 149, 150,
743 158, 106, 155, 159, 97, 163, 118, -76, -76, -76,
744 -76, -76, -76, -76, -76, 160, 164, -76, -76, 99,
745 13, 14, 15, 16, 17, 18, 19, 20, 91, 106,
746 21, 22, 14, 15, 140, 17, 18, 19, 20, 168,
747 175, 21, 22, 177, 181, 182, 183, 32, 187, 167,
748 188, 169, 170, 171, 185, 189, 53, 51, 32, 176,
749 75, 178, 121, 0, 133, 162, 0, 0, 0, 0,
750 184
Patrick Georgi0588d192009-08-12 15:00:51 +0000751};
752
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200753#define yypact_value_is_default(Yystate) \
754 (!!((Yystate) == (-90)))
Patrick Georgid5208402014-04-11 20:24:06 +0200755
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200756#define yytable_value_is_error(Yytable_value) \
Patrick Georgid5208402014-04-11 20:24:06 +0200757 YYID (0)
758
Patrick Georgi0588d192009-08-12 15:00:51 +0000759static const yytype_int16 yycheck[] =
760{
Patrick Georgid5208402014-04-11 20:24:06 +0200761 1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
762 28, 81, 13, 81, 15, 104, 34, 18, 3, 32,
763 33, 23, 26, 27, 90, 91, 30, 32, 33, 31,
764 78, 35, 80, 0, 1, 31, 102, 4, 5, 6,
765 7, 8, 9, 10, 11, 12, 31, 14, 15, 16,
766 17, 18, 19, 20, 21, 22, 23, 24, 78, 26,
767 80, 26, 69, 133, 31, 133, 31, 156, 26, 27,
768 29, 0, 1, 32, 33, 4, 5, 6, 7, 8,
769 9, 10, 11, 12, 150, 14, 15, 16, 17, 18,
770 19, 20, 21, 22, 23, 24, 0, 26, 164, 100,
771 77, 78, 31, 80, 77, 78, 31, 80, 31, 32,
772 33, 0, 1, 31, 115, 4, 5, 6, 7, 8,
773 9, 10, 11, 26, 27, 14, 15, 16, 17, 18,
774 19, 20, 21, 22, 23, 31, 26, 26, 31, 0,
775 1, 26, 31, 4, 5, 6, 7, 8, 9, 10,
776 11, 26, 31, 14, 15, 16, 17, 18, 19, 20,
777 21, 22, 23, 1, 1, 26, 31, 32, 33, 31,
778 31, 0, 1, 31, 31, 4, 5, 6, 7, 8,
779 9, 10, 11, 31, 185, 14, 15, 16, 17, 18,
780 19, 20, 21, 22, 23, 31, 1, 26, 31, 31,
781 5, 6, 31, 8, 9, 10, 11, 12, 31, 14,
782 15, 16, 17, 18, 19, 20, 31, 31, 31, 25,
783 1, 26, 26, 13, 1, 26, 31, 4, 5, 6,
784 7, 8, 9, 10, 11, 31, 14, 14, 15, 16,
785 4, 5, 6, 7, 8, 9, 10, 11, 33, 26,
786 14, 15, 5, 6, 31, 8, 9, 10, 11, 31,
787 31, 14, 15, 31, 31, 31, 31, 31, 31, 151,
788 31, 153, 154, 155, 34, 31, 7, 6, 31, 161,
789 37, 163, 76, -1, 79, 116, -1, -1, -1, -1,
790 172
Patrick Georgi0588d192009-08-12 15:00:51 +0000791};
792
793/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
794 symbol of state STATE-NUM. */
795static const yytype_uint8 yystos[] =
796{
Patrick Georgid5208402014-04-11 20:24:06 +0200797 0, 3, 31, 37, 38, 39, 63, 81, 26, 27,
798 79, 0, 1, 4, 5, 6, 7, 8, 9, 10,
799 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
800 23, 26, 31, 40, 41, 43, 44, 45, 46, 52,
801 53, 55, 59, 61, 64, 65, 67, 69, 70, 71,
802 80, 39, 31, 38, 81, 31, 79, 31, 79, 26,
803 85, 31, 79, 26, 26, 26, 27, 30, 35, 83,
804 84, 31, 1, 1, 47, 47, 56, 58, 62, 76,
805 68, 74, 31, 31, 31, 31, 31, 31, 83, 83,
806 32, 33, 81, 28, 34, 31, 31, 1, 12, 16,
807 18, 19, 20, 21, 22, 24, 26, 31, 42, 48,
808 49, 72, 73, 75, 17, 18, 19, 20, 31, 42,
809 57, 73, 75, 41, 54, 80, 41, 55, 60, 67,
810 80, 23, 31, 74, 77, 41, 55, 66, 67, 80,
811 31, 42, 75, 29, 83, 83, 84, 84, 31, 31,
812 25, 79, 78, 79, 83, 26, 84, 50, 1, 13,
813 31, 79, 78, 26, 14, 82, 83, 82, 31, 82,
814 82, 82, 84, 26, 31, 31, 82, 31, 82, 83,
815 31, 31, 31, 31, 82, 34, 51, 31, 31, 31,
816 79
Patrick Georgi0588d192009-08-12 15:00:51 +0000817};
818
819#define yyerrok (yyerrstatus = 0)
820#define yyclearin (yychar = YYEMPTY)
821#define YYEMPTY (-2)
822#define YYEOF 0
823
824#define YYACCEPT goto yyacceptlab
825#define YYABORT goto yyabortlab
826#define YYERROR goto yyerrorlab
827
828
829/* Like YYERROR except do call yyerror. This remains here temporarily
830 to ease the transition to the new meaning of YYERROR, for GCC.
Patrick Georgid5208402014-04-11 20:24:06 +0200831 Once GCC version 2 has supplanted version 1, this can go. However,
832 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
833 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
834 discussed. */
Patrick Georgi0588d192009-08-12 15:00:51 +0000835
836#define YYFAIL goto yyerrlab
Patrick Georgid5208402014-04-11 20:24:06 +0200837#if defined YYFAIL
838 /* This is here to suppress warnings from the GCC cpp's
839 -Wunused-macros. Normally we don't worry about that warning, but
840 some users do, and we want to make it easy for users to remove
841 YYFAIL uses, which will produce warnings from Bison 2.5. */
842#endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000843
844#define YYRECOVERING() (!!yyerrstatus)
845
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200846#define YYBACKUP(Token, Value) \
847do \
848 if (yychar == YYEMPTY) \
849 { \
850 yychar = (Token); \
851 yylval = (Value); \
852 YYPOPSTACK (yylen); \
853 yystate = *yyssp; \
854 goto yybackup; \
855 } \
856 else \
857 { \
Patrick Georgi0588d192009-08-12 15:00:51 +0000858 yyerror (YY_("syntax error: cannot back up")); \
859 YYERROR; \
860 } \
861while (YYID (0))
862
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200863/* Error token number */
Patrick Georgi0588d192009-08-12 15:00:51 +0000864#define YYTERROR 1
865#define YYERRCODE 256
866
867
Patrick Georgid5208402014-04-11 20:24:06 +0200868/* This macro is provided for backward compatibility. */
Patrick Georgi0588d192009-08-12 15:00:51 +0000869#ifndef YY_LOCATION_PRINT
Patrick Georgid5208402014-04-11 20:24:06 +0200870# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
Patrick Georgi0588d192009-08-12 15:00:51 +0000871#endif
872
873
874/* YYLEX -- calling `yylex' with the right arguments. */
Patrick Georgi0588d192009-08-12 15:00:51 +0000875#ifdef YYLEX_PARAM
876# define YYLEX yylex (YYLEX_PARAM)
877#else
878# define YYLEX yylex ()
879#endif
880
881/* Enable debugging if requested. */
882#if YYDEBUG
883
884# ifndef YYFPRINTF
885# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
886# define YYFPRINTF fprintf
887# endif
888
889# define YYDPRINTF(Args) \
890do { \
891 if (yydebug) \
892 YYFPRINTF Args; \
893} while (YYID (0))
894
895# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
896do { \
897 if (yydebug) \
898 { \
899 YYFPRINTF (stderr, "%s ", Title); \
900 yy_symbol_print (stderr, \
901 Type, Value); \
902 YYFPRINTF (stderr, "\n"); \
903 } \
904} while (YYID (0))
905
906
907/*--------------------------------.
908| Print this symbol on YYOUTPUT. |
909`--------------------------------*/
910
911/*ARGSUSED*/
912#if (defined __STDC__ || defined __C99__FUNC__ \
913 || defined __cplusplus || defined _MSC_VER)
914static void
915yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
916#else
917static void
918yy_symbol_value_print (yyoutput, yytype, yyvaluep)
919 FILE *yyoutput;
920 int yytype;
921 YYSTYPE const * const yyvaluep;
922#endif
923{
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200924 FILE *yyo = yyoutput;
925 YYUSE (yyo);
Patrick Georgi0588d192009-08-12 15:00:51 +0000926 if (!yyvaluep)
927 return;
928# ifdef YYPRINT
929 if (yytype < YYNTOKENS)
930 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
931# else
932 YYUSE (yyoutput);
933# endif
934 switch (yytype)
935 {
936 default:
Stefan Reinauerf78a09b2015-04-03 20:01:38 +0200937 break;
Patrick Georgi0588d192009-08-12 15:00:51 +0000938 }
939}
940
941
942/*--------------------------------.
943| Print this symbol on YYOUTPUT. |
944`--------------------------------*/
945
946#if (defined __STDC__ || defined __C99__FUNC__ \
947 || defined __cplusplus || defined _MSC_VER)
948static void
949yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
950#else
951static void
952yy_symbol_print (yyoutput, yytype, yyvaluep)
953 FILE *yyoutput;
954 int yytype;
955 YYSTYPE const * const yyvaluep;
956#endif
957{
958 if (yytype < YYNTOKENS)
959 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
960 else
961 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
962
963 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
964 YYFPRINTF (yyoutput, ")");
965}
966
967/*------------------------------------------------------------------.
968| yy_stack_print -- Print the state stack from its BOTTOM up to its |
969| TOP (included). |
970`------------------------------------------------------------------*/
971
972#if (defined __STDC__ || defined __C99__FUNC__ \
973 || defined __cplusplus || defined _MSC_VER)
974static void
Patrick Georgid5208402014-04-11 20:24:06 +0200975yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
Patrick Georgi0588d192009-08-12 15:00:51 +0000976#else
977static void
Patrick Georgid5208402014-04-11 20:24:06 +0200978yy_stack_print (yybottom, yytop)
979 yytype_int16 *yybottom;
980 yytype_int16 *yytop;
Patrick Georgi0588d192009-08-12 15:00:51 +0000981#endif
982{
983 YYFPRINTF (stderr, "Stack now");
Patrick Georgid5208402014-04-11 20:24:06 +0200984 for (; yybottom <= yytop; yybottom++)
985 {
986 int yybot = *yybottom;
987 YYFPRINTF (stderr, " %d", yybot);
988 }
Patrick Georgi0588d192009-08-12 15:00:51 +0000989 YYFPRINTF (stderr, "\n");
990}
991
992# define YY_STACK_PRINT(Bottom, Top) \
993do { \
994 if (yydebug) \
995 yy_stack_print ((Bottom), (Top)); \
996} while (YYID (0))
997
998
999/*------------------------------------------------.
1000| Report that the YYRULE is going to be reduced. |
1001`------------------------------------------------*/
1002
1003#if (defined __STDC__ || defined __C99__FUNC__ \
1004 || defined __cplusplus || defined _MSC_VER)
1005static void
1006yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1007#else
1008static void
1009yy_reduce_print (yyvsp, yyrule)
1010 YYSTYPE *yyvsp;
1011 int yyrule;
1012#endif
1013{
1014 int yynrhs = yyr2[yyrule];
1015 int yyi;
1016 unsigned long int yylno = yyrline[yyrule];
1017 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1018 yyrule - 1, yylno);
1019 /* The symbols being reduced. */
1020 for (yyi = 0; yyi < yynrhs; yyi++)
1021 {
Patrick Georgid5208402014-04-11 20:24:06 +02001022 YYFPRINTF (stderr, " $%d = ", yyi + 1);
Patrick Georgi0588d192009-08-12 15:00:51 +00001023 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1024 &(yyvsp[(yyi + 1) - (yynrhs)])
1025 );
Patrick Georgid5208402014-04-11 20:24:06 +02001026 YYFPRINTF (stderr, "\n");
Patrick Georgi0588d192009-08-12 15:00:51 +00001027 }
1028}
1029
1030# define YY_REDUCE_PRINT(Rule) \
1031do { \
1032 if (yydebug) \
1033 yy_reduce_print (yyvsp, Rule); \
1034} while (YYID (0))
1035
1036/* Nonzero means print parse trace. It is left uninitialized so that
1037 multiple parsers can coexist. */
1038int yydebug;
1039#else /* !YYDEBUG */
1040# define YYDPRINTF(Args)
1041# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1042# define YY_STACK_PRINT(Bottom, Top)
1043# define YY_REDUCE_PRINT(Rule)
1044#endif /* !YYDEBUG */
1045
1046
1047/* YYINITDEPTH -- initial size of the parser's stacks. */
1048#ifndef YYINITDEPTH
1049# define YYINITDEPTH 200
1050#endif
1051
1052/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1053 if the built-in stack extension method is used).
1054
1055 Do not make this value too large; the results are undefined if
1056 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1057 evaluated with infinite-precision integer arithmetic. */
1058
1059#ifndef YYMAXDEPTH
1060# define YYMAXDEPTH 10000
1061#endif
1062
Patrick Georgi0588d192009-08-12 15:00:51 +00001063
1064#if YYERROR_VERBOSE
1065
1066# ifndef yystrlen
1067# if defined __GLIBC__ && defined _STRING_H
1068# define yystrlen strlen
1069# else
1070/* Return the length of YYSTR. */
1071#if (defined __STDC__ || defined __C99__FUNC__ \
1072 || defined __cplusplus || defined _MSC_VER)
1073static YYSIZE_T
1074yystrlen (const char *yystr)
1075#else
1076static YYSIZE_T
1077yystrlen (yystr)
1078 const char *yystr;
1079#endif
1080{
1081 YYSIZE_T yylen;
1082 for (yylen = 0; yystr[yylen]; yylen++)
1083 continue;
1084 return yylen;
1085}
1086# endif
1087# endif
1088
1089# ifndef yystpcpy
1090# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1091# define yystpcpy stpcpy
1092# else
1093/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1094 YYDEST. */
1095#if (defined __STDC__ || defined __C99__FUNC__ \
1096 || defined __cplusplus || defined _MSC_VER)
1097static char *
1098yystpcpy (char *yydest, const char *yysrc)
1099#else
1100static char *
1101yystpcpy (yydest, yysrc)
1102 char *yydest;
1103 const char *yysrc;
1104#endif
1105{
1106 char *yyd = yydest;
1107 const char *yys = yysrc;
1108
1109 while ((*yyd++ = *yys++) != '\0')
1110 continue;
1111
1112 return yyd - 1;
1113}
1114# endif
1115# endif
1116
1117# ifndef yytnamerr
1118/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1119 quotes and backslashes, so that it's suitable for yyerror. The
1120 heuristic is that double-quoting is unnecessary unless the string
1121 contains an apostrophe, a comma, or backslash (other than
1122 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1123 null, do not copy; instead, return the length of what the result
1124 would have been. */
1125static YYSIZE_T
1126yytnamerr (char *yyres, const char *yystr)
1127{
1128 if (*yystr == '"')
1129 {
1130 YYSIZE_T yyn = 0;
1131 char const *yyp = yystr;
1132
1133 for (;;)
1134 switch (*++yyp)
1135 {
1136 case '\'':
1137 case ',':
1138 goto do_not_strip_quotes;
1139
1140 case '\\':
1141 if (*++yyp != '\\')
1142 goto do_not_strip_quotes;
1143 /* Fall through. */
1144 default:
1145 if (yyres)
1146 yyres[yyn] = *yyp;
1147 yyn++;
1148 break;
1149
1150 case '"':
1151 if (yyres)
1152 yyres[yyn] = '\0';
1153 return yyn;
1154 }
1155 do_not_strip_quotes: ;
1156 }
1157
1158 if (! yyres)
1159 return yystrlen (yystr);
1160
1161 return yystpcpy (yyres, yystr) - yyres;
1162}
1163# endif
1164
Patrick Georgid5208402014-04-11 20:24:06 +02001165/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1166 about the unexpected token YYTOKEN for the state stack whose top is
1167 YYSSP.
1168
1169 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1170 not large enough to hold the message. In that case, also set
1171 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1172 required number of bytes is too large to store. */
1173static int
1174yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1175 yytype_int16 *yyssp, int yytoken)
Patrick Georgi0588d192009-08-12 15:00:51 +00001176{
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001177 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
Patrick Georgid5208402014-04-11 20:24:06 +02001178 YYSIZE_T yysize = yysize0;
Patrick Georgid5208402014-04-11 20:24:06 +02001179 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1180 /* Internationalized format string. */
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001181 const char *yyformat = YY_NULL;
Patrick Georgid5208402014-04-11 20:24:06 +02001182 /* Arguments of yyformat. */
1183 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1184 /* Number of reported tokens (one for the "unexpected", one per
1185 "expected"). */
1186 int yycount = 0;
Patrick Georgi0588d192009-08-12 15:00:51 +00001187
Patrick Georgid5208402014-04-11 20:24:06 +02001188 /* There are many possibilities here to consider:
1189 - Assume YYFAIL is not used. It's too flawed to consider. See
1190 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1191 for details. YYERROR is fine as it does not invoke this
1192 function.
1193 - If this state is a consistent state with a default action, then
1194 the only way this function was invoked is if the default action
1195 is an error action. In that case, don't check for expected
1196 tokens because there are none.
1197 - The only way there can be no lookahead present (in yychar) is if
1198 this state is a consistent state with a default action. Thus,
1199 detecting the absence of a lookahead is sufficient to determine
1200 that there is no unexpected or expected token to report. In that
1201 case, just report a simple "syntax error".
1202 - Don't assume there isn't a lookahead just because this state is a
1203 consistent state with a default action. There might have been a
1204 previous inconsistent state, consistent state with a non-default
1205 action, or user semantic action that manipulated yychar.
1206 - Of course, the expected token list depends on states to have
1207 correct lookahead information, and it depends on the parser not
1208 to perform extra reductions after fetching a lookahead from the
1209 scanner and before detecting a syntax error. Thus, state merging
1210 (from LALR or IELR) and default reductions corrupt the expected
1211 token list. However, the list is correct for canonical LR with
1212 one exception: it will still contain any token that will not be
1213 accepted due to an error action in a later state.
1214 */
1215 if (yytoken != YYEMPTY)
Patrick Georgi0588d192009-08-12 15:00:51 +00001216 {
Patrick Georgid5208402014-04-11 20:24:06 +02001217 int yyn = yypact[*yyssp];
1218 yyarg[yycount++] = yytname[yytoken];
1219 if (!yypact_value_is_default (yyn))
1220 {
1221 /* Start YYX at -YYN if negative to avoid negative indexes in
1222 YYCHECK. In other words, skip the first -YYN actions for
1223 this state because they are default actions. */
1224 int yyxbegin = yyn < 0 ? -yyn : 0;
1225 /* Stay within bounds of both yycheck and yytname. */
1226 int yychecklim = YYLAST - yyn + 1;
1227 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1228 int yyx;
Patrick Georgi0588d192009-08-12 15:00:51 +00001229
Patrick Georgid5208402014-04-11 20:24:06 +02001230 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1231 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1232 && !yytable_value_is_error (yytable[yyx + yyn]))
1233 {
1234 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1235 {
1236 yycount = 1;
1237 yysize = yysize0;
1238 break;
1239 }
1240 yyarg[yycount++] = yytname[yyx];
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001241 {
1242 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1243 if (! (yysize <= yysize1
1244 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1245 return 2;
1246 yysize = yysize1;
1247 }
Patrick Georgid5208402014-04-11 20:24:06 +02001248 }
1249 }
Patrick Georgi0588d192009-08-12 15:00:51 +00001250 }
Patrick Georgid5208402014-04-11 20:24:06 +02001251
1252 switch (yycount)
1253 {
1254# define YYCASE_(N, S) \
1255 case N: \
1256 yyformat = S; \
1257 break
1258 YYCASE_(0, YY_("syntax error"));
1259 YYCASE_(1, YY_("syntax error, unexpected %s"));
1260 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1261 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1262 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1263 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1264# undef YYCASE_
1265 }
1266
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001267 {
1268 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1269 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1270 return 2;
1271 yysize = yysize1;
1272 }
Patrick Georgid5208402014-04-11 20:24:06 +02001273
1274 if (*yymsg_alloc < yysize)
1275 {
1276 *yymsg_alloc = 2 * yysize;
1277 if (! (yysize <= *yymsg_alloc
1278 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1279 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1280 return 1;
1281 }
1282
1283 /* Avoid sprintf, as that infringes on the user's name space.
1284 Don't have undefined behavior even if the translation
1285 produced a string with the wrong number of "%s"s. */
1286 {
1287 char *yyp = *yymsg;
1288 int yyi = 0;
1289 while ((*yyp = *yyformat) != '\0')
1290 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1291 {
1292 yyp += yytnamerr (yyp, yyarg[yyi++]);
1293 yyformat += 2;
1294 }
1295 else
1296 {
1297 yyp++;
1298 yyformat++;
1299 }
1300 }
1301 return 0;
Patrick Georgi0588d192009-08-12 15:00:51 +00001302}
1303#endif /* YYERROR_VERBOSE */
Patrick Georgi0588d192009-08-12 15:00:51 +00001304
1305/*-----------------------------------------------.
1306| Release the memory associated to this symbol. |
1307`-----------------------------------------------*/
1308
1309/*ARGSUSED*/
1310#if (defined __STDC__ || defined __C99__FUNC__ \
1311 || defined __cplusplus || defined _MSC_VER)
1312static void
1313yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1314#else
1315static void
1316yydestruct (yymsg, yytype, yyvaluep)
1317 const char *yymsg;
1318 int yytype;
1319 YYSTYPE *yyvaluep;
1320#endif
1321{
1322 YYUSE (yyvaluep);
1323
1324 if (!yymsg)
1325 yymsg = "Deleting";
1326 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1327
1328 switch (yytype)
1329 {
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001330 case 53: /* choice_entry */
Patrick Georgi0588d192009-08-12 15:00:51 +00001331
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001332 {
Patrick Georgi0588d192009-08-12 15:00:51 +00001333 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001334 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1335 if (current_menu == ((*yyvaluep).menu))
Patrick Georgi0588d192009-08-12 15:00:51 +00001336 menu_end_menu();
1337};
1338
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001339 break;
1340 case 59: /* if_entry */
Patrick Georgi0588d192009-08-12 15:00:51 +00001341
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001342 {
Patrick Georgi0588d192009-08-12 15:00:51 +00001343 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001344 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1345 if (current_menu == ((*yyvaluep).menu))
Patrick Georgi0588d192009-08-12 15:00:51 +00001346 menu_end_menu();
1347};
1348
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001349 break;
1350 case 65: /* menu_entry */
Patrick Georgi0588d192009-08-12 15:00:51 +00001351
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001352 {
Patrick Georgi0588d192009-08-12 15:00:51 +00001353 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001354 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1355 if (current_menu == ((*yyvaluep).menu))
Patrick Georgi0588d192009-08-12 15:00:51 +00001356 menu_end_menu();
1357};
1358
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001359 break;
Patrick Georgi0588d192009-08-12 15:00:51 +00001360
1361 default:
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001362 break;
Patrick Georgi0588d192009-08-12 15:00:51 +00001363 }
1364}
Patrick Georgid5208402014-04-11 20:24:06 +02001365
Patrick Georgi0588d192009-08-12 15:00:51 +00001366
Patrick Georgi0588d192009-08-12 15:00:51 +00001367
1368
Patrick Georgid5208402014-04-11 20:24:06 +02001369/* The lookahead symbol. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001370int yychar;
1371
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001372
1373#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1374# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1375# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1376#endif
1377#ifndef YY_INITIAL_VALUE
1378# define YY_INITIAL_VALUE(Value) /* Nothing. */
1379#endif
1380
Patrick Georgid5208402014-04-11 20:24:06 +02001381/* The semantic value of the lookahead symbol. */
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001382YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
Patrick Georgi0588d192009-08-12 15:00:51 +00001383
1384/* Number of syntax errors so far. */
1385int yynerrs;
1386
1387
Patrick Georgi0588d192009-08-12 15:00:51 +00001388/*----------.
1389| yyparse. |
1390`----------*/
1391
1392#ifdef YYPARSE_PARAM
1393#if (defined __STDC__ || defined __C99__FUNC__ \
1394 || defined __cplusplus || defined _MSC_VER)
1395int
1396yyparse (void *YYPARSE_PARAM)
1397#else
1398int
1399yyparse (YYPARSE_PARAM)
1400 void *YYPARSE_PARAM;
1401#endif
1402#else /* ! YYPARSE_PARAM */
1403#if (defined __STDC__ || defined __C99__FUNC__ \
1404 || defined __cplusplus || defined _MSC_VER)
1405int
1406yyparse (void)
1407#else
1408int
1409yyparse ()
1410
1411#endif
1412#endif
1413{
Patrick Georgid5208402014-04-11 20:24:06 +02001414 int yystate;
1415 /* Number of tokens to shift before error messages enabled. */
1416 int yyerrstatus;
Stefan Reinauer14e22772010-04-27 06:56:47 +00001417
Patrick Georgid5208402014-04-11 20:24:06 +02001418 /* The stacks and their tools:
1419 `yyss': related to states.
1420 `yyvs': related to semantic values.
1421
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001422 Refer to the stacks through separate pointers, to allow yyoverflow
Patrick Georgid5208402014-04-11 20:24:06 +02001423 to reallocate them elsewhere. */
1424
1425 /* The state stack. */
1426 yytype_int16 yyssa[YYINITDEPTH];
1427 yytype_int16 *yyss;
1428 yytype_int16 *yyssp;
1429
1430 /* The semantic value stack. */
1431 YYSTYPE yyvsa[YYINITDEPTH];
1432 YYSTYPE *yyvs;
1433 YYSTYPE *yyvsp;
1434
1435 YYSIZE_T yystacksize;
1436
Patrick Georgi0588d192009-08-12 15:00:51 +00001437 int yyn;
1438 int yyresult;
Patrick Georgid5208402014-04-11 20:24:06 +02001439 /* Lookahead token as an internal (translated) token number. */
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001440 int yytoken = 0;
Patrick Georgid5208402014-04-11 20:24:06 +02001441 /* The variables used to return semantic value and location from the
1442 action routines. */
1443 YYSTYPE yyval;
1444
Patrick Georgi0588d192009-08-12 15:00:51 +00001445#if YYERROR_VERBOSE
1446 /* Buffer for error messages, and its allocated size. */
1447 char yymsgbuf[128];
1448 char *yymsg = yymsgbuf;
1449 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1450#endif
1451
Patrick Georgi0588d192009-08-12 15:00:51 +00001452#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1453
Patrick Georgi0588d192009-08-12 15:00:51 +00001454 /* The number of symbols on the RHS of the reduced rule.
1455 Keep to zero when no symbol should be popped. */
1456 int yylen = 0;
1457
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001458 yyssp = yyss = yyssa;
1459 yyvsp = yyvs = yyvsa;
Patrick Georgid5208402014-04-11 20:24:06 +02001460 yystacksize = YYINITDEPTH;
1461
Patrick Georgi0588d192009-08-12 15:00:51 +00001462 YYDPRINTF ((stderr, "Starting parse\n"));
1463
1464 yystate = 0;
1465 yyerrstatus = 0;
1466 yynerrs = 0;
Patrick Georgid5208402014-04-11 20:24:06 +02001467 yychar = YYEMPTY; /* Cause a token to be read. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001468 goto yysetstate;
1469
1470/*------------------------------------------------------------.
1471| yynewstate -- Push a new state, which is found in yystate. |
1472`------------------------------------------------------------*/
1473 yynewstate:
1474 /* In all cases, when you get here, the value and location stacks
1475 have just been pushed. So pushing a state here evens the stacks. */
1476 yyssp++;
1477
1478 yysetstate:
1479 *yyssp = yystate;
1480
1481 if (yyss + yystacksize - 1 <= yyssp)
1482 {
1483 /* Get the current used size of the three stacks, in elements. */
1484 YYSIZE_T yysize = yyssp - yyss + 1;
1485
1486#ifdef yyoverflow
1487 {
1488 /* Give user a chance to reallocate the stack. Use copies of
1489 these so that the &'s don't force the real ones into
1490 memory. */
1491 YYSTYPE *yyvs1 = yyvs;
1492 yytype_int16 *yyss1 = yyss;
1493
Patrick Georgi0588d192009-08-12 15:00:51 +00001494 /* Each stack pointer address is followed by the size of the
1495 data in use in that stack, in bytes. This used to be a
1496 conditional around just the two extra args, but that might
1497 be undefined if yyoverflow is a macro. */
1498 yyoverflow (YY_("memory exhausted"),
1499 &yyss1, yysize * sizeof (*yyssp),
1500 &yyvs1, yysize * sizeof (*yyvsp),
Patrick Georgi0588d192009-08-12 15:00:51 +00001501 &yystacksize);
1502
1503 yyss = yyss1;
1504 yyvs = yyvs1;
1505 }
1506#else /* no yyoverflow */
1507# ifndef YYSTACK_RELOCATE
1508 goto yyexhaustedlab;
1509# else
1510 /* Extend the stack our own way. */
1511 if (YYMAXDEPTH <= yystacksize)
1512 goto yyexhaustedlab;
1513 yystacksize *= 2;
1514 if (YYMAXDEPTH < yystacksize)
1515 yystacksize = YYMAXDEPTH;
1516
1517 {
1518 yytype_int16 *yyss1 = yyss;
1519 union yyalloc *yyptr =
1520 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1521 if (! yyptr)
1522 goto yyexhaustedlab;
Patrick Georgid5208402014-04-11 20:24:06 +02001523 YYSTACK_RELOCATE (yyss_alloc, yyss);
1524 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
Patrick Georgi0588d192009-08-12 15:00:51 +00001525# undef YYSTACK_RELOCATE
1526 if (yyss1 != yyssa)
1527 YYSTACK_FREE (yyss1);
1528 }
1529# endif
1530#endif /* no yyoverflow */
1531
1532 yyssp = yyss + yysize - 1;
1533 yyvsp = yyvs + yysize - 1;
1534
Patrick Georgi0588d192009-08-12 15:00:51 +00001535 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1536 (unsigned long int) yystacksize));
1537
1538 if (yyss + yystacksize - 1 <= yyssp)
1539 YYABORT;
1540 }
1541
1542 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1543
Patrick Georgid5208402014-04-11 20:24:06 +02001544 if (yystate == YYFINAL)
1545 YYACCEPT;
1546
Patrick Georgi0588d192009-08-12 15:00:51 +00001547 goto yybackup;
1548
1549/*-----------.
1550| yybackup. |
1551`-----------*/
1552yybackup:
1553
1554 /* Do appropriate processing given the current state. Read a
Patrick Georgid5208402014-04-11 20:24:06 +02001555 lookahead token if we need one and don't already have one. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001556
Patrick Georgid5208402014-04-11 20:24:06 +02001557 /* First try to decide what to do without reference to lookahead token. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001558 yyn = yypact[yystate];
Patrick Georgid5208402014-04-11 20:24:06 +02001559 if (yypact_value_is_default (yyn))
Patrick Georgi0588d192009-08-12 15:00:51 +00001560 goto yydefault;
1561
Patrick Georgid5208402014-04-11 20:24:06 +02001562 /* Not known => get a lookahead token if don't already have one. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001563
Patrick Georgid5208402014-04-11 20:24:06 +02001564 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001565 if (yychar == YYEMPTY)
1566 {
1567 YYDPRINTF ((stderr, "Reading a token: "));
1568 yychar = YYLEX;
1569 }
1570
1571 if (yychar <= YYEOF)
1572 {
1573 yychar = yytoken = YYEOF;
1574 YYDPRINTF ((stderr, "Now at end of input.\n"));
1575 }
1576 else
1577 {
1578 yytoken = YYTRANSLATE (yychar);
1579 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1580 }
1581
1582 /* If the proper action on seeing token YYTOKEN is to reduce or to
1583 detect an error, take that action. */
1584 yyn += yytoken;
1585 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1586 goto yydefault;
1587 yyn = yytable[yyn];
1588 if (yyn <= 0)
1589 {
Patrick Georgid5208402014-04-11 20:24:06 +02001590 if (yytable_value_is_error (yyn))
1591 goto yyerrlab;
Patrick Georgi0588d192009-08-12 15:00:51 +00001592 yyn = -yyn;
1593 goto yyreduce;
1594 }
1595
Patrick Georgi0588d192009-08-12 15:00:51 +00001596 /* Count tokens shifted since error; after three, turn off error
1597 status. */
1598 if (yyerrstatus)
1599 yyerrstatus--;
1600
Patrick Georgid5208402014-04-11 20:24:06 +02001601 /* Shift the lookahead token. */
Patrick Georgi0588d192009-08-12 15:00:51 +00001602 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1603
Patrick Georgid5208402014-04-11 20:24:06 +02001604 /* Discard the shifted token. */
1605 yychar = YYEMPTY;
Patrick Georgi0588d192009-08-12 15:00:51 +00001606
1607 yystate = yyn;
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001608 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Patrick Georgi0588d192009-08-12 15:00:51 +00001609 *++yyvsp = yylval;
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001610 YY_IGNORE_MAYBE_UNINITIALIZED_END
Patrick Georgi0588d192009-08-12 15:00:51 +00001611
1612 goto yynewstate;
1613
1614
1615/*-----------------------------------------------------------.
1616| yydefault -- do the default action for the current state. |
1617`-----------------------------------------------------------*/
1618yydefault:
1619 yyn = yydefact[yystate];
1620 if (yyn == 0)
1621 goto yyerrlab;
1622 goto yyreduce;
1623
1624
1625/*-----------------------------.
1626| yyreduce -- Do a reduction. |
1627`-----------------------------*/
1628yyreduce:
1629 /* yyn is the number of a rule to reduce with. */
1630 yylen = yyr2[yyn];
1631
1632 /* If YYLEN is nonzero, implement the default value of the action:
1633 `$$ = $1'.
1634
1635 Otherwise, the following line sets YYVAL to garbage.
1636 This behavior is undocumented and Bison
1637 users should not rely upon it. Assigning to YYVAL
1638 unconditionally makes the parser a bit smaller, and it avoids a
1639 GCC warning that YYVAL may be used uninitialized. */
1640 yyval = yyvsp[1-yylen];
1641
1642
1643 YY_REDUCE_PRINT (yyn);
1644 switch (yyn)
1645 {
Patrick Georgid5208402014-04-11 20:24:06 +02001646 case 10:
Patrick Georgi0588d192009-08-12 15:00:51 +00001647
Patrick Georgid5208402014-04-11 20:24:06 +02001648 { zconf_error("unexpected end statement"); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001649 break;
1650
1651 case 11:
1652
Patrick Georgid5208402014-04-11 20:24:06 +02001653 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001654 break;
1655
Patrick Georgid5208402014-04-11 20:24:06 +02001656 case 12:
Patrick Georgi0588d192009-08-12 15:00:51 +00001657
Patrick Georgid5208402014-04-11 20:24:06 +02001658 {
1659 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
1660}
Patrick Georgi0588d192009-08-12 15:00:51 +00001661 break;
1662
Patrick Georgid5208402014-04-11 20:24:06 +02001663 case 13:
Patrick Georgi0588d192009-08-12 15:00:51 +00001664
Patrick Georgid5208402014-04-11 20:24:06 +02001665 { zconf_error("invalid statement"); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001666 break;
1667
Patrick Georgid5208402014-04-11 20:24:06 +02001668 case 28:
1669
1670 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); }
1671 break;
1672
1673 case 29:
1674
1675 { zconf_error("invalid option"); }
1676 break;
1677
1678 case 30:
Patrick Georgi0588d192009-08-12 15:00:51 +00001679
1680 {
1681 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
1682 sym->flags |= SYMBOL_OPTIONAL;
1683 menu_add_entry(sym);
1684 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
Patrick Georgid5208402014-04-11 20:24:06 +02001685}
Patrick Georgi0588d192009-08-12 15:00:51 +00001686 break;
1687
Patrick Georgid5208402014-04-11 20:24:06 +02001688 case 31:
Patrick Georgi0588d192009-08-12 15:00:51 +00001689
1690 {
1691 menu_end_entry();
1692 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001693}
Patrick Georgi0588d192009-08-12 15:00:51 +00001694 break;
1695
Patrick Georgid5208402014-04-11 20:24:06 +02001696 case 32:
Patrick Georgi0588d192009-08-12 15:00:51 +00001697
1698 {
1699 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
1700 sym->flags |= SYMBOL_OPTIONAL;
1701 menu_add_entry(sym);
1702 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
Patrick Georgid5208402014-04-11 20:24:06 +02001703}
Patrick Georgi0588d192009-08-12 15:00:51 +00001704 break;
1705
Patrick Georgid5208402014-04-11 20:24:06 +02001706 case 33:
Patrick Georgi0588d192009-08-12 15:00:51 +00001707
1708 {
1709 if (current_entry->prompt)
1710 current_entry->prompt->type = P_MENU;
1711 else
1712 zconfprint("warning: menuconfig statement without prompt");
1713 menu_end_entry();
1714 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001715}
Patrick Georgi0588d192009-08-12 15:00:51 +00001716 break;
1717
Patrick Georgid5208402014-04-11 20:24:06 +02001718 case 41:
Patrick Georgi0588d192009-08-12 15:00:51 +00001719
1720 {
1721 menu_set_type((yyvsp[(1) - (3)].id)->stype);
1722 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1723 zconf_curname(), zconf_lineno(),
1724 (yyvsp[(1) - (3)].id)->stype);
Patrick Georgid5208402014-04-11 20:24:06 +02001725}
Patrick Georgi0588d192009-08-12 15:00:51 +00001726 break;
1727
Patrick Georgid5208402014-04-11 20:24:06 +02001728 case 42:
Patrick Georgi0588d192009-08-12 15:00:51 +00001729
1730 {
1731 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1732 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001733}
Patrick Georgi0588d192009-08-12 15:00:51 +00001734 break;
1735
Patrick Georgid5208402014-04-11 20:24:06 +02001736 case 43:
Patrick Georgi0588d192009-08-12 15:00:51 +00001737
1738 {
1739 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
1740 if ((yyvsp[(1) - (4)].id)->stype != S_UNKNOWN)
1741 menu_set_type((yyvsp[(1) - (4)].id)->stype);
1742 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1743 zconf_curname(), zconf_lineno(),
1744 (yyvsp[(1) - (4)].id)->stype);
Patrick Georgid5208402014-04-11 20:24:06 +02001745}
Patrick Georgi0588d192009-08-12 15:00:51 +00001746 break;
1747
Patrick Georgid5208402014-04-11 20:24:06 +02001748 case 44:
Patrick Georgi0588d192009-08-12 15:00:51 +00001749
1750 {
1751 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
1752 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001753}
Patrick Georgi0588d192009-08-12 15:00:51 +00001754 break;
1755
1756 case 45:
1757
1758 {
Patrick Georgid5208402014-04-11 20:24:06 +02001759 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
1760 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1761}
1762 break;
1763
1764 case 48:
1765
1766 {
1767 const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
Patrick Georgi0588d192009-08-12 15:00:51 +00001768 if (id && id->flags & TF_OPTION)
1769 menu_add_option(id->token, (yyvsp[(3) - (3)].string));
1770 else
1771 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
1772 free((yyvsp[(2) - (3)].string));
Patrick Georgid5208402014-04-11 20:24:06 +02001773}
Patrick Georgi0588d192009-08-12 15:00:51 +00001774 break;
1775
Patrick Georgid5208402014-04-11 20:24:06 +02001776 case 49:
Patrick Georgi0588d192009-08-12 15:00:51 +00001777
Patrick Georgid5208402014-04-11 20:24:06 +02001778 { (yyval.string) = NULL; }
Patrick Georgi0588d192009-08-12 15:00:51 +00001779 break;
1780
Patrick Georgid5208402014-04-11 20:24:06 +02001781 case 50:
Patrick Georgi0588d192009-08-12 15:00:51 +00001782
Patrick Georgid5208402014-04-11 20:24:06 +02001783 { (yyval.string) = (yyvsp[(2) - (2)].string); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001784 break;
1785
Patrick Georgid5208402014-04-11 20:24:06 +02001786 case 51:
Patrick Georgi0588d192009-08-12 15:00:51 +00001787
1788 {
Roman Zippel543aa7b2008-02-29 05:11:50 +01001789 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
1790 sym->flags |= SYMBOL_AUTO;
Patrick Georgi0588d192009-08-12 15:00:51 +00001791 menu_add_entry(sym);
1792 menu_add_expr(P_CHOICE, NULL, NULL);
1793 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001794}
Patrick Georgi0588d192009-08-12 15:00:51 +00001795 break;
1796
Patrick Georgid5208402014-04-11 20:24:06 +02001797 case 52:
Patrick Georgi0588d192009-08-12 15:00:51 +00001798
1799 {
1800 (yyval.menu) = menu_add_menu();
Patrick Georgid5208402014-04-11 20:24:06 +02001801}
Patrick Georgi0588d192009-08-12 15:00:51 +00001802 break;
1803
Patrick Georgid5208402014-04-11 20:24:06 +02001804 case 53:
Patrick Georgi0588d192009-08-12 15:00:51 +00001805
1806 {
1807 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
1808 menu_end_menu();
1809 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1810 }
Patrick Georgid5208402014-04-11 20:24:06 +02001811}
Patrick Georgi0588d192009-08-12 15:00:51 +00001812 break;
1813
Patrick Georgid5208402014-04-11 20:24:06 +02001814 case 61:
Patrick Georgi0588d192009-08-12 15:00:51 +00001815
1816 {
1817 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1818 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001819}
Patrick Georgi0588d192009-08-12 15:00:51 +00001820 break;
1821
Patrick Georgid5208402014-04-11 20:24:06 +02001822 case 62:
Patrick Georgi0588d192009-08-12 15:00:51 +00001823
1824 {
1825 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
1826 menu_set_type((yyvsp[(1) - (3)].id)->stype);
1827 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1828 zconf_curname(), zconf_lineno(),
1829 (yyvsp[(1) - (3)].id)->stype);
1830 } else
1831 YYERROR;
Patrick Georgid5208402014-04-11 20:24:06 +02001832}
Patrick Georgi0588d192009-08-12 15:00:51 +00001833 break;
1834
Patrick Georgid5208402014-04-11 20:24:06 +02001835 case 63:
Patrick Georgi0588d192009-08-12 15:00:51 +00001836
1837 {
1838 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1839 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001840}
Patrick Georgi0588d192009-08-12 15:00:51 +00001841 break;
1842
Patrick Georgid5208402014-04-11 20:24:06 +02001843 case 64:
Patrick Georgi0588d192009-08-12 15:00:51 +00001844
1845 {
1846 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
1847 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
1848 printd(DEBUG_PARSE, "%s:%d:default\n",
1849 zconf_curname(), zconf_lineno());
1850 } else
1851 YYERROR;
Patrick Georgid5208402014-04-11 20:24:06 +02001852}
Patrick Georgi0588d192009-08-12 15:00:51 +00001853 break;
1854
Patrick Georgid5208402014-04-11 20:24:06 +02001855 case 67:
Patrick Georgi0588d192009-08-12 15:00:51 +00001856
1857 {
1858 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1859 menu_add_entry(NULL);
1860 menu_add_dep((yyvsp[(2) - (3)].expr));
1861 (yyval.menu) = menu_add_menu();
Patrick Georgid5208402014-04-11 20:24:06 +02001862}
Patrick Georgi0588d192009-08-12 15:00:51 +00001863 break;
1864
Patrick Georgid5208402014-04-11 20:24:06 +02001865 case 68:
Patrick Georgi0588d192009-08-12 15:00:51 +00001866
1867 {
1868 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
1869 menu_end_menu();
1870 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1871 }
Patrick Georgid5208402014-04-11 20:24:06 +02001872}
Patrick Georgi0588d192009-08-12 15:00:51 +00001873 break;
1874
Patrick Georgid5208402014-04-11 20:24:06 +02001875 case 74:
1876
1877 {
1878 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1879}
1880 break;
1881
1882 case 75:
Patrick Georgi0588d192009-08-12 15:00:51 +00001883
1884 {
1885 menu_add_entry(NULL);
1886 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1887 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001888}
Patrick Georgi0588d192009-08-12 15:00:51 +00001889 break;
1890
Patrick Georgid5208402014-04-11 20:24:06 +02001891 case 76:
Patrick Georgi0588d192009-08-12 15:00:51 +00001892
1893 {
1894 (yyval.menu) = menu_add_menu();
Patrick Georgid5208402014-04-11 20:24:06 +02001895}
Patrick Georgi0588d192009-08-12 15:00:51 +00001896 break;
1897
Patrick Georgid5208402014-04-11 20:24:06 +02001898 case 77:
Patrick Georgi0588d192009-08-12 15:00:51 +00001899
1900 {
1901 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
1902 menu_end_menu();
1903 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1904 }
Patrick Georgid5208402014-04-11 20:24:06 +02001905}
Patrick Georgi0588d192009-08-12 15:00:51 +00001906 break;
1907
1908 case 83:
1909
1910 {
Patrick Georgid5208402014-04-11 20:24:06 +02001911 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02001912 zconf_nextfiles((yyvsp[(2) - (3)].string));
Patrick Georgid5208402014-04-11 20:24:06 +02001913}
Patrick Georgi0588d192009-08-12 15:00:51 +00001914 break;
1915
Patrick Georgid5208402014-04-11 20:24:06 +02001916 case 84:
1917
1918 {
1919 menu_add_entry(NULL);
1920 menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
1921 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1922}
1923 break;
1924
1925 case 85:
1926
1927 {
1928 menu_end_entry();
1929}
1930 break;
1931
1932 case 86:
1933
1934 {
1935 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1936 zconf_starthelp();
1937}
1938 break;
1939
1940 case 87:
1941
1942 {
1943 current_entry->help = (yyvsp[(2) - (2)].string);
1944}
1945 break;
1946
1947 case 92:
Patrick Georgi0588d192009-08-12 15:00:51 +00001948
1949 {
1950 menu_add_dep((yyvsp[(3) - (4)].expr));
1951 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
Patrick Georgid5208402014-04-11 20:24:06 +02001952}
Patrick Georgi0588d192009-08-12 15:00:51 +00001953 break;
1954
Patrick Georgid5208402014-04-11 20:24:06 +02001955 case 96:
Patrick Georgi0588d192009-08-12 15:00:51 +00001956
1957 {
Patrick Georgid5208402014-04-11 20:24:06 +02001958 menu_add_visibility((yyvsp[(2) - (2)].expr));
1959}
Patrick Georgi0588d192009-08-12 15:00:51 +00001960 break;
1961
1962 case 98:
1963
Patrick Georgid5208402014-04-11 20:24:06 +02001964 {
1965 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
1966}
Patrick Georgi0588d192009-08-12 15:00:51 +00001967 break;
1968
1969 case 101:
1970
Patrick Georgid5208402014-04-11 20:24:06 +02001971 { (yyval.id) = (yyvsp[(1) - (2)].id); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001972 break;
1973
1974 case 102:
1975
Patrick Georgid5208402014-04-11 20:24:06 +02001976 { (yyval.id) = (yyvsp[(1) - (2)].id); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001977 break;
1978
1979 case 103:
1980
Patrick Georgid5208402014-04-11 20:24:06 +02001981 { (yyval.id) = (yyvsp[(1) - (2)].id); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001982 break;
1983
1984 case 106:
1985
Patrick Georgid5208402014-04-11 20:24:06 +02001986 { (yyval.expr) = NULL; }
Patrick Georgi0588d192009-08-12 15:00:51 +00001987 break;
1988
1989 case 107:
1990
Patrick Georgid5208402014-04-11 20:24:06 +02001991 { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
Patrick Georgi0588d192009-08-12 15:00:51 +00001992 break;
1993
1994 case 108:
1995
Patrick Georgid5208402014-04-11 20:24:06 +02001996 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); }
Roman Zippel543aa7b2008-02-29 05:11:50 +01001997 break;
1998
1999 case 109:
2000
Patrick Georgid5208402014-04-11 20:24:06 +02002001 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
2002 break;
2003
2004 case 110:
2005
2006 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
2007 break;
2008
2009 case 111:
2010
2011 { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
2012 break;
2013
2014 case 112:
2015
2016 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); }
2017 break;
2018
2019 case 113:
2020
2021 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2022 break;
2023
2024 case 114:
2025
2026 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2027 break;
2028
2029 case 115:
2030
2031 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); }
2032 break;
2033
2034 case 116:
2035
2036 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); }
2037 break;
2038
2039 case 117:
2040
2041 { (yyval.string) = NULL; }
Patrick Georgi0588d192009-08-12 15:00:51 +00002042 break;
2043
2044
Patrick Georgi0588d192009-08-12 15:00:51 +00002045
2046 default: break;
2047 }
Patrick Georgid5208402014-04-11 20:24:06 +02002048 /* User semantic actions sometimes alter yychar, and that requires
2049 that yytoken be updated with the new translation. We take the
2050 approach of translating immediately before every use of yytoken.
2051 One alternative is translating here after every semantic action,
2052 but that translation would be missed if the semantic action invokes
2053 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2054 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2055 incorrect destructor might then be invoked immediately. In the
2056 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2057 to an incorrect destructor call or verbose syntax error message
2058 before the lookahead is translated. */
Patrick Georgi0588d192009-08-12 15:00:51 +00002059 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2060
2061 YYPOPSTACK (yylen);
2062 yylen = 0;
2063 YY_STACK_PRINT (yyss, yyssp);
2064
2065 *++yyvsp = yyval;
2066
Patrick Georgi0588d192009-08-12 15:00:51 +00002067 /* Now `shift' the result of the reduction. Determine what state
2068 that goes to, based on the state we popped back to and the rule
2069 number reduced by. */
2070
2071 yyn = yyr1[yyn];
2072
2073 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2074 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2075 yystate = yytable[yystate];
2076 else
2077 yystate = yydefgoto[yyn - YYNTOKENS];
2078
2079 goto yynewstate;
2080
2081
2082/*------------------------------------.
2083| yyerrlab -- here on detecting error |
2084`------------------------------------*/
2085yyerrlab:
Patrick Georgid5208402014-04-11 20:24:06 +02002086 /* Make sure we have latest lookahead translation. See comments at
2087 user semantic actions for why this is necessary. */
2088 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2089
Patrick Georgi0588d192009-08-12 15:00:51 +00002090 /* If not already recovering from an error, report this error. */
2091 if (!yyerrstatus)
2092 {
2093 ++yynerrs;
2094#if ! YYERROR_VERBOSE
2095 yyerror (YY_("syntax error"));
2096#else
Patrick Georgid5208402014-04-11 20:24:06 +02002097# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2098 yyssp, yytoken)
Patrick Georgi0588d192009-08-12 15:00:51 +00002099 {
Patrick Georgid5208402014-04-11 20:24:06 +02002100 char const *yymsgp = YY_("syntax error");
2101 int yysyntax_error_status;
2102 yysyntax_error_status = YYSYNTAX_ERROR;
2103 if (yysyntax_error_status == 0)
2104 yymsgp = yymsg;
2105 else if (yysyntax_error_status == 1)
2106 {
2107 if (yymsg != yymsgbuf)
2108 YYSTACK_FREE (yymsg);
2109 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2110 if (!yymsg)
2111 {
2112 yymsg = yymsgbuf;
2113 yymsg_alloc = sizeof yymsgbuf;
2114 yysyntax_error_status = 2;
2115 }
2116 else
2117 {
2118 yysyntax_error_status = YYSYNTAX_ERROR;
2119 yymsgp = yymsg;
2120 }
2121 }
2122 yyerror (yymsgp);
2123 if (yysyntax_error_status == 2)
2124 goto yyexhaustedlab;
Patrick Georgi0588d192009-08-12 15:00:51 +00002125 }
Patrick Georgid5208402014-04-11 20:24:06 +02002126# undef YYSYNTAX_ERROR
Patrick Georgi0588d192009-08-12 15:00:51 +00002127#endif
2128 }
2129
2130
2131
2132 if (yyerrstatus == 3)
2133 {
Patrick Georgid5208402014-04-11 20:24:06 +02002134 /* If just tried and failed to reuse lookahead token after an
Patrick Georgi0588d192009-08-12 15:00:51 +00002135 error, discard it. */
2136
2137 if (yychar <= YYEOF)
2138 {
2139 /* Return failure if at end of input. */
2140 if (yychar == YYEOF)
2141 YYABORT;
2142 }
2143 else
2144 {
2145 yydestruct ("Error: discarding",
2146 yytoken, &yylval);
2147 yychar = YYEMPTY;
2148 }
2149 }
2150
Patrick Georgid5208402014-04-11 20:24:06 +02002151 /* Else will try to reuse lookahead token after shifting the error
Patrick Georgi0588d192009-08-12 15:00:51 +00002152 token. */
2153 goto yyerrlab1;
2154
2155
2156/*---------------------------------------------------.
2157| yyerrorlab -- error raised explicitly by YYERROR. |
2158`---------------------------------------------------*/
2159yyerrorlab:
2160
2161 /* Pacify compilers like GCC when the user code never invokes
2162 YYERROR and the label yyerrorlab therefore never appears in user
2163 code. */
2164 if (/*CONSTCOND*/ 0)
2165 goto yyerrorlab;
2166
2167 /* Do not reclaim the symbols of the rule which action triggered
2168 this YYERROR. */
2169 YYPOPSTACK (yylen);
2170 yylen = 0;
2171 YY_STACK_PRINT (yyss, yyssp);
2172 yystate = *yyssp;
2173 goto yyerrlab1;
2174
2175
2176/*-------------------------------------------------------------.
2177| yyerrlab1 -- common code for both syntax error and YYERROR. |
2178`-------------------------------------------------------------*/
2179yyerrlab1:
2180 yyerrstatus = 3; /* Each real token shifted decrements this. */
2181
2182 for (;;)
2183 {
2184 yyn = yypact[yystate];
Patrick Georgid5208402014-04-11 20:24:06 +02002185 if (!yypact_value_is_default (yyn))
Patrick Georgi0588d192009-08-12 15:00:51 +00002186 {
2187 yyn += YYTERROR;
2188 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2189 {
2190 yyn = yytable[yyn];
2191 if (0 < yyn)
2192 break;
2193 }
2194 }
2195
2196 /* Pop the current state because it cannot handle the error token. */
2197 if (yyssp == yyss)
2198 YYABORT;
2199
2200
2201 yydestruct ("Error: popping",
2202 yystos[yystate], yyvsp);
2203 YYPOPSTACK (1);
2204 yystate = *yyssp;
2205 YY_STACK_PRINT (yyss, yyssp);
2206 }
2207
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02002208 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Patrick Georgi0588d192009-08-12 15:00:51 +00002209 *++yyvsp = yylval;
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02002210 YY_IGNORE_MAYBE_UNINITIALIZED_END
Patrick Georgi0588d192009-08-12 15:00:51 +00002211
2212
2213 /* Shift the error token. */
2214 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2215
2216 yystate = yyn;
2217 goto yynewstate;
2218
2219
2220/*-------------------------------------.
2221| yyacceptlab -- YYACCEPT comes here. |
2222`-------------------------------------*/
2223yyacceptlab:
2224 yyresult = 0;
2225 goto yyreturn;
2226
2227/*-----------------------------------.
2228| yyabortlab -- YYABORT comes here. |
2229`-----------------------------------*/
2230yyabortlab:
2231 yyresult = 1;
2232 goto yyreturn;
2233
Stefan Reinauerf78a09b2015-04-03 20:01:38 +02002234#if !defined yyoverflow || YYERROR_VERBOSE
Patrick Georgi0588d192009-08-12 15:00:51 +00002235/*-------------------------------------------------.
2236| yyexhaustedlab -- memory exhaustion comes here. |
2237`-------------------------------------------------*/
2238yyexhaustedlab:
2239 yyerror (YY_("memory exhausted"));
2240 yyresult = 2;
2241 /* Fall through. */
2242#endif
2243
2244yyreturn:
Patrick Georgid5208402014-04-11 20:24:06 +02002245 if (yychar != YYEMPTY)
2246 {
2247 /* Make sure we have latest lookahead translation. See comments at
2248 user semantic actions for why this is necessary. */
2249 yytoken = YYTRANSLATE (yychar);
2250 yydestruct ("Cleanup: discarding lookahead",
2251 yytoken, &yylval);
2252 }
Patrick Georgi0588d192009-08-12 15:00:51 +00002253 /* Do not reclaim the symbols of the rule which action triggered
2254 this YYABORT or YYACCEPT. */
2255 YYPOPSTACK (yylen);
2256 YY_STACK_PRINT (yyss, yyssp);
2257 while (yyssp != yyss)
2258 {
2259 yydestruct ("Cleanup: popping",
2260 yystos[*yyssp], yyvsp);
2261 YYPOPSTACK (1);
2262 }
2263#ifndef yyoverflow
2264 if (yyss != yyssa)
2265 YYSTACK_FREE (yyss);
2266#endif
2267#if YYERROR_VERBOSE
2268 if (yymsg != yymsgbuf)
2269 YYSTACK_FREE (yymsg);
2270#endif
2271 /* Make sure YYID is used. */
2272 return YYID (yyresult);
2273}
2274
2275
2276
2277
2278
2279void conf_parse(const char *name)
2280{
2281 struct symbol *sym;
2282 int i;
2283
2284 zconf_initscan(name);
2285
2286 sym_init();
Patrick Georgid5208402014-04-11 20:24:06 +02002287 _menu_init();
2288 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
Patrick Georgi0588d192009-08-12 15:00:51 +00002289
Patrick Georgi0588d192009-08-12 15:00:51 +00002290 if (getenv("ZCONF_DEBUG"))
2291 zconfdebug = 1;
Patrick Georgi0588d192009-08-12 15:00:51 +00002292 zconfparse();
2293 if (zconfnerrs)
2294 exit(1);
Patrick Georgid5208402014-04-11 20:24:06 +02002295 if (!modules_sym)
2296 modules_sym = sym_find( "n" );
Patrick Georgi0588d192009-08-12 15:00:51 +00002297
Patrick Georgid5208402014-04-11 20:24:06 +02002298 rootmenu.prompt->text = _(rootmenu.prompt->text);
2299 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
2300
Patrick Georgi0588d192009-08-12 15:00:51 +00002301 menu_finalize(&rootmenu);
2302 for_all_symbols(i, sym) {
2303 if (sym_check_deps(sym))
2304 zconfnerrs++;
Stefan Reinauer3ec23b32015-04-06 00:59:23 +02002305 }
Patrick Georgi0588d192009-08-12 15:00:51 +00002306 if (zconfnerrs)
2307 exit(1);
2308 sym_set_change_count(1);
2309}
2310
Patrick Georgid5208402014-04-11 20:24:06 +02002311static const char *zconf_tokenname(int token)
Patrick Georgi0588d192009-08-12 15:00:51 +00002312{
2313 switch (token) {
2314 case T_MENU: return "menu";
2315 case T_ENDMENU: return "endmenu";
2316 case T_CHOICE: return "choice";
2317 case T_ENDCHOICE: return "endchoice";
2318 case T_IF: return "if";
2319 case T_ENDIF: return "endif";
2320 case T_DEPENDS: return "depends";
Patrick Georgid5208402014-04-11 20:24:06 +02002321 case T_VISIBLE: return "visible";
Patrick Georgi0588d192009-08-12 15:00:51 +00002322 }
2323 return "<token>";
2324}
2325
Patrick Georgid5208402014-04-11 20:24:06 +02002326static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
Patrick Georgi0588d192009-08-12 15:00:51 +00002327{
2328 if (id->token != endtoken) {
2329 zconf_error("unexpected '%s' within %s block",
2330 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2331 zconfnerrs++;
2332 return false;
2333 }
2334 if (current_menu->file != current_file) {
2335 zconf_error("'%s' in different file than '%s'",
2336 kconf_id_strings + id->name, zconf_tokenname(starttoken));
2337 fprintf(stderr, "%s:%d: location of the '%s'\n",
2338 current_menu->file->name, current_menu->lineno,
2339 zconf_tokenname(starttoken));
2340 zconfnerrs++;
2341 return false;
2342 }
2343 return true;
2344}
2345
2346static void zconfprint(const char *err, ...)
2347{
2348 va_list ap;
2349
2350 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2351 va_start(ap, err);
2352 vfprintf(stderr, err, ap);
2353 va_end(ap);
2354 fprintf(stderr, "\n");
2355}
2356
2357static void zconf_error(const char *err, ...)
2358{
2359 va_list ap;
2360
2361 zconfnerrs++;
2362 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2363 va_start(ap, err);
2364 vfprintf(stderr, err, ap);
2365 va_end(ap);
2366 fprintf(stderr, "\n");
2367}
2368
2369static void zconferror(const char *err)
2370{
Patrick Georgi0588d192009-08-12 15:00:51 +00002371 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
Patrick Georgi0588d192009-08-12 15:00:51 +00002372}
2373
Patrick Georgid5208402014-04-11 20:24:06 +02002374static void print_quoted_string(FILE *out, const char *str)
Patrick Georgi0588d192009-08-12 15:00:51 +00002375{
2376 const char *p;
2377 int len;
2378
2379 putc('"', out);
2380 while ((p = strchr(str, '"'))) {
2381 len = p - str;
2382 if (len)
2383 fprintf(out, "%.*s", len, str);
2384 fputs("\\\"", out);
2385 str = p + 1;
2386 }
2387 fputs(str, out);
2388 putc('"', out);
2389}
2390
Patrick Georgid5208402014-04-11 20:24:06 +02002391static void print_symbol(FILE *out, struct menu *menu)
Patrick Georgi0588d192009-08-12 15:00:51 +00002392{
2393 struct symbol *sym = menu->sym;
2394 struct property *prop;
2395
2396 if (sym_is_choice(sym))
Patrick Georgid5208402014-04-11 20:24:06 +02002397 fprintf(out, "\nchoice\n");
Patrick Georgi0588d192009-08-12 15:00:51 +00002398 else
Patrick Georgid5208402014-04-11 20:24:06 +02002399 fprintf(out, "\nconfig %s\n", sym->name);
Patrick Georgi0588d192009-08-12 15:00:51 +00002400 switch (sym->type) {
2401 case S_BOOLEAN:
2402 fputs(" boolean\n", out);
2403 break;
2404 case S_TRISTATE:
2405 fputs(" tristate\n", out);
2406 break;
2407 case S_STRING:
2408 fputs(" string\n", out);
2409 break;
2410 case S_INT:
2411 fputs(" integer\n", out);
2412 break;
2413 case S_HEX:
2414 fputs(" hex\n", out);
2415 break;
2416 default:
2417 fputs(" ???\n", out);
2418 break;
2419 }
2420 for (prop = sym->prop; prop; prop = prop->next) {
2421 if (prop->menu != menu)
2422 continue;
2423 switch (prop->type) {
2424 case P_PROMPT:
2425 fputs(" prompt ", out);
2426 print_quoted_string(out, prop->text);
2427 if (!expr_is_yes(prop->visible.expr)) {
2428 fputs(" if ", out);
2429 expr_fprint(prop->visible.expr, out);
2430 }
2431 fputc('\n', out);
2432 break;
2433 case P_DEFAULT:
2434 fputs( " default ", out);
2435 expr_fprint(prop->expr, out);
2436 if (!expr_is_yes(prop->visible.expr)) {
2437 fputs(" if ", out);
2438 expr_fprint(prop->visible.expr, out);
2439 }
2440 fputc('\n', out);
2441 break;
2442 case P_CHOICE:
2443 fputs(" #choice value\n", out);
2444 break;
Patrick Georgid5208402014-04-11 20:24:06 +02002445 case P_SELECT:
2446 fputs( " select ", out);
2447 expr_fprint(prop->expr, out);
2448 fputc('\n', out);
2449 break;
2450 case P_RANGE:
2451 fputs( " range ", out);
2452 expr_fprint(prop->expr, out);
2453 fputc('\n', out);
2454 break;
2455 case P_MENU:
2456 fputs( " menu ", out);
2457 print_quoted_string(out, prop->text);
2458 fputc('\n', out);
2459 break;
Patrick Georgi0588d192009-08-12 15:00:51 +00002460 default:
2461 fprintf(out, " unknown prop %d!\n", prop->type);
2462 break;
2463 }
2464 }
2465 if (menu->help) {
2466 int len = strlen(menu->help);
2467 while (menu->help[--len] == '\n')
2468 menu->help[len] = 0;
2469 fprintf(out, " help\n%s\n", menu->help);
2470 }
Patrick Georgi0588d192009-08-12 15:00:51 +00002471}
2472
2473void zconfdump(FILE *out)
2474{
2475 struct property *prop;
2476 struct symbol *sym;
2477 struct menu *menu;
2478
2479 menu = rootmenu.list;
2480 while (menu) {
2481 if ((sym = menu->sym))
2482 print_symbol(out, menu);
2483 else if ((prop = menu->prompt)) {
2484 switch (prop->type) {
2485 case P_COMMENT:
2486 fputs("\ncomment ", out);
2487 print_quoted_string(out, prop->text);
2488 fputs("\n", out);
2489 break;
2490 case P_MENU:
2491 fputs("\nmenu ", out);
2492 print_quoted_string(out, prop->text);
2493 fputs("\n", out);
2494 break;
2495 default:
2496 ;
2497 }
2498 if (!expr_is_yes(prop->visible.expr)) {
2499 fputs(" depends ", out);
2500 expr_fprint(prop->visible.expr, out);
2501 fputc('\n', out);
2502 }
Patrick Georgi0588d192009-08-12 15:00:51 +00002503 }
2504
2505 if (menu->list)
2506 menu = menu->list;
2507 else if (menu->next)
2508 menu = menu->next;
2509 else while ((menu = menu->parent)) {
2510 if (menu->prompt && menu->prompt->type == P_MENU)
2511 fputs("\nendmenu\n", out);
2512 if (menu->next) {
2513 menu = menu->next;
2514 break;
2515 }
2516 }
2517 }
2518}
2519
Patrick Georgid5208402014-04-11 20:24:06 +02002520#include "zconf.lex.c"
Patrick Georgi0588d192009-08-12 15:00:51 +00002521#include "util.c"
2522#include "confdata.c"
2523#include "expr.c"
2524#include "symbol.c"
2525#include "menu.c"