Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.3. */ |
| 2 | |
| 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
| 4 | |
| 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 |
| 6 | Free Software Foundation, Inc. |
| 7 | |
| 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2, or (at your option) |
| 11 | any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 | Boston, MA 02110-1301, USA. */ |
| 22 | |
| 23 | /* As a special exception, you may create a larger work that contains |
| 24 | part or all of the Bison parser skeleton and distribute that work |
| 25 | under terms of your choice, so long as that work isn't itself a |
| 26 | parser generator using the skeleton or a modified version thereof |
| 27 | as a parser skeleton. Alternatively, if you modify or redistribute |
| 28 | the parser skeleton itself, you may (at your option) remove this |
| 29 | special exception, which will cause the skeleton and the resulting |
| 30 | Bison output files to be licensed under the GNU General Public |
| 31 | License without this special exception. |
| 32 | |
| 33 | This special exception was added by the Free Software Foundation in |
| 34 | version 2.2 of Bison. */ |
| 35 | |
| 36 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
| 37 | simplifying the original so-called "semantic" parser. */ |
| 38 | |
| 39 | /* All symbols defined below should begin with yy or YY, to avoid |
| 40 | infringing on user name space. This should be done even for local |
| 41 | variables, as they might otherwise be expanded by user macros. |
| 42 | There are some unavoidable exceptions within include files to |
| 43 | define necessary library symbols; they are noted "INFRINGES ON |
| 44 | USER NAME SPACE" below. */ |
| 45 | |
| 46 | /* Identify Bison output. */ |
| 47 | #define YYBISON 1 |
| 48 | |
| 49 | /* Bison version. */ |
| 50 | #define YYBISON_VERSION "2.3" |
| 51 | |
| 52 | /* Skeleton name. */ |
| 53 | #define YYSKELETON_NAME "yacc.c" |
| 54 | |
| 55 | /* Pure parsers. */ |
| 56 | #define YYPURE 0 |
| 57 | |
| 58 | /* Using locations. */ |
| 59 | #define YYLSP_NEEDED 0 |
| 60 | |
| 61 | /* Substitute the variable and function names. */ |
| 62 | #define yyparse zconfparse |
| 63 | #define yylex zconflex |
| 64 | #define yyerror zconferror |
| 65 | #define yylval zconflval |
| 66 | #define yychar zconfchar |
| 67 | #define yydebug zconfdebug |
| 68 | #define yynerrs zconfnerrs |
| 69 | |
| 70 | |
| 71 | /* Tokens. */ |
| 72 | #ifndef YYTOKENTYPE |
| 73 | # define YYTOKENTYPE |
| 74 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 75 | know about them. */ |
| 76 | enum yytokentype { |
| 77 | T_MAINMENU = 258, |
| 78 | T_MENU = 259, |
| 79 | T_ENDMENU = 260, |
| 80 | T_SOURCE = 261, |
| 81 | T_CHOICE = 262, |
| 82 | T_ENDCHOICE = 263, |
| 83 | T_COMMENT = 264, |
| 84 | T_CONFIG = 265, |
| 85 | T_MENUCONFIG = 266, |
| 86 | T_HELP = 267, |
| 87 | T_HELPTEXT = 268, |
| 88 | T_IF = 269, |
| 89 | T_ENDIF = 270, |
| 90 | T_DEPENDS = 271, |
| 91 | T_OPTIONAL = 272, |
| 92 | T_PROMPT = 273, |
| 93 | T_TYPE = 274, |
| 94 | T_DEFAULT = 275, |
| 95 | T_SELECT = 276, |
| 96 | T_RANGE = 277, |
| 97 | T_OPTION = 278, |
| 98 | T_ON = 279, |
| 99 | T_WORD = 280, |
| 100 | T_WORD_QUOTE = 281, |
| 101 | T_UNEQUAL = 282, |
| 102 | T_CLOSE_PAREN = 283, |
| 103 | T_OPEN_PAREN = 284, |
| 104 | T_EOL = 285, |
| 105 | T_OR = 286, |
| 106 | T_AND = 287, |
| 107 | T_EQUAL = 288, |
| 108 | T_NOT = 289 |
| 109 | }; |
| 110 | #endif |
| 111 | /* Tokens. */ |
| 112 | #define T_MAINMENU 258 |
| 113 | #define T_MENU 259 |
| 114 | #define T_ENDMENU 260 |
| 115 | #define T_SOURCE 261 |
| 116 | #define T_CHOICE 262 |
| 117 | #define T_ENDCHOICE 263 |
| 118 | #define T_COMMENT 264 |
| 119 | #define T_CONFIG 265 |
| 120 | #define T_MENUCONFIG 266 |
| 121 | #define T_HELP 267 |
| 122 | #define T_HELPTEXT 268 |
| 123 | #define T_IF 269 |
| 124 | #define T_ENDIF 270 |
| 125 | #define T_DEPENDS 271 |
| 126 | #define T_OPTIONAL 272 |
| 127 | #define T_PROMPT 273 |
| 128 | #define T_TYPE 274 |
| 129 | #define T_DEFAULT 275 |
| 130 | #define T_SELECT 276 |
| 131 | #define T_RANGE 277 |
| 132 | #define T_OPTION 278 |
| 133 | #define T_ON 279 |
| 134 | #define T_WORD 280 |
| 135 | #define T_WORD_QUOTE 281 |
| 136 | #define T_UNEQUAL 282 |
| 137 | #define T_CLOSE_PAREN 283 |
| 138 | #define T_OPEN_PAREN 284 |
| 139 | #define T_EOL 285 |
| 140 | #define T_OR 286 |
| 141 | #define T_AND 287 |
| 142 | #define T_EQUAL 288 |
| 143 | #define T_NOT 289 |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | /* Copy the first part of user declarations. */ |
| 149 | |
| 150 | |
| 151 | /* |
| 152 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
| 153 | * Released under the terms of the GNU GPL v2.0. |
| 154 | */ |
| 155 | |
| 156 | #include <ctype.h> |
| 157 | #include <stdarg.h> |
| 158 | #include <stdio.h> |
| 159 | #include <stdlib.h> |
| 160 | #include <string.h> |
| 161 | |
| 162 | #define LKC_DIRECT_LINK |
| 163 | #include "lkc.h" |
| 164 | |
| 165 | #include "zconf.hash.c" |
| 166 | |
| 167 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
| 168 | |
| 169 | #define PRINTD 0x0001 |
| 170 | #define DEBUG_PARSE 0x0002 |
| 171 | |
| 172 | int cdebug = PRINTD; |
| 173 | |
| 174 | extern int zconflex(void); |
| 175 | static void zconfprint(const char *err, ...); |
| 176 | static void zconf_error(const char *err, ...); |
| 177 | static void zconferror(const char *err); |
| 178 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); |
| 179 | |
| 180 | struct symbol *symbol_hash[257]; |
| 181 | |
| 182 | static struct menu *current_menu, *current_entry; |
| 183 | |
| 184 | #define YYDEBUG 0 |
| 185 | #if YYDEBUG |
| 186 | #define YYERROR_VERBOSE |
| 187 | #endif |
| 188 | |
| 189 | |
| 190 | /* Enabling traces. */ |
| 191 | #ifndef YYDEBUG |
| 192 | # define YYDEBUG 0 |
| 193 | #endif |
| 194 | |
| 195 | /* Enabling verbose error messages. */ |
| 196 | #ifdef YYERROR_VERBOSE |
| 197 | # undef YYERROR_VERBOSE |
| 198 | # define YYERROR_VERBOSE 1 |
| 199 | #else |
| 200 | # define YYERROR_VERBOSE 0 |
| 201 | #endif |
| 202 | |
| 203 | /* Enabling the token table. */ |
| 204 | #ifndef YYTOKEN_TABLE |
| 205 | # define YYTOKEN_TABLE 0 |
| 206 | #endif |
| 207 | |
| 208 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 209 | typedef union YYSTYPE |
| 210 | |
| 211 | { |
| 212 | char *string; |
| 213 | struct file *file; |
| 214 | struct symbol *symbol; |
| 215 | struct expr *expr; |
| 216 | struct menu *menu; |
| 217 | struct kconf_id *id; |
| 218 | } |
| 219 | /* Line 187 of yacc.c. */ |
| 220 | |
| 221 | YYSTYPE; |
| 222 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 223 | # define YYSTYPE_IS_DECLARED 1 |
| 224 | # define YYSTYPE_IS_TRIVIAL 1 |
| 225 | #endif |
| 226 | |
| 227 | |
| 228 | |
| 229 | /* Copy the second part of user declarations. */ |
| 230 | |
| 231 | |
| 232 | /* Line 216 of yacc.c. */ |
| 233 | |
| 234 | |
| 235 | #ifdef short |
| 236 | # undef short |
| 237 | #endif |
| 238 | |
| 239 | #ifdef YYTYPE_UINT8 |
| 240 | typedef YYTYPE_UINT8 yytype_uint8; |
| 241 | #else |
| 242 | typedef unsigned char yytype_uint8; |
| 243 | #endif |
| 244 | |
| 245 | #ifdef YYTYPE_INT8 |
| 246 | typedef YYTYPE_INT8 yytype_int8; |
| 247 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 248 | || defined __cplusplus || defined _MSC_VER) |
| 249 | typedef signed char yytype_int8; |
| 250 | #else |
| 251 | typedef short int yytype_int8; |
| 252 | #endif |
| 253 | |
| 254 | #ifdef YYTYPE_UINT16 |
| 255 | typedef YYTYPE_UINT16 yytype_uint16; |
| 256 | #else |
| 257 | typedef unsigned short int yytype_uint16; |
| 258 | #endif |
| 259 | |
| 260 | #ifdef YYTYPE_INT16 |
| 261 | typedef YYTYPE_INT16 yytype_int16; |
| 262 | #else |
| 263 | typedef short int yytype_int16; |
| 264 | #endif |
| 265 | |
| 266 | #ifndef YYSIZE_T |
| 267 | # ifdef __SIZE_TYPE__ |
| 268 | # define YYSIZE_T __SIZE_TYPE__ |
| 269 | # elif defined size_t |
| 270 | # define YYSIZE_T size_t |
| 271 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 272 | || defined __cplusplus || defined _MSC_VER) |
| 273 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 274 | # define YYSIZE_T size_t |
| 275 | # else |
| 276 | # define YYSIZE_T unsigned int |
| 277 | # endif |
| 278 | #endif |
| 279 | |
| 280 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 281 | |
| 282 | #ifndef YY_ |
| 283 | # if YYENABLE_NLS |
| 284 | # if ENABLE_NLS |
| 285 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 286 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 287 | # endif |
| 288 | # endif |
| 289 | # ifndef YY_ |
| 290 | # define YY_(msgid) msgid |
| 291 | # endif |
| 292 | #endif |
| 293 | |
| 294 | /* Suppress unused-variable warnings by "using" E. */ |
| 295 | #if ! defined lint || defined __GNUC__ |
| 296 | # define YYUSE(e) ((void) (e)) |
| 297 | #else |
| 298 | # define YYUSE(e) /* empty */ |
| 299 | #endif |
| 300 | |
| 301 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 302 | #ifndef lint |
| 303 | # define YYID(n) (n) |
| 304 | #else |
| 305 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 306 | || defined __cplusplus || defined _MSC_VER) |
| 307 | static int |
| 308 | YYID (int i) |
| 309 | #else |
| 310 | static int |
| 311 | YYID (i) |
| 312 | int i; |
| 313 | #endif |
| 314 | { |
| 315 | return i; |
| 316 | } |
| 317 | #endif |
| 318 | |
| 319 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 320 | |
| 321 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 322 | |
| 323 | # ifdef YYSTACK_USE_ALLOCA |
| 324 | # if YYSTACK_USE_ALLOCA |
| 325 | # ifdef __GNUC__ |
| 326 | # define YYSTACK_ALLOC __builtin_alloca |
| 327 | # elif defined __BUILTIN_VA_ARG_INCR |
| 328 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 329 | # elif defined _AIX |
| 330 | # define YYSTACK_ALLOC __alloca |
| 331 | # elif defined _MSC_VER |
| 332 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 333 | # define alloca _alloca |
| 334 | # else |
| 335 | # define YYSTACK_ALLOC alloca |
| 336 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 337 | || defined __cplusplus || defined _MSC_VER) |
| 338 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 339 | # ifndef _STDLIB_H |
| 340 | # define _STDLIB_H 1 |
| 341 | # endif |
| 342 | # endif |
| 343 | # endif |
| 344 | # endif |
| 345 | # endif |
| 346 | |
| 347 | # ifdef YYSTACK_ALLOC |
| 348 | /* Pacify GCC's `empty if-body' warning. */ |
| 349 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 350 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 351 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 352 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 353 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 354 | to allow for a few compiler-allocated temporary stack slots. */ |
| 355 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 356 | # endif |
| 357 | # else |
| 358 | # define YYSTACK_ALLOC YYMALLOC |
| 359 | # define YYSTACK_FREE YYFREE |
| 360 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 361 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 362 | # endif |
| 363 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 364 | && ! ((defined YYMALLOC || defined malloc) \ |
| 365 | && (defined YYFREE || defined free))) |
| 366 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 367 | # ifndef _STDLIB_H |
| 368 | # define _STDLIB_H 1 |
| 369 | # endif |
| 370 | # endif |
| 371 | # ifndef YYMALLOC |
| 372 | # define YYMALLOC malloc |
| 373 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 374 | || defined __cplusplus || defined _MSC_VER) |
| 375 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 376 | # endif |
| 377 | # endif |
| 378 | # ifndef YYFREE |
| 379 | # define YYFREE free |
| 380 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 381 | || defined __cplusplus || defined _MSC_VER) |
| 382 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 383 | # endif |
| 384 | # endif |
| 385 | # endif |
| 386 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 387 | |
| 388 | |
| 389 | #if (! defined yyoverflow \ |
| 390 | && (! defined __cplusplus \ |
| 391 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 392 | |
| 393 | /* A type that is properly aligned for any stack member. */ |
| 394 | union yyalloc |
| 395 | { |
| 396 | yytype_int16 yyss; |
| 397 | YYSTYPE yyvs; |
| 398 | }; |
| 399 | |
| 400 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 401 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 402 | |
| 403 | /* The size of an array large to enough to hold all stacks, each with |
| 404 | N elements. */ |
| 405 | # define YYSTACK_BYTES(N) \ |
| 406 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 407 | + YYSTACK_GAP_MAXIMUM) |
| 408 | |
| 409 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 410 | not overlap. */ |
| 411 | # ifndef YYCOPY |
| 412 | # if defined __GNUC__ && 1 < __GNUC__ |
| 413 | # define YYCOPY(To, From, Count) \ |
| 414 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 415 | # else |
| 416 | # define YYCOPY(To, From, Count) \ |
| 417 | do \ |
| 418 | { \ |
| 419 | YYSIZE_T yyi; \ |
| 420 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 421 | (To)[yyi] = (From)[yyi]; \ |
| 422 | } \ |
| 423 | while (YYID (0)) |
| 424 | # endif |
| 425 | # endif |
| 426 | |
| 427 | /* Relocate STACK from its old location to the new one. The |
| 428 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 429 | elements in the stack, and YYPTR gives the new location of the |
| 430 | stack. Advance YYPTR to a properly aligned location for the next |
| 431 | stack. */ |
| 432 | # define YYSTACK_RELOCATE(Stack) \ |
| 433 | do \ |
| 434 | { \ |
| 435 | YYSIZE_T yynewbytes; \ |
| 436 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 437 | Stack = &yyptr->Stack; \ |
| 438 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 439 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 440 | } \ |
| 441 | while (YYID (0)) |
| 442 | |
| 443 | #endif |
| 444 | |
| 445 | /* YYFINAL -- State number of the termination state. */ |
| 446 | #define YYFINAL 3 |
| 447 | /* YYLAST -- Last index in YYTABLE. */ |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 448 | #define YYLAST 259 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 449 | |
| 450 | /* YYNTOKENS -- Number of terminals. */ |
| 451 | #define YYNTOKENS 35 |
| 452 | /* YYNNTS -- Number of nonterminals. */ |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 453 | #define YYNNTS 46 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 454 | /* YYNRULES -- Number of rules. */ |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 455 | #define YYNRULES 110 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 456 | /* YYNRULES -- Number of states. */ |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 457 | #define YYNSTATES 180 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 458 | |
| 459 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 460 | #define YYUNDEFTOK 2 |
| 461 | #define YYMAXUTOK 289 |
| 462 | |
| 463 | #define YYTRANSLATE(YYX) \ |
| 464 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 465 | |
| 466 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 467 | static const yytype_uint8 yytranslate[] = |
| 468 | { |
| 469 | 0, 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, 2, 2, 2, 2, |
| 487 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 488 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 489 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 490 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 491 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 492 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 493 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 494 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 495 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 496 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 497 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 |
| 498 | }; |
| 499 | |
| 500 | #if YYDEBUG |
| 501 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 502 | YYRHS. */ |
| 503 | static const yytype_uint16 yyprhs[] = |
| 504 | { |
| 505 | 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, |
| 506 | 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, |
| 507 | 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, |
| 508 | 81, 84, 85, 88, 91, 94, 97, 100, 103, 107, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 509 | 112, 117, 122, 128, 132, 133, 137, 138, 141, 145, |
| 510 | 148, 150, 154, 155, 158, 161, 164, 167, 170, 175, |
| 511 | 179, 182, 187, 188, 191, 195, 197, 201, 202, 205, |
| 512 | 208, 211, 215, 218, 220, 224, 225, 228, 231, 234, |
| 513 | 238, 242, 245, 248, 251, 252, 255, 258, 261, 266, |
| 514 | 267, 270, 272, 274, 277, 280, 283, 285, 288, 289, |
| 515 | 292, 294, 298, 302, 306, 309, 313, 317, 319, 321, |
| 516 | 322 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 517 | }; |
| 518 | |
| 519 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 520 | static const yytype_int8 yyrhs[] = |
| 521 | { |
| 522 | 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, |
| 523 | 53, -1, 37, 64, -1, 37, 3, 74, 76, -1, |
| 524 | 37, 75, -1, 37, 25, 1, 30, -1, 37, 38, |
| 525 | 1, 30, -1, 37, 1, 30, -1, 16, -1, 18, |
| 526 | -1, 19, -1, 21, -1, 17, -1, 22, -1, 20, |
| 527 | -1, 30, -1, 59, -1, 68, -1, 42, -1, 44, |
| 528 | -1, 66, -1, 25, 1, 30, -1, 1, 30, -1, |
| 529 | 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, |
| 530 | -1, 43, 45, -1, -1, 45, 46, -1, 45, 47, |
| 531 | -1, 45, 72, -1, 45, 70, -1, 45, 40, -1, |
| 532 | 45, 30, -1, 19, 73, 30, -1, 18, 74, 77, |
| 533 | 30, -1, 20, 78, 77, 30, -1, 21, 25, 77, |
| 534 | 30, -1, 22, 79, 79, 77, 30, -1, 23, 48, |
| 535 | 30, -1, -1, 48, 25, 49, -1, -1, 33, 74, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 536 | -1, 7, 80, 30, -1, 50, 54, -1, 75, -1, |
| 537 | 51, 56, 52, -1, -1, 54, 55, -1, 54, 72, |
| 538 | -1, 54, 70, -1, 54, 30, -1, 54, 40, -1, |
| 539 | 18, 74, 77, 30, -1, 19, 73, 30, -1, 17, |
| 540 | 30, -1, 20, 25, 77, 30, -1, -1, 56, 39, |
| 541 | -1, 14, 78, 76, -1, 75, -1, 57, 60, 58, |
| 542 | -1, -1, 60, 39, -1, 60, 64, -1, 60, 53, |
| 543 | -1, 4, 74, 30, -1, 61, 71, -1, 75, -1, |
| 544 | 62, 65, 63, -1, -1, 65, 39, -1, 65, 64, |
| 545 | -1, 65, 53, -1, 6, 74, 30, -1, 9, 74, |
| 546 | 30, -1, 67, 71, -1, 12, 30, -1, 69, 13, |
| 547 | -1, -1, 71, 72, -1, 71, 30, -1, 71, 40, |
| 548 | -1, 16, 24, 78, 30, -1, -1, 74, 77, -1, |
| 549 | 25, -1, 26, -1, 5, 30, -1, 8, 30, -1, |
| 550 | 15, 30, -1, 30, -1, 76, 30, -1, -1, 14, |
| 551 | 78, -1, 79, -1, 79, 33, 79, -1, 79, 27, |
| 552 | 79, -1, 29, 78, 28, -1, 34, 78, -1, 78, |
| 553 | 31, 78, -1, 78, 32, 78, -1, 25, -1, 26, |
| 554 | -1, -1, 25, -1 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 555 | }; |
| 556 | |
| 557 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 558 | static const yytype_uint16 yyrline[] = |
| 559 | { |
| 560 | 0, 104, 104, 106, 108, 109, 110, 111, 112, 113, |
| 561 | 114, 118, 122, 122, 122, 122, 122, 122, 122, 126, |
| 562 | 127, 128, 129, 130, 131, 135, 136, 142, 150, 156, |
| 563 | 164, 174, 176, 177, 178, 179, 180, 181, 184, 192, |
| 564 | 198, 208, 214, 220, 223, 225, 236, 237, 242, 251, |
| 565 | 256, 264, 267, 269, 270, 271, 272, 273, 276, 282, |
| 566 | 293, 299, 309, 311, 316, 324, 332, 335, 337, 338, |
| 567 | 339, 344, 351, 356, 364, 367, 369, 370, 371, 374, |
| 568 | 382, 389, 396, 402, 409, 411, 412, 413, 416, 424, |
| 569 | 426, 431, 432, 435, 436, 437, 441, 442, 445, 446, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 570 | 449, 450, 451, 452, 453, 454, 455, 458, 459, 462, |
| 571 | 463 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 572 | }; |
| 573 | #endif |
| 574 | |
| 575 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 576 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 577 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 578 | static const char *const yytname[] = |
| 579 | { |
| 580 | "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", |
| 581 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", |
| 582 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", |
| 583 | "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", |
| 584 | "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", |
| 585 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", |
| 586 | "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt", |
| 587 | "option_error", "config_entry_start", "config_stmt", |
| 588 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", |
| 589 | "config_option", "symbol_option", "symbol_option_list", |
| 590 | "symbol_option_arg", "choice", "choice_entry", "choice_end", |
| 591 | "choice_stmt", "choice_option_list", "choice_option", "choice_block", |
| 592 | "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", |
| 593 | "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", |
| 594 | "comment_stmt", "help_start", "help", "depends_list", "depends", |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 595 | "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", |
| 596 | "word_opt", 0 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 597 | }; |
| 598 | #endif |
| 599 | |
| 600 | # ifdef YYPRINT |
| 601 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 602 | token YYLEX-NUM. */ |
| 603 | static const yytype_uint16 yytoknum[] = |
| 604 | { |
| 605 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 606 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 607 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 608 | 285, 286, 287, 288, 289 |
| 609 | }; |
| 610 | # endif |
| 611 | |
| 612 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 613 | static const yytype_uint8 yyr1[] = |
| 614 | { |
| 615 | 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, |
| 616 | 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, |
| 617 | 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, |
| 618 | 44, 45, 45, 45, 45, 45, 45, 45, 46, 46, |
| 619 | 46, 46, 46, 47, 48, 48, 49, 49, 50, 51, |
| 620 | 52, 53, 54, 54, 54, 54, 54, 54, 55, 55, |
| 621 | 55, 55, 56, 56, 57, 58, 59, 60, 60, 60, |
| 622 | 60, 61, 62, 63, 64, 65, 65, 65, 65, 66, |
| 623 | 67, 68, 69, 70, 71, 71, 71, 71, 72, 73, |
| 624 | 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 625 | 78, 78, 78, 78, 78, 78, 78, 79, 79, 80, |
| 626 | 80 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 627 | }; |
| 628 | |
| 629 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 630 | static const yytype_uint8 yyr2[] = |
| 631 | { |
| 632 | 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, |
| 633 | 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, |
| 634 | 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, |
| 635 | 2, 0, 2, 2, 2, 2, 2, 2, 3, 4, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 636 | 4, 4, 5, 3, 0, 3, 0, 2, 3, 2, |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 637 | 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, |
| 638 | 2, 4, 0, 2, 3, 1, 3, 0, 2, 2, |
| 639 | 2, 3, 2, 1, 3, 0, 2, 2, 2, 3, |
| 640 | 3, 2, 2, 2, 0, 2, 2, 2, 4, 0, |
| 641 | 2, 1, 1, 2, 2, 2, 1, 2, 0, 2, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 642 | 1, 3, 3, 3, 2, 3, 3, 1, 1, 0, |
| 643 | 1 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 644 | }; |
| 645 | |
| 646 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 647 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 648 | means the default is an error. */ |
| 649 | static const yytype_uint8 yydefact[] = |
| 650 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 651 | 3, 0, 0, 1, 0, 0, 0, 0, 0, 109, |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 652 | 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, |
| 653 | 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, |
| 654 | 23, 52, 62, 5, 67, 20, 84, 75, 6, 24, |
| 655 | 84, 21, 8, 11, 91, 92, 0, 0, 93, 0, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 656 | 110, 0, 94, 0, 0, 0, 107, 108, 0, 0, |
| 657 | 0, 100, 95, 0, 0, 0, 0, 0, 0, 0, |
| 658 | 0, 0, 0, 96, 7, 71, 79, 48, 80, 27, |
| 659 | 29, 0, 104, 0, 0, 64, 0, 0, 9, 10, |
| 660 | 0, 0, 0, 0, 89, 0, 0, 0, 44, 0, |
| 661 | 37, 36, 32, 33, 0, 35, 34, 0, 0, 89, |
| 662 | 0, 56, 57, 53, 55, 54, 63, 51, 50, 68, |
| 663 | 70, 66, 69, 65, 86, 87, 85, 76, 78, 74, |
| 664 | 77, 73, 97, 103, 105, 106, 102, 101, 26, 82, |
| 665 | 0, 98, 0, 98, 98, 98, 0, 0, 0, 83, |
| 666 | 60, 98, 0, 98, 0, 0, 0, 38, 90, 0, |
| 667 | 0, 98, 46, 43, 25, 0, 59, 0, 88, 99, |
| 668 | 39, 40, 41, 0, 0, 45, 58, 61, 42, 47 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 669 | }; |
| 670 | |
| 671 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 672 | static const yytype_int16 yydefgoto[] = |
| 673 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 674 | -1, 1, 2, 25, 26, 101, 27, 28, 29, 30, |
| 675 | 65, 102, 103, 147, 175, 31, 32, 117, 33, 67, |
| 676 | 113, 68, 34, 121, 35, 69, 36, 37, 129, 38, |
| 677 | 71, 39, 40, 41, 104, 105, 70, 106, 142, 143, |
| 678 | 42, 74, 156, 60, 61, 51 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 679 | }; |
| 680 | |
| 681 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 682 | STATE-NUM. */ |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 683 | #define YYPACT_NINF -80 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 684 | static const yytype_int16 yypact[] = |
| 685 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 686 | -80, 2, 132, -80, -13, -1, -1, -2, -1, 9, |
| 687 | 33, -1, 27, 40, -3, 38, -80, -80, -80, -80, |
| 688 | -80, -80, -80, 71, -80, 77, -80, -80, -80, -80, |
| 689 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, |
| 690 | -80, -80, -80, -80, -80, -80, 57, 61, -80, 63, |
| 691 | -80, 76, -80, 87, 101, 133, -80, -80, -3, -3, |
| 692 | 195, -6, -80, 136, 149, 39, 104, 65, 150, 5, |
| 693 | 194, 5, 167, -80, 176, -80, -80, -80, -80, -80, |
| 694 | -80, 68, -80, -3, -3, 176, 72, 72, -80, -80, |
| 695 | 177, 187, 78, -1, -1, -3, 196, 72, -80, 222, |
| 696 | -80, -80, -80, -80, 221, -80, -80, 205, -1, -1, |
| 697 | 211, -80, -80, -80, -80, -80, -80, -80, -80, -80, |
| 698 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, |
| 699 | -80, -80, -80, -80, 206, -80, -80, -80, -80, -80, |
| 700 | -3, 223, 209, 223, 197, 223, 72, 7, 210, -80, |
| 701 | -80, 223, 212, 223, 201, -3, 213, -80, -80, 214, |
| 702 | 215, 223, 208, -80, -80, 216, -80, 217, -80, 113, |
| 703 | -80, -80, -80, 218, -1, -80, -80, -80, -80, -80 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 704 | }; |
| 705 | |
| 706 | /* YYPGOTO[NTERM-NUM]. */ |
| 707 | static const yytype_int16 yypgoto[] = |
| 708 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 709 | -80, -80, -80, -80, 122, -34, -80, -80, -80, -80, |
| 710 | 220, -80, -80, -80, -80, -80, -80, -80, 59, -80, |
| 711 | -80, -80, -80, -80, -80, -80, -80, -80, -80, 125, |
| 712 | -80, -80, -80, -80, -80, 183, 219, 22, 142, -5, |
| 713 | 147, 192, 69, -54, -79, -80 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 714 | }; |
| 715 | |
| 716 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 717 | positive, shift that token. If negative, reduce the rule which |
| 718 | number is the opposite. If zero, do what YYDEFACT says. |
| 719 | If YYTABLE_NINF, syntax error. */ |
| 720 | #define YYTABLE_NINF -82 |
| 721 | static const yytype_int16 yytable[] = |
| 722 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 723 | 46, 47, 3, 49, 81, 82, 53, 136, 137, 6, |
| 724 | 7, 8, 9, 10, 11, 12, 13, 43, 146, 14, |
| 725 | 15, 86, 56, 57, 44, 45, 58, 87, 48, 134, |
| 726 | 135, 59, 162, 112, 50, 24, 125, 163, 125, -28, |
| 727 | 90, 144, -28, -28, -28, -28, -28, -28, -28, -28, |
| 728 | -28, 91, 54, -28, -28, 92, -28, 93, 94, 95, |
| 729 | 96, 97, 98, 52, 99, 55, 90, 161, 62, 100, |
| 730 | -49, -49, 63, -49, -49, -49, -49, 91, 64, -49, |
| 731 | -49, 92, 107, 108, 109, 110, 154, 73, 141, 115, |
| 732 | 99, 75, 126, 76, 126, 111, 133, 56, 57, 83, |
| 733 | 84, 169, 140, 151, -30, 90, 77, -30, -30, -30, |
| 734 | -30, -30, -30, -30, -30, -30, 91, 78, -30, -30, |
| 735 | 92, -30, 93, 94, 95, 96, 97, 98, 120, 99, |
| 736 | 128, 79, -2, 4, 100, 5, 6, 7, 8, 9, |
| 737 | 10, 11, 12, 13, 83, 84, 14, 15, 16, 17, |
| 738 | 18, 19, 20, 21, 22, 7, 8, 23, 10, 11, |
| 739 | 12, 13, 24, 80, 14, 15, 88, -81, 90, 179, |
| 740 | -81, -81, -81, -81, -81, -81, -81, -81, -81, 89, |
| 741 | 24, -81, -81, 92, -81, -81, -81, -81, -81, -81, |
| 742 | 116, 119, 99, 127, 122, 90, 130, 124, -72, -72, |
| 743 | -72, -72, -72, -72, -72, -72, 132, 138, -72, -72, |
| 744 | 92, 155, 158, 159, 160, 118, 123, 139, 131, 99, |
| 745 | 165, 145, 167, 148, 124, 73, 83, 84, 83, 84, |
| 746 | 173, 168, 83, 84, 149, 150, 153, 155, 84, 157, |
| 747 | 164, 174, 166, 170, 171, 172, 176, 177, 178, 66, |
| 748 | 114, 152, 85, 0, 0, 0, 0, 0, 0, 72 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 749 | }; |
| 750 | |
| 751 | static const yytype_int16 yycheck[] = |
| 752 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 753 | 5, 6, 0, 8, 58, 59, 11, 86, 87, 4, |
| 754 | 5, 6, 7, 8, 9, 10, 11, 30, 97, 14, |
| 755 | 15, 27, 25, 26, 25, 26, 29, 33, 30, 83, |
| 756 | 84, 34, 25, 67, 25, 30, 70, 30, 72, 0, |
| 757 | 1, 95, 3, 4, 5, 6, 7, 8, 9, 10, |
| 758 | 11, 12, 25, 14, 15, 16, 17, 18, 19, 20, |
| 759 | 21, 22, 23, 30, 25, 25, 1, 146, 30, 30, |
| 760 | 5, 6, 1, 8, 9, 10, 11, 12, 1, 14, |
| 761 | 15, 16, 17, 18, 19, 20, 140, 30, 93, 67, |
| 762 | 25, 30, 70, 30, 72, 30, 28, 25, 26, 31, |
| 763 | 32, 155, 24, 108, 0, 1, 30, 3, 4, 5, |
| 764 | 6, 7, 8, 9, 10, 11, 12, 30, 14, 15, |
| 765 | 16, 17, 18, 19, 20, 21, 22, 23, 69, 25, |
| 766 | 71, 30, 0, 1, 30, 3, 4, 5, 6, 7, |
| 767 | 8, 9, 10, 11, 31, 32, 14, 15, 16, 17, |
| 768 | 18, 19, 20, 21, 22, 5, 6, 25, 8, 9, |
| 769 | 10, 11, 30, 30, 14, 15, 30, 0, 1, 174, |
| 770 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, |
| 771 | 30, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
| 772 | 68, 69, 25, 71, 69, 1, 71, 30, 4, 5, |
| 773 | 6, 7, 8, 9, 10, 11, 30, 30, 14, 15, |
| 774 | 16, 14, 143, 144, 145, 68, 69, 30, 71, 25, |
| 775 | 151, 25, 153, 1, 30, 30, 31, 32, 31, 32, |
| 776 | 161, 30, 31, 32, 13, 30, 25, 14, 32, 30, |
| 777 | 30, 33, 30, 30, 30, 30, 30, 30, 30, 29, |
| 778 | 67, 109, 60, -1, -1, -1, -1, -1, -1, 40 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 779 | }; |
| 780 | |
| 781 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 782 | symbol of state STATE-NUM. */ |
| 783 | static const yytype_uint8 yystos[] = |
| 784 | { |
| 785 | 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, |
| 786 | 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, |
| 787 | 20, 21, 22, 25, 30, 38, 39, 41, 42, 43, |
| 788 | 44, 50, 51, 53, 57, 59, 61, 62, 64, 66, |
| 789 | 67, 68, 75, 30, 25, 26, 74, 74, 30, 74, |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 790 | 25, 80, 30, 74, 25, 25, 25, 26, 29, 34, |
| 791 | 78, 79, 30, 1, 1, 45, 45, 54, 56, 60, |
| 792 | 71, 65, 71, 30, 76, 30, 30, 30, 30, 30, |
| 793 | 30, 78, 78, 31, 32, 76, 27, 33, 30, 30, |
| 794 | 1, 12, 16, 18, 19, 20, 21, 22, 23, 25, |
| 795 | 30, 40, 46, 47, 69, 70, 72, 17, 18, 19, |
| 796 | 20, 30, 40, 55, 70, 72, 39, 52, 75, 39, |
| 797 | 53, 58, 64, 75, 30, 40, 72, 39, 53, 63, |
| 798 | 64, 75, 30, 28, 78, 78, 79, 79, 30, 30, |
| 799 | 24, 74, 73, 74, 78, 25, 79, 48, 1, 13, |
| 800 | 30, 74, 73, 25, 78, 14, 77, 30, 77, 77, |
| 801 | 77, 79, 25, 30, 30, 77, 30, 77, 30, 78, |
| 802 | 30, 30, 30, 77, 33, 49, 30, 30, 30, 74 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 803 | }; |
| 804 | |
| 805 | #define yyerrok (yyerrstatus = 0) |
| 806 | #define yyclearin (yychar = YYEMPTY) |
| 807 | #define YYEMPTY (-2) |
| 808 | #define YYEOF 0 |
| 809 | |
| 810 | #define YYACCEPT goto yyacceptlab |
| 811 | #define YYABORT goto yyabortlab |
| 812 | #define YYERROR goto yyerrorlab |
| 813 | |
| 814 | |
| 815 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 816 | to ease the transition to the new meaning of YYERROR, for GCC. |
| 817 | Once GCC version 2 has supplanted version 1, this can go. */ |
| 818 | |
| 819 | #define YYFAIL goto yyerrlab |
| 820 | |
| 821 | #define YYRECOVERING() (!!yyerrstatus) |
| 822 | |
| 823 | #define YYBACKUP(Token, Value) \ |
| 824 | do \ |
| 825 | if (yychar == YYEMPTY && yylen == 1) \ |
| 826 | { \ |
| 827 | yychar = (Token); \ |
| 828 | yylval = (Value); \ |
| 829 | yytoken = YYTRANSLATE (yychar); \ |
| 830 | YYPOPSTACK (1); \ |
| 831 | goto yybackup; \ |
| 832 | } \ |
| 833 | else \ |
| 834 | { \ |
| 835 | yyerror (YY_("syntax error: cannot back up")); \ |
| 836 | YYERROR; \ |
| 837 | } \ |
| 838 | while (YYID (0)) |
| 839 | |
| 840 | |
| 841 | #define YYTERROR 1 |
| 842 | #define YYERRCODE 256 |
| 843 | |
| 844 | |
| 845 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 846 | If N is 0, then set CURRENT to the empty location which ends |
| 847 | the previous symbol: RHS[0] (always defined). */ |
| 848 | |
| 849 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 850 | #ifndef YYLLOC_DEFAULT |
| 851 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 852 | do \ |
| 853 | if (YYID (N)) \ |
| 854 | { \ |
| 855 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 856 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 857 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 858 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 859 | } \ |
| 860 | else \ |
| 861 | { \ |
| 862 | (Current).first_line = (Current).last_line = \ |
| 863 | YYRHSLOC (Rhs, 0).last_line; \ |
| 864 | (Current).first_column = (Current).last_column = \ |
| 865 | YYRHSLOC (Rhs, 0).last_column; \ |
| 866 | } \ |
| 867 | while (YYID (0)) |
| 868 | #endif |
| 869 | |
| 870 | |
| 871 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 872 | This macro was not mandated originally: define only if we know |
| 873 | we won't break user code: when these are the locations we know. */ |
| 874 | |
| 875 | #ifndef YY_LOCATION_PRINT |
| 876 | # if YYLTYPE_IS_TRIVIAL |
| 877 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 878 | fprintf (File, "%d.%d-%d.%d", \ |
| 879 | (Loc).first_line, (Loc).first_column, \ |
| 880 | (Loc).last_line, (Loc).last_column) |
| 881 | # else |
| 882 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 883 | # endif |
| 884 | #endif |
| 885 | |
| 886 | |
| 887 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 888 | |
| 889 | #ifdef YYLEX_PARAM |
| 890 | # define YYLEX yylex (YYLEX_PARAM) |
| 891 | #else |
| 892 | # define YYLEX yylex () |
| 893 | #endif |
| 894 | |
| 895 | /* Enable debugging if requested. */ |
| 896 | #if YYDEBUG |
| 897 | |
| 898 | # ifndef YYFPRINTF |
| 899 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 900 | # define YYFPRINTF fprintf |
| 901 | # endif |
| 902 | |
| 903 | # define YYDPRINTF(Args) \ |
| 904 | do { \ |
| 905 | if (yydebug) \ |
| 906 | YYFPRINTF Args; \ |
| 907 | } while (YYID (0)) |
| 908 | |
| 909 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 910 | do { \ |
| 911 | if (yydebug) \ |
| 912 | { \ |
| 913 | YYFPRINTF (stderr, "%s ", Title); \ |
| 914 | yy_symbol_print (stderr, \ |
| 915 | Type, Value); \ |
| 916 | YYFPRINTF (stderr, "\n"); \ |
| 917 | } \ |
| 918 | } while (YYID (0)) |
| 919 | |
| 920 | |
| 921 | /*--------------------------------. |
| 922 | | Print this symbol on YYOUTPUT. | |
| 923 | `--------------------------------*/ |
| 924 | |
| 925 | /*ARGSUSED*/ |
| 926 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 927 | || defined __cplusplus || defined _MSC_VER) |
| 928 | static void |
| 929 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 930 | #else |
| 931 | static void |
| 932 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 933 | FILE *yyoutput; |
| 934 | int yytype; |
| 935 | YYSTYPE const * const yyvaluep; |
| 936 | #endif |
| 937 | { |
| 938 | if (!yyvaluep) |
| 939 | return; |
| 940 | # ifdef YYPRINT |
| 941 | if (yytype < YYNTOKENS) |
| 942 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 943 | # else |
| 944 | YYUSE (yyoutput); |
| 945 | # endif |
| 946 | switch (yytype) |
| 947 | { |
| 948 | default: |
| 949 | break; |
| 950 | } |
| 951 | } |
| 952 | |
| 953 | |
| 954 | /*--------------------------------. |
| 955 | | Print this symbol on YYOUTPUT. | |
| 956 | `--------------------------------*/ |
| 957 | |
| 958 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 959 | || defined __cplusplus || defined _MSC_VER) |
| 960 | static void |
| 961 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 962 | #else |
| 963 | static void |
| 964 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 965 | FILE *yyoutput; |
| 966 | int yytype; |
| 967 | YYSTYPE const * const yyvaluep; |
| 968 | #endif |
| 969 | { |
| 970 | if (yytype < YYNTOKENS) |
| 971 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 972 | else |
| 973 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 974 | |
| 975 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 976 | YYFPRINTF (yyoutput, ")"); |
| 977 | } |
| 978 | |
| 979 | /*------------------------------------------------------------------. |
| 980 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 981 | | TOP (included). | |
| 982 | `------------------------------------------------------------------*/ |
| 983 | |
| 984 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 985 | || defined __cplusplus || defined _MSC_VER) |
| 986 | static void |
| 987 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 988 | #else |
| 989 | static void |
| 990 | yy_stack_print (bottom, top) |
| 991 | yytype_int16 *bottom; |
| 992 | yytype_int16 *top; |
| 993 | #endif |
| 994 | { |
| 995 | YYFPRINTF (stderr, "Stack now"); |
| 996 | for (; bottom <= top; ++bottom) |
| 997 | YYFPRINTF (stderr, " %d", *bottom); |
| 998 | YYFPRINTF (stderr, "\n"); |
| 999 | } |
| 1000 | |
| 1001 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 1002 | do { \ |
| 1003 | if (yydebug) \ |
| 1004 | yy_stack_print ((Bottom), (Top)); \ |
| 1005 | } while (YYID (0)) |
| 1006 | |
| 1007 | |
| 1008 | /*------------------------------------------------. |
| 1009 | | Report that the YYRULE is going to be reduced. | |
| 1010 | `------------------------------------------------*/ |
| 1011 | |
| 1012 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1013 | || defined __cplusplus || defined _MSC_VER) |
| 1014 | static void |
| 1015 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 1016 | #else |
| 1017 | static void |
| 1018 | yy_reduce_print (yyvsp, yyrule) |
| 1019 | YYSTYPE *yyvsp; |
| 1020 | int yyrule; |
| 1021 | #endif |
| 1022 | { |
| 1023 | int yynrhs = yyr2[yyrule]; |
| 1024 | int yyi; |
| 1025 | unsigned long int yylno = yyrline[yyrule]; |
| 1026 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 1027 | yyrule - 1, yylno); |
| 1028 | /* The symbols being reduced. */ |
| 1029 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 1030 | { |
| 1031 | fprintf (stderr, " $%d = ", yyi + 1); |
| 1032 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 1033 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 1034 | ); |
| 1035 | fprintf (stderr, "\n"); |
| 1036 | } |
| 1037 | } |
| 1038 | |
| 1039 | # define YY_REDUCE_PRINT(Rule) \ |
| 1040 | do { \ |
| 1041 | if (yydebug) \ |
| 1042 | yy_reduce_print (yyvsp, Rule); \ |
| 1043 | } while (YYID (0)) |
| 1044 | |
| 1045 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 1046 | multiple parsers can coexist. */ |
| 1047 | int yydebug; |
| 1048 | #else /* !YYDEBUG */ |
| 1049 | # define YYDPRINTF(Args) |
| 1050 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 1051 | # define YY_STACK_PRINT(Bottom, Top) |
| 1052 | # define YY_REDUCE_PRINT(Rule) |
| 1053 | #endif /* !YYDEBUG */ |
| 1054 | |
| 1055 | |
| 1056 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 1057 | #ifndef YYINITDEPTH |
| 1058 | # define YYINITDEPTH 200 |
| 1059 | #endif |
| 1060 | |
| 1061 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 1062 | if the built-in stack extension method is used). |
| 1063 | |
| 1064 | Do not make this value too large; the results are undefined if |
| 1065 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 1066 | evaluated with infinite-precision integer arithmetic. */ |
| 1067 | |
| 1068 | #ifndef YYMAXDEPTH |
| 1069 | # define YYMAXDEPTH 10000 |
| 1070 | #endif |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | #if YYERROR_VERBOSE |
| 1075 | |
| 1076 | # ifndef yystrlen |
| 1077 | # if defined __GLIBC__ && defined _STRING_H |
| 1078 | # define yystrlen strlen |
| 1079 | # else |
| 1080 | /* Return the length of YYSTR. */ |
| 1081 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1082 | || defined __cplusplus || defined _MSC_VER) |
| 1083 | static YYSIZE_T |
| 1084 | yystrlen (const char *yystr) |
| 1085 | #else |
| 1086 | static YYSIZE_T |
| 1087 | yystrlen (yystr) |
| 1088 | const char *yystr; |
| 1089 | #endif |
| 1090 | { |
| 1091 | YYSIZE_T yylen; |
| 1092 | for (yylen = 0; yystr[yylen]; yylen++) |
| 1093 | continue; |
| 1094 | return yylen; |
| 1095 | } |
| 1096 | # endif |
| 1097 | # endif |
| 1098 | |
| 1099 | # ifndef yystpcpy |
| 1100 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 1101 | # define yystpcpy stpcpy |
| 1102 | # else |
| 1103 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 1104 | YYDEST. */ |
| 1105 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1106 | || defined __cplusplus || defined _MSC_VER) |
| 1107 | static char * |
| 1108 | yystpcpy (char *yydest, const char *yysrc) |
| 1109 | #else |
| 1110 | static char * |
| 1111 | yystpcpy (yydest, yysrc) |
| 1112 | char *yydest; |
| 1113 | const char *yysrc; |
| 1114 | #endif |
| 1115 | { |
| 1116 | char *yyd = yydest; |
| 1117 | const char *yys = yysrc; |
| 1118 | |
| 1119 | while ((*yyd++ = *yys++) != '\0') |
| 1120 | continue; |
| 1121 | |
| 1122 | return yyd - 1; |
| 1123 | } |
| 1124 | # endif |
| 1125 | # endif |
| 1126 | |
| 1127 | # ifndef yytnamerr |
| 1128 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 1129 | quotes and backslashes, so that it's suitable for yyerror. The |
| 1130 | heuristic is that double-quoting is unnecessary unless the string |
| 1131 | contains an apostrophe, a comma, or backslash (other than |
| 1132 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 1133 | null, do not copy; instead, return the length of what the result |
| 1134 | would have been. */ |
| 1135 | static YYSIZE_T |
| 1136 | yytnamerr (char *yyres, const char *yystr) |
| 1137 | { |
| 1138 | if (*yystr == '"') |
| 1139 | { |
| 1140 | YYSIZE_T yyn = 0; |
| 1141 | char const *yyp = yystr; |
| 1142 | |
| 1143 | for (;;) |
| 1144 | switch (*++yyp) |
| 1145 | { |
| 1146 | case '\'': |
| 1147 | case ',': |
| 1148 | goto do_not_strip_quotes; |
| 1149 | |
| 1150 | case '\\': |
| 1151 | if (*++yyp != '\\') |
| 1152 | goto do_not_strip_quotes; |
| 1153 | /* Fall through. */ |
| 1154 | default: |
| 1155 | if (yyres) |
| 1156 | yyres[yyn] = *yyp; |
| 1157 | yyn++; |
| 1158 | break; |
| 1159 | |
| 1160 | case '"': |
| 1161 | if (yyres) |
| 1162 | yyres[yyn] = '\0'; |
| 1163 | return yyn; |
| 1164 | } |
| 1165 | do_not_strip_quotes: ; |
| 1166 | } |
| 1167 | |
| 1168 | if (! yyres) |
| 1169 | return yystrlen (yystr); |
| 1170 | |
| 1171 | return yystpcpy (yyres, yystr) - yyres; |
| 1172 | } |
| 1173 | # endif |
| 1174 | |
| 1175 | /* Copy into YYRESULT an error message about the unexpected token |
| 1176 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 1177 | including the terminating null byte. If YYRESULT is null, do not |
| 1178 | copy anything; just return the number of bytes that would be |
| 1179 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 1180 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 1181 | size calculation. */ |
| 1182 | static YYSIZE_T |
| 1183 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 1184 | { |
| 1185 | int yyn = yypact[yystate]; |
| 1186 | |
| 1187 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 1188 | return 0; |
| 1189 | else |
| 1190 | { |
| 1191 | int yytype = YYTRANSLATE (yychar); |
| 1192 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 1193 | YYSIZE_T yysize = yysize0; |
| 1194 | YYSIZE_T yysize1; |
| 1195 | int yysize_overflow = 0; |
| 1196 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 1197 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 1198 | int yyx; |
| 1199 | |
| 1200 | # if 0 |
| 1201 | /* This is so xgettext sees the translatable formats that are |
| 1202 | constructed on the fly. */ |
| 1203 | YY_("syntax error, unexpected %s"); |
| 1204 | YY_("syntax error, unexpected %s, expecting %s"); |
| 1205 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 1206 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 1207 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 1208 | # endif |
| 1209 | char *yyfmt; |
| 1210 | char const *yyf; |
| 1211 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 1212 | static char const yyexpecting[] = ", expecting %s"; |
| 1213 | static char const yyor[] = " or %s"; |
| 1214 | char yyformat[sizeof yyunexpected |
| 1215 | + sizeof yyexpecting - 1 |
| 1216 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 1217 | * (sizeof yyor - 1))]; |
| 1218 | char const *yyprefix = yyexpecting; |
| 1219 | |
| 1220 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 1221 | YYCHECK. */ |
| 1222 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 1223 | |
| 1224 | /* Stay within bounds of both yycheck and yytname. */ |
| 1225 | int yychecklim = YYLAST - yyn + 1; |
| 1226 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 1227 | int yycount = 1; |
| 1228 | |
| 1229 | yyarg[0] = yytname[yytype]; |
| 1230 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 1231 | |
| 1232 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 1233 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1234 | { |
| 1235 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 1236 | { |
| 1237 | yycount = 1; |
| 1238 | yysize = yysize0; |
| 1239 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 1240 | break; |
| 1241 | } |
| 1242 | yyarg[yycount++] = yytname[yyx]; |
| 1243 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 1244 | yysize_overflow |= (yysize1 < yysize); |
| 1245 | yysize = yysize1; |
| 1246 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 1247 | yyprefix = yyor; |
| 1248 | } |
| 1249 | |
| 1250 | yyf = YY_(yyformat); |
| 1251 | yysize1 = yysize + yystrlen (yyf); |
| 1252 | yysize_overflow |= (yysize1 < yysize); |
| 1253 | yysize = yysize1; |
| 1254 | |
| 1255 | if (yysize_overflow) |
| 1256 | return YYSIZE_MAXIMUM; |
| 1257 | |
| 1258 | if (yyresult) |
| 1259 | { |
| 1260 | /* Avoid sprintf, as that infringes on the user's name space. |
| 1261 | Don't have undefined behavior even if the translation |
| 1262 | produced a string with the wrong number of "%s"s. */ |
| 1263 | char *yyp = yyresult; |
| 1264 | int yyi = 0; |
| 1265 | while ((*yyp = *yyf) != '\0') |
| 1266 | { |
| 1267 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 1268 | { |
| 1269 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 1270 | yyf += 2; |
| 1271 | } |
| 1272 | else |
| 1273 | { |
| 1274 | yyp++; |
| 1275 | yyf++; |
| 1276 | } |
| 1277 | } |
| 1278 | } |
| 1279 | return yysize; |
| 1280 | } |
| 1281 | } |
| 1282 | #endif /* YYERROR_VERBOSE */ |
| 1283 | |
| 1284 | |
| 1285 | /*-----------------------------------------------. |
| 1286 | | Release the memory associated to this symbol. | |
| 1287 | `-----------------------------------------------*/ |
| 1288 | |
| 1289 | /*ARGSUSED*/ |
| 1290 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1291 | || defined __cplusplus || defined _MSC_VER) |
| 1292 | static void |
| 1293 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 1294 | #else |
| 1295 | static void |
| 1296 | yydestruct (yymsg, yytype, yyvaluep) |
| 1297 | const char *yymsg; |
| 1298 | int yytype; |
| 1299 | YYSTYPE *yyvaluep; |
| 1300 | #endif |
| 1301 | { |
| 1302 | YYUSE (yyvaluep); |
| 1303 | |
| 1304 | if (!yymsg) |
| 1305 | yymsg = "Deleting"; |
| 1306 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 1307 | |
| 1308 | switch (yytype) |
| 1309 | { |
| 1310 | case 51: /* "choice_entry" */ |
| 1311 | |
| 1312 | { |
| 1313 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 1314 | (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); |
| 1315 | if (current_menu == (yyvaluep->menu)) |
| 1316 | menu_end_menu(); |
| 1317 | }; |
| 1318 | |
| 1319 | break; |
| 1320 | case 57: /* "if_entry" */ |
| 1321 | |
| 1322 | { |
| 1323 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 1324 | (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); |
| 1325 | if (current_menu == (yyvaluep->menu)) |
| 1326 | menu_end_menu(); |
| 1327 | }; |
| 1328 | |
| 1329 | break; |
| 1330 | case 62: /* "menu_entry" */ |
| 1331 | |
| 1332 | { |
| 1333 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 1334 | (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); |
| 1335 | if (current_menu == (yyvaluep->menu)) |
| 1336 | menu_end_menu(); |
| 1337 | }; |
| 1338 | |
| 1339 | break; |
| 1340 | |
| 1341 | default: |
| 1342 | break; |
| 1343 | } |
| 1344 | } |
| 1345 | |
| 1346 | |
| 1347 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 1348 | |
| 1349 | #ifdef YYPARSE_PARAM |
| 1350 | #if defined __STDC__ || defined __cplusplus |
| 1351 | int yyparse (void *YYPARSE_PARAM); |
| 1352 | #else |
| 1353 | int yyparse (); |
| 1354 | #endif |
| 1355 | #else /* ! YYPARSE_PARAM */ |
| 1356 | #if defined __STDC__ || defined __cplusplus |
| 1357 | int yyparse (void); |
| 1358 | #else |
| 1359 | int yyparse (); |
| 1360 | #endif |
| 1361 | #endif /* ! YYPARSE_PARAM */ |
| 1362 | |
| 1363 | |
| 1364 | |
| 1365 | /* The look-ahead symbol. */ |
| 1366 | int yychar; |
| 1367 | |
| 1368 | /* The semantic value of the look-ahead symbol. */ |
| 1369 | YYSTYPE yylval; |
| 1370 | |
| 1371 | /* Number of syntax errors so far. */ |
| 1372 | int yynerrs; |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 | /*----------. |
| 1377 | | yyparse. | |
| 1378 | `----------*/ |
| 1379 | |
| 1380 | #ifdef YYPARSE_PARAM |
| 1381 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1382 | || defined __cplusplus || defined _MSC_VER) |
| 1383 | int |
| 1384 | yyparse (void *YYPARSE_PARAM) |
| 1385 | #else |
| 1386 | int |
| 1387 | yyparse (YYPARSE_PARAM) |
| 1388 | void *YYPARSE_PARAM; |
| 1389 | #endif |
| 1390 | #else /* ! YYPARSE_PARAM */ |
| 1391 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1392 | || defined __cplusplus || defined _MSC_VER) |
| 1393 | int |
| 1394 | yyparse (void) |
| 1395 | #else |
| 1396 | int |
| 1397 | yyparse () |
| 1398 | |
| 1399 | #endif |
| 1400 | #endif |
| 1401 | { |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 1402 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 1403 | int yystate; |
| 1404 | int yyn; |
| 1405 | int yyresult; |
| 1406 | /* Number of tokens to shift before error messages enabled. */ |
| 1407 | int yyerrstatus; |
| 1408 | /* Look-ahead token as an internal (translated) token number. */ |
| 1409 | int yytoken = 0; |
| 1410 | #if YYERROR_VERBOSE |
| 1411 | /* Buffer for error messages, and its allocated size. */ |
| 1412 | char yymsgbuf[128]; |
| 1413 | char *yymsg = yymsgbuf; |
| 1414 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
| 1415 | #endif |
| 1416 | |
| 1417 | /* Three stacks and their tools: |
| 1418 | `yyss': related to states, |
| 1419 | `yyvs': related to semantic values, |
| 1420 | `yyls': related to locations. |
| 1421 | |
| 1422 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 1423 | to reallocate them elsewhere. */ |
| 1424 | |
| 1425 | /* The state stack. */ |
| 1426 | yytype_int16 yyssa[YYINITDEPTH]; |
| 1427 | yytype_int16 *yyss = yyssa; |
| 1428 | yytype_int16 *yyssp; |
| 1429 | |
| 1430 | /* The semantic value stack. */ |
| 1431 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 1432 | YYSTYPE *yyvs = yyvsa; |
| 1433 | YYSTYPE *yyvsp; |
| 1434 | |
| 1435 | |
| 1436 | |
| 1437 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1438 | |
| 1439 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 1440 | |
| 1441 | /* The variables used to return semantic value and location from the |
| 1442 | action routines. */ |
| 1443 | YYSTYPE yyval; |
| 1444 | |
| 1445 | |
| 1446 | /* The number of symbols on the RHS of the reduced rule. |
| 1447 | Keep to zero when no symbol should be popped. */ |
| 1448 | int yylen = 0; |
| 1449 | |
| 1450 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 1451 | |
| 1452 | yystate = 0; |
| 1453 | yyerrstatus = 0; |
| 1454 | yynerrs = 0; |
| 1455 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1456 | |
| 1457 | /* Initialize stack pointers. |
| 1458 | Waste one element of value and location stack |
| 1459 | so that they stay on the same level as the state stack. |
| 1460 | The wasted elements are never initialized. */ |
| 1461 | |
| 1462 | yyssp = yyss; |
| 1463 | yyvsp = yyvs; |
| 1464 | |
| 1465 | goto yysetstate; |
| 1466 | |
| 1467 | /*------------------------------------------------------------. |
| 1468 | | yynewstate -- Push a new state, which is found in yystate. | |
| 1469 | `------------------------------------------------------------*/ |
| 1470 | yynewstate: |
| 1471 | /* In all cases, when you get here, the value and location stacks |
| 1472 | have just been pushed. So pushing a state here evens the stacks. */ |
| 1473 | yyssp++; |
| 1474 | |
| 1475 | yysetstate: |
| 1476 | *yyssp = yystate; |
| 1477 | |
| 1478 | if (yyss + yystacksize - 1 <= yyssp) |
| 1479 | { |
| 1480 | /* Get the current used size of the three stacks, in elements. */ |
| 1481 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 1482 | |
| 1483 | #ifdef yyoverflow |
| 1484 | { |
| 1485 | /* Give user a chance to reallocate the stack. Use copies of |
| 1486 | these so that the &'s don't force the real ones into |
| 1487 | memory. */ |
| 1488 | YYSTYPE *yyvs1 = yyvs; |
| 1489 | yytype_int16 *yyss1 = yyss; |
| 1490 | |
| 1491 | |
| 1492 | /* Each stack pointer address is followed by the size of the |
| 1493 | data in use in that stack, in bytes. This used to be a |
| 1494 | conditional around just the two extra args, but that might |
| 1495 | be undefined if yyoverflow is a macro. */ |
| 1496 | yyoverflow (YY_("memory exhausted"), |
| 1497 | &yyss1, yysize * sizeof (*yyssp), |
| 1498 | &yyvs1, yysize * sizeof (*yyvsp), |
| 1499 | |
| 1500 | &yystacksize); |
| 1501 | |
| 1502 | yyss = yyss1; |
| 1503 | yyvs = yyvs1; |
| 1504 | } |
| 1505 | #else /* no yyoverflow */ |
| 1506 | # ifndef YYSTACK_RELOCATE |
| 1507 | goto yyexhaustedlab; |
| 1508 | # else |
| 1509 | /* Extend the stack our own way. */ |
| 1510 | if (YYMAXDEPTH <= yystacksize) |
| 1511 | goto yyexhaustedlab; |
| 1512 | yystacksize *= 2; |
| 1513 | if (YYMAXDEPTH < yystacksize) |
| 1514 | yystacksize = YYMAXDEPTH; |
| 1515 | |
| 1516 | { |
| 1517 | yytype_int16 *yyss1 = yyss; |
| 1518 | union yyalloc *yyptr = |
| 1519 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1520 | if (! yyptr) |
| 1521 | goto yyexhaustedlab; |
| 1522 | YYSTACK_RELOCATE (yyss); |
| 1523 | YYSTACK_RELOCATE (yyvs); |
| 1524 | |
| 1525 | # 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 | |
| 1535 | |
| 1536 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1537 | (unsigned long int) yystacksize)); |
| 1538 | |
| 1539 | if (yyss + yystacksize - 1 <= yyssp) |
| 1540 | YYABORT; |
| 1541 | } |
| 1542 | |
| 1543 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1544 | |
| 1545 | goto yybackup; |
| 1546 | |
| 1547 | /*-----------. |
| 1548 | | yybackup. | |
| 1549 | `-----------*/ |
| 1550 | yybackup: |
| 1551 | |
| 1552 | /* Do appropriate processing given the current state. Read a |
| 1553 | look-ahead token if we need one and don't already have one. */ |
| 1554 | |
| 1555 | /* First try to decide what to do without reference to look-ahead token. */ |
| 1556 | yyn = yypact[yystate]; |
| 1557 | if (yyn == YYPACT_NINF) |
| 1558 | goto yydefault; |
| 1559 | |
| 1560 | /* Not known => get a look-ahead token if don't already have one. */ |
| 1561 | |
| 1562 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
| 1563 | if (yychar == YYEMPTY) |
| 1564 | { |
| 1565 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 1566 | yychar = YYLEX; |
| 1567 | } |
| 1568 | |
| 1569 | if (yychar <= YYEOF) |
| 1570 | { |
| 1571 | yychar = yytoken = YYEOF; |
| 1572 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1573 | } |
| 1574 | else |
| 1575 | { |
| 1576 | yytoken = YYTRANSLATE (yychar); |
| 1577 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 1578 | } |
| 1579 | |
| 1580 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1581 | detect an error, take that action. */ |
| 1582 | yyn += yytoken; |
| 1583 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1584 | goto yydefault; |
| 1585 | yyn = yytable[yyn]; |
| 1586 | if (yyn <= 0) |
| 1587 | { |
| 1588 | if (yyn == 0 || yyn == YYTABLE_NINF) |
| 1589 | goto yyerrlab; |
| 1590 | yyn = -yyn; |
| 1591 | goto yyreduce; |
| 1592 | } |
| 1593 | |
| 1594 | if (yyn == YYFINAL) |
| 1595 | YYACCEPT; |
| 1596 | |
| 1597 | /* Count tokens shifted since error; after three, turn off error |
| 1598 | status. */ |
| 1599 | if (yyerrstatus) |
| 1600 | yyerrstatus--; |
| 1601 | |
| 1602 | /* Shift the look-ahead token. */ |
| 1603 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 1604 | |
| 1605 | /* Discard the shifted token unless it is eof. */ |
| 1606 | if (yychar != YYEOF) |
| 1607 | yychar = YYEMPTY; |
| 1608 | |
| 1609 | yystate = yyn; |
| 1610 | *++yyvsp = yylval; |
| 1611 | |
| 1612 | goto yynewstate; |
| 1613 | |
| 1614 | |
| 1615 | /*-----------------------------------------------------------. |
| 1616 | | yydefault -- do the default action for the current state. | |
| 1617 | `-----------------------------------------------------------*/ |
| 1618 | yydefault: |
| 1619 | yyn = yydefact[yystate]; |
| 1620 | if (yyn == 0) |
| 1621 | goto yyerrlab; |
| 1622 | goto yyreduce; |
| 1623 | |
| 1624 | |
| 1625 | /*-----------------------------. |
| 1626 | | yyreduce -- Do a reduction. | |
| 1627 | `-----------------------------*/ |
| 1628 | yyreduce: |
| 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 | { |
| 1646 | case 8: |
| 1647 | |
| 1648 | { zconf_error("unexpected end statement"); ;} |
| 1649 | break; |
| 1650 | |
| 1651 | case 9: |
| 1652 | |
| 1653 | { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} |
| 1654 | break; |
| 1655 | |
| 1656 | case 10: |
| 1657 | |
| 1658 | { |
| 1659 | zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); |
| 1660 | ;} |
| 1661 | break; |
| 1662 | |
| 1663 | case 11: |
| 1664 | |
| 1665 | { zconf_error("invalid statement"); ;} |
| 1666 | break; |
| 1667 | |
| 1668 | case 25: |
| 1669 | |
| 1670 | { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} |
| 1671 | break; |
| 1672 | |
| 1673 | case 26: |
| 1674 | |
| 1675 | { zconf_error("invalid option"); ;} |
| 1676 | break; |
| 1677 | |
| 1678 | case 27: |
| 1679 | |
| 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)); |
| 1685 | ;} |
| 1686 | break; |
| 1687 | |
| 1688 | case 28: |
| 1689 | |
| 1690 | { |
| 1691 | menu_end_entry(); |
| 1692 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); |
| 1693 | ;} |
| 1694 | break; |
| 1695 | |
| 1696 | case 29: |
| 1697 | |
| 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)); |
| 1703 | ;} |
| 1704 | break; |
| 1705 | |
| 1706 | case 30: |
| 1707 | |
| 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()); |
| 1715 | ;} |
| 1716 | break; |
| 1717 | |
| 1718 | case 38: |
| 1719 | |
| 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); |
| 1725 | ;} |
| 1726 | break; |
| 1727 | |
| 1728 | case 39: |
| 1729 | |
| 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()); |
| 1733 | ;} |
| 1734 | break; |
| 1735 | |
| 1736 | case 40: |
| 1737 | |
| 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); |
| 1745 | ;} |
| 1746 | break; |
| 1747 | |
| 1748 | case 41: |
| 1749 | |
| 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()); |
| 1753 | ;} |
| 1754 | break; |
| 1755 | |
| 1756 | case 42: |
| 1757 | |
| 1758 | { |
| 1759 | 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 45: |
| 1765 | |
| 1766 | { |
| 1767 | struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); |
| 1768 | 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)); |
| 1773 | ;} |
| 1774 | break; |
| 1775 | |
| 1776 | case 46: |
| 1777 | |
| 1778 | { (yyval.string) = NULL; ;} |
| 1779 | break; |
| 1780 | |
| 1781 | case 47: |
| 1782 | |
| 1783 | { (yyval.string) = (yyvsp[(2) - (2)].string); ;} |
| 1784 | break; |
| 1785 | |
| 1786 | case 48: |
| 1787 | |
| 1788 | { |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 1789 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); |
| 1790 | sym->flags |= SYMBOL_AUTO; |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 1791 | menu_add_entry(sym); |
| 1792 | menu_add_expr(P_CHOICE, NULL, NULL); |
| 1793 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); |
| 1794 | ;} |
| 1795 | break; |
| 1796 | |
| 1797 | case 49: |
| 1798 | |
| 1799 | { |
| 1800 | (yyval.menu) = menu_add_menu(); |
| 1801 | ;} |
| 1802 | break; |
| 1803 | |
| 1804 | case 50: |
| 1805 | |
| 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 | } |
| 1811 | ;} |
| 1812 | break; |
| 1813 | |
| 1814 | case 58: |
| 1815 | |
| 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()); |
| 1819 | ;} |
| 1820 | break; |
| 1821 | |
| 1822 | case 59: |
| 1823 | |
| 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; |
| 1832 | ;} |
| 1833 | break; |
| 1834 | |
| 1835 | case 60: |
| 1836 | |
| 1837 | { |
| 1838 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
| 1839 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); |
| 1840 | ;} |
| 1841 | break; |
| 1842 | |
| 1843 | case 61: |
| 1844 | |
| 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; |
| 1852 | ;} |
| 1853 | break; |
| 1854 | |
| 1855 | case 64: |
| 1856 | |
| 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(); |
| 1862 | ;} |
| 1863 | break; |
| 1864 | |
| 1865 | case 65: |
| 1866 | |
| 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 | } |
| 1872 | ;} |
| 1873 | break; |
| 1874 | |
| 1875 | case 71: |
| 1876 | |
| 1877 | { |
| 1878 | menu_add_entry(NULL); |
| 1879 | menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); |
| 1880 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); |
| 1881 | ;} |
| 1882 | break; |
| 1883 | |
| 1884 | case 72: |
| 1885 | |
| 1886 | { |
| 1887 | (yyval.menu) = menu_add_menu(); |
| 1888 | ;} |
| 1889 | break; |
| 1890 | |
| 1891 | case 73: |
| 1892 | |
| 1893 | { |
| 1894 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { |
| 1895 | menu_end_menu(); |
| 1896 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); |
| 1897 | } |
| 1898 | ;} |
| 1899 | break; |
| 1900 | |
| 1901 | case 79: |
| 1902 | |
| 1903 | { |
| 1904 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); |
| 1905 | zconf_nextfile((yyvsp[(2) - (3)].string)); |
| 1906 | ;} |
| 1907 | break; |
| 1908 | |
| 1909 | case 80: |
| 1910 | |
| 1911 | { |
| 1912 | menu_add_entry(NULL); |
| 1913 | menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL); |
| 1914 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); |
| 1915 | ;} |
| 1916 | break; |
| 1917 | |
| 1918 | case 81: |
| 1919 | |
| 1920 | { |
| 1921 | menu_end_entry(); |
| 1922 | ;} |
| 1923 | break; |
| 1924 | |
| 1925 | case 82: |
| 1926 | |
| 1927 | { |
| 1928 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); |
| 1929 | zconf_starthelp(); |
| 1930 | ;} |
| 1931 | break; |
| 1932 | |
| 1933 | case 83: |
| 1934 | |
| 1935 | { |
| 1936 | current_entry->help = (yyvsp[(2) - (2)].string); |
| 1937 | ;} |
| 1938 | break; |
| 1939 | |
| 1940 | case 88: |
| 1941 | |
| 1942 | { |
| 1943 | menu_add_dep((yyvsp[(3) - (4)].expr)); |
| 1944 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); |
| 1945 | ;} |
| 1946 | break; |
| 1947 | |
| 1948 | case 90: |
| 1949 | |
| 1950 | { |
| 1951 | menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); |
| 1952 | ;} |
| 1953 | break; |
| 1954 | |
| 1955 | case 93: |
| 1956 | |
| 1957 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} |
| 1958 | break; |
| 1959 | |
| 1960 | case 94: |
| 1961 | |
| 1962 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} |
| 1963 | break; |
| 1964 | |
| 1965 | case 95: |
| 1966 | |
| 1967 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} |
| 1968 | break; |
| 1969 | |
| 1970 | case 98: |
| 1971 | |
| 1972 | { (yyval.expr) = NULL; ;} |
| 1973 | break; |
| 1974 | |
| 1975 | case 99: |
| 1976 | |
| 1977 | { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} |
| 1978 | break; |
| 1979 | |
| 1980 | case 100: |
| 1981 | |
| 1982 | { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} |
| 1983 | break; |
| 1984 | |
| 1985 | case 101: |
| 1986 | |
| 1987 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} |
| 1988 | break; |
| 1989 | |
| 1990 | case 102: |
| 1991 | |
| 1992 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} |
| 1993 | break; |
| 1994 | |
| 1995 | case 103: |
| 1996 | |
| 1997 | { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} |
| 1998 | break; |
| 1999 | |
| 2000 | case 104: |
| 2001 | |
| 2002 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} |
| 2003 | break; |
| 2004 | |
| 2005 | case 105: |
| 2006 | |
| 2007 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} |
| 2008 | break; |
| 2009 | |
| 2010 | case 106: |
| 2011 | |
| 2012 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} |
| 2013 | break; |
| 2014 | |
| 2015 | case 107: |
| 2016 | |
| 2017 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} |
| 2018 | break; |
| 2019 | |
| 2020 | case 108: |
| 2021 | |
Roman Zippel | 543aa7b | 2008-02-29 05:11:50 +0100 | [diff] [blame] | 2022 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} |
| 2023 | break; |
| 2024 | |
| 2025 | case 109: |
| 2026 | |
| 2027 | { (yyval.string) = NULL; ;} |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 2028 | break; |
| 2029 | |
| 2030 | |
| 2031 | /* Line 1267 of yacc.c. */ |
| 2032 | |
| 2033 | default: break; |
| 2034 | } |
| 2035 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 2036 | |
| 2037 | YYPOPSTACK (yylen); |
| 2038 | yylen = 0; |
| 2039 | YY_STACK_PRINT (yyss, yyssp); |
| 2040 | |
| 2041 | *++yyvsp = yyval; |
| 2042 | |
| 2043 | |
| 2044 | /* Now `shift' the result of the reduction. Determine what state |
| 2045 | that goes to, based on the state we popped back to and the rule |
| 2046 | number reduced by. */ |
| 2047 | |
| 2048 | yyn = yyr1[yyn]; |
| 2049 | |
| 2050 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 2051 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 2052 | yystate = yytable[yystate]; |
| 2053 | else |
| 2054 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 2055 | |
| 2056 | goto yynewstate; |
| 2057 | |
| 2058 | |
| 2059 | /*------------------------------------. |
| 2060 | | yyerrlab -- here on detecting error | |
| 2061 | `------------------------------------*/ |
| 2062 | yyerrlab: |
| 2063 | /* If not already recovering from an error, report this error. */ |
| 2064 | if (!yyerrstatus) |
| 2065 | { |
| 2066 | ++yynerrs; |
| 2067 | #if ! YYERROR_VERBOSE |
| 2068 | yyerror (YY_("syntax error")); |
| 2069 | #else |
| 2070 | { |
| 2071 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 2072 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 2073 | { |
| 2074 | YYSIZE_T yyalloc = 2 * yysize; |
| 2075 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 2076 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 2077 | if (yymsg != yymsgbuf) |
| 2078 | YYSTACK_FREE (yymsg); |
| 2079 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 2080 | if (yymsg) |
| 2081 | yymsg_alloc = yyalloc; |
| 2082 | else |
| 2083 | { |
| 2084 | yymsg = yymsgbuf; |
| 2085 | yymsg_alloc = sizeof yymsgbuf; |
| 2086 | } |
| 2087 | } |
| 2088 | |
| 2089 | if (0 < yysize && yysize <= yymsg_alloc) |
| 2090 | { |
| 2091 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 2092 | yyerror (yymsg); |
| 2093 | } |
| 2094 | else |
| 2095 | { |
| 2096 | yyerror (YY_("syntax error")); |
| 2097 | if (yysize != 0) |
| 2098 | goto yyexhaustedlab; |
| 2099 | } |
| 2100 | } |
| 2101 | #endif |
| 2102 | } |
| 2103 | |
| 2104 | |
| 2105 | |
| 2106 | if (yyerrstatus == 3) |
| 2107 | { |
| 2108 | /* If just tried and failed to reuse look-ahead token after an |
| 2109 | error, discard it. */ |
| 2110 | |
| 2111 | if (yychar <= YYEOF) |
| 2112 | { |
| 2113 | /* Return failure if at end of input. */ |
| 2114 | if (yychar == YYEOF) |
| 2115 | YYABORT; |
| 2116 | } |
| 2117 | else |
| 2118 | { |
| 2119 | yydestruct ("Error: discarding", |
| 2120 | yytoken, &yylval); |
| 2121 | yychar = YYEMPTY; |
| 2122 | } |
| 2123 | } |
| 2124 | |
| 2125 | /* Else will try to reuse look-ahead token after shifting the error |
| 2126 | token. */ |
| 2127 | goto yyerrlab1; |
| 2128 | |
| 2129 | |
| 2130 | /*---------------------------------------------------. |
| 2131 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 2132 | `---------------------------------------------------*/ |
| 2133 | yyerrorlab: |
| 2134 | |
| 2135 | /* Pacify compilers like GCC when the user code never invokes |
| 2136 | YYERROR and the label yyerrorlab therefore never appears in user |
| 2137 | code. */ |
| 2138 | if (/*CONSTCOND*/ 0) |
| 2139 | goto yyerrorlab; |
| 2140 | |
| 2141 | /* Do not reclaim the symbols of the rule which action triggered |
| 2142 | this YYERROR. */ |
| 2143 | YYPOPSTACK (yylen); |
| 2144 | yylen = 0; |
| 2145 | YY_STACK_PRINT (yyss, yyssp); |
| 2146 | yystate = *yyssp; |
| 2147 | goto yyerrlab1; |
| 2148 | |
| 2149 | |
| 2150 | /*-------------------------------------------------------------. |
| 2151 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 2152 | `-------------------------------------------------------------*/ |
| 2153 | yyerrlab1: |
| 2154 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 2155 | |
| 2156 | for (;;) |
| 2157 | { |
| 2158 | yyn = yypact[yystate]; |
| 2159 | if (yyn != YYPACT_NINF) |
| 2160 | { |
| 2161 | yyn += YYTERROR; |
| 2162 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 2163 | { |
| 2164 | yyn = yytable[yyn]; |
| 2165 | if (0 < yyn) |
| 2166 | break; |
| 2167 | } |
| 2168 | } |
| 2169 | |
| 2170 | /* Pop the current state because it cannot handle the error token. */ |
| 2171 | if (yyssp == yyss) |
| 2172 | YYABORT; |
| 2173 | |
| 2174 | |
| 2175 | yydestruct ("Error: popping", |
| 2176 | yystos[yystate], yyvsp); |
| 2177 | YYPOPSTACK (1); |
| 2178 | yystate = *yyssp; |
| 2179 | YY_STACK_PRINT (yyss, yyssp); |
| 2180 | } |
| 2181 | |
| 2182 | if (yyn == YYFINAL) |
| 2183 | YYACCEPT; |
| 2184 | |
| 2185 | *++yyvsp = yylval; |
| 2186 | |
| 2187 | |
| 2188 | /* Shift the error token. */ |
| 2189 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 2190 | |
| 2191 | yystate = yyn; |
| 2192 | goto yynewstate; |
| 2193 | |
| 2194 | |
| 2195 | /*-------------------------------------. |
| 2196 | | yyacceptlab -- YYACCEPT comes here. | |
| 2197 | `-------------------------------------*/ |
| 2198 | yyacceptlab: |
| 2199 | yyresult = 0; |
| 2200 | goto yyreturn; |
| 2201 | |
| 2202 | /*-----------------------------------. |
| 2203 | | yyabortlab -- YYABORT comes here. | |
| 2204 | `-----------------------------------*/ |
| 2205 | yyabortlab: |
| 2206 | yyresult = 1; |
| 2207 | goto yyreturn; |
| 2208 | |
| 2209 | #ifndef yyoverflow |
| 2210 | /*-------------------------------------------------. |
| 2211 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 2212 | `-------------------------------------------------*/ |
| 2213 | yyexhaustedlab: |
| 2214 | yyerror (YY_("memory exhausted")); |
| 2215 | yyresult = 2; |
| 2216 | /* Fall through. */ |
| 2217 | #endif |
| 2218 | |
| 2219 | yyreturn: |
| 2220 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 2221 | yydestruct ("Cleanup: discarding lookahead", |
| 2222 | yytoken, &yylval); |
| 2223 | /* Do not reclaim the symbols of the rule which action triggered |
| 2224 | this YYABORT or YYACCEPT. */ |
| 2225 | YYPOPSTACK (yylen); |
| 2226 | YY_STACK_PRINT (yyss, yyssp); |
| 2227 | while (yyssp != yyss) |
| 2228 | { |
| 2229 | yydestruct ("Cleanup: popping", |
| 2230 | yystos[*yyssp], yyvsp); |
| 2231 | YYPOPSTACK (1); |
| 2232 | } |
| 2233 | #ifndef yyoverflow |
| 2234 | if (yyss != yyssa) |
| 2235 | YYSTACK_FREE (yyss); |
| 2236 | #endif |
| 2237 | #if YYERROR_VERBOSE |
| 2238 | if (yymsg != yymsgbuf) |
| 2239 | YYSTACK_FREE (yymsg); |
| 2240 | #endif |
| 2241 | /* Make sure YYID is used. */ |
| 2242 | return YYID (yyresult); |
| 2243 | } |
| 2244 | |
| 2245 | |
| 2246 | |
| 2247 | |
| 2248 | |
| 2249 | void conf_parse(const char *name) |
| 2250 | { |
| 2251 | struct symbol *sym; |
| 2252 | int i; |
| 2253 | |
| 2254 | zconf_initscan(name); |
| 2255 | |
| 2256 | sym_init(); |
| 2257 | menu_init(); |
| 2258 | modules_sym = sym_lookup(NULL, 0); |
| 2259 | modules_sym->type = S_BOOLEAN; |
| 2260 | modules_sym->flags |= SYMBOL_AUTO; |
| 2261 | rootmenu.prompt = menu_add_prompt(P_MENU, "coreboot Configuration", NULL); |
| 2262 | |
| 2263 | #if YYDEBUG |
| 2264 | if (getenv("ZCONF_DEBUG")) |
| 2265 | zconfdebug = 1; |
| 2266 | #endif |
| 2267 | zconfparse(); |
| 2268 | if (zconfnerrs) |
| 2269 | exit(1); |
| 2270 | if (!modules_sym->prop) { |
| 2271 | struct property *prop; |
| 2272 | |
| 2273 | prop = prop_alloc(P_DEFAULT, modules_sym); |
| 2274 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); |
| 2275 | } |
| 2276 | menu_finalize(&rootmenu); |
| 2277 | for_all_symbols(i, sym) { |
| 2278 | if (sym_check_deps(sym)) |
| 2279 | zconfnerrs++; |
| 2280 | } |
| 2281 | if (zconfnerrs) |
| 2282 | exit(1); |
| 2283 | sym_set_change_count(1); |
| 2284 | } |
| 2285 | |
| 2286 | const char *zconf_tokenname(int token) |
| 2287 | { |
| 2288 | switch (token) { |
| 2289 | case T_MENU: return "menu"; |
| 2290 | case T_ENDMENU: return "endmenu"; |
| 2291 | case T_CHOICE: return "choice"; |
| 2292 | case T_ENDCHOICE: return "endchoice"; |
| 2293 | case T_IF: return "if"; |
| 2294 | case T_ENDIF: return "endif"; |
| 2295 | case T_DEPENDS: return "depends"; |
| 2296 | } |
| 2297 | return "<token>"; |
| 2298 | } |
| 2299 | |
| 2300 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) |
| 2301 | { |
| 2302 | if (id->token != endtoken) { |
| 2303 | zconf_error("unexpected '%s' within %s block", |
| 2304 | kconf_id_strings + id->name, zconf_tokenname(starttoken)); |
| 2305 | zconfnerrs++; |
| 2306 | return false; |
| 2307 | } |
| 2308 | if (current_menu->file != current_file) { |
| 2309 | zconf_error("'%s' in different file than '%s'", |
| 2310 | kconf_id_strings + id->name, zconf_tokenname(starttoken)); |
| 2311 | fprintf(stderr, "%s:%d: location of the '%s'\n", |
| 2312 | current_menu->file->name, current_menu->lineno, |
| 2313 | zconf_tokenname(starttoken)); |
| 2314 | zconfnerrs++; |
| 2315 | return false; |
| 2316 | } |
| 2317 | return true; |
| 2318 | } |
| 2319 | |
| 2320 | static void zconfprint(const char *err, ...) |
| 2321 | { |
| 2322 | va_list ap; |
| 2323 | |
| 2324 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); |
| 2325 | va_start(ap, err); |
| 2326 | vfprintf(stderr, err, ap); |
| 2327 | va_end(ap); |
| 2328 | fprintf(stderr, "\n"); |
| 2329 | } |
| 2330 | |
| 2331 | static void zconf_error(const char *err, ...) |
| 2332 | { |
| 2333 | va_list ap; |
| 2334 | |
| 2335 | zconfnerrs++; |
| 2336 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); |
| 2337 | va_start(ap, err); |
| 2338 | vfprintf(stderr, err, ap); |
| 2339 | va_end(ap); |
| 2340 | fprintf(stderr, "\n"); |
| 2341 | } |
| 2342 | |
| 2343 | static void zconferror(const char *err) |
| 2344 | { |
| 2345 | #if YYDEBUG |
| 2346 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
| 2347 | #endif |
| 2348 | } |
| 2349 | |
| 2350 | void print_quoted_string(FILE *out, const char *str) |
| 2351 | { |
| 2352 | const char *p; |
| 2353 | int len; |
| 2354 | |
| 2355 | putc('"', out); |
| 2356 | while ((p = strchr(str, '"'))) { |
| 2357 | len = p - str; |
| 2358 | if (len) |
| 2359 | fprintf(out, "%.*s", len, str); |
| 2360 | fputs("\\\"", out); |
| 2361 | str = p + 1; |
| 2362 | } |
| 2363 | fputs(str, out); |
| 2364 | putc('"', out); |
| 2365 | } |
| 2366 | |
| 2367 | void print_symbol(FILE *out, struct menu *menu) |
| 2368 | { |
| 2369 | struct symbol *sym = menu->sym; |
| 2370 | struct property *prop; |
| 2371 | |
| 2372 | if (sym_is_choice(sym)) |
| 2373 | fprintf(out, "choice\n"); |
| 2374 | else |
| 2375 | fprintf(out, "config %s\n", sym->name); |
| 2376 | switch (sym->type) { |
| 2377 | case S_BOOLEAN: |
| 2378 | fputs(" boolean\n", out); |
| 2379 | break; |
| 2380 | case S_TRISTATE: |
| 2381 | fputs(" tristate\n", out); |
| 2382 | break; |
| 2383 | case S_STRING: |
| 2384 | fputs(" string\n", out); |
| 2385 | break; |
| 2386 | case S_INT: |
| 2387 | fputs(" integer\n", out); |
| 2388 | break; |
| 2389 | case S_HEX: |
| 2390 | fputs(" hex\n", out); |
| 2391 | break; |
| 2392 | default: |
| 2393 | fputs(" ???\n", out); |
| 2394 | break; |
| 2395 | } |
| 2396 | for (prop = sym->prop; prop; prop = prop->next) { |
| 2397 | if (prop->menu != menu) |
| 2398 | continue; |
| 2399 | switch (prop->type) { |
| 2400 | case P_PROMPT: |
| 2401 | fputs(" prompt ", out); |
| 2402 | print_quoted_string(out, prop->text); |
| 2403 | if (!expr_is_yes(prop->visible.expr)) { |
| 2404 | fputs(" if ", out); |
| 2405 | expr_fprint(prop->visible.expr, out); |
| 2406 | } |
| 2407 | fputc('\n', out); |
| 2408 | break; |
| 2409 | case P_DEFAULT: |
| 2410 | fputs( " default ", out); |
| 2411 | expr_fprint(prop->expr, out); |
| 2412 | if (!expr_is_yes(prop->visible.expr)) { |
| 2413 | fputs(" if ", out); |
| 2414 | expr_fprint(prop->visible.expr, out); |
| 2415 | } |
| 2416 | fputc('\n', out); |
| 2417 | break; |
| 2418 | case P_CHOICE: |
| 2419 | fputs(" #choice value\n", out); |
| 2420 | break; |
| 2421 | default: |
| 2422 | fprintf(out, " unknown prop %d!\n", prop->type); |
| 2423 | break; |
| 2424 | } |
| 2425 | } |
| 2426 | if (menu->help) { |
| 2427 | int len = strlen(menu->help); |
| 2428 | while (menu->help[--len] == '\n') |
| 2429 | menu->help[len] = 0; |
| 2430 | fprintf(out, " help\n%s\n", menu->help); |
| 2431 | } |
| 2432 | fputc('\n', out); |
| 2433 | } |
| 2434 | |
| 2435 | void zconfdump(FILE *out) |
| 2436 | { |
| 2437 | struct property *prop; |
| 2438 | struct symbol *sym; |
| 2439 | struct menu *menu; |
| 2440 | |
| 2441 | menu = rootmenu.list; |
| 2442 | while (menu) { |
| 2443 | if ((sym = menu->sym)) |
| 2444 | print_symbol(out, menu); |
| 2445 | else if ((prop = menu->prompt)) { |
| 2446 | switch (prop->type) { |
| 2447 | case P_COMMENT: |
| 2448 | fputs("\ncomment ", out); |
| 2449 | print_quoted_string(out, prop->text); |
| 2450 | fputs("\n", out); |
| 2451 | break; |
| 2452 | case P_MENU: |
| 2453 | fputs("\nmenu ", out); |
| 2454 | print_quoted_string(out, prop->text); |
| 2455 | fputs("\n", out); |
| 2456 | break; |
| 2457 | default: |
| 2458 | ; |
| 2459 | } |
| 2460 | if (!expr_is_yes(prop->visible.expr)) { |
| 2461 | fputs(" depends ", out); |
| 2462 | expr_fprint(prop->visible.expr, out); |
| 2463 | fputc('\n', out); |
| 2464 | } |
| 2465 | fputs("\n", out); |
| 2466 | } |
| 2467 | |
| 2468 | if (menu->list) |
| 2469 | menu = menu->list; |
| 2470 | else if (menu->next) |
| 2471 | menu = menu->next; |
| 2472 | else while ((menu = menu->parent)) { |
| 2473 | if (menu->prompt && menu->prompt->type == P_MENU) |
| 2474 | fputs("\nendmenu\n", out); |
| 2475 | if (menu->next) { |
| 2476 | menu = menu->next; |
| 2477 | break; |
| 2478 | } |
| 2479 | } |
| 2480 | } |
| 2481 | } |
| 2482 | |
| 2483 | #include "lex.zconf.c" |
| 2484 | #include "util.c" |
| 2485 | #include "confdata.c" |
| 2486 | #include "expr.c" |
| 2487 | #include "symbol.c" |
| 2488 | #include "menu.c" |
| 2489 | |