Eric Andersen | c9f20d9 | 2002-12-05 08:41:41 +0000 | [diff] [blame] | 1 | /* A Bison parser, made from zconf.y, by GNU bison 1.75. */ |
| 2 | |
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | /* As a special exception, when this file is copied by Bison into a |
| 22 | Bison output file, you may use that output file without restriction. |
| 23 | This special exception was added by the Free Software Foundation |
| 24 | in version 1.24 of Bison. */ |
| 25 | |
| 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
| 28 | |
| 29 | /* All symbols defined below should begin with yy or YY, to avoid |
| 30 | infringing on user name space. This should be done even for local |
| 31 | variables, as they might otherwise be expanded by user macros. |
| 32 | There are some unavoidable exceptions within include files to |
| 33 | define necessary library symbols; they are noted "INFRINGES ON |
| 34 | USER NAME SPACE" below. */ |
| 35 | |
| 36 | /* Identify Bison output. */ |
| 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Pure parsers. */ |
| 40 | #define YYPURE 0 |
| 41 | |
| 42 | /* Using locations. */ |
| 43 | #define YYLSP_NEEDED 0 |
| 44 | |
| 45 | /* If NAME_PREFIX is specified substitute the variables and functions |
| 46 | names. */ |
| 47 | #define yyparse zconfparse |
| 48 | #define yylex zconflex |
| 49 | #define yyerror zconferror |
| 50 | #define yylval zconflval |
| 51 | #define yychar zconfchar |
| 52 | #define yydebug zconfdebug |
| 53 | #define yynerrs zconfnerrs |
| 54 | |
| 55 | |
| 56 | /* Tokens. */ |
| 57 | #ifndef YYTOKENTYPE |
| 58 | # define YYTOKENTYPE |
| 59 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 60 | know about them. */ |
| 61 | enum yytokentype { |
| 62 | T_MAINMENU = 258, |
| 63 | T_MENU = 259, |
| 64 | T_ENDMENU = 260, |
| 65 | T_SOURCE = 261, |
| 66 | T_CHOICE = 262, |
| 67 | T_ENDCHOICE = 263, |
| 68 | T_COMMENT = 264, |
| 69 | T_CONFIG = 265, |
| 70 | T_HELP = 266, |
| 71 | T_HELPTEXT = 267, |
| 72 | T_IF = 268, |
| 73 | T_ENDIF = 269, |
| 74 | T_DEPENDS = 270, |
| 75 | T_REQUIRES = 271, |
| 76 | T_OPTIONAL = 272, |
| 77 | T_PROMPT = 273, |
| 78 | T_DEFAULT = 274, |
| 79 | T_TRISTATE = 275, |
| 80 | T_BOOLEAN = 276, |
| 81 | T_INT = 277, |
| 82 | T_HEX = 278, |
| 83 | T_WORD = 279, |
| 84 | T_STRING = 280, |
| 85 | T_UNEQUAL = 281, |
| 86 | T_EOF = 282, |
| 87 | T_EOL = 283, |
| 88 | T_CLOSE_PAREN = 284, |
| 89 | T_OPEN_PAREN = 285, |
| 90 | T_ON = 286, |
| 91 | T_OR = 287, |
| 92 | T_AND = 288, |
| 93 | T_EQUAL = 289, |
| 94 | T_NOT = 290 |
| 95 | }; |
| 96 | #endif |
| 97 | #define T_MAINMENU 258 |
| 98 | #define T_MENU 259 |
| 99 | #define T_ENDMENU 260 |
| 100 | #define T_SOURCE 261 |
| 101 | #define T_CHOICE 262 |
| 102 | #define T_ENDCHOICE 263 |
| 103 | #define T_COMMENT 264 |
| 104 | #define T_CONFIG 265 |
| 105 | #define T_HELP 266 |
| 106 | #define T_HELPTEXT 267 |
| 107 | #define T_IF 268 |
| 108 | #define T_ENDIF 269 |
| 109 | #define T_DEPENDS 270 |
| 110 | #define T_REQUIRES 271 |
| 111 | #define T_OPTIONAL 272 |
| 112 | #define T_PROMPT 273 |
| 113 | #define T_DEFAULT 274 |
| 114 | #define T_TRISTATE 275 |
| 115 | #define T_BOOLEAN 276 |
| 116 | #define T_INT 277 |
| 117 | #define T_HEX 278 |
| 118 | #define T_WORD 279 |
| 119 | #define T_STRING 280 |
| 120 | #define T_UNEQUAL 281 |
| 121 | #define T_EOF 282 |
| 122 | #define T_EOL 283 |
| 123 | #define T_CLOSE_PAREN 284 |
| 124 | #define T_OPEN_PAREN 285 |
| 125 | #define T_ON 286 |
| 126 | #define T_OR 287 |
| 127 | #define T_AND 288 |
| 128 | #define T_EQUAL 289 |
| 129 | #define T_NOT 290 |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | /* Copy the first part of user declarations. */ |
| 135 | #line 1 "zconf.y" |
| 136 | |
| 137 | /* |
| 138 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
| 139 | * Released under the terms of the GNU GPL v2.0. |
| 140 | */ |
| 141 | |
| 142 | #include <ctype.h> |
| 143 | #include <stdarg.h> |
| 144 | #include <stdio.h> |
| 145 | #include <stdlib.h> |
| 146 | #include <string.h> |
| 147 | #include <stdbool.h> |
| 148 | |
| 149 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
| 150 | |
| 151 | #define PRINTD 0x0001 |
| 152 | #define DEBUG_PARSE 0x0002 |
| 153 | |
| 154 | int cdebug = PRINTD; |
| 155 | |
| 156 | extern int zconflex(void); |
| 157 | static void zconfprint(const char *err, ...); |
| 158 | static void zconferror(const char *err); |
| 159 | static bool zconf_endtoken(int token, int starttoken, int endtoken); |
| 160 | |
| 161 | struct symbol *symbol_hash[257]; |
| 162 | |
| 163 | #define YYERROR_VERBOSE |
| 164 | |
| 165 | |
| 166 | /* Enabling traces. */ |
| 167 | #ifndef YYDEBUG |
| 168 | # define YYDEBUG 1 |
| 169 | #endif |
| 170 | |
| 171 | /* Enabling verbose error messages. */ |
| 172 | #ifdef YYERROR_VERBOSE |
| 173 | # undef YYERROR_VERBOSE |
| 174 | # define YYERROR_VERBOSE 1 |
| 175 | #else |
| 176 | # define YYERROR_VERBOSE 0 |
| 177 | #endif |
| 178 | |
| 179 | #ifndef YYSTYPE |
| 180 | #line 33 "zconf.y" |
| 181 | typedef union { |
| 182 | int token; |
| 183 | char *string; |
| 184 | struct symbol *symbol; |
| 185 | struct expr *expr; |
| 186 | struct menu *menu; |
| 187 | } yystype; |
| 188 | /* Line 193 of /usr/share/bison/yacc.c. */ |
| 189 | #line 190 "zconf.tab.c" |
| 190 | # define YYSTYPE yystype |
| 191 | # define YYSTYPE_IS_TRIVIAL 1 |
| 192 | #endif |
| 193 | |
| 194 | #ifndef YYLTYPE |
| 195 | typedef struct yyltype |
| 196 | { |
| 197 | int first_line; |
| 198 | int first_column; |
| 199 | int last_line; |
| 200 | int last_column; |
| 201 | } yyltype; |
| 202 | # define YYLTYPE yyltype |
| 203 | # define YYLTYPE_IS_TRIVIAL 1 |
| 204 | #endif |
| 205 | |
| 206 | /* Copy the second part of user declarations. */ |
| 207 | #line 83 "zconf.y" |
| 208 | |
| 209 | #define LKC_DIRECT_LINK |
| 210 | #include "lkc.h" |
| 211 | |
| 212 | |
| 213 | /* Line 213 of /usr/share/bison/yacc.c. */ |
| 214 | #line 215 "zconf.tab.c" |
| 215 | |
| 216 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 217 | |
| 218 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 219 | |
| 220 | # if YYSTACK_USE_ALLOCA |
| 221 | # define YYSTACK_ALLOC alloca |
| 222 | # else |
| 223 | # ifndef YYSTACK_USE_ALLOCA |
| 224 | # if defined (alloca) || defined (_ALLOCA_H) |
| 225 | # define YYSTACK_ALLOC alloca |
| 226 | # else |
| 227 | # ifdef __GNUC__ |
| 228 | # define YYSTACK_ALLOC __builtin_alloca |
| 229 | # endif |
| 230 | # endif |
| 231 | # endif |
| 232 | # endif |
| 233 | |
| 234 | # ifdef YYSTACK_ALLOC |
| 235 | /* Pacify GCC's `empty if-body' warning. */ |
| 236 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 237 | # else |
| 238 | # if defined (__STDC__) || defined (__cplusplus) |
| 239 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 240 | # define YYSIZE_T size_t |
| 241 | # endif |
| 242 | # define YYSTACK_ALLOC malloc |
| 243 | # define YYSTACK_FREE free |
| 244 | # endif |
| 245 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 246 | |
| 247 | |
| 248 | #if (! defined (yyoverflow) \ |
| 249 | && (! defined (__cplusplus) \ |
| 250 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 251 | |
| 252 | /* A type that is properly aligned for any stack member. */ |
| 253 | union yyalloc |
| 254 | { |
| 255 | short yyss; |
| 256 | YYSTYPE yyvs; |
| 257 | }; |
| 258 | |
| 259 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 260 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) |
| 261 | |
| 262 | /* The size of an array large to enough to hold all stacks, each with |
| 263 | N elements. */ |
| 264 | # define YYSTACK_BYTES(N) \ |
| 265 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ |
| 266 | + YYSTACK_GAP_MAX) |
| 267 | |
| 268 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 269 | not overlap. */ |
| 270 | # ifndef YYCOPY |
| 271 | # if 1 < __GNUC__ |
| 272 | # define YYCOPY(To, From, Count) \ |
| 273 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 274 | # else |
| 275 | # define YYCOPY(To, From, Count) \ |
| 276 | do \ |
| 277 | { \ |
| 278 | register YYSIZE_T yyi; \ |
| 279 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 280 | (To)[yyi] = (From)[yyi]; \ |
| 281 | } \ |
| 282 | while (0) |
| 283 | # endif |
| 284 | # endif |
| 285 | |
| 286 | /* Relocate STACK from its old location to the new one. The |
| 287 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 288 | elements in the stack, and YYPTR gives the new location of the |
| 289 | stack. Advance YYPTR to a properly aligned location for the next |
| 290 | stack. */ |
| 291 | # define YYSTACK_RELOCATE(Stack) \ |
| 292 | do \ |
| 293 | { \ |
| 294 | YYSIZE_T yynewbytes; \ |
| 295 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 296 | Stack = &yyptr->Stack; \ |
| 297 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ |
| 298 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 299 | } \ |
| 300 | while (0) |
| 301 | |
| 302 | #endif |
| 303 | |
| 304 | #if defined (__STDC__) || defined (__cplusplus) |
| 305 | typedef signed char yysigned_char; |
| 306 | #else |
| 307 | typedef short yysigned_char; |
| 308 | #endif |
| 309 | |
| 310 | /* YYFINAL -- State number of the termination state. */ |
| 311 | #define YYFINAL 2 |
| 312 | #define YYLAST 151 |
| 313 | |
| 314 | /* YYNTOKENS -- Number of terminals. */ |
| 315 | #define YYNTOKENS 36 |
| 316 | /* YYNNTS -- Number of nonterminals. */ |
| 317 | #define YYNNTS 39 |
| 318 | /* YYNRULES -- Number of rules. */ |
| 319 | #define YYNRULES 96 |
| 320 | /* YYNRULES -- Number of states. */ |
| 321 | #define YYNSTATES 145 |
| 322 | |
| 323 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 324 | #define YYUNDEFTOK 2 |
| 325 | #define YYMAXUTOK 290 |
| 326 | |
| 327 | #define YYTRANSLATE(X) \ |
| 328 | ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) |
| 329 | |
| 330 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 331 | static const unsigned char yytranslate[] = |
| 332 | { |
| 333 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 334 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 335 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 336 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 337 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 338 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 339 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 340 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 341 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 342 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 343 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 344 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 345 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 346 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 347 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 348 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 349 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 350 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 351 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 352 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 353 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 354 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 355 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 356 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 357 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 358 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 359 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 360 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 361 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 362 | 35 |
| 363 | }; |
| 364 | |
| 365 | #if YYDEBUG |
| 366 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 367 | YYRHS. */ |
| 368 | static const unsigned short yyprhs[] = |
| 369 | { |
| 370 | 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, |
| 371 | 21, 23, 26, 28, 30, 32, 34, 36, 39, 43, |
| 372 | 44, 48, 52, 55, 58, 61, 64, 67, 70, 73, |
| 373 | 77, 81, 83, 87, 89, 94, 97, 98, 102, 106, |
| 374 | 109, 112, 116, 118, 121, 122, 125, 128, 130, 136, |
| 375 | 140, 141, 144, 147, 150, 153, 157, 159, 164, 167, |
| 376 | 168, 171, 174, 177, 181, 184, 187, 190, 194, 197, |
| 377 | 200, 201, 205, 208, 212, 215, 218, 219, 221, 225, |
| 378 | 227, 229, 231, 233, 235, 237, 239, 240, 243, 245, |
| 379 | 249, 253, 257, 260, 264, 268, 270 |
| 380 | }; |
| 381 | |
| 382 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 383 | static const yysigned_char yyrhs[] = |
| 384 | { |
| 385 | 37, 0, -1, -1, 37, 38, -1, 39, -1, 47, |
| 386 | -1, 58, -1, 3, 69, 71, -1, 5, -1, 14, |
| 387 | -1, 8, -1, 1, 71, -1, 53, -1, 63, -1, |
| 388 | 41, -1, 61, -1, 71, -1, 10, 24, -1, 40, |
| 389 | 28, 42, -1, -1, 42, 43, 28, -1, 42, 67, |
| 390 | 28, -1, 42, 65, -1, 42, 28, -1, 20, 68, |
| 391 | -1, 21, 68, -1, 22, 68, -1, 23, 68, -1, |
| 392 | 25, 68, -1, 18, 69, 72, -1, 19, 74, 72, |
| 393 | -1, 7, -1, 44, 28, 48, -1, 70, -1, 45, |
| 394 | 50, 46, 28, -1, 45, 50, -1, -1, 48, 49, |
| 395 | 28, -1, 48, 67, 28, -1, 48, 65, -1, 48, |
| 396 | 28, -1, 18, 69, 72, -1, 17, -1, 19, 74, |
| 397 | -1, -1, 50, 39, -1, 13, 73, -1, 70, -1, |
| 398 | 51, 28, 54, 52, 28, -1, 51, 28, 54, -1, |
| 399 | -1, 54, 39, -1, 54, 58, -1, 54, 47, -1, |
| 400 | 4, 69, -1, 55, 28, 66, -1, 70, -1, 56, |
| 401 | 59, 57, 28, -1, 56, 59, -1, -1, 59, 39, |
| 402 | -1, 59, 58, -1, 59, 47, -1, 59, 1, 28, |
| 403 | -1, 6, 69, -1, 60, 28, -1, 9, 69, -1, |
| 404 | 62, 28, 66, -1, 11, 28, -1, 64, 12, -1, |
| 405 | -1, 66, 67, 28, -1, 66, 28, -1, 15, 31, |
| 406 | 73, -1, 15, 73, -1, 16, 73, -1, -1, 69, |
| 407 | -1, 69, 13, 73, -1, 24, -1, 25, -1, 5, |
| 408 | -1, 8, -1, 14, -1, 28, -1, 27, -1, -1, |
| 409 | 13, 73, -1, 74, -1, 74, 34, 74, -1, 74, |
| 410 | 26, 74, -1, 30, 73, 29, -1, 35, 73, -1, |
| 411 | 73, 32, 73, -1, 73, 33, 73, -1, 24, -1, |
| 412 | 25, -1 |
| 413 | }; |
| 414 | |
| 415 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 416 | static const unsigned short yyrline[] = |
| 417 | { |
| 418 | 0, 88, 88, 89, 92, 93, 94, 95, 96, 97, |
| 419 | 98, 99, 102, 104, 105, 106, 107, 113, 121, 127, |
| 420 | 129, 130, 131, 132, 135, 141, 147, 153, 159, 165, |
| 421 | 171, 179, 188, 194, 202, 204, 210, 212, 213, 214, |
| 422 | 215, 218, 224, 230, 237, 239, 244, 254, 262, 264, |
| 423 | 270, 272, 273, 274, 279, 286, 292, 300, 302, 308, |
| 424 | 310, 311, 312, 313, 316, 322, 329, 336, 343, 349, |
| 425 | 356, 357, 358, 361, 366, 371, 379, 381, 385, 390, |
| 426 | 391, 394, 395, 396, 399, 400, 402, 403, 406, 407, |
| 427 | 408, 409, 410, 411, 412, 415, 416 |
| 428 | }; |
| 429 | #endif |
| 430 | |
| 431 | #if YYDEBUG || YYERROR_VERBOSE |
| 432 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 433 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 434 | static const char *const yytname[] = |
| 435 | { |
| 436 | "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", |
| 437 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", |
| 438 | "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", "T_REQUIRES", |
| 439 | "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", "T_BOOLEAN", |
| 440 | "T_INT", "T_HEX", "T_WORD", "T_STRING", "T_UNEQUAL", "T_EOF", "T_EOL", |
| 441 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_OR", "T_AND", "T_EQUAL", |
| 442 | "T_NOT", "$accept", "input", "block", "common_block", |
| 443 | "config_entry_start", "config_stmt", "config_option_list", |
| 444 | "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", |
| 445 | "choice_option_list", "choice_option", "choice_block", "if", "if_end", |
| 446 | "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt", |
| 447 | "menu_block", "source", "source_stmt", "comment", "comment_stmt", |
| 448 | "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", |
| 449 | "prompt", "end", "nl_or_eof", "if_expr", "expr", "symbol", 0 |
| 450 | }; |
| 451 | #endif |
| 452 | |
| 453 | # ifdef YYPRINT |
| 454 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 455 | token YYLEX-NUM. */ |
| 456 | static const unsigned short yytoknum[] = |
| 457 | { |
| 458 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 459 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 460 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 461 | 285, 286, 287, 288, 289, 290 |
| 462 | }; |
| 463 | # endif |
| 464 | |
| 465 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 466 | static const unsigned char yyr1[] = |
| 467 | { |
| 468 | 0, 36, 37, 37, 38, 38, 38, 38, 38, 38, |
| 469 | 38, 38, 39, 39, 39, 39, 39, 40, 41, 42, |
| 470 | 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, |
| 471 | 43, 44, 45, 46, 47, 47, 48, 48, 48, 48, |
| 472 | 48, 49, 49, 49, 50, 50, 51, 52, 53, 53, |
| 473 | 54, 54, 54, 54, 55, 56, 57, 58, 58, 59, |
| 474 | 59, 59, 59, 59, 60, 61, 62, 63, 64, 65, |
| 475 | 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, |
| 476 | 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, |
| 477 | 73, 73, 73, 73, 73, 74, 74 |
| 478 | }; |
| 479 | |
| 480 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 481 | static const unsigned char yyr2[] = |
| 482 | { |
| 483 | 0, 2, 0, 2, 1, 1, 1, 3, 1, 1, |
| 484 | 1, 2, 1, 1, 1, 1, 1, 2, 3, 0, |
| 485 | 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, |
| 486 | 3, 1, 3, 1, 4, 2, 0, 3, 3, 2, |
| 487 | 2, 3, 1, 2, 0, 2, 2, 1, 5, 3, |
| 488 | 0, 2, 2, 2, 2, 3, 1, 4, 2, 0, |
| 489 | 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, |
| 490 | 0, 3, 2, 3, 2, 2, 0, 1, 3, 1, |
| 491 | 1, 1, 1, 1, 1, 1, 0, 2, 1, 3, |
| 492 | 3, 3, 2, 3, 3, 1, 1 |
| 493 | }; |
| 494 | |
| 495 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 496 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 497 | means the default is an error. */ |
| 498 | static const unsigned char yydefact[] = |
| 499 | { |
| 500 | 2, 0, 1, 0, 0, 0, 8, 0, 31, 10, |
| 501 | 0, 0, 0, 9, 85, 84, 3, 4, 0, 14, |
| 502 | 0, 44, 5, 0, 12, 0, 59, 6, 0, 15, |
| 503 | 0, 13, 16, 11, 79, 80, 0, 54, 64, 66, |
| 504 | 17, 95, 96, 0, 0, 46, 88, 19, 36, 35, |
| 505 | 50, 70, 0, 65, 70, 7, 0, 92, 0, 0, |
| 506 | 0, 0, 18, 32, 81, 82, 83, 45, 0, 33, |
| 507 | 49, 55, 0, 60, 62, 0, 61, 56, 67, 91, |
| 508 | 93, 94, 90, 89, 0, 0, 0, 0, 0, 76, |
| 509 | 76, 76, 76, 76, 23, 0, 0, 22, 0, 42, |
| 510 | 0, 0, 40, 0, 39, 0, 34, 51, 53, 0, |
| 511 | 52, 47, 72, 0, 63, 57, 68, 0, 74, 75, |
| 512 | 86, 86, 24, 77, 25, 26, 27, 28, 20, 69, |
| 513 | 21, 86, 43, 37, 38, 48, 71, 73, 0, 29, |
| 514 | 30, 0, 41, 87, 78 |
| 515 | }; |
| 516 | |
| 517 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 518 | static const short yydefgoto[] = |
| 519 | { |
| 520 | -1, 1, 16, 17, 18, 19, 62, 95, 20, 21, |
| 521 | 68, 22, 63, 103, 49, 23, 109, 24, 70, 25, |
| 522 | 26, 75, 27, 52, 28, 29, 30, 31, 96, 97, |
| 523 | 71, 113, 122, 123, 69, 32, 139, 45, 46 |
| 524 | }; |
| 525 | |
| 526 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 527 | STATE-NUM. */ |
| 528 | #define YYPACT_NINF -120 |
| 529 | static const short yypact[] = |
| 530 | { |
| 531 | -120, 17, -120, 41, 48, 48, -120, 48, -120, -120, |
| 532 | 48, -11, 40, -120, -120, -120, -120, -120, 13, -120, |
| 533 | 23, -120, -120, 66, -120, 72, -120, -120, 77, -120, |
| 534 | 81, -120, -120, -120, -120, -120, 41, -120, -120, -120, |
| 535 | -120, -120, -120, 40, 40, 57, 59, -120, -120, 98, |
| 536 | -120, -120, 49, -120, -120, -120, 7, -120, 40, 40, |
| 537 | 67, 67, 99, 117, -120, -120, -120, -120, 85, -120, |
| 538 | 74, 18, 88, -120, -120, 95, -120, -120, 18, -120, |
| 539 | 96, -120, -120, -120, 102, 36, 40, 48, 67, 48, |
| 540 | 48, 48, 48, 48, -120, 103, 129, -120, 114, -120, |
| 541 | 48, 67, -120, 115, -120, 116, -120, -120, -120, 118, |
| 542 | -120, -120, -120, 119, -120, -120, -120, 40, 57, 57, |
| 543 | 135, 135, -120, 136, -120, -120, -120, -120, -120, -120, |
| 544 | -120, 135, -120, -120, -120, -120, -120, 57, 40, -120, |
| 545 | -120, 40, -120, 57, 57 |
| 546 | }; |
| 547 | |
| 548 | /* YYPGOTO[NTERM-NUM]. */ |
| 549 | static const yysigned_char yypgoto[] = |
| 550 | { |
| 551 | -120, -120, -120, -38, -120, -120, -120, -120, -120, -120, |
| 552 | -120, -42, -120, -120, -120, -120, -120, -120, -120, -120, |
| 553 | -120, -120, -33, -120, -120, -120, -120, -120, -120, 87, |
| 554 | 97, 34, 47, -1, -23, 2, -119, -43, -53 |
| 555 | }; |
| 556 | |
| 557 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 558 | positive, shift that token. If negative, reduce the rule which |
| 559 | number is the opposite. If zero, do what YYDEFACT says. |
| 560 | If YYTABLE_NINF, parse error. */ |
| 561 | #define YYTABLE_NINF -59 |
| 562 | static const short yytable[] = |
| 563 | { |
| 564 | 56, 57, 140, 36, 37, 33, 38, 82, 83, 39, |
| 565 | 74, 67, 142, 40, 73, 80, 81, 2, 3, 76, |
| 566 | 4, 5, 6, 7, 8, 9, 10, 11, 108, 77, |
| 567 | 12, 13, 107, 85, 86, 121, 79, 110, 55, 58, |
| 568 | 59, 47, 118, 119, 14, 15, 112, 111, 132, -58, |
| 569 | 72, 48, -58, 5, 64, 7, 8, 65, 10, 11, |
| 570 | 41, 42, 12, 66, 41, 42, 43, 117, 14, 15, |
| 571 | 43, 44, 34, 35, 137, 44, 14, 15, 5, 64, |
| 572 | 7, 8, 65, 10, 11, 60, 120, 12, 66, 58, |
| 573 | 59, 41, 42, 61, 50, 143, 98, 105, 144, 131, |
| 574 | 51, 14, 15, 64, 7, 53, 65, 10, 11, 54, |
| 575 | 84, 12, 66, 106, 85, 86, 114, 87, 88, 89, |
| 576 | 90, 91, 92, 115, 93, 14, 15, 94, 84, 59, |
| 577 | 116, 128, 85, 86, 99, 100, 101, 124, 125, 126, |
| 578 | 127, 129, 130, 133, 134, 102, 135, 136, 138, 141, |
| 579 | 104, 78 |
| 580 | }; |
| 581 | |
| 582 | static const unsigned char yycheck[] = |
| 583 | { |
| 584 | 43, 44, 121, 4, 5, 3, 7, 60, 61, 10, |
| 585 | 52, 49, 131, 24, 52, 58, 59, 0, 1, 52, |
| 586 | 3, 4, 5, 6, 7, 8, 9, 10, 70, 52, |
| 587 | 13, 14, 70, 15, 16, 88, 29, 70, 36, 32, |
| 588 | 33, 28, 85, 86, 27, 28, 28, 70, 101, 0, |
| 589 | 1, 28, 3, 4, 5, 6, 7, 8, 9, 10, |
| 590 | 24, 25, 13, 14, 24, 25, 30, 31, 27, 28, |
| 591 | 30, 35, 24, 25, 117, 35, 27, 28, 4, 5, |
| 592 | 6, 7, 8, 9, 10, 26, 87, 13, 14, 32, |
| 593 | 33, 24, 25, 34, 28, 138, 62, 63, 141, 100, |
| 594 | 28, 27, 28, 5, 6, 28, 8, 9, 10, 28, |
| 595 | 11, 13, 14, 28, 15, 16, 28, 18, 19, 20, |
| 596 | 21, 22, 23, 28, 25, 27, 28, 28, 11, 33, |
| 597 | 28, 28, 15, 16, 17, 18, 19, 90, 91, 92, |
| 598 | 93, 12, 28, 28, 28, 28, 28, 28, 13, 13, |
| 599 | 63, 54 |
| 600 | }; |
| 601 | |
| 602 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 603 | symbol of state STATE-NUM. */ |
| 604 | static const unsigned char yystos[] = |
| 605 | { |
| 606 | 0, 37, 0, 1, 3, 4, 5, 6, 7, 8, |
| 607 | 9, 10, 13, 14, 27, 28, 38, 39, 40, 41, |
| 608 | 44, 45, 47, 51, 53, 55, 56, 58, 60, 61, |
| 609 | 62, 63, 71, 71, 24, 25, 69, 69, 69, 69, |
| 610 | 24, 24, 25, 30, 35, 73, 74, 28, 28, 50, |
| 611 | 28, 28, 59, 28, 28, 71, 73, 73, 32, 33, |
| 612 | 26, 34, 42, 48, 5, 8, 14, 39, 46, 70, |
| 613 | 54, 66, 1, 39, 47, 57, 58, 70, 66, 29, |
| 614 | 73, 73, 74, 74, 11, 15, 16, 18, 19, 20, |
| 615 | 21, 22, 23, 25, 28, 43, 64, 65, 67, 17, |
| 616 | 18, 19, 28, 49, 65, 67, 28, 39, 47, 52, |
| 617 | 58, 70, 28, 67, 28, 28, 28, 31, 73, 73, |
| 618 | 69, 74, 68, 69, 68, 68, 68, 68, 28, 12, |
| 619 | 28, 69, 74, 28, 28, 28, 28, 73, 13, 72, |
| 620 | 72, 13, 72, 73, 73 |
| 621 | }; |
| 622 | |
| 623 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 624 | # define YYSIZE_T __SIZE_TYPE__ |
| 625 | #endif |
| 626 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 627 | # define YYSIZE_T size_t |
| 628 | #endif |
| 629 | #if ! defined (YYSIZE_T) |
| 630 | # if defined (__STDC__) || defined (__cplusplus) |
| 631 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 632 | # define YYSIZE_T size_t |
| 633 | # endif |
| 634 | #endif |
| 635 | #if ! defined (YYSIZE_T) |
| 636 | # define YYSIZE_T unsigned int |
| 637 | #endif |
| 638 | |
| 639 | #define yyerrok (yyerrstatus = 0) |
| 640 | #define yyclearin (yychar = YYEMPTY) |
| 641 | #define YYEMPTY -2 |
| 642 | #define YYEOF 0 |
| 643 | |
| 644 | #define YYACCEPT goto yyacceptlab |
| 645 | #define YYABORT goto yyabortlab |
| 646 | #define YYERROR goto yyerrlab1 |
| 647 | |
| 648 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 649 | to ease the transition to the new meaning of YYERROR, for GCC. |
| 650 | Once GCC version 2 has supplanted version 1, this can go. */ |
| 651 | |
| 652 | #define YYFAIL goto yyerrlab |
| 653 | |
| 654 | #define YYRECOVERING() (!!yyerrstatus) |
| 655 | |
| 656 | #define YYBACKUP(Token, Value) \ |
| 657 | do \ |
| 658 | if (yychar == YYEMPTY && yylen == 1) \ |
| 659 | { \ |
| 660 | yychar = (Token); \ |
| 661 | yylval = (Value); \ |
| 662 | yychar1 = YYTRANSLATE (yychar); \ |
| 663 | YYPOPSTACK; \ |
| 664 | goto yybackup; \ |
| 665 | } \ |
| 666 | else \ |
| 667 | { \ |
| 668 | yyerror ("syntax error: cannot back up"); \ |
| 669 | YYERROR; \ |
| 670 | } \ |
| 671 | while (0) |
| 672 | |
| 673 | #define YYTERROR 1 |
| 674 | #define YYERRCODE 256 |
| 675 | |
| 676 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
| 677 | are run). */ |
| 678 | |
| 679 | #ifndef YYLLOC_DEFAULT |
| 680 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 681 | Current.first_line = Rhs[1].first_line; \ |
| 682 | Current.first_column = Rhs[1].first_column; \ |
| 683 | Current.last_line = Rhs[N].last_line; \ |
| 684 | Current.last_column = Rhs[N].last_column; |
| 685 | #endif |
| 686 | |
| 687 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 688 | |
| 689 | #define YYLEX yylex () |
| 690 | |
| 691 | /* Enable debugging if requested. */ |
| 692 | #if YYDEBUG |
| 693 | |
| 694 | # ifndef YYFPRINTF |
| 695 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 696 | # define YYFPRINTF fprintf |
| 697 | # endif |
| 698 | |
| 699 | # define YYDPRINTF(Args) \ |
| 700 | do { \ |
| 701 | if (yydebug) \ |
| 702 | YYFPRINTF Args; \ |
| 703 | } while (0) |
| 704 | # define YYDSYMPRINT(Args) \ |
| 705 | do { \ |
| 706 | if (yydebug) \ |
| 707 | yysymprint Args; \ |
| 708 | } while (0) |
| 709 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 710 | multiple parsers can coexist. */ |
| 711 | int yydebug; |
| 712 | #else /* !YYDEBUG */ |
| 713 | # define YYDPRINTF(Args) |
| 714 | # define YYDSYMPRINT(Args) |
| 715 | #endif /* !YYDEBUG */ |
| 716 | |
| 717 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 718 | #ifndef YYINITDEPTH |
| 719 | # define YYINITDEPTH 200 |
| 720 | #endif |
| 721 | |
| 722 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 723 | if the built-in stack extension method is used). |
| 724 | |
| 725 | Do not make this value too large; the results are undefined if |
| 726 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
| 727 | evaluated with infinite-precision integer arithmetic. */ |
| 728 | |
| 729 | #if YYMAXDEPTH == 0 |
| 730 | # undef YYMAXDEPTH |
| 731 | #endif |
| 732 | |
| 733 | #ifndef YYMAXDEPTH |
| 734 | # define YYMAXDEPTH 10000 |
| 735 | #endif |
| 736 | |
| 737 | |
| 738 | |
| 739 | #if YYERROR_VERBOSE |
| 740 | |
| 741 | # ifndef yystrlen |
| 742 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 743 | # define yystrlen strlen |
| 744 | # else |
| 745 | /* Return the length of YYSTR. */ |
| 746 | static YYSIZE_T |
| 747 | # if defined (__STDC__) || defined (__cplusplus) |
| 748 | yystrlen (const char *yystr) |
| 749 | # else |
| 750 | yystrlen (yystr) |
| 751 | const char *yystr; |
| 752 | # endif |
| 753 | { |
| 754 | register const char *yys = yystr; |
| 755 | |
| 756 | while (*yys++ != '\0') |
| 757 | continue; |
| 758 | |
| 759 | return yys - yystr - 1; |
| 760 | } |
| 761 | # endif |
| 762 | # endif |
| 763 | |
| 764 | # ifndef yystpcpy |
| 765 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 766 | # define yystpcpy stpcpy |
| 767 | # else |
| 768 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 769 | YYDEST. */ |
| 770 | static char * |
| 771 | # if defined (__STDC__) || defined (__cplusplus) |
| 772 | yystpcpy (char *yydest, const char *yysrc) |
| 773 | # else |
| 774 | yystpcpy (yydest, yysrc) |
| 775 | char *yydest; |
| 776 | const char *yysrc; |
| 777 | # endif |
| 778 | { |
| 779 | register char *yyd = yydest; |
| 780 | register const char *yys = yysrc; |
| 781 | |
| 782 | while ((*yyd++ = *yys++) != '\0') |
| 783 | continue; |
| 784 | |
| 785 | return yyd - 1; |
| 786 | } |
| 787 | # endif |
| 788 | # endif |
| 789 | |
| 790 | #endif /* !YYERROR_VERBOSE */ |
| 791 | |
| 792 | |
| 793 | |
| 794 | #if YYDEBUG |
| 795 | /*-----------------------------. |
| 796 | | Print this symbol on YYOUT. | |
| 797 | `-----------------------------*/ |
| 798 | |
| 799 | static void |
| 800 | #if defined (__STDC__) || defined (__cplusplus) |
| 801 | yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue) |
| 802 | #else |
| 803 | yysymprint (yyout, yytype, yyvalue) |
| 804 | FILE* yyout; |
| 805 | int yytype; |
| 806 | YYSTYPE yyvalue; |
| 807 | #endif |
| 808 | { |
| 809 | /* Pacify ``unused variable'' warnings. */ |
| 810 | (void) yyvalue; |
| 811 | |
| 812 | if (yytype < YYNTOKENS) |
| 813 | { |
| 814 | YYFPRINTF (yyout, "token %s (", yytname[yytype]); |
| 815 | # ifdef YYPRINT |
| 816 | YYPRINT (yyout, yytoknum[yytype], yyvalue); |
| 817 | # endif |
| 818 | } |
| 819 | else |
| 820 | YYFPRINTF (yyout, "nterm %s (", yytname[yytype]); |
| 821 | |
| 822 | switch (yytype) |
| 823 | { |
| 824 | default: |
| 825 | break; |
| 826 | } |
| 827 | YYFPRINTF (yyout, ")"); |
| 828 | } |
| 829 | #endif /* YYDEBUG. */ |
| 830 | |
| 831 | |
| 832 | /*-----------------------------------------------. |
| 833 | | Release the memory associated to this symbol. | |
| 834 | `-----------------------------------------------*/ |
| 835 | |
| 836 | static void |
| 837 | #if defined (__STDC__) || defined (__cplusplus) |
| 838 | yydestruct (int yytype, YYSTYPE yyvalue) |
| 839 | #else |
| 840 | yydestruct (yytype, yyvalue) |
| 841 | int yytype; |
| 842 | YYSTYPE yyvalue; |
| 843 | #endif |
| 844 | { |
| 845 | /* Pacify ``unused variable'' warnings. */ |
| 846 | (void) yyvalue; |
| 847 | |
| 848 | switch (yytype) |
| 849 | { |
| 850 | default: |
| 851 | break; |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | |
| 856 | |
| 857 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
| 858 | into yyparse. The argument should have type void *. |
| 859 | It should actually point to an object. |
| 860 | Grammar actions can access the variable by casting it |
| 861 | to the proper pointer type. */ |
| 862 | |
| 863 | #ifdef YYPARSE_PARAM |
| 864 | # if defined (__STDC__) || defined (__cplusplus) |
| 865 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
| 866 | # define YYPARSE_PARAM_DECL |
| 867 | # else |
| 868 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM |
| 869 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
| 870 | # endif |
| 871 | #else /* !YYPARSE_PARAM */ |
| 872 | # define YYPARSE_PARAM_ARG |
| 873 | # define YYPARSE_PARAM_DECL |
| 874 | #endif /* !YYPARSE_PARAM */ |
| 875 | |
| 876 | /* Prevent warning if -Wstrict-prototypes. */ |
| 877 | #ifdef __GNUC__ |
| 878 | # ifdef YYPARSE_PARAM |
| 879 | int yyparse (void *); |
| 880 | # else |
| 881 | int yyparse (void); |
| 882 | # endif |
| 883 | #endif |
| 884 | |
| 885 | |
| 886 | /* The lookahead symbol. */ |
| 887 | int yychar; |
| 888 | |
| 889 | /* The semantic value of the lookahead symbol. */ |
| 890 | YYSTYPE yylval; |
| 891 | |
| 892 | /* Number of parse errors so far. */ |
| 893 | int yynerrs; |
| 894 | |
| 895 | |
| 896 | int |
| 897 | yyparse (YYPARSE_PARAM_ARG) |
| 898 | YYPARSE_PARAM_DECL |
| 899 | { |
| 900 | |
| 901 | register int yystate; |
| 902 | register int yyn; |
| 903 | int yyresult; |
| 904 | /* Number of tokens to shift before error messages enabled. */ |
| 905 | int yyerrstatus; |
| 906 | /* Lookahead token as an internal (translated) token number. */ |
| 907 | int yychar1 = 0; |
| 908 | |
| 909 | /* Three stacks and their tools: |
| 910 | `yyss': related to states, |
| 911 | `yyvs': related to semantic values, |
| 912 | `yyls': related to locations. |
| 913 | |
| 914 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 915 | to reallocate them elsewhere. */ |
| 916 | |
| 917 | /* The state stack. */ |
| 918 | short yyssa[YYINITDEPTH]; |
| 919 | short *yyss = yyssa; |
| 920 | register short *yyssp; |
| 921 | |
| 922 | /* The semantic value stack. */ |
| 923 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 924 | YYSTYPE *yyvs = yyvsa; |
| 925 | register YYSTYPE *yyvsp; |
| 926 | |
| 927 | |
| 928 | |
| 929 | #define YYPOPSTACK (yyvsp--, yyssp--) |
| 930 | |
| 931 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 932 | |
| 933 | /* The variables used to return semantic value and location from the |
| 934 | action routines. */ |
| 935 | YYSTYPE yyval; |
| 936 | |
| 937 | |
| 938 | /* When reducing, the number of symbols on the RHS of the reduced |
| 939 | rule. */ |
| 940 | int yylen; |
| 941 | |
| 942 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 943 | |
| 944 | yystate = 0; |
| 945 | yyerrstatus = 0; |
| 946 | yynerrs = 0; |
| 947 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 948 | |
| 949 | /* Initialize stack pointers. |
| 950 | Waste one element of value and location stack |
| 951 | so that they stay on the same level as the state stack. |
| 952 | The wasted elements are never initialized. */ |
| 953 | |
| 954 | yyssp = yyss; |
| 955 | yyvsp = yyvs; |
| 956 | |
| 957 | goto yysetstate; |
| 958 | |
| 959 | /*------------------------------------------------------------. |
| 960 | | yynewstate -- Push a new state, which is found in yystate. | |
| 961 | `------------------------------------------------------------*/ |
| 962 | yynewstate: |
| 963 | /* In all cases, when you get here, the value and location stacks |
| 964 | have just been pushed. so pushing a state here evens the stacks. |
| 965 | */ |
| 966 | yyssp++; |
| 967 | |
| 968 | yysetstate: |
| 969 | *yyssp = yystate; |
| 970 | |
| 971 | if (yyssp >= yyss + yystacksize - 1) |
| 972 | { |
| 973 | /* Get the current used size of the three stacks, in elements. */ |
| 974 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 975 | |
| 976 | #ifdef yyoverflow |
| 977 | { |
| 978 | /* Give user a chance to reallocate the stack. Use copies of |
| 979 | these so that the &'s don't force the real ones into |
| 980 | memory. */ |
| 981 | YYSTYPE *yyvs1 = yyvs; |
| 982 | short *yyss1 = yyss; |
| 983 | |
| 984 | |
| 985 | /* Each stack pointer address is followed by the size of the |
| 986 | data in use in that stack, in bytes. This used to be a |
| 987 | conditional around just the two extra args, but that might |
| 988 | be undefined if yyoverflow is a macro. */ |
| 989 | yyoverflow ("parser stack overflow", |
| 990 | &yyss1, yysize * sizeof (*yyssp), |
| 991 | &yyvs1, yysize * sizeof (*yyvsp), |
| 992 | |
| 993 | &yystacksize); |
| 994 | |
| 995 | yyss = yyss1; |
| 996 | yyvs = yyvs1; |
| 997 | } |
| 998 | #else /* no yyoverflow */ |
| 999 | # ifndef YYSTACK_RELOCATE |
| 1000 | goto yyoverflowlab; |
| 1001 | # else |
| 1002 | /* Extend the stack our own way. */ |
| 1003 | if (yystacksize >= YYMAXDEPTH) |
| 1004 | goto yyoverflowlab; |
| 1005 | yystacksize *= 2; |
| 1006 | if (yystacksize > YYMAXDEPTH) |
| 1007 | yystacksize = YYMAXDEPTH; |
| 1008 | |
| 1009 | { |
| 1010 | short *yyss1 = yyss; |
| 1011 | union yyalloc *yyptr = |
| 1012 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1013 | if (! yyptr) |
| 1014 | goto yyoverflowlab; |
| 1015 | YYSTACK_RELOCATE (yyss); |
| 1016 | YYSTACK_RELOCATE (yyvs); |
| 1017 | |
| 1018 | # undef YYSTACK_RELOCATE |
| 1019 | if (yyss1 != yyssa) |
| 1020 | YYSTACK_FREE (yyss1); |
| 1021 | } |
| 1022 | # endif |
| 1023 | #endif /* no yyoverflow */ |
| 1024 | |
| 1025 | yyssp = yyss + yysize - 1; |
| 1026 | yyvsp = yyvs + yysize - 1; |
| 1027 | |
| 1028 | |
| 1029 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1030 | (unsigned long int) yystacksize)); |
| 1031 | |
| 1032 | if (yyssp >= yyss + yystacksize - 1) |
| 1033 | YYABORT; |
| 1034 | } |
| 1035 | |
| 1036 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1037 | |
| 1038 | goto yybackup; |
| 1039 | |
| 1040 | /*-----------. |
| 1041 | | yybackup. | |
| 1042 | `-----------*/ |
| 1043 | yybackup: |
| 1044 | |
| 1045 | /* Do appropriate processing given the current state. */ |
| 1046 | /* Read a lookahead token if we need one and don't already have one. */ |
| 1047 | /* yyresume: */ |
| 1048 | |
| 1049 | /* First try to decide what to do without reference to lookahead token. */ |
| 1050 | |
| 1051 | yyn = yypact[yystate]; |
| 1052 | if (yyn == YYPACT_NINF) |
| 1053 | goto yydefault; |
| 1054 | |
| 1055 | /* Not known => get a lookahead token if don't already have one. */ |
| 1056 | |
| 1057 | /* yychar is either YYEMPTY or YYEOF |
| 1058 | or a valid token in external form. */ |
| 1059 | |
| 1060 | if (yychar == YYEMPTY) |
| 1061 | { |
| 1062 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 1063 | yychar = YYLEX; |
| 1064 | } |
| 1065 | |
| 1066 | /* Convert token to internal form (in yychar1) for indexing tables with. */ |
| 1067 | |
| 1068 | if (yychar <= 0) /* This means end of input. */ |
| 1069 | { |
| 1070 | yychar1 = 0; |
| 1071 | yychar = YYEOF; /* Don't call YYLEX any more. */ |
| 1072 | |
| 1073 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1074 | } |
| 1075 | else |
| 1076 | { |
| 1077 | yychar1 = YYTRANSLATE (yychar); |
| 1078 | |
| 1079 | /* We have to keep this `#if YYDEBUG', since we use variables |
| 1080 | which are defined only if `YYDEBUG' is set. */ |
| 1081 | YYDPRINTF ((stderr, "Next token is ")); |
| 1082 | YYDSYMPRINT ((stderr, yychar1, yylval)); |
| 1083 | YYDPRINTF ((stderr, "\n")); |
| 1084 | } |
| 1085 | |
| 1086 | /* If the proper action on seeing token YYCHAR1 is to reduce or to |
| 1087 | detect an error, take that action. */ |
| 1088 | yyn += yychar1; |
| 1089 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) |
| 1090 | goto yydefault; |
| 1091 | yyn = yytable[yyn]; |
| 1092 | if (yyn <= 0) |
| 1093 | { |
| 1094 | if (yyn == 0 || yyn == YYTABLE_NINF) |
| 1095 | goto yyerrlab; |
| 1096 | yyn = -yyn; |
| 1097 | goto yyreduce; |
| 1098 | } |
| 1099 | |
| 1100 | if (yyn == YYFINAL) |
| 1101 | YYACCEPT; |
| 1102 | |
| 1103 | /* Shift the lookahead token. */ |
| 1104 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
| 1105 | yychar, yytname[yychar1])); |
| 1106 | |
| 1107 | /* Discard the token being shifted unless it is eof. */ |
| 1108 | if (yychar != YYEOF) |
| 1109 | yychar = YYEMPTY; |
| 1110 | |
| 1111 | *++yyvsp = yylval; |
| 1112 | |
| 1113 | |
| 1114 | /* Count tokens shifted since error; after three, turn off error |
| 1115 | status. */ |
| 1116 | if (yyerrstatus) |
| 1117 | yyerrstatus--; |
| 1118 | |
| 1119 | yystate = yyn; |
| 1120 | goto yynewstate; |
| 1121 | |
| 1122 | |
| 1123 | /*-----------------------------------------------------------. |
| 1124 | | yydefault -- do the default action for the current state. | |
| 1125 | `-----------------------------------------------------------*/ |
| 1126 | yydefault: |
| 1127 | yyn = yydefact[yystate]; |
| 1128 | if (yyn == 0) |
| 1129 | goto yyerrlab; |
| 1130 | goto yyreduce; |
| 1131 | |
| 1132 | |
| 1133 | /*-----------------------------. |
| 1134 | | yyreduce -- Do a reduction. | |
| 1135 | `-----------------------------*/ |
| 1136 | yyreduce: |
| 1137 | /* yyn is the number of a rule to reduce with. */ |
| 1138 | yylen = yyr2[yyn]; |
| 1139 | |
| 1140 | /* If YYLEN is nonzero, implement the default value of the action: |
| 1141 | `$$ = $1'. |
| 1142 | |
| 1143 | Otherwise, the following line sets YYVAL to garbage. |
| 1144 | This behavior is undocumented and Bison |
| 1145 | users should not rely upon it. Assigning to YYVAL |
| 1146 | unconditionally makes the parser a bit smaller, and it avoids a |
| 1147 | GCC warning that YYVAL may be used uninitialized. */ |
| 1148 | yyval = yyvsp[1-yylen]; |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | #if YYDEBUG |
| 1153 | /* We have to keep this `#if YYDEBUG', since we use variables which |
| 1154 | are defined only if `YYDEBUG' is set. */ |
| 1155 | if (yydebug) |
| 1156 | { |
| 1157 | int yyi; |
| 1158 | |
| 1159 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
| 1160 | yyn - 1, yyrline[yyn]); |
| 1161 | |
| 1162 | /* Print the symbols being reduced, and their result. */ |
| 1163 | for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) |
| 1164 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 1165 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
| 1166 | } |
| 1167 | #endif |
| 1168 | switch (yyn) |
| 1169 | { |
| 1170 | case 8: |
| 1171 | #line 96 "zconf.y" |
| 1172 | { zconfprint("unexpected 'endmenu' statement"); } |
| 1173 | break; |
| 1174 | |
| 1175 | case 9: |
| 1176 | #line 97 "zconf.y" |
| 1177 | { zconfprint("unexpected 'endif' statement"); } |
| 1178 | break; |
| 1179 | |
| 1180 | case 10: |
| 1181 | #line 98 "zconf.y" |
| 1182 | { zconfprint("unexpected 'endchoice' statement"); } |
| 1183 | break; |
| 1184 | |
| 1185 | case 11: |
| 1186 | #line 99 "zconf.y" |
| 1187 | { zconfprint("syntax error"); yyerrok; } |
| 1188 | break; |
| 1189 | |
| 1190 | case 17: |
| 1191 | #line 114 "zconf.y" |
| 1192 | { |
| 1193 | struct symbol *sym = sym_lookup(yyvsp[0].string, 0); |
| 1194 | sym->flags |= SYMBOL_OPTIONAL; |
| 1195 | menu_add_entry(sym); |
| 1196 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string); |
| 1197 | } |
| 1198 | break; |
| 1199 | |
| 1200 | case 18: |
| 1201 | #line 122 "zconf.y" |
| 1202 | { |
| 1203 | menu_end_entry(); |
| 1204 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); |
| 1205 | } |
| 1206 | break; |
| 1207 | |
| 1208 | case 23: |
| 1209 | #line 133 "zconf.y" |
| 1210 | { } |
| 1211 | break; |
| 1212 | |
| 1213 | case 24: |
| 1214 | #line 136 "zconf.y" |
| 1215 | { |
| 1216 | menu_set_type(S_TRISTATE); |
| 1217 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); |
| 1218 | } |
| 1219 | break; |
| 1220 | |
| 1221 | case 25: |
| 1222 | #line 142 "zconf.y" |
| 1223 | { |
| 1224 | menu_set_type(S_BOOLEAN); |
| 1225 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); |
| 1226 | } |
| 1227 | break; |
| 1228 | |
| 1229 | case 26: |
| 1230 | #line 148 "zconf.y" |
| 1231 | { |
| 1232 | menu_set_type(S_INT); |
| 1233 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); |
| 1234 | } |
| 1235 | break; |
| 1236 | |
| 1237 | case 27: |
| 1238 | #line 154 "zconf.y" |
| 1239 | { |
| 1240 | menu_set_type(S_HEX); |
| 1241 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); |
| 1242 | } |
| 1243 | break; |
| 1244 | |
| 1245 | case 28: |
| 1246 | #line 160 "zconf.y" |
| 1247 | { |
| 1248 | menu_set_type(S_STRING); |
| 1249 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); |
| 1250 | } |
| 1251 | break; |
| 1252 | |
| 1253 | case 29: |
| 1254 | #line 166 "zconf.y" |
| 1255 | { |
| 1256 | menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); |
| 1257 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
| 1258 | } |
| 1259 | break; |
| 1260 | |
| 1261 | case 30: |
| 1262 | #line 172 "zconf.y" |
| 1263 | { |
| 1264 | menu_add_prop(P_DEFAULT, NULL, yyvsp[-1].symbol, yyvsp[0].expr); |
| 1265 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); |
| 1266 | } |
| 1267 | break; |
| 1268 | |
| 1269 | case 31: |
| 1270 | #line 180 "zconf.y" |
| 1271 | { |
| 1272 | struct symbol *sym = sym_lookup(NULL, 0); |
| 1273 | sym->flags |= SYMBOL_CHOICE; |
| 1274 | menu_add_entry(sym); |
| 1275 | menu_add_prop(P_CHOICE, NULL, NULL, NULL); |
| 1276 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); |
| 1277 | } |
| 1278 | break; |
| 1279 | |
| 1280 | case 32: |
| 1281 | #line 189 "zconf.y" |
| 1282 | { |
| 1283 | menu_end_entry(); |
| 1284 | menu_add_menu(); |
| 1285 | } |
| 1286 | break; |
| 1287 | |
| 1288 | case 33: |
| 1289 | #line 195 "zconf.y" |
| 1290 | { |
| 1291 | if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) { |
| 1292 | menu_end_menu(); |
| 1293 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); |
| 1294 | } |
| 1295 | } |
| 1296 | break; |
| 1297 | |
| 1298 | case 35: |
| 1299 | #line 205 "zconf.y" |
| 1300 | { |
| 1301 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); |
| 1302 | zconfnerrs++; |
| 1303 | } |
| 1304 | break; |
| 1305 | |
| 1306 | case 41: |
| 1307 | #line 219 "zconf.y" |
| 1308 | { |
| 1309 | menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); |
| 1310 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
| 1311 | } |
| 1312 | break; |
| 1313 | |
| 1314 | case 42: |
| 1315 | #line 225 "zconf.y" |
| 1316 | { |
| 1317 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
| 1318 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); |
| 1319 | } |
| 1320 | break; |
| 1321 | |
| 1322 | case 43: |
| 1323 | #line 231 "zconf.y" |
| 1324 | { |
| 1325 | menu_add_prop(P_DEFAULT, NULL, yyvsp[0].symbol, NULL); |
| 1326 | //current_choice->prop->def = ; |
| 1327 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); |
| 1328 | } |
| 1329 | break; |
| 1330 | |
| 1331 | case 46: |
| 1332 | #line 245 "zconf.y" |
| 1333 | { |
| 1334 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); |
| 1335 | menu_add_entry(NULL); |
| 1336 | //current_entry->prompt = menu_add_prop(T_IF, NULL, NULL, ); |
| 1337 | menu_add_dep(yyvsp[0].expr); |
| 1338 | menu_end_entry(); |
| 1339 | menu_add_menu(); |
| 1340 | } |
| 1341 | break; |
| 1342 | |
| 1343 | case 47: |
| 1344 | #line 255 "zconf.y" |
| 1345 | { |
| 1346 | if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) { |
| 1347 | menu_end_menu(); |
| 1348 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); |
| 1349 | } |
| 1350 | } |
| 1351 | break; |
| 1352 | |
| 1353 | case 49: |
| 1354 | #line 265 "zconf.y" |
| 1355 | { |
| 1356 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); |
| 1357 | zconfnerrs++; |
| 1358 | } |
| 1359 | break; |
| 1360 | |
| 1361 | case 54: |
| 1362 | #line 280 "zconf.y" |
| 1363 | { |
| 1364 | menu_add_entry(NULL); |
| 1365 | menu_add_prop(P_MENU, yyvsp[0].string, NULL, NULL); |
| 1366 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); |
| 1367 | } |
| 1368 | break; |
| 1369 | |
| 1370 | case 55: |
| 1371 | #line 287 "zconf.y" |
| 1372 | { |
| 1373 | menu_end_entry(); |
| 1374 | menu_add_menu(); |
| 1375 | } |
| 1376 | break; |
| 1377 | |
| 1378 | case 56: |
| 1379 | #line 293 "zconf.y" |
| 1380 | { |
| 1381 | if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) { |
| 1382 | menu_end_menu(); |
| 1383 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); |
| 1384 | } |
| 1385 | } |
| 1386 | break; |
| 1387 | |
| 1388 | case 58: |
| 1389 | #line 303 "zconf.y" |
| 1390 | { |
| 1391 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); |
| 1392 | zconfnerrs++; |
| 1393 | } |
| 1394 | break; |
| 1395 | |
| 1396 | case 63: |
| 1397 | #line 313 "zconf.y" |
| 1398 | { zconfprint("invalid menu option"); yyerrok; } |
| 1399 | break; |
| 1400 | |
| 1401 | case 64: |
| 1402 | #line 317 "zconf.y" |
| 1403 | { |
| 1404 | yyval.string = yyvsp[0].string; |
| 1405 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string); |
| 1406 | } |
| 1407 | break; |
| 1408 | |
| 1409 | case 65: |
| 1410 | #line 323 "zconf.y" |
| 1411 | { |
| 1412 | zconf_nextfile(yyvsp[-1].string); |
| 1413 | } |
| 1414 | break; |
| 1415 | |
| 1416 | case 66: |
| 1417 | #line 330 "zconf.y" |
| 1418 | { |
| 1419 | menu_add_entry(NULL); |
| 1420 | menu_add_prop(P_COMMENT, yyvsp[0].string, NULL, NULL); |
| 1421 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); |
| 1422 | } |
| 1423 | break; |
| 1424 | |
| 1425 | case 67: |
| 1426 | #line 337 "zconf.y" |
| 1427 | { |
| 1428 | menu_end_entry(); |
| 1429 | } |
| 1430 | break; |
| 1431 | |
| 1432 | case 68: |
| 1433 | #line 344 "zconf.y" |
| 1434 | { |
| 1435 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); |
| 1436 | zconf_starthelp(); |
| 1437 | } |
| 1438 | break; |
| 1439 | |
| 1440 | case 69: |
| 1441 | #line 350 "zconf.y" |
| 1442 | { |
| 1443 | current_entry->sym->help = yyvsp[0].string; |
| 1444 | } |
| 1445 | break; |
| 1446 | |
| 1447 | case 72: |
| 1448 | #line 359 "zconf.y" |
| 1449 | { } |
| 1450 | break; |
| 1451 | |
| 1452 | case 73: |
| 1453 | #line 362 "zconf.y" |
| 1454 | { |
| 1455 | menu_add_dep(yyvsp[0].expr); |
| 1456 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); |
| 1457 | } |
| 1458 | break; |
| 1459 | |
| 1460 | case 74: |
| 1461 | #line 367 "zconf.y" |
| 1462 | { |
| 1463 | menu_add_dep(yyvsp[0].expr); |
| 1464 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); |
| 1465 | } |
| 1466 | break; |
| 1467 | |
| 1468 | case 75: |
| 1469 | #line 372 "zconf.y" |
| 1470 | { |
| 1471 | menu_add_dep(yyvsp[0].expr); |
| 1472 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); |
| 1473 | } |
| 1474 | break; |
| 1475 | |
| 1476 | case 77: |
| 1477 | #line 382 "zconf.y" |
| 1478 | { |
| 1479 | menu_add_prop(P_PROMPT, yyvsp[0].string, NULL, NULL); |
| 1480 | } |
| 1481 | break; |
| 1482 | |
| 1483 | case 78: |
| 1484 | #line 386 "zconf.y" |
| 1485 | { |
| 1486 | menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[0].expr); |
| 1487 | } |
| 1488 | break; |
| 1489 | |
| 1490 | case 81: |
| 1491 | #line 394 "zconf.y" |
| 1492 | { yyval.token = T_ENDMENU; } |
| 1493 | break; |
| 1494 | |
| 1495 | case 82: |
| 1496 | #line 395 "zconf.y" |
| 1497 | { yyval.token = T_ENDCHOICE; } |
| 1498 | break; |
| 1499 | |
| 1500 | case 83: |
| 1501 | #line 396 "zconf.y" |
| 1502 | { yyval.token = T_ENDIF; } |
| 1503 | break; |
| 1504 | |
| 1505 | case 86: |
| 1506 | #line 402 "zconf.y" |
| 1507 | { yyval.expr = NULL; } |
| 1508 | break; |
| 1509 | |
| 1510 | case 87: |
| 1511 | #line 403 "zconf.y" |
| 1512 | { yyval.expr = yyvsp[0].expr; } |
| 1513 | break; |
| 1514 | |
| 1515 | case 88: |
| 1516 | #line 406 "zconf.y" |
| 1517 | { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); } |
| 1518 | break; |
| 1519 | |
| 1520 | case 89: |
| 1521 | #line 407 "zconf.y" |
| 1522 | { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); } |
| 1523 | break; |
| 1524 | |
| 1525 | case 90: |
| 1526 | #line 408 "zconf.y" |
| 1527 | { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); } |
| 1528 | break; |
| 1529 | |
| 1530 | case 91: |
| 1531 | #line 409 "zconf.y" |
| 1532 | { yyval.expr = yyvsp[-1].expr; } |
| 1533 | break; |
| 1534 | |
| 1535 | case 92: |
| 1536 | #line 410 "zconf.y" |
| 1537 | { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); } |
| 1538 | break; |
| 1539 | |
| 1540 | case 93: |
| 1541 | #line 411 "zconf.y" |
| 1542 | { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); } |
| 1543 | break; |
| 1544 | |
| 1545 | case 94: |
| 1546 | #line 412 "zconf.y" |
| 1547 | { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); } |
| 1548 | break; |
| 1549 | |
| 1550 | case 95: |
| 1551 | #line 415 "zconf.y" |
| 1552 | { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); } |
| 1553 | break; |
| 1554 | |
| 1555 | case 96: |
| 1556 | #line 416 "zconf.y" |
| 1557 | { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); } |
| 1558 | break; |
| 1559 | |
| 1560 | |
| 1561 | } |
| 1562 | |
| 1563 | /* Line 1016 of /usr/share/bison/yacc.c. */ |
| 1564 | #line 1565 "zconf.tab.c" |
| 1565 | |
| 1566 | yyvsp -= yylen; |
| 1567 | yyssp -= yylen; |
| 1568 | |
| 1569 | |
| 1570 | #if YYDEBUG |
| 1571 | if (yydebug) |
| 1572 | { |
| 1573 | short *yyssp1 = yyss - 1; |
| 1574 | YYFPRINTF (stderr, "state stack now"); |
| 1575 | while (yyssp1 != yyssp) |
| 1576 | YYFPRINTF (stderr, " %d", *++yyssp1); |
| 1577 | YYFPRINTF (stderr, "\n"); |
| 1578 | } |
| 1579 | #endif |
| 1580 | |
| 1581 | *++yyvsp = yyval; |
| 1582 | |
| 1583 | |
| 1584 | /* Now `shift' the result of the reduction. Determine what state |
| 1585 | that goes to, based on the state we popped back to and the rule |
| 1586 | number reduced by. */ |
| 1587 | |
| 1588 | yyn = yyr1[yyn]; |
| 1589 | |
| 1590 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 1591 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 1592 | yystate = yytable[yystate]; |
| 1593 | else |
| 1594 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 1595 | |
| 1596 | goto yynewstate; |
| 1597 | |
| 1598 | |
| 1599 | /*------------------------------------. |
| 1600 | | yyerrlab -- here on detecting error | |
| 1601 | `------------------------------------*/ |
| 1602 | yyerrlab: |
| 1603 | /* If not already recovering from an error, report this error. */ |
| 1604 | if (!yyerrstatus) |
| 1605 | { |
| 1606 | ++yynerrs; |
| 1607 | #if YYERROR_VERBOSE |
| 1608 | yyn = yypact[yystate]; |
| 1609 | |
| 1610 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
| 1611 | { |
| 1612 | YYSIZE_T yysize = 0; |
| 1613 | int yytype = YYTRANSLATE (yychar); |
| 1614 | char *yymsg; |
| 1615 | int yyx, yycount; |
| 1616 | |
| 1617 | yycount = 0; |
| 1618 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 1619 | YYCHECK. */ |
| 1620 | for (yyx = yyn < 0 ? -yyn : 0; |
| 1621 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) |
| 1622 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1623 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; |
| 1624 | yysize += yystrlen ("parse error, unexpected ") + 1; |
| 1625 | yysize += yystrlen (yytname[yytype]); |
| 1626 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 1627 | if (yymsg != 0) |
| 1628 | { |
| 1629 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); |
| 1630 | yyp = yystpcpy (yyp, yytname[yytype]); |
| 1631 | |
| 1632 | if (yycount < 5) |
| 1633 | { |
| 1634 | yycount = 0; |
| 1635 | for (yyx = yyn < 0 ? -yyn : 0; |
| 1636 | yyx < (int) (sizeof (yytname) / sizeof (char *)); |
| 1637 | yyx++) |
| 1638 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1639 | { |
| 1640 | const char *yyq = ! yycount ? ", expecting " : " or "; |
| 1641 | yyp = yystpcpy (yyp, yyq); |
| 1642 | yyp = yystpcpy (yyp, yytname[yyx]); |
| 1643 | yycount++; |
| 1644 | } |
| 1645 | } |
| 1646 | yyerror (yymsg); |
| 1647 | YYSTACK_FREE (yymsg); |
| 1648 | } |
| 1649 | else |
| 1650 | yyerror ("parse error; also virtual memory exhausted"); |
| 1651 | } |
| 1652 | else |
| 1653 | #endif /* YYERROR_VERBOSE */ |
| 1654 | yyerror ("parse error"); |
| 1655 | } |
| 1656 | goto yyerrlab1; |
| 1657 | |
| 1658 | |
| 1659 | /*----------------------------------------------------. |
| 1660 | | yyerrlab1 -- error raised explicitly by an action. | |
| 1661 | `----------------------------------------------------*/ |
| 1662 | yyerrlab1: |
| 1663 | if (yyerrstatus == 3) |
| 1664 | { |
| 1665 | /* If just tried and failed to reuse lookahead token after an |
| 1666 | error, discard it. */ |
| 1667 | |
| 1668 | /* Return failure if at end of input. */ |
| 1669 | if (yychar == YYEOF) |
| 1670 | { |
| 1671 | /* Pop the error token. */ |
| 1672 | YYPOPSTACK; |
| 1673 | /* Pop the rest of the stack. */ |
| 1674 | while (yyssp > yyss) |
| 1675 | { |
| 1676 | YYDPRINTF ((stderr, "Error: popping ")); |
| 1677 | YYDSYMPRINT ((stderr, |
| 1678 | yystos[*yyssp], |
| 1679 | *yyvsp)); |
| 1680 | YYDPRINTF ((stderr, "\n")); |
| 1681 | yydestruct (yystos[*yyssp], *yyvsp); |
| 1682 | YYPOPSTACK; |
| 1683 | } |
| 1684 | YYABORT; |
| 1685 | } |
| 1686 | |
| 1687 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
| 1688 | yychar, yytname[yychar1])); |
| 1689 | yydestruct (yychar1, yylval); |
| 1690 | yychar = YYEMPTY; |
| 1691 | } |
| 1692 | |
| 1693 | /* Else will try to reuse lookahead token after shifting the error |
| 1694 | token. */ |
| 1695 | |
| 1696 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1697 | |
| 1698 | for (;;) |
| 1699 | { |
| 1700 | yyn = yypact[yystate]; |
| 1701 | if (yyn != YYPACT_NINF) |
| 1702 | { |
| 1703 | yyn += YYTERROR; |
| 1704 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 1705 | { |
| 1706 | yyn = yytable[yyn]; |
| 1707 | if (0 < yyn) |
| 1708 | break; |
| 1709 | } |
| 1710 | } |
| 1711 | |
| 1712 | /* Pop the current state because it cannot handle the error token. */ |
| 1713 | if (yyssp == yyss) |
| 1714 | YYABORT; |
| 1715 | |
| 1716 | YYDPRINTF ((stderr, "Error: popping ")); |
| 1717 | YYDSYMPRINT ((stderr, |
| 1718 | yystos[*yyssp], *yyvsp)); |
| 1719 | YYDPRINTF ((stderr, "\n")); |
| 1720 | |
| 1721 | yydestruct (yystos[yystate], *yyvsp); |
| 1722 | yyvsp--; |
| 1723 | yystate = *--yyssp; |
| 1724 | |
| 1725 | |
| 1726 | #if YYDEBUG |
| 1727 | if (yydebug) |
| 1728 | { |
| 1729 | short *yyssp1 = yyss - 1; |
| 1730 | YYFPRINTF (stderr, "Error: state stack now"); |
| 1731 | while (yyssp1 != yyssp) |
| 1732 | YYFPRINTF (stderr, " %d", *++yyssp1); |
| 1733 | YYFPRINTF (stderr, "\n"); |
| 1734 | } |
| 1735 | #endif |
| 1736 | } |
| 1737 | |
| 1738 | if (yyn == YYFINAL) |
| 1739 | YYACCEPT; |
| 1740 | |
| 1741 | YYDPRINTF ((stderr, "Shifting error token, ")); |
| 1742 | |
| 1743 | *++yyvsp = yylval; |
| 1744 | |
| 1745 | |
| 1746 | yystate = yyn; |
| 1747 | goto yynewstate; |
| 1748 | |
| 1749 | |
| 1750 | /*-------------------------------------. |
| 1751 | | yyacceptlab -- YYACCEPT comes here. | |
| 1752 | `-------------------------------------*/ |
| 1753 | yyacceptlab: |
| 1754 | yyresult = 0; |
| 1755 | goto yyreturn; |
| 1756 | |
| 1757 | /*-----------------------------------. |
| 1758 | | yyabortlab -- YYABORT comes here. | |
| 1759 | `-----------------------------------*/ |
| 1760 | yyabortlab: |
| 1761 | yyresult = 1; |
| 1762 | goto yyreturn; |
| 1763 | |
| 1764 | #ifndef yyoverflow |
| 1765 | /*----------------------------------------------. |
| 1766 | | yyoverflowlab -- parser overflow comes here. | |
| 1767 | `----------------------------------------------*/ |
| 1768 | yyoverflowlab: |
| 1769 | yyerror ("parser stack overflow"); |
| 1770 | yyresult = 2; |
| 1771 | /* Fall through. */ |
| 1772 | #endif |
| 1773 | |
| 1774 | yyreturn: |
| 1775 | #ifndef yyoverflow |
| 1776 | if (yyss != yyssa) |
| 1777 | YYSTACK_FREE (yyss); |
| 1778 | #endif |
| 1779 | return yyresult; |
| 1780 | } |
| 1781 | |
| 1782 | |
| 1783 | #line 419 "zconf.y" |
| 1784 | |
| 1785 | |
| 1786 | void conf_parse(const char *name) |
| 1787 | { |
| 1788 | zconf_initscan(name); |
| 1789 | |
| 1790 | sym_init(); |
| 1791 | menu_init(); |
| 1792 | rootmenu.prompt = menu_add_prop(P_MENU, "BusyBox Configuration", NULL, NULL); |
| 1793 | |
| 1794 | //zconfdebug = 1; |
| 1795 | zconfparse(); |
| 1796 | if (zconfnerrs) |
| 1797 | exit(1); |
| 1798 | menu_finalize(&rootmenu); |
| 1799 | |
| 1800 | modules_sym = sym_lookup("MODULES", 0); |
| 1801 | |
| 1802 | sym_change_count = 1; |
| 1803 | } |
| 1804 | |
| 1805 | const char *zconf_tokenname(int token) |
| 1806 | { |
| 1807 | switch (token) { |
| 1808 | case T_MENU: return "menu"; |
| 1809 | case T_ENDMENU: return "endmenu"; |
| 1810 | case T_CHOICE: return "choice"; |
| 1811 | case T_ENDCHOICE: return "endchoice"; |
| 1812 | case T_IF: return "if"; |
| 1813 | case T_ENDIF: return "endif"; |
| 1814 | } |
| 1815 | return "<token>"; |
| 1816 | } |
| 1817 | |
| 1818 | static bool zconf_endtoken(int token, int starttoken, int endtoken) |
| 1819 | { |
| 1820 | if (token != endtoken) { |
| 1821 | zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); |
| 1822 | zconfnerrs++; |
| 1823 | return false; |
| 1824 | } |
| 1825 | if (current_menu->file != current_file) { |
| 1826 | zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); |
| 1827 | zconfprint("location of the '%s'", zconf_tokenname(starttoken)); |
| 1828 | zconfnerrs++; |
| 1829 | return false; |
| 1830 | } |
| 1831 | return true; |
| 1832 | } |
| 1833 | |
| 1834 | static void zconfprint(const char *err, ...) |
| 1835 | { |
| 1836 | va_list ap; |
| 1837 | |
| 1838 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); |
| 1839 | va_start(ap, err); |
| 1840 | vfprintf(stderr, err, ap); |
| 1841 | va_end(ap); |
| 1842 | fprintf(stderr, "\n"); |
| 1843 | } |
| 1844 | |
| 1845 | static void zconferror(const char *err) |
| 1846 | { |
| 1847 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err); |
| 1848 | } |
| 1849 | |
| 1850 | void print_quoted_string(FILE *out, const char *str) |
| 1851 | { |
| 1852 | const char *p; |
| 1853 | int len; |
| 1854 | |
| 1855 | putc('"', out); |
| 1856 | while ((p = strchr(str, '"'))) { |
| 1857 | len = p - str; |
| 1858 | if (len) |
| 1859 | fprintf(out, "%.*s", len, str); |
| 1860 | fputs("\\\"", out); |
| 1861 | str = p + 1; |
| 1862 | } |
| 1863 | fputs(str, out); |
| 1864 | putc('"', out); |
| 1865 | } |
| 1866 | |
| 1867 | void print_symbol(FILE *out, struct menu *menu) |
| 1868 | { |
| 1869 | struct symbol *sym = menu->sym; |
| 1870 | struct property *prop; |
| 1871 | |
| 1872 | //sym->flags |= SYMBOL_PRINTED; |
| 1873 | |
| 1874 | if (sym_is_choice(sym)) |
| 1875 | fprintf(out, "choice\n"); |
| 1876 | else |
| 1877 | fprintf(out, "config %s\n", sym->name); |
| 1878 | switch (sym->type) { |
| 1879 | case S_BOOLEAN: |
| 1880 | fputs(" boolean\n", out); |
| 1881 | break; |
| 1882 | case S_TRISTATE: |
| 1883 | fputs(" tristate\n", out); |
| 1884 | break; |
| 1885 | case S_STRING: |
| 1886 | fputs(" string\n", out); |
| 1887 | break; |
| 1888 | case S_INT: |
| 1889 | fputs(" integer\n", out); |
| 1890 | break; |
| 1891 | case S_HEX: |
| 1892 | fputs(" hex\n", out); |
| 1893 | break; |
| 1894 | default: |
| 1895 | fputs(" ???\n", out); |
| 1896 | break; |
| 1897 | } |
| 1898 | #if 0 |
| 1899 | if (!expr_is_yes(sym->dep)) { |
| 1900 | fputs(" depends ", out); |
| 1901 | expr_fprint(sym->dep, out); |
| 1902 | fputc('\n', out); |
| 1903 | } |
| 1904 | #endif |
| 1905 | for (prop = sym->prop; prop; prop = prop->next) { |
| 1906 | if (prop->menu != menu) |
| 1907 | continue; |
| 1908 | switch (prop->type) { |
| 1909 | case P_PROMPT: |
| 1910 | fputs(" prompt ", out); |
| 1911 | print_quoted_string(out, prop->text); |
| 1912 | if (prop->def) { |
| 1913 | fputc(' ', out); |
| 1914 | if (prop->def->flags & SYMBOL_CONST) |
| 1915 | print_quoted_string(out, prop->def->name); |
| 1916 | else |
| 1917 | fputs(prop->def->name, out); |
| 1918 | } |
| 1919 | if (!expr_is_yes(E_EXPR(prop->visible))) { |
| 1920 | fputs(" if ", out); |
| 1921 | expr_fprint(E_EXPR(prop->visible), out); |
| 1922 | } |
| 1923 | fputc('\n', out); |
| 1924 | break; |
| 1925 | case P_DEFAULT: |
| 1926 | fputs( " default ", out); |
| 1927 | print_quoted_string(out, prop->def->name); |
| 1928 | if (!expr_is_yes(E_EXPR(prop->visible))) { |
| 1929 | fputs(" if ", out); |
| 1930 | expr_fprint(E_EXPR(prop->visible), out); |
| 1931 | } |
| 1932 | fputc('\n', out); |
| 1933 | break; |
| 1934 | case P_CHOICE: |
| 1935 | fputs(" #choice value\n", out); |
| 1936 | break; |
| 1937 | default: |
| 1938 | fprintf(out, " unknown prop %d!\n", prop->type); |
| 1939 | break; |
| 1940 | } |
| 1941 | } |
| 1942 | if (sym->help) { |
| 1943 | int len = strlen(sym->help); |
| 1944 | while (sym->help[--len] == '\n') |
| 1945 | sym->help[len] = 0; |
| 1946 | fprintf(out, " help\n%s\n", sym->help); |
| 1947 | } |
| 1948 | fputc('\n', out); |
| 1949 | } |
| 1950 | |
| 1951 | void zconfdump(FILE *out) |
| 1952 | { |
| 1953 | //struct file *file; |
| 1954 | struct property *prop; |
| 1955 | struct symbol *sym; |
| 1956 | struct menu *menu; |
| 1957 | |
| 1958 | menu = rootmenu.list; |
| 1959 | while (menu) { |
| 1960 | if ((sym = menu->sym)) |
| 1961 | print_symbol(out, menu); |
| 1962 | else if ((prop = menu->prompt)) { |
| 1963 | switch (prop->type) { |
| 1964 | //case T_MAINMENU: |
| 1965 | // fputs("\nmainmenu ", out); |
| 1966 | // print_quoted_string(out, prop->text); |
| 1967 | // fputs("\n", out); |
| 1968 | // break; |
| 1969 | case P_COMMENT: |
| 1970 | fputs("\ncomment ", out); |
| 1971 | print_quoted_string(out, prop->text); |
| 1972 | fputs("\n", out); |
| 1973 | break; |
| 1974 | case P_MENU: |
| 1975 | fputs("\nmenu ", out); |
| 1976 | print_quoted_string(out, prop->text); |
| 1977 | fputs("\n", out); |
| 1978 | break; |
| 1979 | //case T_SOURCE: |
| 1980 | // fputs("\nsource ", out); |
| 1981 | // print_quoted_string(out, prop->text); |
| 1982 | // fputs("\n", out); |
| 1983 | // break; |
| 1984 | //case T_IF: |
| 1985 | // fputs("\nif\n", out); |
| 1986 | default: |
| 1987 | ; |
| 1988 | } |
| 1989 | if (!expr_is_yes(E_EXPR(prop->visible))) { |
| 1990 | fputs(" depends ", out); |
| 1991 | expr_fprint(E_EXPR(prop->visible), out); |
| 1992 | fputc('\n', out); |
| 1993 | } |
| 1994 | fputs("\n", out); |
| 1995 | } |
| 1996 | |
| 1997 | if (menu->list) |
| 1998 | menu = menu->list; |
| 1999 | else if (menu->next) |
| 2000 | menu = menu->next; |
| 2001 | else while ((menu = menu->parent)) { |
| 2002 | if (menu->prompt && menu->prompt->type == P_MENU) |
| 2003 | fputs("\nendmenu\n", out); |
| 2004 | if (menu->next) { |
| 2005 | menu = menu->next; |
| 2006 | break; |
| 2007 | } |
| 2008 | } |
| 2009 | } |
| 2010 | } |
| 2011 | |
| 2012 | #include "lex.zconf.c" |
| 2013 | #include "confdata.c" |
| 2014 | #include "expr.c" |
| 2015 | #include "symbol.c" |
| 2016 | #include "menu.c" |
| 2017 | |