1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/kconfig/zconf.tab.c_shipped Sat Mar 31 19:45:25 2007 +0000
1.3 @@ -0,0 +1,2345 @@
1.4 +/* A Bison parser, made by GNU Bison 2.1. */
1.5 +
1.6 +/* Skeleton parser for Yacc-like parsing with Bison,
1.7 + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1.8 +
1.9 + This program is free software; you can redistribute it and/or modify
1.10 + it under the terms of the GNU General Public License as published by
1.11 + the Free Software Foundation; either version 2, or (at your option)
1.12 + any later version.
1.13 +
1.14 + This program is distributed in the hope that it will be useful,
1.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + GNU General Public License for more details.
1.18 +
1.19 + You should have received a copy of the GNU General Public License
1.20 + along with this program; if not, write to the Free Software
1.21 + Foundation, Inc., 51 Franklin Street, Fifth Floor,
1.22 + Boston, MA 02110-1301, USA. */
1.23 +
1.24 +/* As a special exception, when this file is copied by Bison into a
1.25 + Bison output file, you may use that output file without restriction.
1.26 + This special exception was added by the Free Software Foundation
1.27 + in version 1.24 of Bison. */
1.28 +
1.29 +/* Written by Richard Stallman by simplifying the original so called
1.30 + ``semantic'' parser. */
1.31 +
1.32 +/* All symbols defined below should begin with yy or YY, to avoid
1.33 + infringing on user name space. This should be done even for local
1.34 + variables, as they might otherwise be expanded by user macros.
1.35 + There are some unavoidable exceptions within include files to
1.36 + define necessary library symbols; they are noted "INFRINGES ON
1.37 + USER NAME SPACE" below. */
1.38 +
1.39 +/* Identify Bison output. */
1.40 +#define YYBISON 1
1.41 +
1.42 +/* Bison version. */
1.43 +#define YYBISON_VERSION "2.1"
1.44 +
1.45 +/* Skeleton name. */
1.46 +#define YYSKELETON_NAME "yacc.c"
1.47 +
1.48 +/* Pure parsers. */
1.49 +#define YYPURE 0
1.50 +
1.51 +/* Using locations. */
1.52 +#define YYLSP_NEEDED 0
1.53 +
1.54 +/* Substitute the variable and function names. */
1.55 +#define yyparse zconfparse
1.56 +#define yylex zconflex
1.57 +#define yyerror zconferror
1.58 +#define yylval zconflval
1.59 +#define yychar zconfchar
1.60 +#define yydebug zconfdebug
1.61 +#define yynerrs zconfnerrs
1.62 +
1.63 +
1.64 +/* Tokens. */
1.65 +#ifndef YYTOKENTYPE
1.66 +# define YYTOKENTYPE
1.67 + /* Put the tokens into the symbol table, so that GDB and other debuggers
1.68 + know about them. */
1.69 + enum yytokentype {
1.70 + T_MAINMENU = 258,
1.71 + T_MENU = 259,
1.72 + T_ENDMENU = 260,
1.73 + T_SOURCE = 261,
1.74 + T_CHOICE = 262,
1.75 + T_ENDCHOICE = 263,
1.76 + T_COMMENT = 264,
1.77 + T_CONFIG = 265,
1.78 + T_MENUCONFIG = 266,
1.79 + T_HELP = 267,
1.80 + T_HELPTEXT = 268,
1.81 + T_IF = 269,
1.82 + T_ENDIF = 270,
1.83 + T_DEPENDS = 271,
1.84 + T_REQUIRES = 272,
1.85 + T_OPTIONAL = 273,
1.86 + T_PROMPT = 274,
1.87 + T_TYPE = 275,
1.88 + T_DEFAULT = 276,
1.89 + T_SELECT = 277,
1.90 + T_RANGE = 278,
1.91 + T_OPTION = 279,
1.92 + T_ON = 280,
1.93 + T_WORD = 281,
1.94 + T_WORD_QUOTE = 282,
1.95 + T_UNEQUAL = 283,
1.96 + T_CLOSE_PAREN = 284,
1.97 + T_OPEN_PAREN = 285,
1.98 + T_EOL = 286,
1.99 + T_OR = 287,
1.100 + T_AND = 288,
1.101 + T_EQUAL = 289,
1.102 + T_NOT = 290
1.103 + };
1.104 +#endif
1.105 +/* Tokens. */
1.106 +#define T_MAINMENU 258
1.107 +#define T_MENU 259
1.108 +#define T_ENDMENU 260
1.109 +#define T_SOURCE 261
1.110 +#define T_CHOICE 262
1.111 +#define T_ENDCHOICE 263
1.112 +#define T_COMMENT 264
1.113 +#define T_CONFIG 265
1.114 +#define T_MENUCONFIG 266
1.115 +#define T_HELP 267
1.116 +#define T_HELPTEXT 268
1.117 +#define T_IF 269
1.118 +#define T_ENDIF 270
1.119 +#define T_DEPENDS 271
1.120 +#define T_REQUIRES 272
1.121 +#define T_OPTIONAL 273
1.122 +#define T_PROMPT 274
1.123 +#define T_TYPE 275
1.124 +#define T_DEFAULT 276
1.125 +#define T_SELECT 277
1.126 +#define T_RANGE 278
1.127 +#define T_OPTION 279
1.128 +#define T_ON 280
1.129 +#define T_WORD 281
1.130 +#define T_WORD_QUOTE 282
1.131 +#define T_UNEQUAL 283
1.132 +#define T_CLOSE_PAREN 284
1.133 +#define T_OPEN_PAREN 285
1.134 +#define T_EOL 286
1.135 +#define T_OR 287
1.136 +#define T_AND 288
1.137 +#define T_EQUAL 289
1.138 +#define T_NOT 290
1.139 +
1.140 +
1.141 +
1.142 +
1.143 +/* Copy the first part of user declarations. */
1.144 +
1.145 +
1.146 +/*
1.147 + * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
1.148 + * Released under the terms of the GNU GPL v2.0.
1.149 + */
1.150 +
1.151 +#include <ctype.h>
1.152 +#include <stdarg.h>
1.153 +#include <stdio.h>
1.154 +#include <stdlib.h>
1.155 +#include <string.h>
1.156 +#include <stdbool.h>
1.157 +
1.158 +#define LKC_DIRECT_LINK
1.159 +#include "lkc.h"
1.160 +
1.161 +#include "zconf.hash.c"
1.162 +
1.163 +#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
1.164 +
1.165 +#define PRINTD 0x0001
1.166 +#define DEBUG_PARSE 0x0002
1.167 +
1.168 +int cdebug = PRINTD;
1.169 +
1.170 +extern int zconflex(void);
1.171 +static void zconfprint(const char *err, ...);
1.172 +static void zconf_error(const char *err, ...);
1.173 +static void zconferror(const char *err);
1.174 +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
1.175 +
1.176 +struct symbol *symbol_hash[257];
1.177 +
1.178 +static struct menu *current_menu, *current_entry;
1.179 +
1.180 +#define YYDEBUG 0
1.181 +#if YYDEBUG
1.182 +#define YYERROR_VERBOSE
1.183 +#endif
1.184 +
1.185 +
1.186 +/* Enabling traces. */
1.187 +#ifndef YYDEBUG
1.188 +# define YYDEBUG 0
1.189 +#endif
1.190 +
1.191 +/* Enabling verbose error messages. */
1.192 +#ifdef YYERROR_VERBOSE
1.193 +# undef YYERROR_VERBOSE
1.194 +# define YYERROR_VERBOSE 1
1.195 +#else
1.196 +# define YYERROR_VERBOSE 0
1.197 +#endif
1.198 +
1.199 +/* Enabling the token table. */
1.200 +#ifndef YYTOKEN_TABLE
1.201 +# define YYTOKEN_TABLE 0
1.202 +#endif
1.203 +
1.204 +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1.205 +
1.206 +typedef union YYSTYPE {
1.207 + char *string;
1.208 + struct file *file;
1.209 + struct symbol *symbol;
1.210 + struct expr *expr;
1.211 + struct menu *menu;
1.212 + struct kconf_id *id;
1.213 +} YYSTYPE;
1.214 +/* Line 196 of yacc.c. */
1.215 +
1.216 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1.217 +# define YYSTYPE_IS_DECLARED 1
1.218 +# define YYSTYPE_IS_TRIVIAL 1
1.219 +#endif
1.220 +
1.221 +
1.222 +
1.223 +/* Copy the second part of user declarations. */
1.224 +
1.225 +
1.226 +/* Line 219 of yacc.c. */
1.227 +
1.228 +
1.229 +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1.230 +# define YYSIZE_T __SIZE_TYPE__
1.231 +#endif
1.232 +#if ! defined (YYSIZE_T) && defined (size_t)
1.233 +# define YYSIZE_T size_t
1.234 +#endif
1.235 +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1.236 +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1.237 +# define YYSIZE_T size_t
1.238 +#endif
1.239 +#if ! defined (YYSIZE_T)
1.240 +# define YYSIZE_T unsigned int
1.241 +#endif
1.242 +
1.243 +#ifndef YY_
1.244 +# if YYENABLE_NLS
1.245 +# if ENABLE_NLS
1.246 +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1.247 +# define YY_(msgid) dgettext ("bison-runtime", msgid)
1.248 +# endif
1.249 +# endif
1.250 +# ifndef YY_
1.251 +# define YY_(msgid) msgid
1.252 +# endif
1.253 +#endif
1.254 +
1.255 +#if ! defined (yyoverflow) || YYERROR_VERBOSE
1.256 +
1.257 +/* The parser invokes alloca or malloc; define the necessary symbols. */
1.258 +
1.259 +# ifdef YYSTACK_USE_ALLOCA
1.260 +# if YYSTACK_USE_ALLOCA
1.261 +# ifdef __GNUC__
1.262 +# define YYSTACK_ALLOC __builtin_alloca
1.263 +# else
1.264 +# define YYSTACK_ALLOC alloca
1.265 +# if defined (__STDC__) || defined (__cplusplus)
1.266 +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1.267 +# define YYINCLUDED_STDLIB_H
1.268 +# endif
1.269 +# endif
1.270 +# endif
1.271 +# endif
1.272 +
1.273 +# ifdef YYSTACK_ALLOC
1.274 + /* Pacify GCC's `empty if-body' warning. */
1.275 +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1.276 +# ifndef YYSTACK_ALLOC_MAXIMUM
1.277 + /* The OS might guarantee only one guard page at the bottom of the stack,
1.278 + and a page size can be as small as 4096 bytes. So we cannot safely
1.279 + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1.280 + to allow for a few compiler-allocated temporary stack slots. */
1.281 +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1.282 +# endif
1.283 +# else
1.284 +# define YYSTACK_ALLOC YYMALLOC
1.285 +# define YYSTACK_FREE YYFREE
1.286 +# ifndef YYSTACK_ALLOC_MAXIMUM
1.287 +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1.288 +# endif
1.289 +# ifdef __cplusplus
1.290 +extern "C" {
1.291 +# endif
1.292 +# ifndef YYMALLOC
1.293 +# define YYMALLOC malloc
1.294 +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1.295 + && (defined (__STDC__) || defined (__cplusplus)))
1.296 +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1.297 +# endif
1.298 +# endif
1.299 +# ifndef YYFREE
1.300 +# define YYFREE free
1.301 +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1.302 + && (defined (__STDC__) || defined (__cplusplus)))
1.303 +void free (void *); /* INFRINGES ON USER NAME SPACE */
1.304 +# endif
1.305 +# endif
1.306 +# ifdef __cplusplus
1.307 +}
1.308 +# endif
1.309 +# endif
1.310 +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1.311 +
1.312 +
1.313 +#if (! defined (yyoverflow) \
1.314 + && (! defined (__cplusplus) \
1.315 + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1.316 +
1.317 +/* A type that is properly aligned for any stack member. */
1.318 +union yyalloc
1.319 +{
1.320 + short int yyss;
1.321 + YYSTYPE yyvs;
1.322 + };
1.323 +
1.324 +/* The size of the maximum gap between one aligned stack and the next. */
1.325 +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1.326 +
1.327 +/* The size of an array large to enough to hold all stacks, each with
1.328 + N elements. */
1.329 +# define YYSTACK_BYTES(N) \
1.330 + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1.331 + + YYSTACK_GAP_MAXIMUM)
1.332 +
1.333 +/* Copy COUNT objects from FROM to TO. The source and destination do
1.334 + not overlap. */
1.335 +# ifndef YYCOPY
1.336 +# if defined (__GNUC__) && 1 < __GNUC__
1.337 +# define YYCOPY(To, From, Count) \
1.338 + __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1.339 +# else
1.340 +# define YYCOPY(To, From, Count) \
1.341 + do \
1.342 + { \
1.343 + YYSIZE_T yyi; \
1.344 + for (yyi = 0; yyi < (Count); yyi++) \
1.345 + (To)[yyi] = (From)[yyi]; \
1.346 + } \
1.347 + while (0)
1.348 +# endif
1.349 +# endif
1.350 +
1.351 +/* Relocate STACK from its old location to the new one. The
1.352 + local variables YYSIZE and YYSTACKSIZE give the old and new number of
1.353 + elements in the stack, and YYPTR gives the new location of the
1.354 + stack. Advance YYPTR to a properly aligned location for the next
1.355 + stack. */
1.356 +# define YYSTACK_RELOCATE(Stack) \
1.357 + do \
1.358 + { \
1.359 + YYSIZE_T yynewbytes; \
1.360 + YYCOPY (&yyptr->Stack, Stack, yysize); \
1.361 + Stack = &yyptr->Stack; \
1.362 + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1.363 + yyptr += yynewbytes / sizeof (*yyptr); \
1.364 + } \
1.365 + while (0)
1.366 +
1.367 +#endif
1.368 +
1.369 +#if defined (__STDC__) || defined (__cplusplus)
1.370 + typedef signed char yysigned_char;
1.371 +#else
1.372 + typedef short int yysigned_char;
1.373 +#endif
1.374 +
1.375 +/* YYFINAL -- State number of the termination state. */
1.376 +#define YYFINAL 3
1.377 +/* YYLAST -- Last index in YYTABLE. */
1.378 +#define YYLAST 275
1.379 +
1.380 +/* YYNTOKENS -- Number of terminals. */
1.381 +#define YYNTOKENS 36
1.382 +/* YYNNTS -- Number of nonterminals. */
1.383 +#define YYNNTS 45
1.384 +/* YYNRULES -- Number of rules. */
1.385 +#define YYNRULES 110
1.386 +/* YYNRULES -- Number of states. */
1.387 +#define YYNSTATES 183
1.388 +
1.389 +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1.390 +#define YYUNDEFTOK 2
1.391 +#define YYMAXUTOK 290
1.392 +
1.393 +#define YYTRANSLATE(YYX) \
1.394 + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1.395 +
1.396 +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1.397 +static const unsigned char yytranslate[] =
1.398 +{
1.399 + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.400 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.401 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.402 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.403 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.404 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.405 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.406 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.407 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.408 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.409 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.410 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.411 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.412 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.413 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.414 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.415 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.416 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.417 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.418 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.419 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.420 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.421 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.422 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.423 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1.424 + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1.425 + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1.426 + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1.427 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1.428 + 35
1.429 +};
1.430 +
1.431 +#if YYDEBUG
1.432 +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1.433 + YYRHS. */
1.434 +static const unsigned short int yyprhs[] =
1.435 +{
1.436 + 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
1.437 + 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
1.438 + 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
1.439 + 81, 84, 85, 88, 91, 94, 97, 100, 103, 107,
1.440 + 112, 117, 122, 128, 132, 133, 137, 138, 141, 144,
1.441 + 147, 149, 153, 154, 157, 160, 163, 166, 169, 174,
1.442 + 178, 181, 186, 187, 190, 194, 196, 200, 201, 204,
1.443 + 207, 210, 214, 217, 219, 223, 224, 227, 230, 233,
1.444 + 237, 241, 244, 247, 250, 251, 254, 257, 260, 265,
1.445 + 269, 273, 274, 277, 279, 281, 284, 287, 290, 292,
1.446 + 295, 296, 299, 301, 305, 309, 313, 316, 320, 324,
1.447 + 326
1.448 +};
1.449 +
1.450 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1.451 +static const yysigned_char yyrhs[] =
1.452 +{
1.453 + 37, 0, -1, 38, -1, -1, 38, 40, -1, 38,
1.454 + 54, -1, 38, 65, -1, 38, 3, 75, 77, -1,
1.455 + 38, 76, -1, 38, 26, 1, 31, -1, 38, 39,
1.456 + 1, 31, -1, 38, 1, 31, -1, 16, -1, 19,
1.457 + -1, 20, -1, 22, -1, 18, -1, 23, -1, 21,
1.458 + -1, 31, -1, 60, -1, 69, -1, 43, -1, 45,
1.459 + -1, 67, -1, 26, 1, 31, -1, 1, 31, -1,
1.460 + 10, 26, 31, -1, 42, 46, -1, 11, 26, 31,
1.461 + -1, 44, 46, -1, -1, 46, 47, -1, 46, 48,
1.462 + -1, 46, 73, -1, 46, 71, -1, 46, 41, -1,
1.463 + 46, 31, -1, 20, 74, 31, -1, 19, 75, 78,
1.464 + 31, -1, 21, 79, 78, 31, -1, 22, 26, 78,
1.465 + 31, -1, 23, 80, 80, 78, 31, -1, 24, 49,
1.466 + 31, -1, -1, 49, 26, 50, -1, -1, 34, 75,
1.467 + -1, 7, 31, -1, 51, 55, -1, 76, -1, 52,
1.468 + 57, 53, -1, -1, 55, 56, -1, 55, 73, -1,
1.469 + 55, 71, -1, 55, 31, -1, 55, 41, -1, 19,
1.470 + 75, 78, 31, -1, 20, 74, 31, -1, 18, 31,
1.471 + -1, 21, 26, 78, 31, -1, -1, 57, 40, -1,
1.472 + 14, 79, 77, -1, 76, -1, 58, 61, 59, -1,
1.473 + -1, 61, 40, -1, 61, 65, -1, 61, 54, -1,
1.474 + 4, 75, 31, -1, 62, 72, -1, 76, -1, 63,
1.475 + 66, 64, -1, -1, 66, 40, -1, 66, 65, -1,
1.476 + 66, 54, -1, 6, 75, 31, -1, 9, 75, 31,
1.477 + -1, 68, 72, -1, 12, 31, -1, 70, 13, -1,
1.478 + -1, 72, 73, -1, 72, 31, -1, 72, 41, -1,
1.479 + 16, 25, 79, 31, -1, 16, 79, 31, -1, 17,
1.480 + 79, 31, -1, -1, 75, 78, -1, 26, -1, 27,
1.481 + -1, 5, 31, -1, 8, 31, -1, 15, 31, -1,
1.482 + 31, -1, 77, 31, -1, -1, 14, 79, -1, 80,
1.483 + -1, 80, 34, 80, -1, 80, 28, 80, -1, 30,
1.484 + 79, 29, -1, 35, 79, -1, 79, 32, 79, -1,
1.485 + 79, 33, 79, -1, 26, -1, 27, -1
1.486 +};
1.487 +
1.488 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1.489 +static const unsigned short int yyrline[] =
1.490 +{
1.491 + 0, 105, 105, 107, 109, 110, 111, 112, 113, 114,
1.492 + 115, 119, 123, 123, 123, 123, 123, 123, 123, 127,
1.493 + 128, 129, 130, 131, 132, 136, 137, 143, 151, 157,
1.494 + 165, 175, 177, 178, 179, 180, 181, 182, 185, 193,
1.495 + 199, 209, 215, 221, 224, 226, 237, 238, 243, 252,
1.496 + 257, 265, 268, 270, 271, 272, 273, 274, 277, 283,
1.497 + 294, 300, 310, 312, 317, 325, 333, 336, 338, 339,
1.498 + 340, 345, 352, 357, 365, 368, 370, 371, 372, 375,
1.499 + 383, 390, 397, 403, 410, 412, 413, 414, 417, 422,
1.500 + 427, 435, 437, 442, 443, 446, 447, 448, 452, 453,
1.501 + 456, 457, 460, 461, 462, 463, 464, 465, 466, 469,
1.502 + 470
1.503 +};
1.504 +#endif
1.505 +
1.506 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1.507 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1.508 + First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1.509 +static const char *const yytname[] =
1.510 +{
1.511 + "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
1.512 + "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
1.513 + "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
1.514 + "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
1.515 + "T_SELECT", "T_RANGE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE",
1.516 + "T_UNEQUAL", "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND",
1.517 + "T_EQUAL", "T_NOT", "$accept", "input", "stmt_list", "option_name",
1.518 + "common_stmt", "option_error", "config_entry_start", "config_stmt",
1.519 + "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
1.520 + "config_option", "symbol_option", "symbol_option_list",
1.521 + "symbol_option_arg", "choice", "choice_entry", "choice_end",
1.522 + "choice_stmt", "choice_option_list", "choice_option", "choice_block",
1.523 + "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry",
1.524 + "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment",
1.525 + "comment_stmt", "help_start", "help", "depends_list", "depends",
1.526 + "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
1.527 +};
1.528 +#endif
1.529 +
1.530 +# ifdef YYPRINT
1.531 +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1.532 + token YYLEX-NUM. */
1.533 +static const unsigned short int yytoknum[] =
1.534 +{
1.535 + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1.536 + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1.537 + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1.538 + 285, 286, 287, 288, 289, 290
1.539 +};
1.540 +# endif
1.541 +
1.542 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1.543 +static const unsigned char yyr1[] =
1.544 +{
1.545 + 0, 36, 37, 38, 38, 38, 38, 38, 38, 38,
1.546 + 38, 38, 39, 39, 39, 39, 39, 39, 39, 40,
1.547 + 40, 40, 40, 40, 40, 41, 41, 42, 43, 44,
1.548 + 45, 46, 46, 46, 46, 46, 46, 46, 47, 47,
1.549 + 47, 47, 47, 48, 49, 49, 50, 50, 51, 52,
1.550 + 53, 54, 55, 55, 55, 55, 55, 55, 56, 56,
1.551 + 56, 56, 57, 57, 58, 59, 60, 61, 61, 61,
1.552 + 61, 62, 63, 64, 65, 66, 66, 66, 66, 67,
1.553 + 68, 69, 70, 71, 72, 72, 72, 72, 73, 73,
1.554 + 73, 74, 74, 75, 75, 76, 76, 76, 77, 77,
1.555 + 78, 78, 79, 79, 79, 79, 79, 79, 79, 80,
1.556 + 80
1.557 +};
1.558 +
1.559 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1.560 +static const unsigned char yyr2[] =
1.561 +{
1.562 + 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
1.563 + 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
1.564 + 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
1.565 + 2, 0, 2, 2, 2, 2, 2, 2, 3, 4,
1.566 + 4, 4, 5, 3, 0, 3, 0, 2, 2, 2,
1.567 + 1, 3, 0, 2, 2, 2, 2, 2, 4, 3,
1.568 + 2, 4, 0, 2, 3, 1, 3, 0, 2, 2,
1.569 + 2, 3, 2, 1, 3, 0, 2, 2, 2, 3,
1.570 + 3, 2, 2, 2, 0, 2, 2, 2, 4, 3,
1.571 + 3, 0, 2, 1, 1, 2, 2, 2, 1, 2,
1.572 + 0, 2, 1, 3, 3, 3, 2, 3, 3, 1,
1.573 + 1
1.574 +};
1.575 +
1.576 +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1.577 + STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1.578 + means the default is an error. */
1.579 +static const unsigned char yydefact[] =
1.580 +{
1.581 + 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
1.582 + 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
1.583 + 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
1.584 + 23, 52, 62, 5, 67, 20, 84, 75, 6, 24,
1.585 + 84, 21, 8, 11, 93, 94, 0, 0, 95, 0,
1.586 + 48, 96, 0, 0, 0, 109, 110, 0, 0, 0,
1.587 + 102, 97, 0, 0, 0, 0, 0, 0, 0, 0,
1.588 + 0, 0, 98, 7, 71, 79, 80, 27, 29, 0,
1.589 + 106, 0, 0, 64, 0, 0, 9, 10, 0, 0,
1.590 + 0, 0, 0, 91, 0, 0, 0, 44, 0, 37,
1.591 + 36, 32, 33, 0, 35, 34, 0, 0, 91, 0,
1.592 + 56, 57, 53, 55, 54, 63, 51, 50, 68, 70,
1.593 + 66, 69, 65, 86, 87, 85, 76, 78, 74, 77,
1.594 + 73, 99, 105, 107, 108, 104, 103, 26, 82, 0,
1.595 + 0, 0, 100, 0, 100, 100, 100, 0, 0, 0,
1.596 + 83, 60, 100, 0, 100, 0, 89, 90, 0, 0,
1.597 + 38, 92, 0, 0, 100, 46, 43, 25, 0, 59,
1.598 + 0, 88, 101, 39, 40, 41, 0, 0, 45, 58,
1.599 + 61, 42, 47
1.600 +};
1.601 +
1.602 +/* YYDEFGOTO[NTERM-NUM]. */
1.603 +static const short int yydefgoto[] =
1.604 +{
1.605 + -1, 1, 2, 25, 26, 100, 27, 28, 29, 30,
1.606 + 64, 101, 102, 148, 178, 31, 32, 116, 33, 66,
1.607 + 112, 67, 34, 120, 35, 68, 36, 37, 128, 38,
1.608 + 70, 39, 40, 41, 103, 104, 69, 105, 143, 144,
1.609 + 42, 73, 159, 59, 60
1.610 +};
1.611 +
1.612 +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1.613 + STATE-NUM. */
1.614 +#define YYPACT_NINF -135
1.615 +static const short int yypact[] =
1.616 +{
1.617 + -135, 2, 170, -135, -14, 56, 56, -8, 56, 24,
1.618 + 67, 56, 7, 14, 62, 97, -135, -135, -135, -135,
1.619 + -135, -135, -135, 156, -135, 166, -135, -135, -135, -135,
1.620 + -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
1.621 + -135, -135, -135, -135, -135, -135, 138, 151, -135, 152,
1.622 + -135, -135, 163, 167, 176, -135, -135, 62, 62, 185,
1.623 + -19, -135, 188, 190, 42, 103, 194, 85, 70, 222,
1.624 + 70, 132, -135, 191, -135, -135, -135, -135, -135, 127,
1.625 + -135, 62, 62, 191, 104, 104, -135, -135, 193, 203,
1.626 + 9, 62, 56, 56, 62, 161, 104, -135, 196, -135,
1.627 + -135, -135, -135, 233, -135, -135, 204, 56, 56, 221,
1.628 + -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
1.629 + -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
1.630 + -135, -135, -135, 219, -135, -135, -135, -135, -135, 62,
1.631 + 209, 212, 240, 224, 240, -1, 240, 104, 41, 225,
1.632 + -135, -135, 240, 226, 240, 218, -135, -135, 62, 227,
1.633 + -135, -135, 228, 229, 240, 230, -135, -135, 231, -135,
1.634 + 232, -135, 112, -135, -135, -135, 234, 56, -135, -135,
1.635 + -135, -135, -135
1.636 +};
1.637 +
1.638 +/* YYPGOTO[NTERM-NUM]. */
1.639 +static const short int yypgoto[] =
1.640 +{
1.641 + -135, -135, -135, -135, 94, -45, -135, -135, -135, -135,
1.642 + 237, -135, -135, -135, -135, -135, -135, -135, -54, -135,
1.643 + -135, -135, -135, -135, -135, -135, -135, -135, -135, 1,
1.644 + -135, -135, -135, -135, -135, 195, 235, -44, 159, -5,
1.645 + 98, 210, -134, -53, -77
1.646 +};
1.647 +
1.648 +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1.649 + positive, shift that token. If negative, reduce the rule which
1.650 + number is the opposite. If zero, do what YYDEFACT says.
1.651 + If YYTABLE_NINF, syntax error. */
1.652 +#define YYTABLE_NINF -82
1.653 +static const short int yytable[] =
1.654 +{
1.655 + 46, 47, 3, 49, 79, 80, 52, 135, 136, 84,
1.656 + 161, 162, 163, 158, 119, 85, 127, 43, 168, 147,
1.657 + 170, 111, 114, 48, 124, 125, 124, 125, 133, 134,
1.658 + 176, 81, 82, 53, 139, 55, 56, 140, 141, 57,
1.659 + 54, 145, -28, 88, 58, -28, -28, -28, -28, -28,
1.660 + -28, -28, -28, -28, 89, 50, -28, -28, 90, 91,
1.661 + -28, 92, 93, 94, 95, 96, 97, 165, 98, 121,
1.662 + 164, 129, 166, 99, 6, 7, 8, 9, 10, 11,
1.663 + 12, 13, 44, 45, 14, 15, 155, 142, 55, 56,
1.664 + 7, 8, 57, 10, 11, 12, 13, 58, 51, 14,
1.665 + 15, 24, 152, -30, 88, 172, -30, -30, -30, -30,
1.666 + -30, -30, -30, -30, -30, 89, 24, -30, -30, 90,
1.667 + 91, -30, 92, 93, 94, 95, 96, 97, 61, 98,
1.668 + 55, 56, -81, 88, 99, -81, -81, -81, -81, -81,
1.669 + -81, -81, -81, -81, 81, 82, -81, -81, 90, 91,
1.670 + -81, -81, -81, -81, -81, -81, 132, 62, 98, 81,
1.671 + 82, 115, 118, 123, 126, 117, 122, 63, 130, 72,
1.672 + -2, 4, 182, 5, 6, 7, 8, 9, 10, 11,
1.673 + 12, 13, 74, 75, 14, 15, 16, 146, 17, 18,
1.674 + 19, 20, 21, 22, 76, 88, 23, 149, 77, -49,
1.675 + -49, 24, -49, -49, -49, -49, 89, 78, -49, -49,
1.676 + 90, 91, 106, 107, 108, 109, 72, 81, 82, 86,
1.677 + 98, 87, 131, 88, 137, 110, -72, -72, -72, -72,
1.678 + -72, -72, -72, -72, 138, 151, -72, -72, 90, 91,
1.679 + 156, 81, 82, 157, 81, 82, 150, 154, 98, 171,
1.680 + 81, 82, 82, 123, 158, 160, 167, 169, 173, 174,
1.681 + 175, 113, 179, 180, 177, 181, 65, 153, 0, 83,
1.682 + 0, 0, 0, 0, 0, 71
1.683 +};
1.684 +
1.685 +static const short int yycheck[] =
1.686 +{
1.687 + 5, 6, 0, 8, 57, 58, 11, 84, 85, 28,
1.688 + 144, 145, 146, 14, 68, 34, 70, 31, 152, 96,
1.689 + 154, 66, 66, 31, 69, 69, 71, 71, 81, 82,
1.690 + 164, 32, 33, 26, 25, 26, 27, 90, 91, 30,
1.691 + 26, 94, 0, 1, 35, 3, 4, 5, 6, 7,
1.692 + 8, 9, 10, 11, 12, 31, 14, 15, 16, 17,
1.693 + 18, 19, 20, 21, 22, 23, 24, 26, 26, 68,
1.694 + 147, 70, 31, 31, 4, 5, 6, 7, 8, 9,
1.695 + 10, 11, 26, 27, 14, 15, 139, 92, 26, 27,
1.696 + 5, 6, 30, 8, 9, 10, 11, 35, 31, 14,
1.697 + 15, 31, 107, 0, 1, 158, 3, 4, 5, 6,
1.698 + 7, 8, 9, 10, 11, 12, 31, 14, 15, 16,
1.699 + 17, 18, 19, 20, 21, 22, 23, 24, 31, 26,
1.700 + 26, 27, 0, 1, 31, 3, 4, 5, 6, 7,
1.701 + 8, 9, 10, 11, 32, 33, 14, 15, 16, 17,
1.702 + 18, 19, 20, 21, 22, 23, 29, 1, 26, 32,
1.703 + 33, 67, 68, 31, 70, 67, 68, 1, 70, 31,
1.704 + 0, 1, 177, 3, 4, 5, 6, 7, 8, 9,
1.705 + 10, 11, 31, 31, 14, 15, 16, 26, 18, 19,
1.706 + 20, 21, 22, 23, 31, 1, 26, 1, 31, 5,
1.707 + 6, 31, 8, 9, 10, 11, 12, 31, 14, 15,
1.708 + 16, 17, 18, 19, 20, 21, 31, 32, 33, 31,
1.709 + 26, 31, 31, 1, 31, 31, 4, 5, 6, 7,
1.710 + 8, 9, 10, 11, 31, 31, 14, 15, 16, 17,
1.711 + 31, 32, 33, 31, 32, 33, 13, 26, 26, 31,
1.712 + 32, 33, 33, 31, 14, 31, 31, 31, 31, 31,
1.713 + 31, 66, 31, 31, 34, 31, 29, 108, -1, 59,
1.714 + -1, -1, -1, -1, -1, 40
1.715 +};
1.716 +
1.717 +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1.718 + symbol of state STATE-NUM. */
1.719 +static const unsigned char yystos[] =
1.720 +{
1.721 + 0, 37, 38, 0, 1, 3, 4, 5, 6, 7,
1.722 + 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
1.723 + 21, 22, 23, 26, 31, 39, 40, 42, 43, 44,
1.724 + 45, 51, 52, 54, 58, 60, 62, 63, 65, 67,
1.725 + 68, 69, 76, 31, 26, 27, 75, 75, 31, 75,
1.726 + 31, 31, 75, 26, 26, 26, 27, 30, 35, 79,
1.727 + 80, 31, 1, 1, 46, 46, 55, 57, 61, 72,
1.728 + 66, 72, 31, 77, 31, 31, 31, 31, 31, 79,
1.729 + 79, 32, 33, 77, 28, 34, 31, 31, 1, 12,
1.730 + 16, 17, 19, 20, 21, 22, 23, 24, 26, 31,
1.731 + 41, 47, 48, 70, 71, 73, 18, 19, 20, 21,
1.732 + 31, 41, 56, 71, 73, 40, 53, 76, 40, 54,
1.733 + 59, 65, 76, 31, 41, 73, 40, 54, 64, 65,
1.734 + 76, 31, 29, 79, 79, 80, 80, 31, 31, 25,
1.735 + 79, 79, 75, 74, 75, 79, 26, 80, 49, 1,
1.736 + 13, 31, 75, 74, 26, 79, 31, 31, 14, 78,
1.737 + 31, 78, 78, 78, 80, 26, 31, 31, 78, 31,
1.738 + 78, 31, 79, 31, 31, 31, 78, 34, 50, 31,
1.739 + 31, 31, 75
1.740 +};
1.741 +
1.742 +#define yyerrok (yyerrstatus = 0)
1.743 +#define yyclearin (yychar = YYEMPTY)
1.744 +#define YYEMPTY (-2)
1.745 +#define YYEOF 0
1.746 +
1.747 +#define YYACCEPT goto yyacceptlab
1.748 +#define YYABORT goto yyabortlab
1.749 +#define YYERROR goto yyerrorlab
1.750 +
1.751 +
1.752 +/* Like YYERROR except do call yyerror. This remains here temporarily
1.753 + to ease the transition to the new meaning of YYERROR, for GCC.
1.754 + Once GCC version 2 has supplanted version 1, this can go. */
1.755 +
1.756 +#define YYFAIL goto yyerrlab
1.757 +
1.758 +#define YYRECOVERING() (!!yyerrstatus)
1.759 +
1.760 +#define YYBACKUP(Token, Value) \
1.761 +do \
1.762 + if (yychar == YYEMPTY && yylen == 1) \
1.763 + { \
1.764 + yychar = (Token); \
1.765 + yylval = (Value); \
1.766 + yytoken = YYTRANSLATE (yychar); \
1.767 + YYPOPSTACK; \
1.768 + goto yybackup; \
1.769 + } \
1.770 + else \
1.771 + { \
1.772 + yyerror (YY_("syntax error: cannot back up")); \
1.773 + YYERROR; \
1.774 + } \
1.775 +while (0)
1.776 +
1.777 +
1.778 +#define YYTERROR 1
1.779 +#define YYERRCODE 256
1.780 +
1.781 +
1.782 +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1.783 + If N is 0, then set CURRENT to the empty location which ends
1.784 + the previous symbol: RHS[0] (always defined). */
1.785 +
1.786 +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1.787 +#ifndef YYLLOC_DEFAULT
1.788 +# define YYLLOC_DEFAULT(Current, Rhs, N) \
1.789 + do \
1.790 + if (N) \
1.791 + { \
1.792 + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1.793 + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1.794 + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1.795 + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1.796 + } \
1.797 + else \
1.798 + { \
1.799 + (Current).first_line = (Current).last_line = \
1.800 + YYRHSLOC (Rhs, 0).last_line; \
1.801 + (Current).first_column = (Current).last_column = \
1.802 + YYRHSLOC (Rhs, 0).last_column; \
1.803 + } \
1.804 + while (0)
1.805 +#endif
1.806 +
1.807 +
1.808 +/* YY_LOCATION_PRINT -- Print the location on the stream.
1.809 + This macro was not mandated originally: define only if we know
1.810 + we won't break user code: when these are the locations we know. */
1.811 +
1.812 +#ifndef YY_LOCATION_PRINT
1.813 +# if YYLTYPE_IS_TRIVIAL
1.814 +# define YY_LOCATION_PRINT(File, Loc) \
1.815 + fprintf (File, "%d.%d-%d.%d", \
1.816 + (Loc).first_line, (Loc).first_column, \
1.817 + (Loc).last_line, (Loc).last_column)
1.818 +# else
1.819 +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1.820 +# endif
1.821 +#endif
1.822 +
1.823 +
1.824 +/* YYLEX -- calling `yylex' with the right arguments. */
1.825 +
1.826 +#ifdef YYLEX_PARAM
1.827 +# define YYLEX yylex (YYLEX_PARAM)
1.828 +#else
1.829 +# define YYLEX yylex ()
1.830 +#endif
1.831 +
1.832 +/* Enable debugging if requested. */
1.833 +#if YYDEBUG
1.834 +
1.835 +# ifndef YYFPRINTF
1.836 +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1.837 +# define YYFPRINTF fprintf
1.838 +# endif
1.839 +
1.840 +# define YYDPRINTF(Args) \
1.841 +do { \
1.842 + if (yydebug) \
1.843 + YYFPRINTF Args; \
1.844 +} while (0)
1.845 +
1.846 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1.847 +do { \
1.848 + if (yydebug) \
1.849 + { \
1.850 + YYFPRINTF (stderr, "%s ", Title); \
1.851 + yysymprint (stderr, \
1.852 + Type, Value); \
1.853 + YYFPRINTF (stderr, "\n"); \
1.854 + } \
1.855 +} while (0)
1.856 +
1.857 +/*------------------------------------------------------------------.
1.858 +| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1.859 +| TOP (included). |
1.860 +`------------------------------------------------------------------*/
1.861 +
1.862 +#if defined (__STDC__) || defined (__cplusplus)
1.863 +static void
1.864 +yy_stack_print (short int *bottom, short int *top)
1.865 +#else
1.866 +static void
1.867 +yy_stack_print (bottom, top)
1.868 + short int *bottom;
1.869 + short int *top;
1.870 +#endif
1.871 +{
1.872 + YYFPRINTF (stderr, "Stack now");
1.873 + for (/* Nothing. */; bottom <= top; ++bottom)
1.874 + YYFPRINTF (stderr, " %d", *bottom);
1.875 + YYFPRINTF (stderr, "\n");
1.876 +}
1.877 +
1.878 +# define YY_STACK_PRINT(Bottom, Top) \
1.879 +do { \
1.880 + if (yydebug) \
1.881 + yy_stack_print ((Bottom), (Top)); \
1.882 +} while (0)
1.883 +
1.884 +
1.885 +/*------------------------------------------------.
1.886 +| Report that the YYRULE is going to be reduced. |
1.887 +`------------------------------------------------*/
1.888 +
1.889 +#if defined (__STDC__) || defined (__cplusplus)
1.890 +static void
1.891 +yy_reduce_print (int yyrule)
1.892 +#else
1.893 +static void
1.894 +yy_reduce_print (yyrule)
1.895 + int yyrule;
1.896 +#endif
1.897 +{
1.898 + int yyi;
1.899 + unsigned long int yylno = yyrline[yyrule];
1.900 + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
1.901 + yyrule - 1, yylno);
1.902 + /* Print the symbols being reduced, and their result. */
1.903 + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1.904 + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1.905 + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
1.906 +}
1.907 +
1.908 +# define YY_REDUCE_PRINT(Rule) \
1.909 +do { \
1.910 + if (yydebug) \
1.911 + yy_reduce_print (Rule); \
1.912 +} while (0)
1.913 +
1.914 +/* Nonzero means print parse trace. It is left uninitialized so that
1.915 + multiple parsers can coexist. */
1.916 +int yydebug;
1.917 +#else /* !YYDEBUG */
1.918 +# define YYDPRINTF(Args)
1.919 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1.920 +# define YY_STACK_PRINT(Bottom, Top)
1.921 +# define YY_REDUCE_PRINT(Rule)
1.922 +#endif /* !YYDEBUG */
1.923 +
1.924 +
1.925 +/* YYINITDEPTH -- initial size of the parser's stacks. */
1.926 +#ifndef YYINITDEPTH
1.927 +# define YYINITDEPTH 200
1.928 +#endif
1.929 +
1.930 +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1.931 + if the built-in stack extension method is used).
1.932 +
1.933 + Do not make this value too large; the results are undefined if
1.934 + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1.935 + evaluated with infinite-precision integer arithmetic. */
1.936 +
1.937 +#ifndef YYMAXDEPTH
1.938 +# define YYMAXDEPTH 10000
1.939 +#endif
1.940 +
1.941 +
1.942 +
1.943 +#if YYERROR_VERBOSE
1.944 +
1.945 +# ifndef yystrlen
1.946 +# if defined (__GLIBC__) && defined (_STRING_H)
1.947 +# define yystrlen strlen
1.948 +# else
1.949 +/* Return the length of YYSTR. */
1.950 +static YYSIZE_T
1.951 +# if defined (__STDC__) || defined (__cplusplus)
1.952 +yystrlen (const char *yystr)
1.953 +# else
1.954 +yystrlen (yystr)
1.955 + const char *yystr;
1.956 +# endif
1.957 +{
1.958 + const char *yys = yystr;
1.959 +
1.960 + while (*yys++ != '\0')
1.961 + continue;
1.962 +
1.963 + return yys - yystr - 1;
1.964 +}
1.965 +# endif
1.966 +# endif
1.967 +
1.968 +# ifndef yystpcpy
1.969 +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1.970 +# define yystpcpy stpcpy
1.971 +# else
1.972 +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1.973 + YYDEST. */
1.974 +static char *
1.975 +# if defined (__STDC__) || defined (__cplusplus)
1.976 +yystpcpy (char *yydest, const char *yysrc)
1.977 +# else
1.978 +yystpcpy (yydest, yysrc)
1.979 + char *yydest;
1.980 + const char *yysrc;
1.981 +# endif
1.982 +{
1.983 + char *yyd = yydest;
1.984 + const char *yys = yysrc;
1.985 +
1.986 + while ((*yyd++ = *yys++) != '\0')
1.987 + continue;
1.988 +
1.989 + return yyd - 1;
1.990 +}
1.991 +# endif
1.992 +# endif
1.993 +
1.994 +# ifndef yytnamerr
1.995 +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1.996 + quotes and backslashes, so that it's suitable for yyerror. The
1.997 + heuristic is that double-quoting is unnecessary unless the string
1.998 + contains an apostrophe, a comma, or backslash (other than
1.999 + backslash-backslash). YYSTR is taken from yytname. If YYRES is
1.1000 + null, do not copy; instead, return the length of what the result
1.1001 + would have been. */
1.1002 +static YYSIZE_T
1.1003 +yytnamerr (char *yyres, const char *yystr)
1.1004 +{
1.1005 + if (*yystr == '"')
1.1006 + {
1.1007 + size_t yyn = 0;
1.1008 + char const *yyp = yystr;
1.1009 +
1.1010 + for (;;)
1.1011 + switch (*++yyp)
1.1012 + {
1.1013 + case '\'':
1.1014 + case ',':
1.1015 + goto do_not_strip_quotes;
1.1016 +
1.1017 + case '\\':
1.1018 + if (*++yyp != '\\')
1.1019 + goto do_not_strip_quotes;
1.1020 + /* Fall through. */
1.1021 + default:
1.1022 + if (yyres)
1.1023 + yyres[yyn] = *yyp;
1.1024 + yyn++;
1.1025 + break;
1.1026 +
1.1027 + case '"':
1.1028 + if (yyres)
1.1029 + yyres[yyn] = '\0';
1.1030 + return yyn;
1.1031 + }
1.1032 + do_not_strip_quotes: ;
1.1033 + }
1.1034 +
1.1035 + if (! yyres)
1.1036 + return yystrlen (yystr);
1.1037 +
1.1038 + return yystpcpy (yyres, yystr) - yyres;
1.1039 +}
1.1040 +# endif
1.1041 +
1.1042 +#endif /* YYERROR_VERBOSE */
1.1043 +
1.1044 +
1.1045 +
1.1046 +#if YYDEBUG
1.1047 +/*--------------------------------.
1.1048 +| Print this symbol on YYOUTPUT. |
1.1049 +`--------------------------------*/
1.1050 +
1.1051 +#if defined (__STDC__) || defined (__cplusplus)
1.1052 +static void
1.1053 +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1.1054 +#else
1.1055 +static void
1.1056 +yysymprint (yyoutput, yytype, yyvaluep)
1.1057 + FILE *yyoutput;
1.1058 + int yytype;
1.1059 + YYSTYPE *yyvaluep;
1.1060 +#endif
1.1061 +{
1.1062 + /* Pacify ``unused variable'' warnings. */
1.1063 + (void) yyvaluep;
1.1064 +
1.1065 + if (yytype < YYNTOKENS)
1.1066 + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1.1067 + else
1.1068 + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1.1069 +
1.1070 +
1.1071 +# ifdef YYPRINT
1.1072 + if (yytype < YYNTOKENS)
1.1073 + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1.1074 +# endif
1.1075 + switch (yytype)
1.1076 + {
1.1077 + default:
1.1078 + break;
1.1079 + }
1.1080 + YYFPRINTF (yyoutput, ")");
1.1081 +}
1.1082 +
1.1083 +#endif /* ! YYDEBUG */
1.1084 +/*-----------------------------------------------.
1.1085 +| Release the memory associated to this symbol. |
1.1086 +`-----------------------------------------------*/
1.1087 +
1.1088 +#if defined (__STDC__) || defined (__cplusplus)
1.1089 +static void
1.1090 +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1.1091 +#else
1.1092 +static void
1.1093 +yydestruct (yymsg, yytype, yyvaluep)
1.1094 + const char *yymsg;
1.1095 + int yytype;
1.1096 + YYSTYPE *yyvaluep;
1.1097 +#endif
1.1098 +{
1.1099 + /* Pacify ``unused variable'' warnings. */
1.1100 + (void) yyvaluep;
1.1101 +
1.1102 + if (!yymsg)
1.1103 + yymsg = "Deleting";
1.1104 + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1.1105 +
1.1106 + switch (yytype)
1.1107 + {
1.1108 + case 52: /* "choice_entry" */
1.1109 +
1.1110 + {
1.1111 + fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1.1112 + (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1.1113 + if (current_menu == (yyvaluep->menu))
1.1114 + menu_end_menu();
1.1115 +};
1.1116 +
1.1117 + break;
1.1118 + case 58: /* "if_entry" */
1.1119 +
1.1120 + {
1.1121 + fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1.1122 + (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1.1123 + if (current_menu == (yyvaluep->menu))
1.1124 + menu_end_menu();
1.1125 +};
1.1126 +
1.1127 + break;
1.1128 + case 63: /* "menu_entry" */
1.1129 +
1.1130 + {
1.1131 + fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1.1132 + (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1.1133 + if (current_menu == (yyvaluep->menu))
1.1134 + menu_end_menu();
1.1135 +};
1.1136 +
1.1137 + break;
1.1138 +
1.1139 + default:
1.1140 + break;
1.1141 + }
1.1142 +}
1.1143 +
1.1144 +
1.1145 +/* Prevent warnings from -Wmissing-prototypes. */
1.1146 +
1.1147 +#ifdef YYPARSE_PARAM
1.1148 +# if defined (__STDC__) || defined (__cplusplus)
1.1149 +int yyparse (void *YYPARSE_PARAM);
1.1150 +# else
1.1151 +int yyparse ();
1.1152 +# endif
1.1153 +#else /* ! YYPARSE_PARAM */
1.1154 +#if defined (__STDC__) || defined (__cplusplus)
1.1155 +int yyparse (void);
1.1156 +#else
1.1157 +int yyparse ();
1.1158 +#endif
1.1159 +#endif /* ! YYPARSE_PARAM */
1.1160 +
1.1161 +
1.1162 +
1.1163 +/* The look-ahead symbol. */
1.1164 +int yychar;
1.1165 +
1.1166 +/* The semantic value of the look-ahead symbol. */
1.1167 +YYSTYPE yylval;
1.1168 +
1.1169 +/* Number of syntax errors so far. */
1.1170 +int yynerrs;
1.1171 +
1.1172 +
1.1173 +
1.1174 +/*----------.
1.1175 +| yyparse. |
1.1176 +`----------*/
1.1177 +
1.1178 +#ifdef YYPARSE_PARAM
1.1179 +# if defined (__STDC__) || defined (__cplusplus)
1.1180 +int yyparse (void *YYPARSE_PARAM)
1.1181 +# else
1.1182 +int yyparse (YYPARSE_PARAM)
1.1183 + void *YYPARSE_PARAM;
1.1184 +# endif
1.1185 +#else /* ! YYPARSE_PARAM */
1.1186 +#if defined (__STDC__) || defined (__cplusplus)
1.1187 +int
1.1188 +yyparse (void)
1.1189 +#else
1.1190 +int
1.1191 +yyparse ()
1.1192 + ;
1.1193 +#endif
1.1194 +#endif
1.1195 +{
1.1196 +
1.1197 + int yystate;
1.1198 + int yyn;
1.1199 + int yyresult;
1.1200 + /* Number of tokens to shift before error messages enabled. */
1.1201 + int yyerrstatus;
1.1202 + /* Look-ahead token as an internal (translated) token number. */
1.1203 + int yytoken = 0;
1.1204 +
1.1205 + /* Three stacks and their tools:
1.1206 + `yyss': related to states,
1.1207 + `yyvs': related to semantic values,
1.1208 + `yyls': related to locations.
1.1209 +
1.1210 + Refer to the stacks thru separate pointers, to allow yyoverflow
1.1211 + to reallocate them elsewhere. */
1.1212 +
1.1213 + /* The state stack. */
1.1214 + short int yyssa[YYINITDEPTH];
1.1215 + short int *yyss = yyssa;
1.1216 + short int *yyssp;
1.1217 +
1.1218 + /* The semantic value stack. */
1.1219 + YYSTYPE yyvsa[YYINITDEPTH];
1.1220 + YYSTYPE *yyvs = yyvsa;
1.1221 + YYSTYPE *yyvsp;
1.1222 +
1.1223 +
1.1224 +
1.1225 +#define YYPOPSTACK (yyvsp--, yyssp--)
1.1226 +
1.1227 + YYSIZE_T yystacksize = YYINITDEPTH;
1.1228 +
1.1229 + /* The variables used to return semantic value and location from the
1.1230 + action routines. */
1.1231 + YYSTYPE yyval;
1.1232 +
1.1233 +
1.1234 + /* When reducing, the number of symbols on the RHS of the reduced
1.1235 + rule. */
1.1236 + int yylen;
1.1237 +
1.1238 + YYDPRINTF ((stderr, "Starting parse\n"));
1.1239 +
1.1240 + yystate = 0;
1.1241 + yyerrstatus = 0;
1.1242 + yynerrs = 0;
1.1243 + yychar = YYEMPTY; /* Cause a token to be read. */
1.1244 +
1.1245 + /* Initialize stack pointers.
1.1246 + Waste one element of value and location stack
1.1247 + so that they stay on the same level as the state stack.
1.1248 + The wasted elements are never initialized. */
1.1249 +
1.1250 + yyssp = yyss;
1.1251 + yyvsp = yyvs;
1.1252 +
1.1253 + goto yysetstate;
1.1254 +
1.1255 +/*------------------------------------------------------------.
1.1256 +| yynewstate -- Push a new state, which is found in yystate. |
1.1257 +`------------------------------------------------------------*/
1.1258 + yynewstate:
1.1259 + /* In all cases, when you get here, the value and location stacks
1.1260 + have just been pushed. so pushing a state here evens the stacks.
1.1261 + */
1.1262 + yyssp++;
1.1263 +
1.1264 + yysetstate:
1.1265 + *yyssp = yystate;
1.1266 +
1.1267 + if (yyss + yystacksize - 1 <= yyssp)
1.1268 + {
1.1269 + /* Get the current used size of the three stacks, in elements. */
1.1270 + YYSIZE_T yysize = yyssp - yyss + 1;
1.1271 +
1.1272 +#ifdef yyoverflow
1.1273 + {
1.1274 + /* Give user a chance to reallocate the stack. Use copies of
1.1275 + these so that the &'s don't force the real ones into
1.1276 + memory. */
1.1277 + YYSTYPE *yyvs1 = yyvs;
1.1278 + short int *yyss1 = yyss;
1.1279 +
1.1280 +
1.1281 + /* Each stack pointer address is followed by the size of the
1.1282 + data in use in that stack, in bytes. This used to be a
1.1283 + conditional around just the two extra args, but that might
1.1284 + be undefined if yyoverflow is a macro. */
1.1285 + yyoverflow (YY_("memory exhausted"),
1.1286 + &yyss1, yysize * sizeof (*yyssp),
1.1287 + &yyvs1, yysize * sizeof (*yyvsp),
1.1288 +
1.1289 + &yystacksize);
1.1290 +
1.1291 + yyss = yyss1;
1.1292 + yyvs = yyvs1;
1.1293 + }
1.1294 +#else /* no yyoverflow */
1.1295 +# ifndef YYSTACK_RELOCATE
1.1296 + goto yyexhaustedlab;
1.1297 +# else
1.1298 + /* Extend the stack our own way. */
1.1299 + if (YYMAXDEPTH <= yystacksize)
1.1300 + goto yyexhaustedlab;
1.1301 + yystacksize *= 2;
1.1302 + if (YYMAXDEPTH < yystacksize)
1.1303 + yystacksize = YYMAXDEPTH;
1.1304 +
1.1305 + {
1.1306 + short int *yyss1 = yyss;
1.1307 + union yyalloc *yyptr =
1.1308 + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1.1309 + if (! yyptr)
1.1310 + goto yyexhaustedlab;
1.1311 + YYSTACK_RELOCATE (yyss);
1.1312 + YYSTACK_RELOCATE (yyvs);
1.1313 +
1.1314 +# undef YYSTACK_RELOCATE
1.1315 + if (yyss1 != yyssa)
1.1316 + YYSTACK_FREE (yyss1);
1.1317 + }
1.1318 +# endif
1.1319 +#endif /* no yyoverflow */
1.1320 +
1.1321 + yyssp = yyss + yysize - 1;
1.1322 + yyvsp = yyvs + yysize - 1;
1.1323 +
1.1324 +
1.1325 + YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1.1326 + (unsigned long int) yystacksize));
1.1327 +
1.1328 + if (yyss + yystacksize - 1 <= yyssp)
1.1329 + YYABORT;
1.1330 + }
1.1331 +
1.1332 + YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1.1333 +
1.1334 + goto yybackup;
1.1335 +
1.1336 +/*-----------.
1.1337 +| yybackup. |
1.1338 +`-----------*/
1.1339 +yybackup:
1.1340 +
1.1341 +/* Do appropriate processing given the current state. */
1.1342 +/* Read a look-ahead token if we need one and don't already have one. */
1.1343 +/* yyresume: */
1.1344 +
1.1345 + /* First try to decide what to do without reference to look-ahead token. */
1.1346 +
1.1347 + yyn = yypact[yystate];
1.1348 + if (yyn == YYPACT_NINF)
1.1349 + goto yydefault;
1.1350 +
1.1351 + /* Not known => get a look-ahead token if don't already have one. */
1.1352 +
1.1353 + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1.1354 + if (yychar == YYEMPTY)
1.1355 + {
1.1356 + YYDPRINTF ((stderr, "Reading a token: "));
1.1357 + yychar = YYLEX;
1.1358 + }
1.1359 +
1.1360 + if (yychar <= YYEOF)
1.1361 + {
1.1362 + yychar = yytoken = YYEOF;
1.1363 + YYDPRINTF ((stderr, "Now at end of input.\n"));
1.1364 + }
1.1365 + else
1.1366 + {
1.1367 + yytoken = YYTRANSLATE (yychar);
1.1368 + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1.1369 + }
1.1370 +
1.1371 + /* If the proper action on seeing token YYTOKEN is to reduce or to
1.1372 + detect an error, take that action. */
1.1373 + yyn += yytoken;
1.1374 + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1.1375 + goto yydefault;
1.1376 + yyn = yytable[yyn];
1.1377 + if (yyn <= 0)
1.1378 + {
1.1379 + if (yyn == 0 || yyn == YYTABLE_NINF)
1.1380 + goto yyerrlab;
1.1381 + yyn = -yyn;
1.1382 + goto yyreduce;
1.1383 + }
1.1384 +
1.1385 + if (yyn == YYFINAL)
1.1386 + YYACCEPT;
1.1387 +
1.1388 + /* Shift the look-ahead token. */
1.1389 + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1.1390 +
1.1391 + /* Discard the token being shifted unless it is eof. */
1.1392 + if (yychar != YYEOF)
1.1393 + yychar = YYEMPTY;
1.1394 +
1.1395 + *++yyvsp = yylval;
1.1396 +
1.1397 +
1.1398 + /* Count tokens shifted since error; after three, turn off error
1.1399 + status. */
1.1400 + if (yyerrstatus)
1.1401 + yyerrstatus--;
1.1402 +
1.1403 + yystate = yyn;
1.1404 + goto yynewstate;
1.1405 +
1.1406 +
1.1407 +/*-----------------------------------------------------------.
1.1408 +| yydefault -- do the default action for the current state. |
1.1409 +`-----------------------------------------------------------*/
1.1410 +yydefault:
1.1411 + yyn = yydefact[yystate];
1.1412 + if (yyn == 0)
1.1413 + goto yyerrlab;
1.1414 + goto yyreduce;
1.1415 +
1.1416 +
1.1417 +/*-----------------------------.
1.1418 +| yyreduce -- Do a reduction. |
1.1419 +`-----------------------------*/
1.1420 +yyreduce:
1.1421 + /* yyn is the number of a rule to reduce with. */
1.1422 + yylen = yyr2[yyn];
1.1423 +
1.1424 + /* If YYLEN is nonzero, implement the default value of the action:
1.1425 + `$$ = $1'.
1.1426 +
1.1427 + Otherwise, the following line sets YYVAL to garbage.
1.1428 + This behavior is undocumented and Bison
1.1429 + users should not rely upon it. Assigning to YYVAL
1.1430 + unconditionally makes the parser a bit smaller, and it avoids a
1.1431 + GCC warning that YYVAL may be used uninitialized. */
1.1432 + yyval = yyvsp[1-yylen];
1.1433 +
1.1434 +
1.1435 + YY_REDUCE_PRINT (yyn);
1.1436 + switch (yyn)
1.1437 + {
1.1438 + case 8:
1.1439 +
1.1440 + { zconf_error("unexpected end statement"); ;}
1.1441 + break;
1.1442 +
1.1443 + case 9:
1.1444 +
1.1445 + { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
1.1446 + break;
1.1447 +
1.1448 + case 10:
1.1449 +
1.1450 + {
1.1451 + zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1.1452 +;}
1.1453 + break;
1.1454 +
1.1455 + case 11:
1.1456 +
1.1457 + { zconf_error("invalid statement"); ;}
1.1458 + break;
1.1459 +
1.1460 + case 25:
1.1461 +
1.1462 + { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1.1463 + break;
1.1464 +
1.1465 + case 26:
1.1466 +
1.1467 + { zconf_error("invalid option"); ;}
1.1468 + break;
1.1469 +
1.1470 + case 27:
1.1471 +
1.1472 + {
1.1473 + struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1.1474 + sym->flags |= SYMBOL_OPTIONAL;
1.1475 + menu_add_entry(sym);
1.1476 + printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1.1477 +;}
1.1478 + break;
1.1479 +
1.1480 + case 28:
1.1481 +
1.1482 + {
1.1483 + menu_end_entry();
1.1484 + printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1.1485 +;}
1.1486 + break;
1.1487 +
1.1488 + case 29:
1.1489 +
1.1490 + {
1.1491 + struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1.1492 + sym->flags |= SYMBOL_OPTIONAL;
1.1493 + menu_add_entry(sym);
1.1494 + printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1.1495 +;}
1.1496 + break;
1.1497 +
1.1498 + case 30:
1.1499 +
1.1500 + {
1.1501 + if (current_entry->prompt)
1.1502 + current_entry->prompt->type = P_MENU;
1.1503 + else
1.1504 + zconfprint("warning: menuconfig statement without prompt");
1.1505 + menu_end_entry();
1.1506 + printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1.1507 +;}
1.1508 + break;
1.1509 +
1.1510 + case 38:
1.1511 +
1.1512 + {
1.1513 + menu_set_type((yyvsp[-2].id)->stype);
1.1514 + printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1.1515 + zconf_curname(), zconf_lineno(),
1.1516 + (yyvsp[-2].id)->stype);
1.1517 +;}
1.1518 + break;
1.1519 +
1.1520 + case 39:
1.1521 +
1.1522 + {
1.1523 + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1.1524 + printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1.1525 +;}
1.1526 + break;
1.1527 +
1.1528 + case 40:
1.1529 +
1.1530 + {
1.1531 + menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1.1532 + if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1.1533 + menu_set_type((yyvsp[-3].id)->stype);
1.1534 + printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1.1535 + zconf_curname(), zconf_lineno(),
1.1536 + (yyvsp[-3].id)->stype);
1.1537 +;}
1.1538 + break;
1.1539 +
1.1540 + case 41:
1.1541 +
1.1542 + {
1.1543 + menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1.1544 + printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1.1545 +;}
1.1546 + break;
1.1547 +
1.1548 + case 42:
1.1549 +
1.1550 + {
1.1551 + menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1.1552 + printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1.1553 +;}
1.1554 + break;
1.1555 +
1.1556 + case 45:
1.1557 +
1.1558 + {
1.1559 + struct kconf_id *id = kconf_id_lookup((yyvsp[-1].string), strlen((yyvsp[-1].string)));
1.1560 + if (id && id->flags & TF_OPTION)
1.1561 + menu_add_option(id->token, (yyvsp[0].string));
1.1562 + else
1.1563 + zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string));
1.1564 + free((yyvsp[-1].string));
1.1565 +;}
1.1566 + break;
1.1567 +
1.1568 + case 46:
1.1569 +
1.1570 + { (yyval.string) = NULL; ;}
1.1571 + break;
1.1572 +
1.1573 + case 47:
1.1574 +
1.1575 + { (yyval.string) = (yyvsp[0].string); ;}
1.1576 + break;
1.1577 +
1.1578 + case 48:
1.1579 +
1.1580 + {
1.1581 + struct symbol *sym = sym_lookup(NULL, 0);
1.1582 + sym->flags |= SYMBOL_CHOICE;
1.1583 + menu_add_entry(sym);
1.1584 + menu_add_expr(P_CHOICE, NULL, NULL);
1.1585 + printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1.1586 +;}
1.1587 + break;
1.1588 +
1.1589 + case 49:
1.1590 +
1.1591 + {
1.1592 + (yyval.menu) = menu_add_menu();
1.1593 +;}
1.1594 + break;
1.1595 +
1.1596 + case 50:
1.1597 +
1.1598 + {
1.1599 + if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1.1600 + menu_end_menu();
1.1601 + printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1.1602 + }
1.1603 +;}
1.1604 + break;
1.1605 +
1.1606 + case 58:
1.1607 +
1.1608 + {
1.1609 + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1.1610 + printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1.1611 +;}
1.1612 + break;
1.1613 +
1.1614 + case 59:
1.1615 +
1.1616 + {
1.1617 + if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1.1618 + menu_set_type((yyvsp[-2].id)->stype);
1.1619 + printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1.1620 + zconf_curname(), zconf_lineno(),
1.1621 + (yyvsp[-2].id)->stype);
1.1622 + } else
1.1623 + YYERROR;
1.1624 +;}
1.1625 + break;
1.1626 +
1.1627 + case 60:
1.1628 +
1.1629 + {
1.1630 + current_entry->sym->flags |= SYMBOL_OPTIONAL;
1.1631 + printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1.1632 +;}
1.1633 + break;
1.1634 +
1.1635 + case 61:
1.1636 +
1.1637 + {
1.1638 + if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1.1639 + menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1.1640 + printd(DEBUG_PARSE, "%s:%d:default\n",
1.1641 + zconf_curname(), zconf_lineno());
1.1642 + } else
1.1643 + YYERROR;
1.1644 +;}
1.1645 + break;
1.1646 +
1.1647 + case 64:
1.1648 +
1.1649 + {
1.1650 + printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1.1651 + menu_add_entry(NULL);
1.1652 + menu_add_dep((yyvsp[-1].expr));
1.1653 + (yyval.menu) = menu_add_menu();
1.1654 +;}
1.1655 + break;
1.1656 +
1.1657 + case 65:
1.1658 +
1.1659 + {
1.1660 + if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1.1661 + menu_end_menu();
1.1662 + printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1.1663 + }
1.1664 +;}
1.1665 + break;
1.1666 +
1.1667 + case 71:
1.1668 +
1.1669 + {
1.1670 + menu_add_entry(NULL);
1.1671 + menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1.1672 + printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1.1673 +;}
1.1674 + break;
1.1675 +
1.1676 + case 72:
1.1677 +
1.1678 + {
1.1679 + (yyval.menu) = menu_add_menu();
1.1680 +;}
1.1681 + break;
1.1682 +
1.1683 + case 73:
1.1684 +
1.1685 + {
1.1686 + if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1.1687 + menu_end_menu();
1.1688 + printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1.1689 + }
1.1690 +;}
1.1691 + break;
1.1692 +
1.1693 + case 79:
1.1694 +
1.1695 + {
1.1696 + printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1.1697 + zconf_nextfile((yyvsp[-1].string));
1.1698 +;}
1.1699 + break;
1.1700 +
1.1701 + case 80:
1.1702 +
1.1703 + {
1.1704 + menu_add_entry(NULL);
1.1705 + menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1.1706 + printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1.1707 +;}
1.1708 + break;
1.1709 +
1.1710 + case 81:
1.1711 +
1.1712 + {
1.1713 + menu_end_entry();
1.1714 +;}
1.1715 + break;
1.1716 +
1.1717 + case 82:
1.1718 +
1.1719 + {
1.1720 + printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1.1721 + zconf_starthelp();
1.1722 +;}
1.1723 + break;
1.1724 +
1.1725 + case 83:
1.1726 +
1.1727 + {
1.1728 + current_entry->sym->help = (yyvsp[0].string);
1.1729 +;}
1.1730 + break;
1.1731 +
1.1732 + case 88:
1.1733 +
1.1734 + {
1.1735 + menu_add_dep((yyvsp[-1].expr));
1.1736 + printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1.1737 +;}
1.1738 + break;
1.1739 +
1.1740 + case 89:
1.1741 +
1.1742 + {
1.1743 + menu_add_dep((yyvsp[-1].expr));
1.1744 + printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1.1745 +;}
1.1746 + break;
1.1747 +
1.1748 + case 90:
1.1749 +
1.1750 + {
1.1751 + menu_add_dep((yyvsp[-1].expr));
1.1752 + printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1.1753 +;}
1.1754 + break;
1.1755 +
1.1756 + case 92:
1.1757 +
1.1758 + {
1.1759 + menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1.1760 +;}
1.1761 + break;
1.1762 +
1.1763 + case 95:
1.1764 +
1.1765 + { (yyval.id) = (yyvsp[-1].id); ;}
1.1766 + break;
1.1767 +
1.1768 + case 96:
1.1769 +
1.1770 + { (yyval.id) = (yyvsp[-1].id); ;}
1.1771 + break;
1.1772 +
1.1773 + case 97:
1.1774 +
1.1775 + { (yyval.id) = (yyvsp[-1].id); ;}
1.1776 + break;
1.1777 +
1.1778 + case 100:
1.1779 +
1.1780 + { (yyval.expr) = NULL; ;}
1.1781 + break;
1.1782 +
1.1783 + case 101:
1.1784 +
1.1785 + { (yyval.expr) = (yyvsp[0].expr); ;}
1.1786 + break;
1.1787 +
1.1788 + case 102:
1.1789 +
1.1790 + { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1.1791 + break;
1.1792 +
1.1793 + case 103:
1.1794 +
1.1795 + { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1.1796 + break;
1.1797 +
1.1798 + case 104:
1.1799 +
1.1800 + { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1.1801 + break;
1.1802 +
1.1803 + case 105:
1.1804 +
1.1805 + { (yyval.expr) = (yyvsp[-1].expr); ;}
1.1806 + break;
1.1807 +
1.1808 + case 106:
1.1809 +
1.1810 + { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1.1811 + break;
1.1812 +
1.1813 + case 107:
1.1814 +
1.1815 + { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1.1816 + break;
1.1817 +
1.1818 + case 108:
1.1819 +
1.1820 + { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1.1821 + break;
1.1822 +
1.1823 + case 109:
1.1824 +
1.1825 + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1.1826 + break;
1.1827 +
1.1828 + case 110:
1.1829 +
1.1830 + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1.1831 + break;
1.1832 +
1.1833 +
1.1834 + default: break;
1.1835 + }
1.1836 +
1.1837 +/* Line 1126 of yacc.c. */
1.1838 +
1.1839 +
1.1840 + yyvsp -= yylen;
1.1841 + yyssp -= yylen;
1.1842 +
1.1843 +
1.1844 + YY_STACK_PRINT (yyss, yyssp);
1.1845 +
1.1846 + *++yyvsp = yyval;
1.1847 +
1.1848 +
1.1849 + /* Now `shift' the result of the reduction. Determine what state
1.1850 + that goes to, based on the state we popped back to and the rule
1.1851 + number reduced by. */
1.1852 +
1.1853 + yyn = yyr1[yyn];
1.1854 +
1.1855 + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1.1856 + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1857 + yystate = yytable[yystate];
1.1858 + else
1.1859 + yystate = yydefgoto[yyn - YYNTOKENS];
1.1860 +
1.1861 + goto yynewstate;
1.1862 +
1.1863 +
1.1864 +/*------------------------------------.
1.1865 +| yyerrlab -- here on detecting error |
1.1866 +`------------------------------------*/
1.1867 +yyerrlab:
1.1868 + /* If not already recovering from an error, report this error. */
1.1869 + if (!yyerrstatus)
1.1870 + {
1.1871 + ++yynerrs;
1.1872 +#if YYERROR_VERBOSE
1.1873 + yyn = yypact[yystate];
1.1874 +
1.1875 + if (YYPACT_NINF < yyn && yyn < YYLAST)
1.1876 + {
1.1877 + int yytype = YYTRANSLATE (yychar);
1.1878 + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1.1879 + YYSIZE_T yysize = yysize0;
1.1880 + YYSIZE_T yysize1;
1.1881 + int yysize_overflow = 0;
1.1882 + char *yymsg = 0;
1.1883 +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1.1884 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1.1885 + int yyx;
1.1886 +
1.1887 +#if 0
1.1888 + /* This is so xgettext sees the translatable formats that are
1.1889 + constructed on the fly. */
1.1890 + YY_("syntax error, unexpected %s");
1.1891 + YY_("syntax error, unexpected %s, expecting %s");
1.1892 + YY_("syntax error, unexpected %s, expecting %s or %s");
1.1893 + YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1.1894 + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1.1895 +#endif
1.1896 + char *yyfmt;
1.1897 + char const *yyf;
1.1898 + static char const yyunexpected[] = "syntax error, unexpected %s";
1.1899 + static char const yyexpecting[] = ", expecting %s";
1.1900 + static char const yyor[] = " or %s";
1.1901 + char yyformat[sizeof yyunexpected
1.1902 + + sizeof yyexpecting - 1
1.1903 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1.1904 + * (sizeof yyor - 1))];
1.1905 + char const *yyprefix = yyexpecting;
1.1906 +
1.1907 + /* Start YYX at -YYN if negative to avoid negative indexes in
1.1908 + YYCHECK. */
1.1909 + int yyxbegin = yyn < 0 ? -yyn : 0;
1.1910 +
1.1911 + /* Stay within bounds of both yycheck and yytname. */
1.1912 + int yychecklim = YYLAST - yyn;
1.1913 + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1.1914 + int yycount = 1;
1.1915 +
1.1916 + yyarg[0] = yytname[yytype];
1.1917 + yyfmt = yystpcpy (yyformat, yyunexpected);
1.1918 +
1.1919 + for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1.1920 + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1.1921 + {
1.1922 + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1.1923 + {
1.1924 + yycount = 1;
1.1925 + yysize = yysize0;
1.1926 + yyformat[sizeof yyunexpected - 1] = '\0';
1.1927 + break;
1.1928 + }
1.1929 + yyarg[yycount++] = yytname[yyx];
1.1930 + yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1.1931 + yysize_overflow |= yysize1 < yysize;
1.1932 + yysize = yysize1;
1.1933 + yyfmt = yystpcpy (yyfmt, yyprefix);
1.1934 + yyprefix = yyor;
1.1935 + }
1.1936 +
1.1937 + yyf = YY_(yyformat);
1.1938 + yysize1 = yysize + yystrlen (yyf);
1.1939 + yysize_overflow |= yysize1 < yysize;
1.1940 + yysize = yysize1;
1.1941 +
1.1942 + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1.1943 + yymsg = (char *) YYSTACK_ALLOC (yysize);
1.1944 + if (yymsg)
1.1945 + {
1.1946 + /* Avoid sprintf, as that infringes on the user's name space.
1.1947 + Don't have undefined behavior even if the translation
1.1948 + produced a string with the wrong number of "%s"s. */
1.1949 + char *yyp = yymsg;
1.1950 + int yyi = 0;
1.1951 + while ((*yyp = *yyf))
1.1952 + {
1.1953 + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1.1954 + {
1.1955 + yyp += yytnamerr (yyp, yyarg[yyi++]);
1.1956 + yyf += 2;
1.1957 + }
1.1958 + else
1.1959 + {
1.1960 + yyp++;
1.1961 + yyf++;
1.1962 + }
1.1963 + }
1.1964 + yyerror (yymsg);
1.1965 + YYSTACK_FREE (yymsg);
1.1966 + }
1.1967 + else
1.1968 + {
1.1969 + yyerror (YY_("syntax error"));
1.1970 + goto yyexhaustedlab;
1.1971 + }
1.1972 + }
1.1973 + else
1.1974 +#endif /* YYERROR_VERBOSE */
1.1975 + yyerror (YY_("syntax error"));
1.1976 + }
1.1977 +
1.1978 +
1.1979 +
1.1980 + if (yyerrstatus == 3)
1.1981 + {
1.1982 + /* If just tried and failed to reuse look-ahead token after an
1.1983 + error, discard it. */
1.1984 +
1.1985 + if (yychar <= YYEOF)
1.1986 + {
1.1987 + /* Return failure if at end of input. */
1.1988 + if (yychar == YYEOF)
1.1989 + YYABORT;
1.1990 + }
1.1991 + else
1.1992 + {
1.1993 + yydestruct ("Error: discarding", yytoken, &yylval);
1.1994 + yychar = YYEMPTY;
1.1995 + }
1.1996 + }
1.1997 +
1.1998 + /* Else will try to reuse look-ahead token after shifting the error
1.1999 + token. */
1.2000 + goto yyerrlab1;
1.2001 +
1.2002 +
1.2003 +/*---------------------------------------------------.
1.2004 +| yyerrorlab -- error raised explicitly by YYERROR. |
1.2005 +`---------------------------------------------------*/
1.2006 +yyerrorlab:
1.2007 +
1.2008 + /* Pacify compilers like GCC when the user code never invokes
1.2009 + YYERROR and the label yyerrorlab therefore never appears in user
1.2010 + code. */
1.2011 + if (0)
1.2012 + goto yyerrorlab;
1.2013 +
1.2014 +yyvsp -= yylen;
1.2015 + yyssp -= yylen;
1.2016 + yystate = *yyssp;
1.2017 + goto yyerrlab1;
1.2018 +
1.2019 +
1.2020 +/*-------------------------------------------------------------.
1.2021 +| yyerrlab1 -- common code for both syntax error and YYERROR. |
1.2022 +`-------------------------------------------------------------*/
1.2023 +yyerrlab1:
1.2024 + yyerrstatus = 3; /* Each real token shifted decrements this. */
1.2025 +
1.2026 + for (;;)
1.2027 + {
1.2028 + yyn = yypact[yystate];
1.2029 + if (yyn != YYPACT_NINF)
1.2030 + {
1.2031 + yyn += YYTERROR;
1.2032 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1.2033 + {
1.2034 + yyn = yytable[yyn];
1.2035 + if (0 < yyn)
1.2036 + break;
1.2037 + }
1.2038 + }
1.2039 +
1.2040 + /* Pop the current state because it cannot handle the error token. */
1.2041 + if (yyssp == yyss)
1.2042 + YYABORT;
1.2043 +
1.2044 +
1.2045 + yydestruct ("Error: popping", yystos[yystate], yyvsp);
1.2046 + YYPOPSTACK;
1.2047 + yystate = *yyssp;
1.2048 + YY_STACK_PRINT (yyss, yyssp);
1.2049 + }
1.2050 +
1.2051 + if (yyn == YYFINAL)
1.2052 + YYACCEPT;
1.2053 +
1.2054 + *++yyvsp = yylval;
1.2055 +
1.2056 +
1.2057 + /* Shift the error token. */
1.2058 + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1.2059 +
1.2060 + yystate = yyn;
1.2061 + goto yynewstate;
1.2062 +
1.2063 +
1.2064 +/*-------------------------------------.
1.2065 +| yyacceptlab -- YYACCEPT comes here. |
1.2066 +`-------------------------------------*/
1.2067 +yyacceptlab:
1.2068 + yyresult = 0;
1.2069 + goto yyreturn;
1.2070 +
1.2071 +/*-----------------------------------.
1.2072 +| yyabortlab -- YYABORT comes here. |
1.2073 +`-----------------------------------*/
1.2074 +yyabortlab:
1.2075 + yyresult = 1;
1.2076 + goto yyreturn;
1.2077 +
1.2078 +#ifndef yyoverflow
1.2079 +/*-------------------------------------------------.
1.2080 +| yyexhaustedlab -- memory exhaustion comes here. |
1.2081 +`-------------------------------------------------*/
1.2082 +yyexhaustedlab:
1.2083 + yyerror (YY_("memory exhausted"));
1.2084 + yyresult = 2;
1.2085 + /* Fall through. */
1.2086 +#endif
1.2087 +
1.2088 +yyreturn:
1.2089 + if (yychar != YYEOF && yychar != YYEMPTY)
1.2090 + yydestruct ("Cleanup: discarding lookahead",
1.2091 + yytoken, &yylval);
1.2092 + while (yyssp != yyss)
1.2093 + {
1.2094 + yydestruct ("Cleanup: popping",
1.2095 + yystos[*yyssp], yyvsp);
1.2096 + YYPOPSTACK;
1.2097 + }
1.2098 +#ifndef yyoverflow
1.2099 + if (yyss != yyssa)
1.2100 + YYSTACK_FREE (yyss);
1.2101 +#endif
1.2102 + return yyresult;
1.2103 +}
1.2104 +
1.2105 +
1.2106 +
1.2107 +
1.2108 +
1.2109 +void conf_parse(const char *name)
1.2110 +{
1.2111 + struct symbol *sym;
1.2112 + int i;
1.2113 +
1.2114 + zconf_initscan(name);
1.2115 +
1.2116 + sym_init();
1.2117 + menu_init();
1.2118 + modules_sym = sym_lookup(NULL, 0);
1.2119 + modules_sym->type = S_BOOLEAN;
1.2120 + modules_sym->flags |= SYMBOL_AUTO;
1.2121 + rootmenu.prompt = menu_add_prompt(P_MENU, PROJECT_NAME" Configuration", NULL);
1.2122 +
1.2123 +#if YYDEBUG
1.2124 + if (getenv("ZCONF_DEBUG"))
1.2125 + zconfdebug = 1;
1.2126 +#endif
1.2127 + zconfparse();
1.2128 + if (zconfnerrs)
1.2129 + exit(1);
1.2130 + if (!modules_sym->prop) {
1.2131 + struct property *prop;
1.2132 +
1.2133 + prop = prop_alloc(P_DEFAULT, modules_sym);
1.2134 + prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
1.2135 + }
1.2136 + menu_finalize(&rootmenu);
1.2137 + for_all_symbols(i, sym) {
1.2138 + sym_check_deps(sym);
1.2139 + }
1.2140 +
1.2141 + sym_change_count = 1;
1.2142 +}
1.2143 +
1.2144 +const char *zconf_tokenname(int token)
1.2145 +{
1.2146 + switch (token) {
1.2147 + case T_MENU: return "menu";
1.2148 + case T_ENDMENU: return "endmenu";
1.2149 + case T_CHOICE: return "choice";
1.2150 + case T_ENDCHOICE: return "endchoice";
1.2151 + case T_IF: return "if";
1.2152 + case T_ENDIF: return "endif";
1.2153 + case T_DEPENDS: return "depends";
1.2154 + }
1.2155 + return "<token>";
1.2156 +}
1.2157 +
1.2158 +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1.2159 +{
1.2160 + if (id->token != endtoken) {
1.2161 + zconf_error("unexpected '%s' within %s block",
1.2162 + kconf_id_strings + id->name, zconf_tokenname(starttoken));
1.2163 + zconfnerrs++;
1.2164 + return false;
1.2165 + }
1.2166 + if (current_menu->file != current_file) {
1.2167 + zconf_error("'%s' in different file than '%s'",
1.2168 + kconf_id_strings + id->name, zconf_tokenname(starttoken));
1.2169 + fprintf(stderr, "%s:%d: location of the '%s'\n",
1.2170 + current_menu->file->name, current_menu->lineno,
1.2171 + zconf_tokenname(starttoken));
1.2172 + zconfnerrs++;
1.2173 + return false;
1.2174 + }
1.2175 + return true;
1.2176 +}
1.2177 +
1.2178 +static void zconfprint(const char *err, ...)
1.2179 +{
1.2180 + va_list ap;
1.2181 +
1.2182 + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
1.2183 + va_start(ap, err);
1.2184 + vfprintf(stderr, err, ap);
1.2185 + va_end(ap);
1.2186 + fprintf(stderr, "\n");
1.2187 +}
1.2188 +
1.2189 +static void zconf_error(const char *err, ...)
1.2190 +{
1.2191 + va_list ap;
1.2192 +
1.2193 + zconfnerrs++;
1.2194 + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
1.2195 + va_start(ap, err);
1.2196 + vfprintf(stderr, err, ap);
1.2197 + va_end(ap);
1.2198 + fprintf(stderr, "\n");
1.2199 +}
1.2200 +
1.2201 +static void zconferror(const char *err)
1.2202 +{
1.2203 +#if YYDEBUG
1.2204 + fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
1.2205 +#endif
1.2206 +}
1.2207 +
1.2208 +void print_quoted_string(FILE *out, const char *str)
1.2209 +{
1.2210 + const char *p;
1.2211 + int len;
1.2212 +
1.2213 + putc('"', out);
1.2214 + while ((p = strchr(str, '"'))) {
1.2215 + len = p - str;
1.2216 + if (len)
1.2217 + fprintf(out, "%.*s", len, str);
1.2218 + fputs("\\\"", out);
1.2219 + str = p + 1;
1.2220 + }
1.2221 + fputs(str, out);
1.2222 + putc('"', out);
1.2223 +}
1.2224 +
1.2225 +void print_symbol(FILE *out, struct menu *menu)
1.2226 +{
1.2227 + struct symbol *sym = menu->sym;
1.2228 + struct property *prop;
1.2229 +
1.2230 + if (sym_is_choice(sym))
1.2231 + fprintf(out, "choice\n");
1.2232 + else
1.2233 + fprintf(out, "config %s\n", sym->name);
1.2234 + switch (sym->type) {
1.2235 + case S_BOOLEAN:
1.2236 + fputs(" boolean\n", out);
1.2237 + break;
1.2238 + case S_TRISTATE:
1.2239 + fputs(" tristate\n", out);
1.2240 + break;
1.2241 + case S_STRING:
1.2242 + fputs(" string\n", out);
1.2243 + break;
1.2244 + case S_INT:
1.2245 + fputs(" integer\n", out);
1.2246 + break;
1.2247 + case S_HEX:
1.2248 + fputs(" hex\n", out);
1.2249 + break;
1.2250 + default:
1.2251 + fputs(" ???\n", out);
1.2252 + break;
1.2253 + }
1.2254 + for (prop = sym->prop; prop; prop = prop->next) {
1.2255 + if (prop->menu != menu)
1.2256 + continue;
1.2257 + switch (prop->type) {
1.2258 + case P_PROMPT:
1.2259 + fputs(" prompt ", out);
1.2260 + print_quoted_string(out, prop->text);
1.2261 + if (!expr_is_yes(prop->visible.expr)) {
1.2262 + fputs(" if ", out);
1.2263 + expr_fprint(prop->visible.expr, out);
1.2264 + }
1.2265 + fputc('\n', out);
1.2266 + break;
1.2267 + case P_DEFAULT:
1.2268 + fputs( " default ", out);
1.2269 + expr_fprint(prop->expr, out);
1.2270 + if (!expr_is_yes(prop->visible.expr)) {
1.2271 + fputs(" if ", out);
1.2272 + expr_fprint(prop->visible.expr, out);
1.2273 + }
1.2274 + fputc('\n', out);
1.2275 + break;
1.2276 + case P_CHOICE:
1.2277 + fputs(" #choice value\n", out);
1.2278 + break;
1.2279 + default:
1.2280 + fprintf(out, " unknown prop %d!\n", prop->type);
1.2281 + break;
1.2282 + }
1.2283 + }
1.2284 + if (sym->help) {
1.2285 + int len = strlen(sym->help);
1.2286 + while (sym->help[--len] == '\n')
1.2287 + sym->help[len] = 0;
1.2288 + fprintf(out, " help\n%s\n", sym->help);
1.2289 + }
1.2290 + fputc('\n', out);
1.2291 +}
1.2292 +
1.2293 +void zconfdump(FILE *out)
1.2294 +{
1.2295 + struct property *prop;
1.2296 + struct symbol *sym;
1.2297 + struct menu *menu;
1.2298 +
1.2299 + menu = rootmenu.list;
1.2300 + while (menu) {
1.2301 + if ((sym = menu->sym))
1.2302 + print_symbol(out, menu);
1.2303 + else if ((prop = menu->prompt)) {
1.2304 + switch (prop->type) {
1.2305 + case P_COMMENT:
1.2306 + fputs("\ncomment ", out);
1.2307 + print_quoted_string(out, prop->text);
1.2308 + fputs("\n", out);
1.2309 + break;
1.2310 + case P_MENU:
1.2311 + fputs("\nmenu ", out);
1.2312 + print_quoted_string(out, prop->text);
1.2313 + fputs("\n", out);
1.2314 + break;
1.2315 + default:
1.2316 + ;
1.2317 + }
1.2318 + if (!expr_is_yes(prop->visible.expr)) {
1.2319 + fputs(" depends ", out);
1.2320 + expr_fprint(prop->visible.expr, out);
1.2321 + fputc('\n', out);
1.2322 + }
1.2323 + fputs("\n", out);
1.2324 + }
1.2325 +
1.2326 + if (menu->list)
1.2327 + menu = menu->list;
1.2328 + else if (menu->next)
1.2329 + menu = menu->next;
1.2330 + else while ((menu = menu->parent)) {
1.2331 + if (menu->prompt && menu->prompt->type == P_MENU)
1.2332 + fputs("\nendmenu\n", out);
1.2333 + if (menu->next) {
1.2334 + menu = menu->next;
1.2335 + break;
1.2336 + }
1.2337 + }
1.2338 + }
1.2339 +}
1.2340 +
1.2341 +#include "lex.zconf.c"
1.2342 +#include "util.c"
1.2343 +#include "confdata.c"
1.2344 +#include "expr.c"
1.2345 +#include "symbol.c"
1.2346 +#include "menu.c"
1.2347 +
1.2348 +