b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 3.8.2. */ |
| 2 | |
| 3 | /* Bison implementation for Yacc-like parsers in C |
| 4 | |
| 5 | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, |
| 6 | 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 3 of the License, or |
| 11 | (at your option) 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, see <https://www.gnu.org/licenses/>. */ |
| 20 | |
| 21 | /* As a special exception, you may create a larger work that contains |
| 22 | part or all of the Bison parser skeleton and distribute that work |
| 23 | under terms of your choice, so long as that work isn't itself a |
| 24 | parser generator using the skeleton or a modified version thereof |
| 25 | as a parser skeleton. Alternatively, if you modify or redistribute |
| 26 | the parser skeleton itself, you may (at your option) remove this |
| 27 | special exception, which will cause the skeleton and the resulting |
| 28 | Bison output files to be licensed under the GNU General Public |
| 29 | License without this special exception. |
| 30 | |
| 31 | This special exception was added by the Free Software Foundation in |
| 32 | version 2.2 of Bison. */ |
| 33 | |
| 34 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
| 35 | simplifying the original so-called "semantic" parser. */ |
| 36 | |
| 37 | /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
| 38 | especially those whose name start with YY_ or yy_. They are |
| 39 | private implementation details that can be changed or removed. */ |
| 40 | |
| 41 | /* All symbols defined below should begin with yy or YY, to avoid |
| 42 | infringing on user name space. This should be done even for local |
| 43 | variables, as they might otherwise be expanded by user macros. |
| 44 | There are some unavoidable exceptions within include files to |
| 45 | define necessary library symbols; they are noted "INFRINGES ON |
| 46 | USER NAME SPACE" below. */ |
| 47 | |
| 48 | /* Identify Bison output, and Bison version. */ |
| 49 | #define YYBISON 30802 |
| 50 | |
| 51 | /* Bison version string. */ |
| 52 | #define YYBISON_VERSION "3.8.2" |
| 53 | |
| 54 | /* Skeleton name. */ |
| 55 | #define YYSKELETON_NAME "yacc.c" |
| 56 | |
| 57 | /* Pure parsers. */ |
| 58 | #define YYPURE 0 |
| 59 | |
| 60 | /* Push parsers. */ |
| 61 | #define YYPUSH 0 |
| 62 | |
| 63 | /* Pull parsers. */ |
| 64 | #define YYPULL 1 |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | /* First part of user prologue. */ |
| 70 | |
| 71 | |
| 72 | #include <ctype.h> |
| 73 | #include <stdarg.h> |
| 74 | #include <stdio.h> |
| 75 | #include <stdlib.h> |
| 76 | #include <string.h> |
| 77 | #include <stdbool.h> |
| 78 | |
| 79 | #include "lkc.h" |
| 80 | #include "internal.h" |
| 81 | |
| 82 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
| 83 | |
| 84 | #define PRINTD 0x0001 |
| 85 | #define DEBUG_PARSE 0x0002 |
| 86 | |
| 87 | int cdebug = PRINTD; |
| 88 | |
| 89 | static void yyerror(const char *err); |
| 90 | static void zconfprint(const char *err, ...); |
| 91 | static void zconf_error(const char *err, ...); |
| 92 | static bool zconf_endtoken(const char *tokenname, |
| 93 | const char *expected_tokenname); |
| 94 | |
| 95 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; |
| 96 | |
| 97 | struct menu *current_menu, *current_entry; |
| 98 | |
| 99 | |
| 100 | |
| 101 | # ifndef YY_CAST |
| 102 | # ifdef __cplusplus |
| 103 | # define YY_CAST(Type, Val) static_cast<Type> (Val) |
| 104 | # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
| 105 | # else |
| 106 | # define YY_CAST(Type, Val) ((Type) (Val)) |
| 107 | # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
| 108 | # endif |
| 109 | # endif |
| 110 | # ifndef YY_NULLPTR |
| 111 | # if defined __cplusplus |
| 112 | # if 201103L <= __cplusplus |
| 113 | # define YY_NULLPTR nullptr |
| 114 | # else |
| 115 | # define YY_NULLPTR 0 |
| 116 | # endif |
| 117 | # else |
| 118 | # define YY_NULLPTR ((void*)0) |
| 119 | # endif |
| 120 | # endif |
| 121 | |
| 122 | #include "parser.tab.h" |
| 123 | /* Symbol kind. */ |
| 124 | enum yysymbol_kind_t |
| 125 | { |
| 126 | YYSYMBOL_YYEMPTY = -2, |
| 127 | YYSYMBOL_YYEOF = 0, /* "end of file" */ |
| 128 | YYSYMBOL_YYerror = 1, /* error */ |
| 129 | YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ |
| 130 | YYSYMBOL_T_HELPTEXT = 3, /* T_HELPTEXT */ |
| 131 | YYSYMBOL_T_WORD = 4, /* T_WORD */ |
| 132 | YYSYMBOL_T_WORD_QUOTE = 5, /* T_WORD_QUOTE */ |
| 133 | YYSYMBOL_T_BOOL = 6, /* T_BOOL */ |
| 134 | YYSYMBOL_T_CHOICE = 7, /* T_CHOICE */ |
| 135 | YYSYMBOL_T_CLOSE_PAREN = 8, /* T_CLOSE_PAREN */ |
| 136 | YYSYMBOL_T_COLON_EQUAL = 9, /* T_COLON_EQUAL */ |
| 137 | YYSYMBOL_T_COMMENT = 10, /* T_COMMENT */ |
| 138 | YYSYMBOL_T_CONFIG = 11, /* T_CONFIG */ |
| 139 | YYSYMBOL_T_DEFAULT = 12, /* T_DEFAULT */ |
| 140 | YYSYMBOL_T_DEF_BOOL = 13, /* T_DEF_BOOL */ |
| 141 | YYSYMBOL_T_DEF_TRISTATE = 14, /* T_DEF_TRISTATE */ |
| 142 | YYSYMBOL_T_DEPENDS = 15, /* T_DEPENDS */ |
| 143 | YYSYMBOL_T_ENDCHOICE = 16, /* T_ENDCHOICE */ |
| 144 | YYSYMBOL_T_ENDIF = 17, /* T_ENDIF */ |
| 145 | YYSYMBOL_T_ENDMENU = 18, /* T_ENDMENU */ |
| 146 | YYSYMBOL_T_HELP = 19, /* T_HELP */ |
| 147 | YYSYMBOL_T_HEX = 20, /* T_HEX */ |
| 148 | YYSYMBOL_T_IF = 21, /* T_IF */ |
| 149 | YYSYMBOL_T_IMPLY = 22, /* T_IMPLY */ |
| 150 | YYSYMBOL_T_INT = 23, /* T_INT */ |
| 151 | YYSYMBOL_T_MAINMENU = 24, /* T_MAINMENU */ |
| 152 | YYSYMBOL_T_MENU = 25, /* T_MENU */ |
| 153 | YYSYMBOL_T_MENUCONFIG = 26, /* T_MENUCONFIG */ |
| 154 | YYSYMBOL_T_MODULES = 27, /* T_MODULES */ |
| 155 | YYSYMBOL_T_ON = 28, /* T_ON */ |
| 156 | YYSYMBOL_T_OPEN_PAREN = 29, /* T_OPEN_PAREN */ |
| 157 | YYSYMBOL_T_OPTIONAL = 30, /* T_OPTIONAL */ |
| 158 | YYSYMBOL_T_PLUS_EQUAL = 31, /* T_PLUS_EQUAL */ |
| 159 | YYSYMBOL_T_PROMPT = 32, /* T_PROMPT */ |
| 160 | YYSYMBOL_T_RANGE = 33, /* T_RANGE */ |
| 161 | YYSYMBOL_T_RESET = 34, /* T_RESET */ |
| 162 | YYSYMBOL_T_SELECT = 35, /* T_SELECT */ |
| 163 | YYSYMBOL_T_SOURCE = 36, /* T_SOURCE */ |
| 164 | YYSYMBOL_T_STRING = 37, /* T_STRING */ |
| 165 | YYSYMBOL_T_TRISTATE = 38, /* T_TRISTATE */ |
| 166 | YYSYMBOL_T_VISIBLE = 39, /* T_VISIBLE */ |
| 167 | YYSYMBOL_T_EOL = 40, /* T_EOL */ |
| 168 | YYSYMBOL_T_ASSIGN_VAL = 41, /* T_ASSIGN_VAL */ |
| 169 | YYSYMBOL_T_OR = 42, /* T_OR */ |
| 170 | YYSYMBOL_T_AND = 43, /* T_AND */ |
| 171 | YYSYMBOL_T_EQUAL = 44, /* T_EQUAL */ |
| 172 | YYSYMBOL_T_UNEQUAL = 45, /* T_UNEQUAL */ |
| 173 | YYSYMBOL_T_LESS = 46, /* T_LESS */ |
| 174 | YYSYMBOL_T_LESS_EQUAL = 47, /* T_LESS_EQUAL */ |
| 175 | YYSYMBOL_T_GREATER = 48, /* T_GREATER */ |
| 176 | YYSYMBOL_T_GREATER_EQUAL = 49, /* T_GREATER_EQUAL */ |
| 177 | YYSYMBOL_T_NOT = 50, /* T_NOT */ |
| 178 | YYSYMBOL_YYACCEPT = 51, /* $accept */ |
| 179 | YYSYMBOL_input = 52, /* input */ |
| 180 | YYSYMBOL_mainmenu_stmt = 53, /* mainmenu_stmt */ |
| 181 | YYSYMBOL_stmt_list = 54, /* stmt_list */ |
| 182 | YYSYMBOL_stmt_list_in_choice = 55, /* stmt_list_in_choice */ |
| 183 | YYSYMBOL_config_entry_start = 56, /* config_entry_start */ |
| 184 | YYSYMBOL_config_stmt = 57, /* config_stmt */ |
| 185 | YYSYMBOL_menuconfig_entry_start = 58, /* menuconfig_entry_start */ |
| 186 | YYSYMBOL_menuconfig_stmt = 59, /* menuconfig_stmt */ |
| 187 | YYSYMBOL_config_option_list = 60, /* config_option_list */ |
| 188 | YYSYMBOL_config_option = 61, /* config_option */ |
| 189 | YYSYMBOL_choice = 62, /* choice */ |
| 190 | YYSYMBOL_choice_entry = 63, /* choice_entry */ |
| 191 | YYSYMBOL_choice_end = 64, /* choice_end */ |
| 192 | YYSYMBOL_choice_stmt = 65, /* choice_stmt */ |
| 193 | YYSYMBOL_choice_option_list = 66, /* choice_option_list */ |
| 194 | YYSYMBOL_choice_option = 67, /* choice_option */ |
| 195 | YYSYMBOL_type = 68, /* type */ |
| 196 | YYSYMBOL_logic_type = 69, /* logic_type */ |
| 197 | YYSYMBOL_default = 70, /* default */ |
| 198 | YYSYMBOL_if_entry = 71, /* if_entry */ |
| 199 | YYSYMBOL_if_end = 72, /* if_end */ |
| 200 | YYSYMBOL_if_stmt = 73, /* if_stmt */ |
| 201 | YYSYMBOL_if_stmt_in_choice = 74, /* if_stmt_in_choice */ |
| 202 | YYSYMBOL_menu = 75, /* menu */ |
| 203 | YYSYMBOL_menu_entry = 76, /* menu_entry */ |
| 204 | YYSYMBOL_menu_end = 77, /* menu_end */ |
| 205 | YYSYMBOL_menu_stmt = 78, /* menu_stmt */ |
| 206 | YYSYMBOL_menu_option_list = 79, /* menu_option_list */ |
| 207 | YYSYMBOL_source_stmt = 80, /* source_stmt */ |
| 208 | YYSYMBOL_comment = 81, /* comment */ |
| 209 | YYSYMBOL_comment_stmt = 82, /* comment_stmt */ |
| 210 | YYSYMBOL_comment_option_list = 83, /* comment_option_list */ |
| 211 | YYSYMBOL_help_start = 84, /* help_start */ |
| 212 | YYSYMBOL_help = 85, /* help */ |
| 213 | YYSYMBOL_depends = 86, /* depends */ |
| 214 | YYSYMBOL_visible = 87, /* visible */ |
| 215 | YYSYMBOL_prompt_stmt_opt = 88, /* prompt_stmt_opt */ |
| 216 | YYSYMBOL_end = 89, /* end */ |
| 217 | YYSYMBOL_if_expr = 90, /* if_expr */ |
| 218 | YYSYMBOL_expr = 91, /* expr */ |
| 219 | YYSYMBOL_nonconst_symbol = 92, /* nonconst_symbol */ |
| 220 | YYSYMBOL_symbol = 93, /* symbol */ |
| 221 | YYSYMBOL_word_opt = 94, /* word_opt */ |
| 222 | YYSYMBOL_assignment_stmt = 95, /* assignment_stmt */ |
| 223 | YYSYMBOL_assign_op = 96, /* assign_op */ |
| 224 | YYSYMBOL_assign_val = 97 /* assign_val */ |
| 225 | }; |
| 226 | typedef enum yysymbol_kind_t yysymbol_kind_t; |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | #ifdef short |
| 232 | # undef short |
| 233 | #endif |
| 234 | |
| 235 | /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
| 236 | <limits.h> and (if available) <stdint.h> are included |
| 237 | so that the code can choose integer types of a good width. */ |
| 238 | |
| 239 | #ifndef __PTRDIFF_MAX__ |
| 240 | # include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
| 241 | # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
| 242 | # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
| 243 | # define YY_STDINT_H |
| 244 | # endif |
| 245 | #endif |
| 246 | |
| 247 | /* Narrow types that promote to a signed type and that can represent a |
| 248 | signed or unsigned integer of at least N bits. In tables they can |
| 249 | save space and decrease cache pressure. Promoting to a signed type |
| 250 | helps avoid bugs in integer arithmetic. */ |
| 251 | |
| 252 | #ifdef __INT_LEAST8_MAX__ |
| 253 | typedef __INT_LEAST8_TYPE__ yytype_int8; |
| 254 | #elif defined YY_STDINT_H |
| 255 | typedef int_least8_t yytype_int8; |
| 256 | #else |
| 257 | typedef signed char yytype_int8; |
| 258 | #endif |
| 259 | |
| 260 | #ifdef __INT_LEAST16_MAX__ |
| 261 | typedef __INT_LEAST16_TYPE__ yytype_int16; |
| 262 | #elif defined YY_STDINT_H |
| 263 | typedef int_least16_t yytype_int16; |
| 264 | #else |
| 265 | typedef short yytype_int16; |
| 266 | #endif |
| 267 | |
| 268 | /* Work around bug in HP-UX 11.23, which defines these macros |
| 269 | incorrectly for preprocessor constants. This workaround can likely |
| 270 | be removed in 2023, as HPE has promised support for HP-UX 11.23 |
| 271 | (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of |
| 272 | <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ |
| 273 | #ifdef __hpux |
| 274 | # undef UINT_LEAST8_MAX |
| 275 | # undef UINT_LEAST16_MAX |
| 276 | # define UINT_LEAST8_MAX 255 |
| 277 | # define UINT_LEAST16_MAX 65535 |
| 278 | #endif |
| 279 | |
| 280 | #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
| 281 | typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
| 282 | #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
| 283 | && UINT_LEAST8_MAX <= INT_MAX) |
| 284 | typedef uint_least8_t yytype_uint8; |
| 285 | #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
| 286 | typedef unsigned char yytype_uint8; |
| 287 | #else |
| 288 | typedef short yytype_uint8; |
| 289 | #endif |
| 290 | |
| 291 | #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
| 292 | typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
| 293 | #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
| 294 | && UINT_LEAST16_MAX <= INT_MAX) |
| 295 | typedef uint_least16_t yytype_uint16; |
| 296 | #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
| 297 | typedef unsigned short yytype_uint16; |
| 298 | #else |
| 299 | typedef int yytype_uint16; |
| 300 | #endif |
| 301 | |
| 302 | #ifndef YYPTRDIFF_T |
| 303 | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
| 304 | # define YYPTRDIFF_T __PTRDIFF_TYPE__ |
| 305 | # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
| 306 | # elif defined PTRDIFF_MAX |
| 307 | # ifndef ptrdiff_t |
| 308 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 309 | # endif |
| 310 | # define YYPTRDIFF_T ptrdiff_t |
| 311 | # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
| 312 | # else |
| 313 | # define YYPTRDIFF_T long |
| 314 | # define YYPTRDIFF_MAXIMUM LONG_MAX |
| 315 | # endif |
| 316 | #endif |
| 317 | |
| 318 | #ifndef YYSIZE_T |
| 319 | # ifdef __SIZE_TYPE__ |
| 320 | # define YYSIZE_T __SIZE_TYPE__ |
| 321 | # elif defined size_t |
| 322 | # define YYSIZE_T size_t |
| 323 | # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
| 324 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 325 | # define YYSIZE_T size_t |
| 326 | # else |
| 327 | # define YYSIZE_T unsigned |
| 328 | # endif |
| 329 | #endif |
| 330 | |
| 331 | #define YYSIZE_MAXIMUM \ |
| 332 | YY_CAST (YYPTRDIFF_T, \ |
| 333 | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
| 334 | ? YYPTRDIFF_MAXIMUM \ |
| 335 | : YY_CAST (YYSIZE_T, -1))) |
| 336 | |
| 337 | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
| 338 | |
| 339 | |
| 340 | /* Stored state numbers (used for stacks). */ |
| 341 | typedef yytype_uint8 yy_state_t; |
| 342 | |
| 343 | /* State numbers in computations. */ |
| 344 | typedef int yy_state_fast_t; |
| 345 | |
| 346 | #ifndef YY_ |
| 347 | # if defined YYENABLE_NLS && YYENABLE_NLS |
| 348 | # if ENABLE_NLS |
| 349 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 350 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
| 351 | # endif |
| 352 | # endif |
| 353 | # ifndef YY_ |
| 354 | # define YY_(Msgid) Msgid |
| 355 | # endif |
| 356 | #endif |
| 357 | |
| 358 | |
| 359 | #ifndef YY_ATTRIBUTE_PURE |
| 360 | # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
| 361 | # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
| 362 | # else |
| 363 | # define YY_ATTRIBUTE_PURE |
| 364 | # endif |
| 365 | #endif |
| 366 | |
| 367 | #ifndef YY_ATTRIBUTE_UNUSED |
| 368 | # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
| 369 | # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 370 | # else |
| 371 | # define YY_ATTRIBUTE_UNUSED |
| 372 | # endif |
| 373 | #endif |
| 374 | |
| 375 | /* Suppress unused-variable warnings by "using" E. */ |
| 376 | #if ! defined lint || defined __GNUC__ |
| 377 | # define YY_USE(E) ((void) (E)) |
| 378 | #else |
| 379 | # define YY_USE(E) /* empty */ |
| 380 | #endif |
| 381 | |
| 382 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
| 383 | #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ |
| 384 | # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 |
| 385 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 386 | _Pragma ("GCC diagnostic push") \ |
| 387 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") |
| 388 | # else |
| 389 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 390 | _Pragma ("GCC diagnostic push") \ |
| 391 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
| 392 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
| 393 | # endif |
| 394 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
| 395 | _Pragma ("GCC diagnostic pop") |
| 396 | #else |
| 397 | # define YY_INITIAL_VALUE(Value) Value |
| 398 | #endif |
| 399 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 400 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 401 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 402 | #endif |
| 403 | #ifndef YY_INITIAL_VALUE |
| 404 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
| 405 | #endif |
| 406 | |
| 407 | #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
| 408 | # define YY_IGNORE_USELESS_CAST_BEGIN \ |
| 409 | _Pragma ("GCC diagnostic push") \ |
| 410 | _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
| 411 | # define YY_IGNORE_USELESS_CAST_END \ |
| 412 | _Pragma ("GCC diagnostic pop") |
| 413 | #endif |
| 414 | #ifndef YY_IGNORE_USELESS_CAST_BEGIN |
| 415 | # define YY_IGNORE_USELESS_CAST_BEGIN |
| 416 | # define YY_IGNORE_USELESS_CAST_END |
| 417 | #endif |
| 418 | |
| 419 | |
| 420 | #define YY_ASSERT(E) ((void) (0 && (E))) |
| 421 | |
| 422 | #if !defined yyoverflow |
| 423 | |
| 424 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 425 | |
| 426 | # ifdef YYSTACK_USE_ALLOCA |
| 427 | # if YYSTACK_USE_ALLOCA |
| 428 | # ifdef __GNUC__ |
| 429 | # define YYSTACK_ALLOC __builtin_alloca |
| 430 | # elif defined __BUILTIN_VA_ARG_INCR |
| 431 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 432 | # elif defined _AIX |
| 433 | # define YYSTACK_ALLOC __alloca |
| 434 | # elif defined _MSC_VER |
| 435 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 436 | # define alloca _alloca |
| 437 | # else |
| 438 | # define YYSTACK_ALLOC alloca |
| 439 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
| 440 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 441 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
| 442 | # ifndef EXIT_SUCCESS |
| 443 | # define EXIT_SUCCESS 0 |
| 444 | # endif |
| 445 | # endif |
| 446 | # endif |
| 447 | # endif |
| 448 | # endif |
| 449 | |
| 450 | # ifdef YYSTACK_ALLOC |
| 451 | /* Pacify GCC's 'empty if-body' warning. */ |
| 452 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 453 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 454 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 455 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 456 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 457 | to allow for a few compiler-allocated temporary stack slots. */ |
| 458 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 459 | # endif |
| 460 | # else |
| 461 | # define YYSTACK_ALLOC YYMALLOC |
| 462 | # define YYSTACK_FREE YYFREE |
| 463 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 464 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 465 | # endif |
| 466 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
| 467 | && ! ((defined YYMALLOC || defined malloc) \ |
| 468 | && (defined YYFREE || defined free))) |
| 469 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 470 | # ifndef EXIT_SUCCESS |
| 471 | # define EXIT_SUCCESS 0 |
| 472 | # endif |
| 473 | # endif |
| 474 | # ifndef YYMALLOC |
| 475 | # define YYMALLOC malloc |
| 476 | # if ! defined malloc && ! defined EXIT_SUCCESS |
| 477 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 478 | # endif |
| 479 | # endif |
| 480 | # ifndef YYFREE |
| 481 | # define YYFREE free |
| 482 | # if ! defined free && ! defined EXIT_SUCCESS |
| 483 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 484 | # endif |
| 485 | # endif |
| 486 | # endif |
| 487 | #endif /* !defined yyoverflow */ |
| 488 | |
| 489 | #if (! defined yyoverflow \ |
| 490 | && (! defined __cplusplus \ |
| 491 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 492 | |
| 493 | /* A type that is properly aligned for any stack member. */ |
| 494 | union yyalloc |
| 495 | { |
| 496 | yy_state_t yyss_alloc; |
| 497 | YYSTYPE yyvs_alloc; |
| 498 | }; |
| 499 | |
| 500 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 501 | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
| 502 | |
| 503 | /* The size of an array large to enough to hold all stacks, each with |
| 504 | N elements. */ |
| 505 | # define YYSTACK_BYTES(N) \ |
| 506 | ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
| 507 | + YYSTACK_GAP_MAXIMUM) |
| 508 | |
| 509 | # define YYCOPY_NEEDED 1 |
| 510 | |
| 511 | /* Relocate STACK from its old location to the new one. The |
| 512 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 513 | elements in the stack, and YYPTR gives the new location of the |
| 514 | stack. Advance YYPTR to a properly aligned location for the next |
| 515 | stack. */ |
| 516 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
| 517 | do \ |
| 518 | { \ |
| 519 | YYPTRDIFF_T yynewbytes; \ |
| 520 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
| 521 | Stack = &yyptr->Stack_alloc; \ |
| 522 | yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 523 | yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
| 524 | } \ |
| 525 | while (0) |
| 526 | |
| 527 | #endif |
| 528 | |
| 529 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
| 530 | /* Copy COUNT objects from SRC to DST. The source and destination do |
| 531 | not overlap. */ |
| 532 | # ifndef YYCOPY |
| 533 | # if defined __GNUC__ && 1 < __GNUC__ |
| 534 | # define YYCOPY(Dst, Src, Count) \ |
| 535 | __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
| 536 | # else |
| 537 | # define YYCOPY(Dst, Src, Count) \ |
| 538 | do \ |
| 539 | { \ |
| 540 | YYPTRDIFF_T yyi; \ |
| 541 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 542 | (Dst)[yyi] = (Src)[yyi]; \ |
| 543 | } \ |
| 544 | while (0) |
| 545 | # endif |
| 546 | # endif |
| 547 | #endif /* !YYCOPY_NEEDED */ |
| 548 | |
| 549 | /* YYFINAL -- State number of the termination state. */ |
| 550 | #define YYFINAL 6 |
| 551 | /* YYLAST -- Last index in YYTABLE. */ |
| 552 | #define YYLAST 194 |
| 553 | |
| 554 | /* YYNTOKENS -- Number of terminals. */ |
| 555 | #define YYNTOKENS 51 |
| 556 | /* YYNNTS -- Number of nonterminals. */ |
| 557 | #define YYNNTS 47 |
| 558 | /* YYNRULES -- Number of rules. */ |
| 559 | #define YYNRULES 106 |
| 560 | /* YYNSTATES -- Number of states. */ |
| 561 | #define YYNSTATES 187 |
| 562 | |
| 563 | /* YYMAXUTOK -- Last valid token kind. */ |
| 564 | #define YYMAXUTOK 305 |
| 565 | |
| 566 | |
| 567 | /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
| 568 | as returned by yylex, with out-of-bounds checking. */ |
| 569 | #define YYTRANSLATE(YYX) \ |
| 570 | (0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
| 571 | ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
| 572 | : YYSYMBOL_YYUNDEF) |
| 573 | |
| 574 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
| 575 | as returned by yylex. */ |
| 576 | static const yytype_int8 yytranslate[] = |
| 577 | { |
| 578 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 579 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 580 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 581 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 582 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 583 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 585 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 586 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 587 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 588 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 589 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 590 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 591 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 592 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 593 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 594 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 595 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 596 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 597 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 598 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 599 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 600 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 601 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 602 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 603 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 604 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 605 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 606 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 607 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 608 | 45, 46, 47, 48, 49, 50 |
| 609 | }; |
| 610 | |
| 611 | #if YYDEBUG |
| 612 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
| 613 | static const yytype_int16 yyrline[] = |
| 614 | { |
| 615 | 0, 110, 110, 110, 114, 119, 121, 122, 123, 124, |
| 616 | 125, 126, 127, 128, 129, 130, 133, 135, 136, 137, |
| 617 | 138, 143, 150, 155, 162, 171, 173, 174, 175, 178, |
| 618 | 186, 192, 202, 208, 214, 220, 230, 240, 245, 253, |
| 619 | 256, 258, 259, 260, 263, 269, 276, 282, 287, 295, |
| 620 | 296, 297, 298, 301, 302, 305, 306, 307, 311, 319, |
| 621 | 327, 330, 335, 342, 347, 355, 358, 360, 361, 364, |
| 622 | 373, 380, 383, 385, 390, 396, 408, 415, 422, 424, |
| 623 | 429, 430, 431, 434, 435, 438, 439, 440, 441, 442, |
| 624 | 443, 444, 445, 446, 447, 448, 452, 454, 455, 458, |
| 625 | 459, 463, 466, 467, 468, 472, 473 |
| 626 | }; |
| 627 | #endif |
| 628 | |
| 629 | /** Accessing symbol of state STATE. */ |
| 630 | #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
| 631 | |
| 632 | #if YYDEBUG || 0 |
| 633 | /* The user-facing name of the symbol whose (internal) number is |
| 634 | YYSYMBOL. No bounds checking. */ |
| 635 | static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; |
| 636 | |
| 637 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 638 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 639 | static const char *const yytname[] = |
| 640 | { |
| 641 | "\"end of file\"", "error", "\"invalid token\"", "T_HELPTEXT", "T_WORD", |
| 642 | "T_WORD_QUOTE", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN", "T_COLON_EQUAL", |
| 643 | "T_COMMENT", "T_CONFIG", "T_DEFAULT", "T_DEF_BOOL", "T_DEF_TRISTATE", |
| 644 | "T_DEPENDS", "T_ENDCHOICE", "T_ENDIF", "T_ENDMENU", "T_HELP", "T_HEX", |
| 645 | "T_IF", "T_IMPLY", "T_INT", "T_MAINMENU", "T_MENU", "T_MENUCONFIG", |
| 646 | "T_MODULES", "T_ON", "T_OPEN_PAREN", "T_OPTIONAL", "T_PLUS_EQUAL", |
| 647 | "T_PROMPT", "T_RANGE", "T_RESET", "T_SELECT", "T_SOURCE", "T_STRING", |
| 648 | "T_TRISTATE", "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND", |
| 649 | "T_EQUAL", "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", |
| 650 | "T_GREATER_EQUAL", "T_NOT", "$accept", "input", "mainmenu_stmt", |
| 651 | "stmt_list", "stmt_list_in_choice", "config_entry_start", "config_stmt", |
| 652 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", |
| 653 | "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", |
| 654 | "choice_option_list", "choice_option", "type", "logic_type", "default", |
| 655 | "if_entry", "if_end", "if_stmt", "if_stmt_in_choice", "menu", |
| 656 | "menu_entry", "menu_end", "menu_stmt", "menu_option_list", "source_stmt", |
| 657 | "comment", "comment_stmt", "comment_option_list", "help_start", "help", |
| 658 | "depends", "visible", "prompt_stmt_opt", "end", "if_expr", "expr", |
| 659 | "nonconst_symbol", "symbol", "word_opt", "assignment_stmt", "assign_op", |
| 660 | "assign_val", YY_NULLPTR |
| 661 | }; |
| 662 | |
| 663 | static const char * |
| 664 | yysymbol_name (yysymbol_kind_t yysymbol) |
| 665 | { |
| 666 | return yytname[yysymbol]; |
| 667 | } |
| 668 | #endif |
| 669 | |
| 670 | #define YYPACT_NINF (-105) |
| 671 | |
| 672 | #define yypact_value_is_default(Yyn) \ |
| 673 | ((Yyn) == YYPACT_NINF) |
| 674 | |
| 675 | #define YYTABLE_NINF (-4) |
| 676 | |
| 677 | #define yytable_value_is_error(Yyn) \ |
| 678 | 0 |
| 679 | |
| 680 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 681 | STATE-NUM. */ |
| 682 | static const yytype_int16 yypact[] = |
| 683 | { |
| 684 | -5, 17, 37, -105, 57, 8, -105, 91, 39, 15, |
| 685 | 46, 72, 80, 10, 82, 80, 83, -105, -105, -105, |
| 686 | -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, |
| 687 | -105, -105, -105, -105, -105, 45, -105, -105, -105, 48, |
| 688 | -105, 50, 59, -105, 60, -105, 10, 10, -7, -105, |
| 689 | 25, 63, 64, 65, 132, 132, 156, 162, 114, 14, |
| 690 | 114, 95, -105, -105, 71, -105, -105, -105, 9, -105, |
| 691 | -105, 10, 10, 27, 27, 27, 27, 27, 27, -105, |
| 692 | -105, -105, -105, -105, -105, -105, 69, 73, -105, 80, |
| 693 | -105, 74, 115, 27, 80, -105, -105, -105, 117, -105, |
| 694 | 10, 116, -105, -105, 80, 86, 118, 107, -105, 117, |
| 695 | -105, -105, 89, 93, 94, 96, -105, -105, -105, -105, |
| 696 | -105, -105, -105, -105, 107, -105, -105, -105, -105, -105, |
| 697 | -105, -105, 98, -105, -105, -105, -105, -105, -105, -105, |
| 698 | 10, -105, 107, -105, 107, 27, 107, 107, 97, 13, |
| 699 | -105, 107, -105, 107, 10, 102, 103, -105, -105, -105, |
| 700 | -105, 162, 108, 23, 109, 113, 107, 120, -105, -105, |
| 701 | 121, 126, 134, 33, -105, -105, -105, -105, -105, -105, |
| 702 | -105, 136, -105, -105, -105, -105, -105 |
| 703 | }; |
| 704 | |
| 705 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
| 706 | Performed when YYTABLE does not specify something else to do. Zero |
| 707 | means the default is an error. */ |
| 708 | static const yytype_int8 yydefact[] = |
| 709 | { |
| 710 | 5, 0, 0, 5, 0, 0, 1, 0, 0, 0, |
| 711 | 99, 0, 0, 0, 0, 0, 0, 25, 9, 25, |
| 712 | 12, 40, 16, 7, 5, 10, 66, 5, 11, 13, |
| 713 | 72, 8, 6, 4, 15, 0, 103, 104, 102, 105, |
| 714 | 100, 0, 0, 96, 0, 98, 0, 0, 0, 97, |
| 715 | 85, 0, 0, 0, 22, 24, 37, 0, 0, 63, |
| 716 | 0, 71, 14, 106, 0, 36, 70, 21, 0, 93, |
| 717 | 58, 0, 0, 0, 0, 0, 0, 0, 0, 62, |
| 718 | 23, 69, 53, 55, 56, 57, 0, 0, 51, 0, |
| 719 | 50, 0, 0, 0, 0, 52, 54, 26, 78, 49, |
| 720 | 0, 0, 28, 27, 0, 0, 0, 83, 41, 78, |
| 721 | 43, 42, 0, 0, 0, 0, 18, 39, 16, 19, |
| 722 | 17, 38, 60, 59, 83, 68, 67, 65, 64, 73, |
| 723 | 101, 92, 94, 95, 90, 91, 86, 87, 88, 89, |
| 724 | 0, 74, 83, 35, 83, 0, 83, 83, 0, 83, |
| 725 | 75, 83, 46, 83, 0, 0, 0, 20, 81, 82, |
| 726 | 80, 0, 0, 0, 0, 0, 83, 0, 79, 29, |
| 727 | 0, 0, 0, 84, 47, 45, 61, 77, 76, 33, |
| 728 | 30, 0, 32, 31, 48, 44, 34 |
| 729 | }; |
| 730 | |
| 731 | /* YYPGOTO[NTERM-NUM]. */ |
| 732 | static const yytype_int16 yypgoto[] = |
| 733 | { |
| 734 | -105, -105, -105, 3, 38, -105, -55, -105, -105, 138, |
| 735 | -105, -105, -105, -105, -105, -105, -105, -105, 125, -105, |
| 736 | -54, -3, -105, -105, -105, -105, -105, -105, -105, -105, |
| 737 | -105, -52, -105, -105, 128, -38, -105, 68, -16, -104, |
| 738 | -46, -8, -65, -105, -105, -105, -105 |
| 739 | }; |
| 740 | |
| 741 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 742 | static const yytype_uint8 yydefgoto[] = |
| 743 | { |
| 744 | 0, 2, 3, 4, 57, 17, 18, 19, 20, 54, |
| 745 | 97, 21, 22, 117, 23, 56, 108, 98, 99, 100, |
| 746 | 24, 122, 25, 119, 26, 27, 127, 28, 59, 29, |
| 747 | 30, 31, 61, 101, 102, 103, 126, 148, 123, 155, |
| 748 | 48, 49, 50, 41, 32, 39, 64 |
| 749 | }; |
| 750 | |
| 751 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
| 752 | positive, shift that token. If negative, reduce the rule whose |
| 753 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
| 754 | static const yytype_int16 yytable[] = |
| 755 | { |
| 756 | 68, 69, 116, 118, 44, 120, 7, 52, 134, 135, |
| 757 | 136, 137, 138, 139, 43, 45, 35, 131, 111, 1, |
| 758 | 162, 125, 5, 129, 36, 132, 133, 58, 145, 86, |
| 759 | 60, 43, 45, 70, 154, 71, 72, 6, 164, 46, |
| 760 | 165, 121, 167, 168, 128, 170, 37, 171, 33, 172, |
| 761 | 40, 71, 72, 124, 149, 71, 72, -3, 8, 38, |
| 762 | 47, 9, 181, 178, 10, 71, 72, 11, 12, 73, |
| 763 | 74, 75, 76, 77, 78, 71, 72, 42, 13, 34, |
| 764 | 166, 142, 14, 15, 43, 62, 146, 51, 53, 63, |
| 765 | 65, -2, 8, 16, 163, 9, 151, 140, 10, 66, |
| 766 | 67, 11, 12, 79, 80, 81, 116, 118, 173, 120, |
| 767 | 86, 130, 13, 141, 143, 8, 14, 15, 9, 150, |
| 768 | 144, 10, 147, 153, 11, 12, 152, 16, 154, 157, |
| 769 | 113, 114, 115, 158, 159, 13, 160, 169, 82, 14, |
| 770 | 15, 72, 174, 175, 83, 84, 85, 86, 177, 179, |
| 771 | 16, 87, 88, 180, 89, 90, 161, 55, 176, 91, |
| 772 | 182, 183, 82, 112, 92, 93, 184, 94, 104, 95, |
| 773 | 96, 86, 11, 12, 185, 87, 186, 156, 113, 114, |
| 774 | 115, 109, 0, 13, 110, 0, 105, 0, 106, 0, |
| 775 | 107, 0, 0, 0, 96 |
| 776 | }; |
| 777 | |
| 778 | static const yytype_int16 yycheck[] = |
| 779 | { |
| 780 | 46, 47, 57, 57, 12, 57, 3, 15, 73, 74, |
| 781 | 75, 76, 77, 78, 4, 5, 1, 8, 56, 24, |
| 782 | 124, 59, 5, 61, 9, 71, 72, 24, 93, 15, |
| 783 | 27, 4, 5, 40, 21, 42, 43, 0, 142, 29, |
| 784 | 144, 57, 146, 147, 60, 149, 31, 151, 40, 153, |
| 785 | 4, 42, 43, 39, 100, 42, 43, 0, 1, 44, |
| 786 | 50, 4, 166, 40, 7, 42, 43, 10, 11, 44, |
| 787 | 45, 46, 47, 48, 49, 42, 43, 5, 21, 40, |
| 788 | 145, 89, 25, 26, 4, 40, 94, 5, 5, 41, |
| 789 | 40, 0, 1, 36, 140, 4, 104, 28, 7, 40, |
| 790 | 40, 10, 11, 40, 40, 40, 161, 161, 154, 161, |
| 791 | 15, 40, 21, 40, 40, 1, 25, 26, 4, 3, |
| 792 | 5, 7, 5, 5, 10, 11, 40, 36, 21, 40, |
| 793 | 16, 17, 18, 40, 40, 21, 40, 40, 6, 25, |
| 794 | 26, 43, 40, 40, 12, 13, 14, 15, 40, 40, |
| 795 | 36, 19, 20, 40, 22, 23, 118, 19, 161, 27, |
| 796 | 40, 40, 6, 1, 32, 33, 40, 35, 12, 37, |
| 797 | 38, 15, 10, 11, 40, 19, 40, 109, 16, 17, |
| 798 | 18, 56, -1, 21, 56, -1, 30, -1, 32, -1, |
| 799 | 34, -1, -1, -1, 38 |
| 800 | }; |
| 801 | |
| 802 | /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
| 803 | state STATE-NUM. */ |
| 804 | static const yytype_int8 yystos[] = |
| 805 | { |
| 806 | 0, 24, 52, 53, 54, 5, 0, 54, 1, 4, |
| 807 | 7, 10, 11, 21, 25, 26, 36, 56, 57, 58, |
| 808 | 59, 62, 63, 65, 71, 73, 75, 76, 78, 80, |
| 809 | 81, 82, 95, 40, 40, 1, 9, 31, 44, 96, |
| 810 | 4, 94, 5, 4, 92, 5, 29, 50, 91, 92, |
| 811 | 93, 5, 92, 5, 60, 60, 66, 55, 54, 79, |
| 812 | 54, 83, 40, 41, 97, 40, 40, 40, 91, 91, |
| 813 | 40, 42, 43, 44, 45, 46, 47, 48, 49, 40, |
| 814 | 40, 40, 6, 12, 13, 14, 15, 19, 20, 22, |
| 815 | 23, 27, 32, 33, 35, 37, 38, 61, 68, 69, |
| 816 | 70, 84, 85, 86, 12, 30, 32, 34, 67, 69, |
| 817 | 85, 86, 1, 16, 17, 18, 57, 64, 71, 74, |
| 818 | 82, 89, 72, 89, 39, 86, 87, 77, 89, 86, |
| 819 | 40, 8, 91, 91, 93, 93, 93, 93, 93, 93, |
| 820 | 28, 40, 92, 40, 5, 93, 92, 5, 88, 91, |
| 821 | 3, 92, 40, 5, 21, 90, 88, 40, 40, 40, |
| 822 | 40, 55, 90, 91, 90, 90, 93, 90, 90, 40, |
| 823 | 90, 90, 90, 91, 40, 40, 72, 40, 40, 40, |
| 824 | 40, 90, 40, 40, 40, 40, 40 |
| 825 | }; |
| 826 | |
| 827 | /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
| 828 | static const yytype_int8 yyr1[] = |
| 829 | { |
| 830 | 0, 51, 52, 52, 53, 54, 54, 54, 54, 54, |
| 831 | 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, |
| 832 | 55, 56, 57, 58, 59, 60, 60, 60, 60, 61, |
| 833 | 61, 61, 61, 61, 61, 61, 62, 63, 64, 65, |
| 834 | 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, |
| 835 | 68, 68, 68, 69, 69, 70, 70, 70, 71, 72, |
| 836 | 73, 74, 75, 76, 77, 78, 79, 79, 79, 80, |
| 837 | 81, 82, 83, 83, 84, 85, 86, 87, 88, 88, |
| 838 | 89, 89, 89, 90, 90, 91, 91, 91, 91, 91, |
| 839 | 91, 91, 91, 91, 91, 91, 92, 93, 93, 94, |
| 840 | 94, 95, 96, 96, 96, 97, 97 |
| 841 | }; |
| 842 | |
| 843 | /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
| 844 | static const yytype_int8 yyr2[] = |
| 845 | { |
| 846 | 0, 2, 2, 1, 3, 0, 2, 2, 2, 2, |
| 847 | 2, 2, 2, 2, 4, 3, 0, 2, 2, 2, |
| 848 | 3, 3, 2, 3, 2, 0, 2, 2, 2, 3, |
| 849 | 4, 4, 4, 4, 5, 2, 3, 2, 1, 3, |
| 850 | 0, 2, 2, 2, 4, 3, 2, 3, 4, 1, |
| 851 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, |
| 852 | 3, 3, 3, 2, 1, 3, 0, 2, 2, 3, |
| 853 | 3, 2, 0, 2, 2, 2, 4, 3, 0, 2, |
| 854 | 2, 2, 2, 0, 2, 1, 3, 3, 3, 3, |
| 855 | 3, 3, 3, 2, 3, 3, 1, 1, 1, 0, |
| 856 | 1, 4, 1, 1, 1, 0, 1 |
| 857 | }; |
| 858 | |
| 859 | |
| 860 | enum { YYENOMEM = -2 }; |
| 861 | |
| 862 | #define yyerrok (yyerrstatus = 0) |
| 863 | #define yyclearin (yychar = YYEMPTY) |
| 864 | |
| 865 | #define YYACCEPT goto yyacceptlab |
| 866 | #define YYABORT goto yyabortlab |
| 867 | #define YYERROR goto yyerrorlab |
| 868 | #define YYNOMEM goto yyexhaustedlab |
| 869 | |
| 870 | |
| 871 | #define YYRECOVERING() (!!yyerrstatus) |
| 872 | |
| 873 | #define YYBACKUP(Token, Value) \ |
| 874 | do \ |
| 875 | if (yychar == YYEMPTY) \ |
| 876 | { \ |
| 877 | yychar = (Token); \ |
| 878 | yylval = (Value); \ |
| 879 | YYPOPSTACK (yylen); \ |
| 880 | yystate = *yyssp; \ |
| 881 | goto yybackup; \ |
| 882 | } \ |
| 883 | else \ |
| 884 | { \ |
| 885 | yyerror (YY_("syntax error: cannot back up")); \ |
| 886 | YYERROR; \ |
| 887 | } \ |
| 888 | while (0) |
| 889 | |
| 890 | /* Backward compatibility with an undocumented macro. |
| 891 | Use YYerror or YYUNDEF. */ |
| 892 | #define YYERRCODE YYUNDEF |
| 893 | |
| 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 (0) |
| 908 | |
| 909 | |
| 910 | |
| 911 | |
| 912 | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
| 913 | do { \ |
| 914 | if (yydebug) \ |
| 915 | { \ |
| 916 | YYFPRINTF (stderr, "%s ", Title); \ |
| 917 | yy_symbol_print (stderr, \ |
| 918 | Kind, Value); \ |
| 919 | YYFPRINTF (stderr, "\n"); \ |
| 920 | } \ |
| 921 | } while (0) |
| 922 | |
| 923 | |
| 924 | /*-----------------------------------. |
| 925 | | Print this symbol's value on YYO. | |
| 926 | `-----------------------------------*/ |
| 927 | |
| 928 | static void |
| 929 | yy_symbol_value_print (FILE *yyo, |
| 930 | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) |
| 931 | { |
| 932 | FILE *yyoutput = yyo; |
| 933 | YY_USE (yyoutput); |
| 934 | if (!yyvaluep) |
| 935 | return; |
| 936 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 937 | YY_USE (yykind); |
| 938 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 939 | } |
| 940 | |
| 941 | |
| 942 | /*---------------------------. |
| 943 | | Print this symbol on YYO. | |
| 944 | `---------------------------*/ |
| 945 | |
| 946 | static void |
| 947 | yy_symbol_print (FILE *yyo, |
| 948 | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) |
| 949 | { |
| 950 | YYFPRINTF (yyo, "%s %s (", |
| 951 | yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
| 952 | |
| 953 | yy_symbol_value_print (yyo, yykind, yyvaluep); |
| 954 | YYFPRINTF (yyo, ")"); |
| 955 | } |
| 956 | |
| 957 | /*------------------------------------------------------------------. |
| 958 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 959 | | TOP (included). | |
| 960 | `------------------------------------------------------------------*/ |
| 961 | |
| 962 | static void |
| 963 | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
| 964 | { |
| 965 | YYFPRINTF (stderr, "Stack now"); |
| 966 | for (; yybottom <= yytop; yybottom++) |
| 967 | { |
| 968 | int yybot = *yybottom; |
| 969 | YYFPRINTF (stderr, " %d", yybot); |
| 970 | } |
| 971 | YYFPRINTF (stderr, "\n"); |
| 972 | } |
| 973 | |
| 974 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 975 | do { \ |
| 976 | if (yydebug) \ |
| 977 | yy_stack_print ((Bottom), (Top)); \ |
| 978 | } while (0) |
| 979 | |
| 980 | |
| 981 | /*------------------------------------------------. |
| 982 | | Report that the YYRULE is going to be reduced. | |
| 983 | `------------------------------------------------*/ |
| 984 | |
| 985 | static void |
| 986 | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
| 987 | int yyrule) |
| 988 | { |
| 989 | int yylno = yyrline[yyrule]; |
| 990 | int yynrhs = yyr2[yyrule]; |
| 991 | int yyi; |
| 992 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
| 993 | yyrule - 1, yylno); |
| 994 | /* The symbols being reduced. */ |
| 995 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 996 | { |
| 997 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
| 998 | yy_symbol_print (stderr, |
| 999 | YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
| 1000 | &yyvsp[(yyi + 1) - (yynrhs)]); |
| 1001 | YYFPRINTF (stderr, "\n"); |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | # define YY_REDUCE_PRINT(Rule) \ |
| 1006 | do { \ |
| 1007 | if (yydebug) \ |
| 1008 | yy_reduce_print (yyssp, yyvsp, Rule); \ |
| 1009 | } while (0) |
| 1010 | |
| 1011 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 1012 | multiple parsers can coexist. */ |
| 1013 | int yydebug; |
| 1014 | #else /* !YYDEBUG */ |
| 1015 | # define YYDPRINTF(Args) ((void) 0) |
| 1016 | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
| 1017 | # define YY_STACK_PRINT(Bottom, Top) |
| 1018 | # define YY_REDUCE_PRINT(Rule) |
| 1019 | #endif /* !YYDEBUG */ |
| 1020 | |
| 1021 | |
| 1022 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 1023 | #ifndef YYINITDEPTH |
| 1024 | # define YYINITDEPTH 200 |
| 1025 | #endif |
| 1026 | |
| 1027 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 1028 | if the built-in stack extension method is used). |
| 1029 | |
| 1030 | Do not make this value too large; the results are undefined if |
| 1031 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 1032 | evaluated with infinite-precision integer arithmetic. */ |
| 1033 | |
| 1034 | #ifndef YYMAXDEPTH |
| 1035 | # define YYMAXDEPTH 10000 |
| 1036 | #endif |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | /*-----------------------------------------------. |
| 1044 | | Release the memory associated to this symbol. | |
| 1045 | `-----------------------------------------------*/ |
| 1046 | |
| 1047 | static void |
| 1048 | yydestruct (const char *yymsg, |
| 1049 | yysymbol_kind_t yykind, YYSTYPE *yyvaluep) |
| 1050 | { |
| 1051 | YY_USE (yyvaluep); |
| 1052 | if (!yymsg) |
| 1053 | yymsg = "Deleting"; |
| 1054 | YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
| 1055 | |
| 1056 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1057 | switch (yykind) |
| 1058 | { |
| 1059 | case YYSYMBOL_choice_entry: /* choice_entry */ |
| 1060 | { |
| 1061 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 1062 | ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno); |
| 1063 | if (current_menu == ((*yyvaluep).menu)) |
| 1064 | menu_end_menu(); |
| 1065 | } |
| 1066 | break; |
| 1067 | |
| 1068 | case YYSYMBOL_if_entry: /* if_entry */ |
| 1069 | { |
| 1070 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 1071 | ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno); |
| 1072 | if (current_menu == ((*yyvaluep).menu)) |
| 1073 | menu_end_menu(); |
| 1074 | } |
| 1075 | break; |
| 1076 | |
| 1077 | case YYSYMBOL_menu_entry: /* menu_entry */ |
| 1078 | { |
| 1079 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
| 1080 | ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno); |
| 1081 | if (current_menu == ((*yyvaluep).menu)) |
| 1082 | menu_end_menu(); |
| 1083 | } |
| 1084 | break; |
| 1085 | |
| 1086 | default: |
| 1087 | break; |
| 1088 | } |
| 1089 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1090 | } |
| 1091 | |
| 1092 | |
| 1093 | /* Lookahead token kind. */ |
| 1094 | int yychar; |
| 1095 | |
| 1096 | /* The semantic value of the lookahead symbol. */ |
| 1097 | YYSTYPE yylval; |
| 1098 | /* Number of syntax errors so far. */ |
| 1099 | int yynerrs; |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | /*----------. |
| 1105 | | yyparse. | |
| 1106 | `----------*/ |
| 1107 | |
| 1108 | int |
| 1109 | yyparse (void) |
| 1110 | { |
| 1111 | yy_state_fast_t yystate = 0; |
| 1112 | /* Number of tokens to shift before error messages enabled. */ |
| 1113 | int yyerrstatus = 0; |
| 1114 | |
| 1115 | /* Refer to the stacks through separate pointers, to allow yyoverflow |
| 1116 | to reallocate them elsewhere. */ |
| 1117 | |
| 1118 | /* Their size. */ |
| 1119 | YYPTRDIFF_T yystacksize = YYINITDEPTH; |
| 1120 | |
| 1121 | /* The state stack: array, bottom, top. */ |
| 1122 | yy_state_t yyssa[YYINITDEPTH]; |
| 1123 | yy_state_t *yyss = yyssa; |
| 1124 | yy_state_t *yyssp = yyss; |
| 1125 | |
| 1126 | /* The semantic value stack: array, bottom, top. */ |
| 1127 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 1128 | YYSTYPE *yyvs = yyvsa; |
| 1129 | YYSTYPE *yyvsp = yyvs; |
| 1130 | |
| 1131 | int yyn; |
| 1132 | /* The return value of yyparse. */ |
| 1133 | int yyresult; |
| 1134 | /* Lookahead symbol kind. */ |
| 1135 | yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
| 1136 | /* The variables used to return semantic value and location from the |
| 1137 | action routines. */ |
| 1138 | YYSTYPE yyval; |
| 1139 | |
| 1140 | |
| 1141 | |
| 1142 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1143 | |
| 1144 | /* The number of symbols on the RHS of the reduced rule. |
| 1145 | Keep to zero when no symbol should be popped. */ |
| 1146 | int yylen = 0; |
| 1147 | |
| 1148 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 1149 | |
| 1150 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1151 | |
| 1152 | goto yysetstate; |
| 1153 | |
| 1154 | |
| 1155 | /*------------------------------------------------------------. |
| 1156 | | yynewstate -- push a new state, which is found in yystate. | |
| 1157 | `------------------------------------------------------------*/ |
| 1158 | yynewstate: |
| 1159 | /* In all cases, when you get here, the value and location stacks |
| 1160 | have just been pushed. So pushing a state here evens the stacks. */ |
| 1161 | yyssp++; |
| 1162 | |
| 1163 | |
| 1164 | /*--------------------------------------------------------------------. |
| 1165 | | yysetstate -- set current state (the top of the stack) to yystate. | |
| 1166 | `--------------------------------------------------------------------*/ |
| 1167 | yysetstate: |
| 1168 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1169 | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
| 1170 | YY_IGNORE_USELESS_CAST_BEGIN |
| 1171 | *yyssp = YY_CAST (yy_state_t, yystate); |
| 1172 | YY_IGNORE_USELESS_CAST_END |
| 1173 | YY_STACK_PRINT (yyss, yyssp); |
| 1174 | |
| 1175 | if (yyss + yystacksize - 1 <= yyssp) |
| 1176 | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
| 1177 | YYNOMEM; |
| 1178 | #else |
| 1179 | { |
| 1180 | /* Get the current used size of the three stacks, in elements. */ |
| 1181 | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
| 1182 | |
| 1183 | # if defined yyoverflow |
| 1184 | { |
| 1185 | /* Give user a chance to reallocate the stack. Use copies of |
| 1186 | these so that the &'s don't force the real ones into |
| 1187 | memory. */ |
| 1188 | yy_state_t *yyss1 = yyss; |
| 1189 | YYSTYPE *yyvs1 = yyvs; |
| 1190 | |
| 1191 | /* Each stack pointer address is followed by the size of the |
| 1192 | data in use in that stack, in bytes. This used to be a |
| 1193 | conditional around just the two extra args, but that might |
| 1194 | be undefined if yyoverflow is a macro. */ |
| 1195 | yyoverflow (YY_("memory exhausted"), |
| 1196 | &yyss1, yysize * YYSIZEOF (*yyssp), |
| 1197 | &yyvs1, yysize * YYSIZEOF (*yyvsp), |
| 1198 | &yystacksize); |
| 1199 | yyss = yyss1; |
| 1200 | yyvs = yyvs1; |
| 1201 | } |
| 1202 | # else /* defined YYSTACK_RELOCATE */ |
| 1203 | /* Extend the stack our own way. */ |
| 1204 | if (YYMAXDEPTH <= yystacksize) |
| 1205 | YYNOMEM; |
| 1206 | yystacksize *= 2; |
| 1207 | if (YYMAXDEPTH < yystacksize) |
| 1208 | yystacksize = YYMAXDEPTH; |
| 1209 | |
| 1210 | { |
| 1211 | yy_state_t *yyss1 = yyss; |
| 1212 | union yyalloc *yyptr = |
| 1213 | YY_CAST (union yyalloc *, |
| 1214 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
| 1215 | if (! yyptr) |
| 1216 | YYNOMEM; |
| 1217 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
| 1218 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
| 1219 | # undef YYSTACK_RELOCATE |
| 1220 | if (yyss1 != yyssa) |
| 1221 | YYSTACK_FREE (yyss1); |
| 1222 | } |
| 1223 | # endif |
| 1224 | |
| 1225 | yyssp = yyss + yysize - 1; |
| 1226 | yyvsp = yyvs + yysize - 1; |
| 1227 | |
| 1228 | YY_IGNORE_USELESS_CAST_BEGIN |
| 1229 | YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
| 1230 | YY_CAST (long, yystacksize))); |
| 1231 | YY_IGNORE_USELESS_CAST_END |
| 1232 | |
| 1233 | if (yyss + yystacksize - 1 <= yyssp) |
| 1234 | YYABORT; |
| 1235 | } |
| 1236 | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
| 1237 | |
| 1238 | |
| 1239 | if (yystate == YYFINAL) |
| 1240 | YYACCEPT; |
| 1241 | |
| 1242 | goto yybackup; |
| 1243 | |
| 1244 | |
| 1245 | /*-----------. |
| 1246 | | yybackup. | |
| 1247 | `-----------*/ |
| 1248 | yybackup: |
| 1249 | /* Do appropriate processing given the current state. Read a |
| 1250 | lookahead token if we need one and don't already have one. */ |
| 1251 | |
| 1252 | /* First try to decide what to do without reference to lookahead token. */ |
| 1253 | yyn = yypact[yystate]; |
| 1254 | if (yypact_value_is_default (yyn)) |
| 1255 | goto yydefault; |
| 1256 | |
| 1257 | /* Not known => get a lookahead token if don't already have one. */ |
| 1258 | |
| 1259 | /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
| 1260 | if (yychar == YYEMPTY) |
| 1261 | { |
| 1262 | YYDPRINTF ((stderr, "Reading a token\n")); |
| 1263 | yychar = yylex (); |
| 1264 | } |
| 1265 | |
| 1266 | if (yychar <= YYEOF) |
| 1267 | { |
| 1268 | yychar = YYEOF; |
| 1269 | yytoken = YYSYMBOL_YYEOF; |
| 1270 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1271 | } |
| 1272 | else if (yychar == YYerror) |
| 1273 | { |
| 1274 | /* The scanner already issued an error message, process directly |
| 1275 | to error recovery. But do not keep the error token as |
| 1276 | lookahead, it is too special and may lead us to an endless |
| 1277 | loop in error recovery. */ |
| 1278 | yychar = YYUNDEF; |
| 1279 | yytoken = YYSYMBOL_YYerror; |
| 1280 | goto yyerrlab1; |
| 1281 | } |
| 1282 | else |
| 1283 | { |
| 1284 | yytoken = YYTRANSLATE (yychar); |
| 1285 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 1286 | } |
| 1287 | |
| 1288 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1289 | detect an error, take that action. */ |
| 1290 | yyn += yytoken; |
| 1291 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1292 | goto yydefault; |
| 1293 | yyn = yytable[yyn]; |
| 1294 | if (yyn <= 0) |
| 1295 | { |
| 1296 | if (yytable_value_is_error (yyn)) |
| 1297 | goto yyerrlab; |
| 1298 | yyn = -yyn; |
| 1299 | goto yyreduce; |
| 1300 | } |
| 1301 | |
| 1302 | /* Count tokens shifted since error; after three, turn off error |
| 1303 | status. */ |
| 1304 | if (yyerrstatus) |
| 1305 | yyerrstatus--; |
| 1306 | |
| 1307 | /* Shift the lookahead token. */ |
| 1308 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 1309 | yystate = yyn; |
| 1310 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1311 | *++yyvsp = yylval; |
| 1312 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1313 | |
| 1314 | /* Discard the shifted token. */ |
| 1315 | yychar = YYEMPTY; |
| 1316 | goto yynewstate; |
| 1317 | |
| 1318 | |
| 1319 | /*-----------------------------------------------------------. |
| 1320 | | yydefault -- do the default action for the current state. | |
| 1321 | `-----------------------------------------------------------*/ |
| 1322 | yydefault: |
| 1323 | yyn = yydefact[yystate]; |
| 1324 | if (yyn == 0) |
| 1325 | goto yyerrlab; |
| 1326 | goto yyreduce; |
| 1327 | |
| 1328 | |
| 1329 | /*-----------------------------. |
| 1330 | | yyreduce -- do a reduction. | |
| 1331 | `-----------------------------*/ |
| 1332 | yyreduce: |
| 1333 | /* yyn is the number of a rule to reduce with. */ |
| 1334 | yylen = yyr2[yyn]; |
| 1335 | |
| 1336 | /* If YYLEN is nonzero, implement the default value of the action: |
| 1337 | '$$ = $1'. |
| 1338 | |
| 1339 | Otherwise, the following line sets YYVAL to garbage. |
| 1340 | This behavior is undocumented and Bison |
| 1341 | users should not rely upon it. Assigning to YYVAL |
| 1342 | unconditionally makes the parser a bit smaller, and it avoids a |
| 1343 | GCC warning that YYVAL may be used uninitialized. */ |
| 1344 | yyval = yyvsp[1-yylen]; |
| 1345 | |
| 1346 | |
| 1347 | YY_REDUCE_PRINT (yyn); |
| 1348 | switch (yyn) |
| 1349 | { |
| 1350 | case 4: /* mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL */ |
| 1351 | { |
| 1352 | menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); |
| 1353 | } |
| 1354 | break; |
| 1355 | |
| 1356 | case 14: /* stmt_list: stmt_list T_WORD error T_EOL */ |
| 1357 | { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); } |
| 1358 | break; |
| 1359 | |
| 1360 | case 15: /* stmt_list: stmt_list error T_EOL */ |
| 1361 | { zconf_error("invalid statement"); } |
| 1362 | break; |
| 1363 | |
| 1364 | case 20: /* stmt_list_in_choice: stmt_list_in_choice error T_EOL */ |
| 1365 | { zconf_error("invalid statement"); } |
| 1366 | break; |
| 1367 | |
| 1368 | case 21: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */ |
| 1369 | { |
| 1370 | (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; |
| 1371 | menu_add_entry((yyvsp[-1].symbol)); |
| 1372 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name); |
| 1373 | } |
| 1374 | break; |
| 1375 | |
| 1376 | case 22: /* config_stmt: config_entry_start config_option_list */ |
| 1377 | { |
| 1378 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); |
| 1379 | } |
| 1380 | break; |
| 1381 | |
| 1382 | case 23: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */ |
| 1383 | { |
| 1384 | (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; |
| 1385 | menu_add_entry((yyvsp[-1].symbol)); |
| 1386 | printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name); |
| 1387 | } |
| 1388 | break; |
| 1389 | |
| 1390 | case 24: /* menuconfig_stmt: menuconfig_entry_start config_option_list */ |
| 1391 | { |
| 1392 | if (current_entry->prompt) |
| 1393 | current_entry->prompt->type = P_MENU; |
| 1394 | else |
| 1395 | zconfprint("warning: menuconfig statement without prompt"); |
| 1396 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); |
| 1397 | } |
| 1398 | break; |
| 1399 | |
| 1400 | case 29: /* config_option: type prompt_stmt_opt T_EOL */ |
| 1401 | { |
| 1402 | menu_set_type((yyvsp[-2].type)); |
| 1403 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", |
| 1404 | zconf_curname(), zconf_lineno(), |
| 1405 | (yyvsp[-2].type)); |
| 1406 | } |
| 1407 | break; |
| 1408 | |
| 1409 | case 30: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ |
| 1410 | { |
| 1411 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); |
| 1412 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
| 1413 | } |
| 1414 | break; |
| 1415 | |
| 1416 | case 31: /* config_option: default expr if_expr T_EOL */ |
| 1417 | { |
| 1418 | menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); |
| 1419 | if ((yyvsp[-3].type) != S_UNKNOWN) |
| 1420 | menu_set_type((yyvsp[-3].type)); |
| 1421 | printd(DEBUG_PARSE, "%s:%d:default(%u)\n", |
| 1422 | zconf_curname(), zconf_lineno(), |
| 1423 | (yyvsp[-3].type)); |
| 1424 | } |
| 1425 | break; |
| 1426 | |
| 1427 | case 32: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */ |
| 1428 | { |
| 1429 | menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); |
| 1430 | printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); |
| 1431 | } |
| 1432 | break; |
| 1433 | |
| 1434 | case 33: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */ |
| 1435 | { |
| 1436 | menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr)); |
| 1437 | printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno()); |
| 1438 | } |
| 1439 | break; |
| 1440 | |
| 1441 | case 34: /* config_option: T_RANGE symbol symbol if_expr T_EOL */ |
| 1442 | { |
| 1443 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); |
| 1444 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); |
| 1445 | } |
| 1446 | break; |
| 1447 | |
| 1448 | case 35: /* config_option: T_MODULES T_EOL */ |
| 1449 | { |
| 1450 | if (modules_sym) |
| 1451 | zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'", |
| 1452 | current_entry->sym->name, modules_sym->name); |
| 1453 | modules_sym = current_entry->sym; |
| 1454 | } |
| 1455 | break; |
| 1456 | |
| 1457 | case 36: /* choice: T_CHOICE word_opt T_EOL */ |
| 1458 | { |
| 1459 | struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE); |
| 1460 | sym->flags |= SYMBOL_NO_WRITE; |
| 1461 | menu_add_entry(sym); |
| 1462 | menu_add_expr(P_CHOICE, NULL, NULL); |
| 1463 | free((yyvsp[-1].string)); |
| 1464 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); |
| 1465 | } |
| 1466 | break; |
| 1467 | |
| 1468 | case 37: /* choice_entry: choice choice_option_list */ |
| 1469 | { |
| 1470 | (yyval.menu) = menu_add_menu(); |
| 1471 | } |
| 1472 | break; |
| 1473 | |
| 1474 | case 38: /* choice_end: end */ |
| 1475 | { |
| 1476 | if (zconf_endtoken((yyvsp[0].string), "choice")) { |
| 1477 | menu_end_menu(); |
| 1478 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); |
| 1479 | } |
| 1480 | } |
| 1481 | break; |
| 1482 | |
| 1483 | case 44: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ |
| 1484 | { |
| 1485 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); |
| 1486 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
| 1487 | } |
| 1488 | break; |
| 1489 | |
| 1490 | case 45: /* choice_option: logic_type prompt_stmt_opt T_EOL */ |
| 1491 | { |
| 1492 | menu_set_type((yyvsp[-2].type)); |
| 1493 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", |
| 1494 | zconf_curname(), zconf_lineno(), (yyvsp[-2].type)); |
| 1495 | } |
| 1496 | break; |
| 1497 | |
| 1498 | case 46: /* choice_option: T_OPTIONAL T_EOL */ |
| 1499 | { |
| 1500 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
| 1501 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); |
| 1502 | } |
| 1503 | break; |
| 1504 | |
| 1505 | case 47: /* choice_option: T_RESET if_expr T_EOL */ |
| 1506 | { |
| 1507 | menu_add_prop(P_RESET, NULL, (yyvsp[-1].expr)); |
| 1508 | } |
| 1509 | break; |
| 1510 | |
| 1511 | case 48: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */ |
| 1512 | { |
| 1513 | menu_add_symbol(P_DEFAULT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); |
| 1514 | printd(DEBUG_PARSE, "%s:%d:default\n", |
| 1515 | zconf_curname(), zconf_lineno()); |
| 1516 | } |
| 1517 | break; |
| 1518 | |
| 1519 | case 50: /* type: T_INT */ |
| 1520 | { (yyval.type) = S_INT; } |
| 1521 | break; |
| 1522 | |
| 1523 | case 51: /* type: T_HEX */ |
| 1524 | { (yyval.type) = S_HEX; } |
| 1525 | break; |
| 1526 | |
| 1527 | case 52: /* type: T_STRING */ |
| 1528 | { (yyval.type) = S_STRING; } |
| 1529 | break; |
| 1530 | |
| 1531 | case 53: /* logic_type: T_BOOL */ |
| 1532 | { (yyval.type) = S_BOOLEAN; } |
| 1533 | break; |
| 1534 | |
| 1535 | case 54: /* logic_type: T_TRISTATE */ |
| 1536 | { (yyval.type) = S_TRISTATE; } |
| 1537 | break; |
| 1538 | |
| 1539 | case 55: /* default: T_DEFAULT */ |
| 1540 | { (yyval.type) = S_UNKNOWN; } |
| 1541 | break; |
| 1542 | |
| 1543 | case 56: /* default: T_DEF_BOOL */ |
| 1544 | { (yyval.type) = S_BOOLEAN; } |
| 1545 | break; |
| 1546 | |
| 1547 | case 57: /* default: T_DEF_TRISTATE */ |
| 1548 | { (yyval.type) = S_TRISTATE; } |
| 1549 | break; |
| 1550 | |
| 1551 | case 58: /* if_entry: T_IF expr T_EOL */ |
| 1552 | { |
| 1553 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); |
| 1554 | menu_add_entry(NULL); |
| 1555 | menu_add_dep((yyvsp[-1].expr)); |
| 1556 | (yyval.menu) = menu_add_menu(); |
| 1557 | } |
| 1558 | break; |
| 1559 | |
| 1560 | case 59: /* if_end: end */ |
| 1561 | { |
| 1562 | if (zconf_endtoken((yyvsp[0].string), "if")) { |
| 1563 | menu_end_menu(); |
| 1564 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); |
| 1565 | } |
| 1566 | } |
| 1567 | break; |
| 1568 | |
| 1569 | case 62: /* menu: T_MENU T_WORD_QUOTE T_EOL */ |
| 1570 | { |
| 1571 | menu_add_entry(NULL); |
| 1572 | menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); |
| 1573 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); |
| 1574 | } |
| 1575 | break; |
| 1576 | |
| 1577 | case 63: /* menu_entry: menu menu_option_list */ |
| 1578 | { |
| 1579 | (yyval.menu) = menu_add_menu(); |
| 1580 | } |
| 1581 | break; |
| 1582 | |
| 1583 | case 64: /* menu_end: end */ |
| 1584 | { |
| 1585 | if (zconf_endtoken((yyvsp[0].string), "menu")) { |
| 1586 | menu_end_menu(); |
| 1587 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); |
| 1588 | } |
| 1589 | } |
| 1590 | break; |
| 1591 | |
| 1592 | case 69: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */ |
| 1593 | { |
| 1594 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); |
| 1595 | zconf_nextfile((yyvsp[-1].string)); |
| 1596 | free((yyvsp[-1].string)); |
| 1597 | } |
| 1598 | break; |
| 1599 | |
| 1600 | case 70: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */ |
| 1601 | { |
| 1602 | menu_add_entry(NULL); |
| 1603 | menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL); |
| 1604 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); |
| 1605 | } |
| 1606 | break; |
| 1607 | |
| 1608 | case 74: /* help_start: T_HELP T_EOL */ |
| 1609 | { |
| 1610 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); |
| 1611 | zconf_starthelp(); |
| 1612 | } |
| 1613 | break; |
| 1614 | |
| 1615 | case 75: /* help: help_start T_HELPTEXT */ |
| 1616 | { |
| 1617 | /* Is the help text empty or all whitespace? */ |
| 1618 | if ((yyvsp[0].string)[strspn((yyvsp[0].string), " \f\n\r\t\v")] == '\0') |
| 1619 | zconfprint("warning: '%s' defined with blank help text", |
| 1620 | current_entry->sym->name ?: "<choice>"); |
| 1621 | |
| 1622 | current_entry->help = (yyvsp[0].string); |
| 1623 | } |
| 1624 | break; |
| 1625 | |
| 1626 | case 76: /* depends: T_DEPENDS T_ON expr T_EOL */ |
| 1627 | { |
| 1628 | menu_add_dep((yyvsp[-1].expr)); |
| 1629 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); |
| 1630 | } |
| 1631 | break; |
| 1632 | |
| 1633 | case 77: /* visible: T_VISIBLE if_expr T_EOL */ |
| 1634 | { |
| 1635 | menu_add_visibility((yyvsp[-1].expr)); |
| 1636 | } |
| 1637 | break; |
| 1638 | |
| 1639 | case 79: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */ |
| 1640 | { |
| 1641 | menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); |
| 1642 | } |
| 1643 | break; |
| 1644 | |
| 1645 | case 80: /* end: T_ENDMENU T_EOL */ |
| 1646 | { (yyval.string) = "menu"; } |
| 1647 | break; |
| 1648 | |
| 1649 | case 81: /* end: T_ENDCHOICE T_EOL */ |
| 1650 | { (yyval.string) = "choice"; } |
| 1651 | break; |
| 1652 | |
| 1653 | case 82: /* end: T_ENDIF T_EOL */ |
| 1654 | { (yyval.string) = "if"; } |
| 1655 | break; |
| 1656 | |
| 1657 | case 83: /* if_expr: %empty */ |
| 1658 | { (yyval.expr) = NULL; } |
| 1659 | break; |
| 1660 | |
| 1661 | case 84: /* if_expr: T_IF expr */ |
| 1662 | { (yyval.expr) = (yyvsp[0].expr); } |
| 1663 | break; |
| 1664 | |
| 1665 | case 85: /* expr: symbol */ |
| 1666 | { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); } |
| 1667 | break; |
| 1668 | |
| 1669 | case 86: /* expr: symbol T_LESS symbol */ |
| 1670 | { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } |
| 1671 | break; |
| 1672 | |
| 1673 | case 87: /* expr: symbol T_LESS_EQUAL symbol */ |
| 1674 | { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } |
| 1675 | break; |
| 1676 | |
| 1677 | case 88: /* expr: symbol T_GREATER symbol */ |
| 1678 | { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } |
| 1679 | break; |
| 1680 | |
| 1681 | case 89: /* expr: symbol T_GREATER_EQUAL symbol */ |
| 1682 | { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } |
| 1683 | break; |
| 1684 | |
| 1685 | case 90: /* expr: symbol T_EQUAL symbol */ |
| 1686 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } |
| 1687 | break; |
| 1688 | |
| 1689 | case 91: /* expr: symbol T_UNEQUAL symbol */ |
| 1690 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } |
| 1691 | break; |
| 1692 | |
| 1693 | case 92: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */ |
| 1694 | { (yyval.expr) = (yyvsp[-1].expr); } |
| 1695 | break; |
| 1696 | |
| 1697 | case 93: /* expr: T_NOT expr */ |
| 1698 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); } |
| 1699 | break; |
| 1700 | |
| 1701 | case 94: /* expr: expr T_OR expr */ |
| 1702 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } |
| 1703 | break; |
| 1704 | |
| 1705 | case 95: /* expr: expr T_AND expr */ |
| 1706 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } |
| 1707 | break; |
| 1708 | |
| 1709 | case 96: /* nonconst_symbol: T_WORD */ |
| 1710 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); } |
| 1711 | break; |
| 1712 | |
| 1713 | case 98: /* symbol: T_WORD_QUOTE */ |
| 1714 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); } |
| 1715 | break; |
| 1716 | |
| 1717 | case 99: /* word_opt: %empty */ |
| 1718 | { (yyval.string) = NULL; } |
| 1719 | break; |
| 1720 | |
| 1721 | case 101: /* assignment_stmt: T_WORD assign_op assign_val T_EOL */ |
| 1722 | { variable_add((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[-2].flavor)); free((yyvsp[-3].string)); free((yyvsp[-1].string)); } |
| 1723 | break; |
| 1724 | |
| 1725 | case 102: /* assign_op: T_EQUAL */ |
| 1726 | { (yyval.flavor) = VAR_RECURSIVE; } |
| 1727 | break; |
| 1728 | |
| 1729 | case 103: /* assign_op: T_COLON_EQUAL */ |
| 1730 | { (yyval.flavor) = VAR_SIMPLE; } |
| 1731 | break; |
| 1732 | |
| 1733 | case 104: /* assign_op: T_PLUS_EQUAL */ |
| 1734 | { (yyval.flavor) = VAR_APPEND; } |
| 1735 | break; |
| 1736 | |
| 1737 | case 105: /* assign_val: %empty */ |
| 1738 | { (yyval.string) = xstrdup(""); } |
| 1739 | break; |
| 1740 | |
| 1741 | |
| 1742 | |
| 1743 | default: break; |
| 1744 | } |
| 1745 | /* User semantic actions sometimes alter yychar, and that requires |
| 1746 | that yytoken be updated with the new translation. We take the |
| 1747 | approach of translating immediately before every use of yytoken. |
| 1748 | One alternative is translating here after every semantic action, |
| 1749 | but that translation would be missed if the semantic action invokes |
| 1750 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
| 1751 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
| 1752 | incorrect destructor might then be invoked immediately. In the |
| 1753 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
| 1754 | to an incorrect destructor call or verbose syntax error message |
| 1755 | before the lookahead is translated. */ |
| 1756 | YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
| 1757 | |
| 1758 | YYPOPSTACK (yylen); |
| 1759 | yylen = 0; |
| 1760 | |
| 1761 | *++yyvsp = yyval; |
| 1762 | |
| 1763 | /* Now 'shift' the result of the reduction. Determine what state |
| 1764 | that goes to, based on the state we popped back to and the rule |
| 1765 | number reduced by. */ |
| 1766 | { |
| 1767 | const int yylhs = yyr1[yyn] - YYNTOKENS; |
| 1768 | const int yyi = yypgoto[yylhs] + *yyssp; |
| 1769 | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
| 1770 | ? yytable[yyi] |
| 1771 | : yydefgoto[yylhs]); |
| 1772 | } |
| 1773 | |
| 1774 | goto yynewstate; |
| 1775 | |
| 1776 | |
| 1777 | /*--------------------------------------. |
| 1778 | | yyerrlab -- here on detecting error. | |
| 1779 | `--------------------------------------*/ |
| 1780 | yyerrlab: |
| 1781 | /* Make sure we have latest lookahead translation. See comments at |
| 1782 | user semantic actions for why this is necessary. */ |
| 1783 | yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
| 1784 | /* If not already recovering from an error, report this error. */ |
| 1785 | if (!yyerrstatus) |
| 1786 | { |
| 1787 | ++yynerrs; |
| 1788 | yyerror (YY_("syntax error")); |
| 1789 | } |
| 1790 | |
| 1791 | if (yyerrstatus == 3) |
| 1792 | { |
| 1793 | /* If just tried and failed to reuse lookahead token after an |
| 1794 | error, discard it. */ |
| 1795 | |
| 1796 | if (yychar <= YYEOF) |
| 1797 | { |
| 1798 | /* Return failure if at end of input. */ |
| 1799 | if (yychar == YYEOF) |
| 1800 | YYABORT; |
| 1801 | } |
| 1802 | else |
| 1803 | { |
| 1804 | yydestruct ("Error: discarding", |
| 1805 | yytoken, &yylval); |
| 1806 | yychar = YYEMPTY; |
| 1807 | } |
| 1808 | } |
| 1809 | |
| 1810 | /* Else will try to reuse lookahead token after shifting the error |
| 1811 | token. */ |
| 1812 | goto yyerrlab1; |
| 1813 | |
| 1814 | |
| 1815 | /*---------------------------------------------------. |
| 1816 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 1817 | `---------------------------------------------------*/ |
| 1818 | yyerrorlab: |
| 1819 | /* Pacify compilers when the user code never invokes YYERROR and the |
| 1820 | label yyerrorlab therefore never appears in user code. */ |
| 1821 | if (0) |
| 1822 | YYERROR; |
| 1823 | ++yynerrs; |
| 1824 | |
| 1825 | /* Do not reclaim the symbols of the rule whose action triggered |
| 1826 | this YYERROR. */ |
| 1827 | YYPOPSTACK (yylen); |
| 1828 | yylen = 0; |
| 1829 | YY_STACK_PRINT (yyss, yyssp); |
| 1830 | yystate = *yyssp; |
| 1831 | goto yyerrlab1; |
| 1832 | |
| 1833 | |
| 1834 | /*-------------------------------------------------------------. |
| 1835 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 1836 | `-------------------------------------------------------------*/ |
| 1837 | yyerrlab1: |
| 1838 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1839 | |
| 1840 | /* Pop stack until we find a state that shifts the error token. */ |
| 1841 | for (;;) |
| 1842 | { |
| 1843 | yyn = yypact[yystate]; |
| 1844 | if (!yypact_value_is_default (yyn)) |
| 1845 | { |
| 1846 | yyn += YYSYMBOL_YYerror; |
| 1847 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
| 1848 | { |
| 1849 | yyn = yytable[yyn]; |
| 1850 | if (0 < yyn) |
| 1851 | break; |
| 1852 | } |
| 1853 | } |
| 1854 | |
| 1855 | /* Pop the current state because it cannot handle the error token. */ |
| 1856 | if (yyssp == yyss) |
| 1857 | YYABORT; |
| 1858 | |
| 1859 | |
| 1860 | yydestruct ("Error: popping", |
| 1861 | YY_ACCESSING_SYMBOL (yystate), yyvsp); |
| 1862 | YYPOPSTACK (1); |
| 1863 | yystate = *yyssp; |
| 1864 | YY_STACK_PRINT (yyss, yyssp); |
| 1865 | } |
| 1866 | |
| 1867 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1868 | *++yyvsp = yylval; |
| 1869 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1870 | |
| 1871 | |
| 1872 | /* Shift the error token. */ |
| 1873 | YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
| 1874 | |
| 1875 | yystate = yyn; |
| 1876 | goto yynewstate; |
| 1877 | |
| 1878 | |
| 1879 | /*-------------------------------------. |
| 1880 | | yyacceptlab -- YYACCEPT comes here. | |
| 1881 | `-------------------------------------*/ |
| 1882 | yyacceptlab: |
| 1883 | yyresult = 0; |
| 1884 | goto yyreturnlab; |
| 1885 | |
| 1886 | |
| 1887 | /*-----------------------------------. |
| 1888 | | yyabortlab -- YYABORT comes here. | |
| 1889 | `-----------------------------------*/ |
| 1890 | yyabortlab: |
| 1891 | yyresult = 1; |
| 1892 | goto yyreturnlab; |
| 1893 | |
| 1894 | |
| 1895 | /*-----------------------------------------------------------. |
| 1896 | | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
| 1897 | `-----------------------------------------------------------*/ |
| 1898 | yyexhaustedlab: |
| 1899 | yyerror (YY_("memory exhausted")); |
| 1900 | yyresult = 2; |
| 1901 | goto yyreturnlab; |
| 1902 | |
| 1903 | |
| 1904 | /*----------------------------------------------------------. |
| 1905 | | yyreturnlab -- parsing is finished, clean up and return. | |
| 1906 | `----------------------------------------------------------*/ |
| 1907 | yyreturnlab: |
| 1908 | if (yychar != YYEMPTY) |
| 1909 | { |
| 1910 | /* Make sure we have latest lookahead translation. See comments at |
| 1911 | user semantic actions for why this is necessary. */ |
| 1912 | yytoken = YYTRANSLATE (yychar); |
| 1913 | yydestruct ("Cleanup: discarding lookahead", |
| 1914 | yytoken, &yylval); |
| 1915 | } |
| 1916 | /* Do not reclaim the symbols of the rule whose action triggered |
| 1917 | this YYABORT or YYACCEPT. */ |
| 1918 | YYPOPSTACK (yylen); |
| 1919 | YY_STACK_PRINT (yyss, yyssp); |
| 1920 | while (yyssp != yyss) |
| 1921 | { |
| 1922 | yydestruct ("Cleanup: popping", |
| 1923 | YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); |
| 1924 | YYPOPSTACK (1); |
| 1925 | } |
| 1926 | #ifndef yyoverflow |
| 1927 | if (yyss != yyssa) |
| 1928 | YYSTACK_FREE (yyss); |
| 1929 | #endif |
| 1930 | |
| 1931 | return yyresult; |
| 1932 | } |
| 1933 | |
| 1934 | |
| 1935 | |
| 1936 | void conf_parse(const char *name) |
| 1937 | { |
| 1938 | struct symbol *sym; |
| 1939 | int i; |
| 1940 | |
| 1941 | zconf_initscan(name); |
| 1942 | |
| 1943 | _menu_init(); |
| 1944 | |
| 1945 | #if YYDEBUG |
| 1946 | if (getenv("ZCONF_DEBUG")) |
| 1947 | yydebug = 1; |
| 1948 | #endif |
| 1949 | yyparse(); |
| 1950 | |
| 1951 | /* Variables are expanded in the parse phase. We can free them here. */ |
| 1952 | variable_all_del(); |
| 1953 | |
| 1954 | if (yynerrs) |
| 1955 | exit(1); |
| 1956 | if (!modules_sym) |
| 1957 | modules_sym = sym_find( "n" ); |
| 1958 | |
| 1959 | if (!menu_has_prompt(&rootmenu)) { |
| 1960 | current_entry = &rootmenu; |
| 1961 | menu_add_prompt(P_MENU, "Main menu", NULL); |
| 1962 | } |
| 1963 | |
| 1964 | menu_finalize(&rootmenu); |
| 1965 | for_all_symbols(i, sym) { |
| 1966 | if (sym_check_deps(sym)) |
| 1967 | yynerrs++; |
| 1968 | } |
| 1969 | if (yynerrs) |
| 1970 | exit(1); |
| 1971 | conf_set_changed(true); |
| 1972 | } |
| 1973 | |
| 1974 | static bool zconf_endtoken(const char *tokenname, |
| 1975 | const char *expected_tokenname) |
| 1976 | { |
| 1977 | if (strcmp(tokenname, expected_tokenname)) { |
| 1978 | zconf_error("unexpected '%s' within %s block", |
| 1979 | tokenname, expected_tokenname); |
| 1980 | yynerrs++; |
| 1981 | return false; |
| 1982 | } |
| 1983 | if (current_menu->file != current_file) { |
| 1984 | zconf_error("'%s' in different file than '%s'", |
| 1985 | tokenname, expected_tokenname); |
| 1986 | fprintf(stderr, "%s:%d: location of the '%s'\n", |
| 1987 | current_menu->file->name, current_menu->lineno, |
| 1988 | expected_tokenname); |
| 1989 | yynerrs++; |
| 1990 | return false; |
| 1991 | } |
| 1992 | return true; |
| 1993 | } |
| 1994 | |
| 1995 | static void zconfprint(const char *err, ...) |
| 1996 | { |
| 1997 | va_list ap; |
| 1998 | |
| 1999 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); |
| 2000 | va_start(ap, err); |
| 2001 | vfprintf(stderr, err, ap); |
| 2002 | va_end(ap); |
| 2003 | fprintf(stderr, "\n"); |
| 2004 | } |
| 2005 | |
| 2006 | static void zconf_error(const char *err, ...) |
| 2007 | { |
| 2008 | va_list ap; |
| 2009 | |
| 2010 | yynerrs++; |
| 2011 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); |
| 2012 | va_start(ap, err); |
| 2013 | vfprintf(stderr, err, ap); |
| 2014 | va_end(ap); |
| 2015 | fprintf(stderr, "\n"); |
| 2016 | } |
| 2017 | |
| 2018 | static void yyerror(const char *err) |
| 2019 | { |
| 2020 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
| 2021 | } |
| 2022 | |
| 2023 | static void print_quoted_string(FILE *out, const char *str) |
| 2024 | { |
| 2025 | const char *p; |
| 2026 | int len; |
| 2027 | |
| 2028 | putc('"', out); |
| 2029 | while ((p = strchr(str, '"'))) { |
| 2030 | len = p - str; |
| 2031 | if (len) |
| 2032 | fprintf(out, "%.*s", len, str); |
| 2033 | fputs("\\\"", out); |
| 2034 | str = p + 1; |
| 2035 | } |
| 2036 | fputs(str, out); |
| 2037 | putc('"', out); |
| 2038 | } |
| 2039 | |
| 2040 | static void print_symbol(FILE *out, struct menu *menu) |
| 2041 | { |
| 2042 | struct symbol *sym = menu->sym; |
| 2043 | struct property *prop; |
| 2044 | |
| 2045 | if (sym_is_choice(sym)) |
| 2046 | fprintf(out, "\nchoice\n"); |
| 2047 | else |
| 2048 | fprintf(out, "\nconfig %s\n", sym->name); |
| 2049 | switch (sym->type) { |
| 2050 | case S_BOOLEAN: |
| 2051 | fputs(" bool\n", out); |
| 2052 | break; |
| 2053 | case S_TRISTATE: |
| 2054 | fputs(" tristate\n", out); |
| 2055 | break; |
| 2056 | case S_STRING: |
| 2057 | fputs(" string\n", out); |
| 2058 | break; |
| 2059 | case S_INT: |
| 2060 | fputs(" integer\n", out); |
| 2061 | break; |
| 2062 | case S_HEX: |
| 2063 | fputs(" hex\n", out); |
| 2064 | break; |
| 2065 | default: |
| 2066 | fputs(" ???\n", out); |
| 2067 | break; |
| 2068 | } |
| 2069 | for (prop = sym->prop; prop; prop = prop->next) { |
| 2070 | if (prop->menu != menu) |
| 2071 | continue; |
| 2072 | switch (prop->type) { |
| 2073 | case P_PROMPT: |
| 2074 | fputs(" prompt ", out); |
| 2075 | print_quoted_string(out, prop->text); |
| 2076 | if (!expr_is_yes(prop->visible.expr)) { |
| 2077 | fputs(" if ", out); |
| 2078 | expr_fprint(prop->visible.expr, out); |
| 2079 | } |
| 2080 | fputc('\n', out); |
| 2081 | break; |
| 2082 | case P_DEFAULT: |
| 2083 | fputs( " default ", out); |
| 2084 | expr_fprint(prop->expr, out); |
| 2085 | if (!expr_is_yes(prop->visible.expr)) { |
| 2086 | fputs(" if ", out); |
| 2087 | expr_fprint(prop->visible.expr, out); |
| 2088 | } |
| 2089 | fputc('\n', out); |
| 2090 | break; |
| 2091 | case P_CHOICE: |
| 2092 | fputs(" #choice value\n", out); |
| 2093 | break; |
| 2094 | case P_SELECT: |
| 2095 | fputs( " select ", out); |
| 2096 | expr_fprint(prop->expr, out); |
| 2097 | fputc('\n', out); |
| 2098 | break; |
| 2099 | case P_IMPLY: |
| 2100 | fputs( " imply ", out); |
| 2101 | expr_fprint(prop->expr, out); |
| 2102 | fputc('\n', out); |
| 2103 | break; |
| 2104 | case P_RANGE: |
| 2105 | fputs( " range ", out); |
| 2106 | expr_fprint(prop->expr, out); |
| 2107 | fputc('\n', out); |
| 2108 | break; |
| 2109 | case P_MENU: |
| 2110 | fputs( " menu ", out); |
| 2111 | print_quoted_string(out, prop->text); |
| 2112 | fputc('\n', out); |
| 2113 | break; |
| 2114 | case P_SYMBOL: |
| 2115 | fputs( " symbol ", out); |
| 2116 | fprintf(out, "%s\n", prop->menu->sym->name); |
| 2117 | break; |
| 2118 | default: |
| 2119 | fprintf(out, " unknown prop %d!\n", prop->type); |
| 2120 | break; |
| 2121 | } |
| 2122 | } |
| 2123 | if (menu->help) { |
| 2124 | int len = strlen(menu->help); |
| 2125 | while (menu->help[--len] == '\n') |
| 2126 | menu->help[len] = 0; |
| 2127 | fprintf(out, " help\n%s\n", menu->help); |
| 2128 | } |
| 2129 | } |
| 2130 | |
| 2131 | void zconfdump(FILE *out) |
| 2132 | { |
| 2133 | struct property *prop; |
| 2134 | struct symbol *sym; |
| 2135 | struct menu *menu; |
| 2136 | |
| 2137 | menu = rootmenu.list; |
| 2138 | while (menu) { |
| 2139 | if ((sym = menu->sym)) |
| 2140 | print_symbol(out, menu); |
| 2141 | else if ((prop = menu->prompt)) { |
| 2142 | switch (prop->type) { |
| 2143 | case P_COMMENT: |
| 2144 | fputs("\ncomment ", out); |
| 2145 | print_quoted_string(out, prop->text); |
| 2146 | fputs("\n", out); |
| 2147 | break; |
| 2148 | case P_MENU: |
| 2149 | fputs("\nmenu ", out); |
| 2150 | print_quoted_string(out, prop->text); |
| 2151 | fputs("\n", out); |
| 2152 | break; |
| 2153 | default: |
| 2154 | ; |
| 2155 | } |
| 2156 | if (!expr_is_yes(prop->visible.expr)) { |
| 2157 | fputs(" depends ", out); |
| 2158 | expr_fprint(prop->visible.expr, out); |
| 2159 | fputc('\n', out); |
| 2160 | } |
| 2161 | } |
| 2162 | |
| 2163 | if (menu->list) |
| 2164 | menu = menu->list; |
| 2165 | else if (menu->next) |
| 2166 | menu = menu->next; |
| 2167 | else while ((menu = menu->parent)) { |
| 2168 | if (menu->prompt && menu->prompt->type == P_MENU) |
| 2169 | fputs("\nendmenu\n", out); |
| 2170 | if (menu->next) { |
| 2171 | menu = menu->next; |
| 2172 | break; |
| 2173 | } |
| 2174 | } |
| 2175 | } |
| 2176 | } |