Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ |
| 2 | |
| 3 | /* Bison implementation for Yacc-like parsers in C |
| 4 | |
| 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. |
| 6 | |
| 7 | This program is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | /* As a special exception, you may create a larger work that contains |
| 21 | part or all of the Bison parser skeleton and distribute that work |
| 22 | under terms of your choice, so long as that work isn't itself a |
| 23 | parser generator using the skeleton or a modified version thereof |
| 24 | as a parser skeleton. Alternatively, if you modify or redistribute |
| 25 | the parser skeleton itself, you may (at your option) remove this |
| 26 | special exception, which will cause the skeleton and the resulting |
| 27 | Bison output files to be licensed under the GNU General Public |
| 28 | License without this special exception. |
| 29 | |
| 30 | This special exception was added by the Free Software Foundation in |
| 31 | version 2.2 of Bison. */ |
| 32 | |
| 33 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
| 34 | simplifying the original so-called "semantic" parser. */ |
| 35 | |
| 36 | /* All symbols defined below should begin with yy or YY, to avoid |
| 37 | infringing on user name space. This should be done even for local |
| 38 | variables, as they might otherwise be expanded by user macros. |
| 39 | There are some unavoidable exceptions within include files to |
| 40 | define necessary library symbols; they are noted "INFRINGES ON |
| 41 | USER NAME SPACE" below. */ |
| 42 | |
| 43 | /* Identify Bison output. */ |
| 44 | #define YYBISON 1 |
| 45 | |
| 46 | /* Bison version. */ |
| 47 | #define YYBISON_VERSION "3.0.2" |
| 48 | |
| 49 | /* Skeleton name. */ |
| 50 | #define YYSKELETON_NAME "yacc.c" |
| 51 | |
| 52 | /* Pure parsers. */ |
| 53 | #define YYPURE 0 |
| 54 | |
| 55 | /* Push parsers. */ |
| 56 | #define YYPUSH 0 |
| 57 | |
| 58 | /* Pull parsers. */ |
| 59 | #define YYPULL 1 |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | /* Copy the first part of user declarations. */ |
| 65 | #line 20 "fmd_parser.y" /* yacc.c:339 */ |
| 66 | |
| 67 | #include "fmd_scanner.h" |
| 68 | |
| 69 | #include <stdlib.h> |
| 70 | |
| 71 | struct flashmap_descriptor *res = NULL; |
| 72 | |
| 73 | #line 74 "y.tab.c" /* yacc.c:339 */ |
| 74 | |
| 75 | # ifndef YY_NULLPTR |
| 76 | # if defined __cplusplus && 201103L <= __cplusplus |
| 77 | # define YY_NULLPTR nullptr |
| 78 | # else |
| 79 | # define YY_NULLPTR 0 |
| 80 | # endif |
| 81 | # endif |
| 82 | |
| 83 | /* Enabling verbose error messages. */ |
| 84 | #ifdef YYERROR_VERBOSE |
| 85 | # undef YYERROR_VERBOSE |
| 86 | # define YYERROR_VERBOSE 1 |
| 87 | #else |
| 88 | # define YYERROR_VERBOSE 0 |
| 89 | #endif |
| 90 | |
| 91 | /* In a future release of Bison, this section will be replaced |
| 92 | by #include "y.tab.h". */ |
| 93 | #ifndef YY_YY_Y_TAB_H_INCLUDED |
| 94 | # define YY_YY_Y_TAB_H_INCLUDED |
| 95 | /* Debug traces. */ |
| 96 | #ifndef YYDEBUG |
| 97 | # define YYDEBUG 0 |
| 98 | #endif |
| 99 | #if YYDEBUG |
| 100 | extern int yydebug; |
| 101 | #endif |
| 102 | /* "%code requires" blocks. */ |
| 103 | #line 36 "fmd_parser.y" /* yacc.c:355 */ |
| 104 | |
| 105 | #include "fmd.h" |
| 106 | #include "option.h" |
| 107 | |
| 108 | #include <stdbool.h> |
| 109 | |
| 110 | struct descriptor_node { |
| 111 | struct flashmap_descriptor *val; |
| 112 | struct descriptor_node *next; |
| 113 | }; |
| 114 | |
| 115 | struct descriptor_list { |
| 116 | size_t len; |
| 117 | struct descriptor_node *head; |
| 118 | struct descriptor_node *tail; |
| 119 | }; |
| 120 | |
| 121 | extern struct flashmap_descriptor *res; |
| 122 | |
| 123 | struct flashmap_descriptor *parse_descriptor(char *name, |
| 124 | struct unsigned_option offset, struct unsigned_option size, |
| 125 | struct descriptor_list children); |
| 126 | void yyerror(const char *s); |
| 127 | |
| 128 | #line 129 "y.tab.c" /* yacc.c:355 */ |
| 129 | |
| 130 | /* Token type. */ |
| 131 | #ifndef YYTOKENTYPE |
| 132 | # define YYTOKENTYPE |
| 133 | enum yytokentype |
| 134 | { |
| 135 | INTEGER = 258, |
| 136 | OCTAL = 259, |
| 137 | STRING = 260 |
| 138 | }; |
| 139 | #endif |
| 140 | /* Tokens. */ |
| 141 | #define INTEGER 258 |
| 142 | #define OCTAL 259 |
| 143 | #define STRING 260 |
| 144 | |
| 145 | /* Value type. */ |
| 146 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 147 | typedef union YYSTYPE YYSTYPE; |
| 148 | union YYSTYPE |
| 149 | { |
| 150 | #line 28 "fmd_parser.y" /* yacc.c:355 */ |
| 151 | |
| 152 | unsigned intval; |
| 153 | char *strval; |
| 154 | struct unsigned_option maybe_intval; |
| 155 | struct flashmap_descriptor *region_ptr; |
| 156 | struct descriptor_list region_listhdr; |
| 157 | |
| 158 | #line 159 "y.tab.c" /* yacc.c:355 */ |
| 159 | }; |
| 160 | # define YYSTYPE_IS_TRIVIAL 1 |
| 161 | # define YYSTYPE_IS_DECLARED 1 |
| 162 | #endif |
| 163 | |
| 164 | |
| 165 | extern YYSTYPE yylval; |
| 166 | |
| 167 | int yyparse (void); |
| 168 | |
| 169 | #endif /* !YY_YY_Y_TAB_H_INCLUDED */ |
| 170 | |
| 171 | /* Copy the second part of user declarations. */ |
| 172 | |
| 173 | #line 174 "y.tab.c" /* yacc.c:358 */ |
| 174 | |
| 175 | #ifdef short |
| 176 | # undef short |
| 177 | #endif |
| 178 | |
| 179 | #ifdef YYTYPE_UINT8 |
| 180 | typedef YYTYPE_UINT8 yytype_uint8; |
| 181 | #else |
| 182 | typedef unsigned char yytype_uint8; |
| 183 | #endif |
| 184 | |
| 185 | #ifdef YYTYPE_INT8 |
| 186 | typedef YYTYPE_INT8 yytype_int8; |
| 187 | #else |
| 188 | typedef signed char yytype_int8; |
| 189 | #endif |
| 190 | |
| 191 | #ifdef YYTYPE_UINT16 |
| 192 | typedef YYTYPE_UINT16 yytype_uint16; |
| 193 | #else |
| 194 | typedef unsigned short int yytype_uint16; |
| 195 | #endif |
| 196 | |
| 197 | #ifdef YYTYPE_INT16 |
| 198 | typedef YYTYPE_INT16 yytype_int16; |
| 199 | #else |
| 200 | typedef short int yytype_int16; |
| 201 | #endif |
| 202 | |
| 203 | #ifndef YYSIZE_T |
| 204 | # ifdef __SIZE_TYPE__ |
| 205 | # define YYSIZE_T __SIZE_TYPE__ |
| 206 | # elif defined size_t |
| 207 | # define YYSIZE_T size_t |
| 208 | # elif ! defined YYSIZE_T |
| 209 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 210 | # define YYSIZE_T size_t |
| 211 | # else |
| 212 | # define YYSIZE_T unsigned int |
| 213 | # endif |
| 214 | #endif |
| 215 | |
| 216 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 217 | |
| 218 | #ifndef YY_ |
| 219 | # if defined YYENABLE_NLS && YYENABLE_NLS |
| 220 | # if ENABLE_NLS |
| 221 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 222 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
| 223 | # endif |
| 224 | # endif |
| 225 | # ifndef YY_ |
| 226 | # define YY_(Msgid) Msgid |
| 227 | # endif |
| 228 | #endif |
| 229 | |
| 230 | #ifndef YY_ATTRIBUTE |
| 231 | # if (defined __GNUC__ \ |
| 232 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ |
| 233 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
| 234 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) |
| 235 | # else |
| 236 | # define YY_ATTRIBUTE(Spec) /* empty */ |
| 237 | # endif |
| 238 | #endif |
| 239 | |
| 240 | #ifndef YY_ATTRIBUTE_PURE |
| 241 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
| 242 | #endif |
| 243 | |
| 244 | #ifndef YY_ATTRIBUTE_UNUSED |
| 245 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
| 246 | #endif |
| 247 | |
| 248 | #if !defined _Noreturn \ |
| 249 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) |
| 250 | # if defined _MSC_VER && 1200 <= _MSC_VER |
| 251 | # define _Noreturn __declspec (noreturn) |
| 252 | # else |
| 253 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) |
| 254 | # endif |
| 255 | #endif |
| 256 | |
| 257 | /* Suppress unused-variable warnings by "using" E. */ |
| 258 | #if ! defined lint || defined __GNUC__ |
| 259 | # define YYUSE(E) ((void) (E)) |
| 260 | #else |
| 261 | # define YYUSE(E) /* empty */ |
| 262 | #endif |
| 263 | |
| 264 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
| 265 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
| 266 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 267 | _Pragma ("GCC diagnostic push") \ |
| 268 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ |
| 269 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
| 270 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
| 271 | _Pragma ("GCC diagnostic pop") |
| 272 | #else |
| 273 | # define YY_INITIAL_VALUE(Value) Value |
| 274 | #endif |
| 275 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 276 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 277 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 278 | #endif |
| 279 | #ifndef YY_INITIAL_VALUE |
| 280 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
| 281 | #endif |
| 282 | |
| 283 | |
| 284 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 285 | |
| 286 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 287 | |
| 288 | # ifdef YYSTACK_USE_ALLOCA |
| 289 | # if YYSTACK_USE_ALLOCA |
| 290 | # ifdef __GNUC__ |
| 291 | # define YYSTACK_ALLOC __builtin_alloca |
| 292 | # elif defined __BUILTIN_VA_ARG_INCR |
| 293 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 294 | # elif defined _AIX |
| 295 | # define YYSTACK_ALLOC __alloca |
| 296 | # elif defined _MSC_VER |
| 297 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 298 | # define alloca _alloca |
| 299 | # else |
| 300 | # define YYSTACK_ALLOC alloca |
| 301 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
| 302 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 303 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
| 304 | # ifndef EXIT_SUCCESS |
| 305 | # define EXIT_SUCCESS 0 |
| 306 | # endif |
| 307 | # endif |
| 308 | # endif |
| 309 | # endif |
| 310 | # endif |
| 311 | |
| 312 | # ifdef YYSTACK_ALLOC |
| 313 | /* Pacify GCC's 'empty if-body' warning. */ |
| 314 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 315 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 316 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 317 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 318 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 319 | to allow for a few compiler-allocated temporary stack slots. */ |
| 320 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 321 | # endif |
| 322 | # else |
| 323 | # define YYSTACK_ALLOC YYMALLOC |
| 324 | # define YYSTACK_FREE YYFREE |
| 325 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 326 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 327 | # endif |
| 328 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
| 329 | && ! ((defined YYMALLOC || defined malloc) \ |
| 330 | && (defined YYFREE || defined free))) |
| 331 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 332 | # ifndef EXIT_SUCCESS |
| 333 | # define EXIT_SUCCESS 0 |
| 334 | # endif |
| 335 | # endif |
| 336 | # ifndef YYMALLOC |
| 337 | # define YYMALLOC malloc |
| 338 | # if ! defined malloc && ! defined EXIT_SUCCESS |
| 339 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 340 | # endif |
| 341 | # endif |
| 342 | # ifndef YYFREE |
| 343 | # define YYFREE free |
| 344 | # if ! defined free && ! defined EXIT_SUCCESS |
| 345 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 346 | # endif |
| 347 | # endif |
| 348 | # endif |
| 349 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 350 | |
| 351 | |
| 352 | #if (! defined yyoverflow \ |
| 353 | && (! defined __cplusplus \ |
| 354 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 355 | |
| 356 | /* A type that is properly aligned for any stack member. */ |
| 357 | union yyalloc |
| 358 | { |
| 359 | yytype_int16 yyss_alloc; |
| 360 | YYSTYPE yyvs_alloc; |
| 361 | }; |
| 362 | |
| 363 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 364 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 365 | |
| 366 | /* The size of an array large to enough to hold all stacks, each with |
| 367 | N elements. */ |
| 368 | # define YYSTACK_BYTES(N) \ |
| 369 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 370 | + YYSTACK_GAP_MAXIMUM) |
| 371 | |
| 372 | # define YYCOPY_NEEDED 1 |
| 373 | |
| 374 | /* Relocate STACK from its old location to the new one. The |
| 375 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 376 | elements in the stack, and YYPTR gives the new location of the |
| 377 | stack. Advance YYPTR to a properly aligned location for the next |
| 378 | stack. */ |
| 379 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
| 380 | do \ |
| 381 | { \ |
| 382 | YYSIZE_T yynewbytes; \ |
| 383 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
| 384 | Stack = &yyptr->Stack_alloc; \ |
| 385 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 386 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 387 | } \ |
| 388 | while (0) |
| 389 | |
| 390 | #endif |
| 391 | |
| 392 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
| 393 | /* Copy COUNT objects from SRC to DST. The source and destination do |
| 394 | not overlap. */ |
| 395 | # ifndef YYCOPY |
| 396 | # if defined __GNUC__ && 1 < __GNUC__ |
| 397 | # define YYCOPY(Dst, Src, Count) \ |
| 398 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
| 399 | # else |
| 400 | # define YYCOPY(Dst, Src, Count) \ |
| 401 | do \ |
| 402 | { \ |
| 403 | YYSIZE_T yyi; \ |
| 404 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 405 | (Dst)[yyi] = (Src)[yyi]; \ |
| 406 | } \ |
| 407 | while (0) |
| 408 | # endif |
| 409 | # endif |
| 410 | #endif /* !YYCOPY_NEEDED */ |
| 411 | |
| 412 | /* YYFINAL -- State number of the termination state. */ |
| 413 | #define YYFINAL 4 |
| 414 | /* YYLAST -- Last index in YYTABLE. */ |
| 415 | #define YYLAST 17 |
| 416 | |
| 417 | /* YYNTOKENS -- Number of terminals. */ |
| 418 | #define YYNTOKENS 11 |
| 419 | /* YYNNTS -- Number of nonterminals. */ |
| 420 | #define YYNNTS 13 |
| 421 | /* YYNRULES -- Number of rules. */ |
| 422 | #define YYNRULES 18 |
| 423 | /* YYNSTATES -- Number of states. */ |
| 424 | #define YYNSTATES 28 |
| 425 | |
| 426 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
| 427 | by yylex, with out-of-bounds checking. */ |
| 428 | #define YYUNDEFTOK 2 |
| 429 | #define YYMAXUTOK 260 |
| 430 | |
| 431 | #define YYTRANSLATE(YYX) \ |
| 432 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 433 | |
| 434 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
| 435 | as returned by yylex, without out-of-bounds checking. */ |
| 436 | static const yytype_uint8 yytranslate[] = |
| 437 | { |
| 438 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 439 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 440 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 441 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 442 | 6, 7, 2, 2, 2, 2, 2, 2, 2, 2, |
| 443 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 444 | 2, 2, 2, 2, 8, 2, 2, 2, 2, 2, |
| 445 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 446 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 447 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 448 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 449 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 450 | 2, 2, 2, 9, 2, 10, 2, 2, 2, 2, |
| 451 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 452 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 453 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 454 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 455 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 456 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 457 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 458 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 459 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 460 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 461 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 462 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 463 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 464 | 5 |
| 465 | }; |
| 466 | |
| 467 | #if YYDEBUG |
| 468 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
| 469 | static const yytype_uint8 yyrline[] = |
| 470 | { |
| 471 | 0, 79, 79, 84, 101, 108, 109, 110, 111, 112, |
| 472 | 113, 114, 115, 116, 118, 122, 123, 124, 135 |
| 473 | }; |
| 474 | #endif |
| 475 | |
| 476 | #if YYDEBUG || YYERROR_VERBOSE || 0 |
| 477 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 478 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 479 | static const char *const yytname[] = |
| 480 | { |
| 481 | "$end", "error", "$undefined", "INTEGER", "OCTAL", "STRING", "'('", |
| 482 | "')'", "'@'", "'{'", "'}'", "$accept", "flash_chip", "flash_region", |
| 483 | "region_name", "region_annotation_opt", "region_annotation", |
| 484 | "region_offset_opt", "region_offset", "region_size_opt", "region_size", |
| 485 | "region_list_opt", "region_list", "region_list_entries", YY_NULLPTR |
| 486 | }; |
| 487 | #endif |
| 488 | |
| 489 | # ifdef YYPRINT |
| 490 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
| 491 | (internal) symbol number NUM (which must be that of a token). */ |
| 492 | static const yytype_uint16 yytoknum[] = |
| 493 | { |
| 494 | 0, 256, 257, 258, 259, 260, 40, 41, 64, 123, |
| 495 | 125 |
| 496 | }; |
| 497 | # endif |
| 498 | |
| 499 | #define YYPACT_NINF -10 |
| 500 | |
| 501 | #define yypact_value_is_default(Yystate) \ |
| 502 | (!!((Yystate) == (-10))) |
| 503 | |
| 504 | #define YYTABLE_NINF -1 |
| 505 | |
| 506 | #define yytable_value_is_error(Yytable_value) \ |
| 507 | 0 |
| 508 | |
| 509 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 510 | STATE-NUM. */ |
| 511 | static const yytype_int8 yypact[] = |
| 512 | { |
| 513 | -4, -10, 2, -2, -10, 0, 1, -10, -10, -10, |
| 514 | -1, -4, -10, -10, 3, -5, 5, -2, -10, -10, |
| 515 | -10, 4, 1, -10, -1, -10, -10, -10 |
| 516 | }; |
| 517 | |
| 518 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
| 519 | Performed when YYTABLE does not specify something else to do. Zero |
| 520 | means the default is an error. */ |
| 521 | static const yytype_uint8 yydefact[] = |
| 522 | { |
| 523 | 0, 4, 0, 8, 1, 0, 0, 9, 10, 13, |
| 524 | 0, 0, 2, 17, 5, 0, 0, 8, 6, 16, |
| 525 | 18, 0, 11, 7, 14, 12, 3, 15 |
| 526 | }; |
| 527 | |
| 528 | /* YYPGOTO[NTERM-NUM]. */ |
| 529 | static const yytype_int8 yypgoto[] = |
| 530 | { |
| 531 | -10, -10, -8, 12, -10, -10, -3, -10, -10, -9, |
| 532 | -10, -7, -10 |
| 533 | }; |
| 534 | |
| 535 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 536 | static const yytype_int8 yydefgoto[] = |
| 537 | { |
| 538 | -1, 2, 13, 14, 17, 18, 6, 7, 24, 10, |
| 539 | 26, 12, 15 |
| 540 | }; |
| 541 | |
| 542 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
| 543 | positive, shift that token. If negative, reduce the rule whose |
| 544 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
| 545 | static const yytype_uint8 yytable[] = |
| 546 | { |
| 547 | 1, 1, 4, 8, 9, 19, 5, 20, 11, 16, |
| 548 | 21, 23, 3, 25, 22, 0, 0, 27 |
| 549 | }; |
| 550 | |
| 551 | static const yytype_int8 yycheck[] = |
| 552 | { |
| 553 | 5, 5, 0, 3, 3, 10, 8, 15, 9, 6, |
| 554 | 5, 7, 0, 22, 17, -1, -1, 24 |
| 555 | }; |
| 556 | |
| 557 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 558 | symbol of state STATE-NUM. */ |
| 559 | static const yytype_uint8 yystos[] = |
| 560 | { |
| 561 | 0, 5, 12, 14, 0, 8, 17, 18, 3, 3, |
| 562 | 20, 9, 22, 13, 14, 23, 6, 15, 16, 10, |
| 563 | 13, 5, 17, 7, 19, 20, 21, 22 |
| 564 | }; |
| 565 | |
| 566 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 567 | static const yytype_uint8 yyr1[] = |
| 568 | { |
| 569 | 0, 11, 12, 13, 14, 15, 15, 16, 17, 17, |
| 570 | 18, 19, 19, 20, 21, 21, 22, 23, 23 |
| 571 | }; |
| 572 | |
| 573 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
| 574 | static const yytype_uint8 yyr2[] = |
| 575 | { |
| 576 | 0, 2, 4, 5, 1, 0, 1, 3, 0, 1, |
| 577 | 2, 0, 1, 1, 0, 1, 3, 1, 2 |
| 578 | }; |
| 579 | |
| 580 | |
| 581 | #define yyerrok (yyerrstatus = 0) |
| 582 | #define yyclearin (yychar = YYEMPTY) |
| 583 | #define YYEMPTY (-2) |
| 584 | #define YYEOF 0 |
| 585 | |
| 586 | #define YYACCEPT goto yyacceptlab |
| 587 | #define YYABORT goto yyabortlab |
| 588 | #define YYERROR goto yyerrorlab |
| 589 | |
| 590 | |
| 591 | #define YYRECOVERING() (!!yyerrstatus) |
| 592 | |
| 593 | #define YYBACKUP(Token, Value) \ |
| 594 | do \ |
| 595 | if (yychar == YYEMPTY) \ |
| 596 | { \ |
| 597 | yychar = (Token); \ |
| 598 | yylval = (Value); \ |
| 599 | YYPOPSTACK (yylen); \ |
| 600 | yystate = *yyssp; \ |
| 601 | goto yybackup; \ |
| 602 | } \ |
| 603 | else \ |
| 604 | { \ |
| 605 | yyerror (YY_("syntax error: cannot back up")); \ |
| 606 | YYERROR; \ |
| 607 | } \ |
| 608 | while (0) |
| 609 | |
| 610 | /* Error token number */ |
| 611 | #define YYTERROR 1 |
| 612 | #define YYERRCODE 256 |
| 613 | |
| 614 | |
| 615 | |
| 616 | /* Enable debugging if requested. */ |
| 617 | #if YYDEBUG |
| 618 | |
| 619 | # ifndef YYFPRINTF |
| 620 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 621 | # define YYFPRINTF fprintf |
| 622 | # endif |
| 623 | |
| 624 | # define YYDPRINTF(Args) \ |
| 625 | do { \ |
| 626 | if (yydebug) \ |
| 627 | YYFPRINTF Args; \ |
| 628 | } while (0) |
| 629 | |
| 630 | /* This macro is provided for backward compatibility. */ |
| 631 | #ifndef YY_LOCATION_PRINT |
| 632 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 633 | #endif |
| 634 | |
| 635 | |
| 636 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 637 | do { \ |
| 638 | if (yydebug) \ |
| 639 | { \ |
| 640 | YYFPRINTF (stderr, "%s ", Title); \ |
| 641 | yy_symbol_print (stderr, \ |
| 642 | Type, Value); \ |
| 643 | YYFPRINTF (stderr, "\n"); \ |
| 644 | } \ |
| 645 | } while (0) |
| 646 | |
| 647 | |
| 648 | /*----------------------------------------. |
| 649 | | Print this symbol's value on YYOUTPUT. | |
| 650 | `----------------------------------------*/ |
| 651 | |
| 652 | static void |
| 653 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 654 | { |
| 655 | FILE *yyo = yyoutput; |
| 656 | YYUSE (yyo); |
| 657 | if (!yyvaluep) |
| 658 | return; |
| 659 | # ifdef YYPRINT |
| 660 | if (yytype < YYNTOKENS) |
| 661 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 662 | # endif |
| 663 | YYUSE (yytype); |
| 664 | } |
| 665 | |
| 666 | |
| 667 | /*--------------------------------. |
| 668 | | Print this symbol on YYOUTPUT. | |
| 669 | `--------------------------------*/ |
| 670 | |
| 671 | static void |
| 672 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 673 | { |
| 674 | YYFPRINTF (yyoutput, "%s %s (", |
| 675 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
| 676 | |
| 677 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 678 | YYFPRINTF (yyoutput, ")"); |
| 679 | } |
| 680 | |
| 681 | /*------------------------------------------------------------------. |
| 682 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 683 | | TOP (included). | |
| 684 | `------------------------------------------------------------------*/ |
| 685 | |
| 686 | static void |
| 687 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
| 688 | { |
| 689 | YYFPRINTF (stderr, "Stack now"); |
| 690 | for (; yybottom <= yytop; yybottom++) |
| 691 | { |
| 692 | int yybot = *yybottom; |
| 693 | YYFPRINTF (stderr, " %d", yybot); |
| 694 | } |
| 695 | YYFPRINTF (stderr, "\n"); |
| 696 | } |
| 697 | |
| 698 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 699 | do { \ |
| 700 | if (yydebug) \ |
| 701 | yy_stack_print ((Bottom), (Top)); \ |
| 702 | } while (0) |
| 703 | |
| 704 | |
| 705 | /*------------------------------------------------. |
| 706 | | Report that the YYRULE is going to be reduced. | |
| 707 | `------------------------------------------------*/ |
| 708 | |
| 709 | static void |
| 710 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) |
| 711 | { |
| 712 | unsigned long int yylno = yyrline[yyrule]; |
| 713 | int yynrhs = yyr2[yyrule]; |
| 714 | int yyi; |
| 715 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 716 | yyrule - 1, yylno); |
| 717 | /* The symbols being reduced. */ |
| 718 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 719 | { |
| 720 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
| 721 | yy_symbol_print (stderr, |
| 722 | yystos[yyssp[yyi + 1 - yynrhs]], |
| 723 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 724 | ); |
| 725 | YYFPRINTF (stderr, "\n"); |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | # define YY_REDUCE_PRINT(Rule) \ |
| 730 | do { \ |
| 731 | if (yydebug) \ |
| 732 | yy_reduce_print (yyssp, yyvsp, Rule); \ |
| 733 | } while (0) |
| 734 | |
| 735 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 736 | multiple parsers can coexist. */ |
| 737 | int yydebug; |
| 738 | #else /* !YYDEBUG */ |
| 739 | # define YYDPRINTF(Args) |
| 740 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 741 | # define YY_STACK_PRINT(Bottom, Top) |
| 742 | # define YY_REDUCE_PRINT(Rule) |
| 743 | #endif /* !YYDEBUG */ |
| 744 | |
| 745 | |
| 746 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 747 | #ifndef YYINITDEPTH |
| 748 | # define YYINITDEPTH 200 |
| 749 | #endif |
| 750 | |
| 751 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 752 | if the built-in stack extension method is used). |
| 753 | |
| 754 | Do not make this value too large; the results are undefined if |
| 755 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 756 | evaluated with infinite-precision integer arithmetic. */ |
| 757 | |
| 758 | #ifndef YYMAXDEPTH |
| 759 | # define YYMAXDEPTH 10000 |
| 760 | #endif |
| 761 | |
| 762 | |
| 763 | #if YYERROR_VERBOSE |
| 764 | |
| 765 | # ifndef yystrlen |
| 766 | # if defined __GLIBC__ && defined _STRING_H |
| 767 | # define yystrlen strlen |
| 768 | # else |
| 769 | /* Return the length of YYSTR. */ |
| 770 | static YYSIZE_T |
| 771 | yystrlen (const char *yystr) |
| 772 | { |
| 773 | YYSIZE_T yylen; |
| 774 | for (yylen = 0; yystr[yylen]; yylen++) |
| 775 | continue; |
| 776 | return yylen; |
| 777 | } |
| 778 | # endif |
| 779 | # endif |
| 780 | |
| 781 | # ifndef yystpcpy |
| 782 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 783 | # define yystpcpy stpcpy |
| 784 | # else |
| 785 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 786 | YYDEST. */ |
| 787 | static char * |
| 788 | yystpcpy (char *yydest, const char *yysrc) |
| 789 | { |
| 790 | char *yyd = yydest; |
| 791 | const char *yys = yysrc; |
| 792 | |
| 793 | while ((*yyd++ = *yys++) != '\0') |
| 794 | continue; |
| 795 | |
| 796 | return yyd - 1; |
| 797 | } |
| 798 | # endif |
| 799 | # endif |
| 800 | |
| 801 | # ifndef yytnamerr |
| 802 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 803 | quotes and backslashes, so that it's suitable for yyerror. The |
| 804 | heuristic is that double-quoting is unnecessary unless the string |
| 805 | contains an apostrophe, a comma, or backslash (other than |
| 806 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 807 | null, do not copy; instead, return the length of what the result |
| 808 | would have been. */ |
| 809 | static YYSIZE_T |
| 810 | yytnamerr (char *yyres, const char *yystr) |
| 811 | { |
| 812 | if (*yystr == '"') |
| 813 | { |
| 814 | YYSIZE_T yyn = 0; |
| 815 | char const *yyp = yystr; |
| 816 | |
| 817 | for (;;) |
| 818 | switch (*++yyp) |
| 819 | { |
| 820 | case '\'': |
| 821 | case ',': |
| 822 | goto do_not_strip_quotes; |
| 823 | |
| 824 | case '\\': |
| 825 | if (*++yyp != '\\') |
| 826 | goto do_not_strip_quotes; |
| 827 | /* Fall through. */ |
| 828 | default: |
| 829 | if (yyres) |
| 830 | yyres[yyn] = *yyp; |
| 831 | yyn++; |
| 832 | break; |
| 833 | |
| 834 | case '"': |
| 835 | if (yyres) |
| 836 | yyres[yyn] = '\0'; |
| 837 | return yyn; |
| 838 | } |
| 839 | do_not_strip_quotes: ; |
| 840 | } |
| 841 | |
| 842 | if (! yyres) |
| 843 | return yystrlen (yystr); |
| 844 | |
| 845 | return yystpcpy (yyres, yystr) - yyres; |
| 846 | } |
| 847 | # endif |
| 848 | |
| 849 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
| 850 | about the unexpected token YYTOKEN for the state stack whose top is |
| 851 | YYSSP. |
| 852 | |
| 853 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
| 854 | not large enough to hold the message. In that case, also set |
| 855 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
| 856 | required number of bytes is too large to store. */ |
| 857 | static int |
| 858 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
| 859 | yytype_int16 *yyssp, int yytoken) |
| 860 | { |
| 861 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
| 862 | YYSIZE_T yysize = yysize0; |
| 863 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 864 | /* Internationalized format string. */ |
| 865 | const char *yyformat = YY_NULLPTR; |
| 866 | /* Arguments of yyformat. */ |
| 867 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 868 | /* Number of reported tokens (one for the "unexpected", one per |
| 869 | "expected"). */ |
| 870 | int yycount = 0; |
| 871 | |
| 872 | /* There are many possibilities here to consider: |
| 873 | - If this state is a consistent state with a default action, then |
| 874 | the only way this function was invoked is if the default action |
| 875 | is an error action. In that case, don't check for expected |
| 876 | tokens because there are none. |
| 877 | - The only way there can be no lookahead present (in yychar) is if |
| 878 | this state is a consistent state with a default action. Thus, |
| 879 | detecting the absence of a lookahead is sufficient to determine |
| 880 | that there is no unexpected or expected token to report. In that |
| 881 | case, just report a simple "syntax error". |
| 882 | - Don't assume there isn't a lookahead just because this state is a |
| 883 | consistent state with a default action. There might have been a |
| 884 | previous inconsistent state, consistent state with a non-default |
| 885 | action, or user semantic action that manipulated yychar. |
| 886 | - Of course, the expected token list depends on states to have |
| 887 | correct lookahead information, and it depends on the parser not |
| 888 | to perform extra reductions after fetching a lookahead from the |
| 889 | scanner and before detecting a syntax error. Thus, state merging |
| 890 | (from LALR or IELR) and default reductions corrupt the expected |
| 891 | token list. However, the list is correct for canonical LR with |
| 892 | one exception: it will still contain any token that will not be |
| 893 | accepted due to an error action in a later state. |
| 894 | */ |
| 895 | if (yytoken != YYEMPTY) |
| 896 | { |
| 897 | int yyn = yypact[*yyssp]; |
| 898 | yyarg[yycount++] = yytname[yytoken]; |
| 899 | if (!yypact_value_is_default (yyn)) |
| 900 | { |
| 901 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 902 | YYCHECK. In other words, skip the first -YYN actions for |
| 903 | this state because they are default actions. */ |
| 904 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 905 | /* Stay within bounds of both yycheck and yytname. */ |
| 906 | int yychecklim = YYLAST - yyn + 1; |
| 907 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 908 | int yyx; |
| 909 | |
| 910 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 911 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
| 912 | && !yytable_value_is_error (yytable[yyx + yyn])) |
| 913 | { |
| 914 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 915 | { |
| 916 | yycount = 1; |
| 917 | yysize = yysize0; |
| 918 | break; |
| 919 | } |
| 920 | yyarg[yycount++] = yytname[yyx]; |
| 921 | { |
| 922 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
| 923 | if (! (yysize <= yysize1 |
| 924 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
| 925 | return 2; |
| 926 | yysize = yysize1; |
| 927 | } |
| 928 | } |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | switch (yycount) |
| 933 | { |
| 934 | # define YYCASE_(N, S) \ |
| 935 | case N: \ |
| 936 | yyformat = S; \ |
| 937 | break |
| 938 | YYCASE_(0, YY_("syntax error")); |
| 939 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
| 940 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
| 941 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
| 942 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
| 943 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
| 944 | # undef YYCASE_ |
| 945 | } |
| 946 | |
| 947 | { |
| 948 | YYSIZE_T yysize1 = yysize + yystrlen (yyformat); |
| 949 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
| 950 | return 2; |
| 951 | yysize = yysize1; |
| 952 | } |
| 953 | |
| 954 | if (*yymsg_alloc < yysize) |
| 955 | { |
| 956 | *yymsg_alloc = 2 * yysize; |
| 957 | if (! (yysize <= *yymsg_alloc |
| 958 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 959 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
| 960 | return 1; |
| 961 | } |
| 962 | |
| 963 | /* Avoid sprintf, as that infringes on the user's name space. |
| 964 | Don't have undefined behavior even if the translation |
| 965 | produced a string with the wrong number of "%s"s. */ |
| 966 | { |
| 967 | char *yyp = *yymsg; |
| 968 | int yyi = 0; |
| 969 | while ((*yyp = *yyformat) != '\0') |
| 970 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
| 971 | { |
| 972 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 973 | yyformat += 2; |
| 974 | } |
| 975 | else |
| 976 | { |
| 977 | yyp++; |
| 978 | yyformat++; |
| 979 | } |
| 980 | } |
| 981 | return 0; |
| 982 | } |
| 983 | #endif /* YYERROR_VERBOSE */ |
| 984 | |
| 985 | /*-----------------------------------------------. |
| 986 | | Release the memory associated to this symbol. | |
| 987 | `-----------------------------------------------*/ |
| 988 | |
| 989 | static void |
| 990 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 991 | { |
| 992 | YYUSE (yyvaluep); |
| 993 | if (!yymsg) |
| 994 | yymsg = "Deleting"; |
| 995 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 996 | |
| 997 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 998 | YYUSE (yytype); |
| 999 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1000 | } |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | /* The lookahead symbol. */ |
| 1006 | int yychar; |
| 1007 | |
| 1008 | /* The semantic value of the lookahead symbol. */ |
| 1009 | YYSTYPE yylval; |
| 1010 | /* Number of syntax errors so far. */ |
| 1011 | int yynerrs; |
| 1012 | |
| 1013 | |
| 1014 | /*----------. |
| 1015 | | yyparse. | |
| 1016 | `----------*/ |
| 1017 | |
| 1018 | int |
| 1019 | yyparse (void) |
| 1020 | { |
| 1021 | int yystate; |
| 1022 | /* Number of tokens to shift before error messages enabled. */ |
| 1023 | int yyerrstatus; |
| 1024 | |
| 1025 | /* The stacks and their tools: |
| 1026 | 'yyss': related to states. |
| 1027 | 'yyvs': related to semantic values. |
| 1028 | |
| 1029 | Refer to the stacks through separate pointers, to allow yyoverflow |
| 1030 | to reallocate them elsewhere. */ |
| 1031 | |
| 1032 | /* The state stack. */ |
| 1033 | yytype_int16 yyssa[YYINITDEPTH]; |
| 1034 | yytype_int16 *yyss; |
| 1035 | yytype_int16 *yyssp; |
| 1036 | |
| 1037 | /* The semantic value stack. */ |
| 1038 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 1039 | YYSTYPE *yyvs; |
| 1040 | YYSTYPE *yyvsp; |
| 1041 | |
| 1042 | YYSIZE_T yystacksize; |
| 1043 | |
| 1044 | int yyn; |
| 1045 | int yyresult; |
| 1046 | /* Lookahead token as an internal (translated) token number. */ |
| 1047 | int yytoken = 0; |
| 1048 | /* The variables used to return semantic value and location from the |
| 1049 | action routines. */ |
| 1050 | YYSTYPE yyval; |
| 1051 | |
| 1052 | #if YYERROR_VERBOSE |
| 1053 | /* Buffer for error messages, and its allocated size. */ |
| 1054 | char yymsgbuf[128]; |
| 1055 | char *yymsg = yymsgbuf; |
| 1056 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
| 1057 | #endif |
| 1058 | |
| 1059 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1060 | |
| 1061 | /* The number of symbols on the RHS of the reduced rule. |
| 1062 | Keep to zero when no symbol should be popped. */ |
| 1063 | int yylen = 0; |
| 1064 | |
| 1065 | yyssp = yyss = yyssa; |
| 1066 | yyvsp = yyvs = yyvsa; |
| 1067 | yystacksize = YYINITDEPTH; |
| 1068 | |
| 1069 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 1070 | |
| 1071 | yystate = 0; |
| 1072 | yyerrstatus = 0; |
| 1073 | yynerrs = 0; |
| 1074 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1075 | goto yysetstate; |
| 1076 | |
| 1077 | /*------------------------------------------------------------. |
| 1078 | | yynewstate -- Push a new state, which is found in yystate. | |
| 1079 | `------------------------------------------------------------*/ |
| 1080 | yynewstate: |
| 1081 | /* In all cases, when you get here, the value and location stacks |
| 1082 | have just been pushed. So pushing a state here evens the stacks. */ |
| 1083 | yyssp++; |
| 1084 | |
| 1085 | yysetstate: |
| 1086 | *yyssp = yystate; |
| 1087 | |
| 1088 | if (yyss + yystacksize - 1 <= yyssp) |
| 1089 | { |
| 1090 | /* Get the current used size of the three stacks, in elements. */ |
| 1091 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 1092 | |
| 1093 | #ifdef yyoverflow |
| 1094 | { |
| 1095 | /* Give user a chance to reallocate the stack. Use copies of |
| 1096 | these so that the &'s don't force the real ones into |
| 1097 | memory. */ |
| 1098 | YYSTYPE *yyvs1 = yyvs; |
| 1099 | yytype_int16 *yyss1 = yyss; |
| 1100 | |
| 1101 | /* Each stack pointer address is followed by the size of the |
| 1102 | data in use in that stack, in bytes. This used to be a |
| 1103 | conditional around just the two extra args, but that might |
| 1104 | be undefined if yyoverflow is a macro. */ |
| 1105 | yyoverflow (YY_("memory exhausted"), |
| 1106 | &yyss1, yysize * sizeof (*yyssp), |
| 1107 | &yyvs1, yysize * sizeof (*yyvsp), |
| 1108 | &yystacksize); |
| 1109 | |
| 1110 | yyss = yyss1; |
| 1111 | yyvs = yyvs1; |
| 1112 | } |
| 1113 | #else /* no yyoverflow */ |
| 1114 | # ifndef YYSTACK_RELOCATE |
| 1115 | goto yyexhaustedlab; |
| 1116 | # else |
| 1117 | /* Extend the stack our own way. */ |
| 1118 | if (YYMAXDEPTH <= yystacksize) |
| 1119 | goto yyexhaustedlab; |
| 1120 | yystacksize *= 2; |
| 1121 | if (YYMAXDEPTH < yystacksize) |
| 1122 | yystacksize = YYMAXDEPTH; |
| 1123 | |
| 1124 | { |
| 1125 | yytype_int16 *yyss1 = yyss; |
| 1126 | union yyalloc *yyptr = |
| 1127 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1128 | if (! yyptr) |
| 1129 | goto yyexhaustedlab; |
| 1130 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
| 1131 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
| 1132 | # undef YYSTACK_RELOCATE |
| 1133 | if (yyss1 != yyssa) |
| 1134 | YYSTACK_FREE (yyss1); |
| 1135 | } |
| 1136 | # endif |
| 1137 | #endif /* no yyoverflow */ |
| 1138 | |
| 1139 | yyssp = yyss + yysize - 1; |
| 1140 | yyvsp = yyvs + yysize - 1; |
| 1141 | |
| 1142 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1143 | (unsigned long int) yystacksize)); |
| 1144 | |
| 1145 | if (yyss + yystacksize - 1 <= yyssp) |
| 1146 | YYABORT; |
| 1147 | } |
| 1148 | |
| 1149 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1150 | |
| 1151 | if (yystate == YYFINAL) |
| 1152 | YYACCEPT; |
| 1153 | |
| 1154 | goto yybackup; |
| 1155 | |
| 1156 | /*-----------. |
| 1157 | | yybackup. | |
| 1158 | `-----------*/ |
| 1159 | yybackup: |
| 1160 | |
| 1161 | /* Do appropriate processing given the current state. Read a |
| 1162 | lookahead token if we need one and don't already have one. */ |
| 1163 | |
| 1164 | /* First try to decide what to do without reference to lookahead token. */ |
| 1165 | yyn = yypact[yystate]; |
| 1166 | if (yypact_value_is_default (yyn)) |
| 1167 | goto yydefault; |
| 1168 | |
| 1169 | /* Not known => get a lookahead token if don't already have one. */ |
| 1170 | |
| 1171 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
| 1172 | if (yychar == YYEMPTY) |
| 1173 | { |
| 1174 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 1175 | yychar = yylex (); |
| 1176 | } |
| 1177 | |
| 1178 | if (yychar <= YYEOF) |
| 1179 | { |
| 1180 | yychar = yytoken = YYEOF; |
| 1181 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1182 | } |
| 1183 | else |
| 1184 | { |
| 1185 | yytoken = YYTRANSLATE (yychar); |
| 1186 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 1187 | } |
| 1188 | |
| 1189 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1190 | detect an error, take that action. */ |
| 1191 | yyn += yytoken; |
| 1192 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1193 | goto yydefault; |
| 1194 | yyn = yytable[yyn]; |
| 1195 | if (yyn <= 0) |
| 1196 | { |
| 1197 | if (yytable_value_is_error (yyn)) |
| 1198 | goto yyerrlab; |
| 1199 | yyn = -yyn; |
| 1200 | goto yyreduce; |
| 1201 | } |
| 1202 | |
| 1203 | /* Count tokens shifted since error; after three, turn off error |
| 1204 | status. */ |
| 1205 | if (yyerrstatus) |
| 1206 | yyerrstatus--; |
| 1207 | |
| 1208 | /* Shift the lookahead token. */ |
| 1209 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 1210 | |
| 1211 | /* Discard the shifted token. */ |
| 1212 | yychar = YYEMPTY; |
| 1213 | |
| 1214 | yystate = yyn; |
| 1215 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1216 | *++yyvsp = yylval; |
| 1217 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1218 | |
| 1219 | goto yynewstate; |
| 1220 | |
| 1221 | |
| 1222 | /*-----------------------------------------------------------. |
| 1223 | | yydefault -- do the default action for the current state. | |
| 1224 | `-----------------------------------------------------------*/ |
| 1225 | yydefault: |
| 1226 | yyn = yydefact[yystate]; |
| 1227 | if (yyn == 0) |
| 1228 | goto yyerrlab; |
| 1229 | goto yyreduce; |
| 1230 | |
| 1231 | |
| 1232 | /*-----------------------------. |
| 1233 | | yyreduce -- Do a reduction. | |
| 1234 | `-----------------------------*/ |
| 1235 | yyreduce: |
| 1236 | /* yyn is the number of a rule to reduce with. */ |
| 1237 | yylen = yyr2[yyn]; |
| 1238 | |
| 1239 | /* If YYLEN is nonzero, implement the default value of the action: |
| 1240 | '$$ = $1'. |
| 1241 | |
| 1242 | Otherwise, the following line sets YYVAL to garbage. |
| 1243 | This behavior is undocumented and Bison |
| 1244 | users should not rely upon it. Assigning to YYVAL |
| 1245 | unconditionally makes the parser a bit smaller, and it avoids a |
| 1246 | GCC warning that YYVAL may be used uninitialized. */ |
| 1247 | yyval = yyvsp[1-yylen]; |
| 1248 | |
| 1249 | |
| 1250 | YY_REDUCE_PRINT (yyn); |
| 1251 | switch (yyn) |
| 1252 | { |
| 1253 | case 2: |
| 1254 | #line 80 "fmd_parser.y" /* yacc.c:1646 */ |
| 1255 | { |
| 1256 | if (!(res = parse_descriptor((yyvsp[-3].strval), (yyvsp[-2].maybe_intval), (yyvsp[-1].maybe_intval), (yyvsp[0].region_listhdr)))) |
| 1257 | YYABORT; |
| 1258 | } |
| 1259 | #line 1260 "y.tab.c" /* yacc.c:1646 */ |
| 1260 | break; |
| 1261 | |
| 1262 | case 3: |
| 1263 | #line 86 "fmd_parser.y" /* yacc.c:1646 */ |
| 1264 | { |
| 1265 | struct flashmap_descriptor *node = parse_descriptor((yyvsp[-4].strval), (yyvsp[-2].maybe_intval), (yyvsp[-1].maybe_intval), (yyvsp[0].region_listhdr)); |
| 1266 | if (!node) |
| 1267 | YYABORT; |
| 1268 | |
| 1269 | char *annotation = (yyvsp[-3].strval); |
| 1270 | if (annotation && !fmd_process_annotation_impl(node, annotation)) { |
| 1271 | fprintf(stderr, "ERROR: Section '%s' has unexpected annotation '(%s)'\n", |
| 1272 | node->name, annotation); |
| 1273 | YYABORT; |
| 1274 | } |
| 1275 | free(annotation); |
| 1276 | |
| 1277 | (yyval.region_ptr) = node; |
| 1278 | } |
| 1279 | #line 1280 "y.tab.c" /* yacc.c:1646 */ |
| 1280 | break; |
| 1281 | |
| 1282 | case 4: |
| 1283 | #line 102 "fmd_parser.y" /* yacc.c:1646 */ |
| 1284 | { |
| 1285 | if (!(yyvsp[0].strval)) { |
| 1286 | perror("ERROR: While allocating section name"); |
| 1287 | YYABORT; |
| 1288 | } |
| 1289 | } |
| 1290 | #line 1291 "y.tab.c" /* yacc.c:1646 */ |
| 1291 | break; |
| 1292 | |
| 1293 | case 5: |
| 1294 | #line 108 "fmd_parser.y" /* yacc.c:1646 */ |
| 1295 | { (yyval.strval) = NULL; } |
| 1296 | #line 1297 "y.tab.c" /* yacc.c:1646 */ |
| 1297 | break; |
| 1298 | |
| 1299 | case 7: |
| 1300 | #line 110 "fmd_parser.y" /* yacc.c:1646 */ |
| 1301 | { (yyval.strval) = (yyvsp[-1].strval); } |
| 1302 | #line 1303 "y.tab.c" /* yacc.c:1646 */ |
| 1303 | break; |
| 1304 | |
| 1305 | case 8: |
| 1306 | #line 111 "fmd_parser.y" /* yacc.c:1646 */ |
| 1307 | { (yyval.maybe_intval) = (struct unsigned_option){false, 0}; } |
| 1308 | #line 1309 "y.tab.c" /* yacc.c:1646 */ |
| 1309 | break; |
| 1310 | |
| 1311 | case 10: |
| 1312 | #line 113 "fmd_parser.y" /* yacc.c:1646 */ |
| 1313 | { (yyval.maybe_intval) = (struct unsigned_option){true, (yyvsp[0].intval)}; } |
| 1314 | #line 1315 "y.tab.c" /* yacc.c:1646 */ |
| 1315 | break; |
| 1316 | |
| 1317 | case 11: |
| 1318 | #line 114 "fmd_parser.y" /* yacc.c:1646 */ |
| 1319 | { (yyval.maybe_intval) = (struct unsigned_option){false, 0}; } |
| 1320 | #line 1321 "y.tab.c" /* yacc.c:1646 */ |
| 1321 | break; |
| 1322 | |
| 1323 | case 13: |
| 1324 | #line 116 "fmd_parser.y" /* yacc.c:1646 */ |
| 1325 | { (yyval.maybe_intval) = (struct unsigned_option){true, (yyvsp[0].intval)}; } |
| 1326 | #line 1327 "y.tab.c" /* yacc.c:1646 */ |
| 1327 | break; |
| 1328 | |
| 1329 | case 14: |
| 1330 | #line 118 "fmd_parser.y" /* yacc.c:1646 */ |
| 1331 | { |
| 1332 | (yyval.region_listhdr) = (struct descriptor_list) |
| 1333 | {.len = 0, .head = NULL, .tail = NULL}; |
| 1334 | } |
| 1335 | #line 1336 "y.tab.c" /* yacc.c:1646 */ |
| 1336 | break; |
| 1337 | |
| 1338 | case 16: |
| 1339 | #line 123 "fmd_parser.y" /* yacc.c:1646 */ |
| 1340 | { (yyval.region_listhdr) = (yyvsp[-1].region_listhdr); } |
| 1341 | #line 1342 "y.tab.c" /* yacc.c:1646 */ |
| 1342 | break; |
| 1343 | |
| 1344 | case 17: |
| 1345 | #line 125 "fmd_parser.y" /* yacc.c:1646 */ |
| 1346 | { |
| 1347 | struct descriptor_node *node = malloc(sizeof(*node)); |
| 1348 | if (!node) { |
| 1349 | perror("ERROR: While allocating linked list node"); |
| 1350 | YYABORT; |
| 1351 | } |
| 1352 | node->val = (yyvsp[0].region_ptr); |
| 1353 | node->next = NULL; |
| 1354 | (yyval.region_listhdr) = (struct descriptor_list){.len = 1, .head = node, .tail = node}; |
| 1355 | } |
| 1356 | #line 1357 "y.tab.c" /* yacc.c:1646 */ |
| 1357 | break; |
| 1358 | |
| 1359 | case 18: |
| 1360 | #line 136 "fmd_parser.y" /* yacc.c:1646 */ |
| 1361 | { |
| 1362 | struct descriptor_node *node = malloc(sizeof(*node)); |
| 1363 | if (!node) { |
| 1364 | perror("ERROR: While allocating linked list node"); |
| 1365 | YYABORT; |
| 1366 | } |
| 1367 | node->val = (yyvsp[0].region_ptr); |
| 1368 | node->next = NULL; |
| 1369 | |
| 1370 | (yyvsp[-1].region_listhdr).tail->next = node; |
| 1371 | (yyval.region_listhdr) = (struct descriptor_list) |
| 1372 | {.len = (yyvsp[-1].region_listhdr).len + 1, .head = (yyvsp[-1].region_listhdr).head, .tail = node}; |
| 1373 | } |
| 1374 | #line 1375 "y.tab.c" /* yacc.c:1646 */ |
| 1375 | break; |
| 1376 | |
| 1377 | |
| 1378 | #line 1379 "y.tab.c" /* yacc.c:1646 */ |
| 1379 | default: break; |
| 1380 | } |
| 1381 | /* User semantic actions sometimes alter yychar, and that requires |
| 1382 | that yytoken be updated with the new translation. We take the |
| 1383 | approach of translating immediately before every use of yytoken. |
| 1384 | One alternative is translating here after every semantic action, |
| 1385 | but that translation would be missed if the semantic action invokes |
| 1386 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
| 1387 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
| 1388 | incorrect destructor might then be invoked immediately. In the |
| 1389 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
| 1390 | to an incorrect destructor call or verbose syntax error message |
| 1391 | before the lookahead is translated. */ |
| 1392 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 1393 | |
| 1394 | YYPOPSTACK (yylen); |
| 1395 | yylen = 0; |
| 1396 | YY_STACK_PRINT (yyss, yyssp); |
| 1397 | |
| 1398 | *++yyvsp = yyval; |
| 1399 | |
| 1400 | /* Now 'shift' the result of the reduction. Determine what state |
| 1401 | that goes to, based on the state we popped back to and the rule |
| 1402 | number reduced by. */ |
| 1403 | |
| 1404 | yyn = yyr1[yyn]; |
| 1405 | |
| 1406 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 1407 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 1408 | yystate = yytable[yystate]; |
| 1409 | else |
| 1410 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 1411 | |
| 1412 | goto yynewstate; |
| 1413 | |
| 1414 | |
| 1415 | /*--------------------------------------. |
| 1416 | | yyerrlab -- here on detecting error. | |
| 1417 | `--------------------------------------*/ |
| 1418 | yyerrlab: |
| 1419 | /* Make sure we have latest lookahead translation. See comments at |
| 1420 | user semantic actions for why this is necessary. */ |
| 1421 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
| 1422 | |
| 1423 | /* If not already recovering from an error, report this error. */ |
| 1424 | if (!yyerrstatus) |
| 1425 | { |
| 1426 | ++yynerrs; |
| 1427 | #if ! YYERROR_VERBOSE |
| 1428 | yyerror (YY_("syntax error")); |
| 1429 | #else |
| 1430 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
| 1431 | yyssp, yytoken) |
| 1432 | { |
| 1433 | char const *yymsgp = YY_("syntax error"); |
| 1434 | int yysyntax_error_status; |
| 1435 | yysyntax_error_status = YYSYNTAX_ERROR; |
| 1436 | if (yysyntax_error_status == 0) |
| 1437 | yymsgp = yymsg; |
| 1438 | else if (yysyntax_error_status == 1) |
| 1439 | { |
| 1440 | if (yymsg != yymsgbuf) |
| 1441 | YYSTACK_FREE (yymsg); |
| 1442 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
| 1443 | if (!yymsg) |
| 1444 | { |
| 1445 | yymsg = yymsgbuf; |
| 1446 | yymsg_alloc = sizeof yymsgbuf; |
| 1447 | yysyntax_error_status = 2; |
| 1448 | } |
| 1449 | else |
| 1450 | { |
| 1451 | yysyntax_error_status = YYSYNTAX_ERROR; |
| 1452 | yymsgp = yymsg; |
| 1453 | } |
| 1454 | } |
| 1455 | yyerror (yymsgp); |
| 1456 | if (yysyntax_error_status == 2) |
| 1457 | goto yyexhaustedlab; |
| 1458 | } |
| 1459 | # undef YYSYNTAX_ERROR |
| 1460 | #endif |
| 1461 | } |
| 1462 | |
| 1463 | |
| 1464 | |
| 1465 | if (yyerrstatus == 3) |
| 1466 | { |
| 1467 | /* If just tried and failed to reuse lookahead token after an |
| 1468 | error, discard it. */ |
| 1469 | |
| 1470 | if (yychar <= YYEOF) |
| 1471 | { |
| 1472 | /* Return failure if at end of input. */ |
| 1473 | if (yychar == YYEOF) |
| 1474 | YYABORT; |
| 1475 | } |
| 1476 | else |
| 1477 | { |
| 1478 | yydestruct ("Error: discarding", |
| 1479 | yytoken, &yylval); |
| 1480 | yychar = YYEMPTY; |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | /* Else will try to reuse lookahead token after shifting the error |
| 1485 | token. */ |
| 1486 | goto yyerrlab1; |
| 1487 | |
| 1488 | |
| 1489 | /*---------------------------------------------------. |
| 1490 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 1491 | `---------------------------------------------------*/ |
| 1492 | yyerrorlab: |
| 1493 | |
| 1494 | /* Pacify compilers like GCC when the user code never invokes |
| 1495 | YYERROR and the label yyerrorlab therefore never appears in user |
| 1496 | code. */ |
| 1497 | if (/*CONSTCOND*/ 0) |
| 1498 | goto yyerrorlab; |
| 1499 | |
| 1500 | /* Do not reclaim the symbols of the rule whose action triggered |
| 1501 | this YYERROR. */ |
| 1502 | YYPOPSTACK (yylen); |
| 1503 | yylen = 0; |
| 1504 | YY_STACK_PRINT (yyss, yyssp); |
| 1505 | yystate = *yyssp; |
| 1506 | goto yyerrlab1; |
| 1507 | |
| 1508 | |
| 1509 | /*-------------------------------------------------------------. |
| 1510 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 1511 | `-------------------------------------------------------------*/ |
| 1512 | yyerrlab1: |
| 1513 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1514 | |
| 1515 | for (;;) |
| 1516 | { |
| 1517 | yyn = yypact[yystate]; |
| 1518 | if (!yypact_value_is_default (yyn)) |
| 1519 | { |
| 1520 | yyn += YYTERROR; |
| 1521 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 1522 | { |
| 1523 | yyn = yytable[yyn]; |
| 1524 | if (0 < yyn) |
| 1525 | break; |
| 1526 | } |
| 1527 | } |
| 1528 | |
| 1529 | /* Pop the current state because it cannot handle the error token. */ |
| 1530 | if (yyssp == yyss) |
| 1531 | YYABORT; |
| 1532 | |
| 1533 | |
| 1534 | yydestruct ("Error: popping", |
| 1535 | yystos[yystate], yyvsp); |
| 1536 | YYPOPSTACK (1); |
| 1537 | yystate = *yyssp; |
| 1538 | YY_STACK_PRINT (yyss, yyssp); |
| 1539 | } |
| 1540 | |
| 1541 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1542 | *++yyvsp = yylval; |
| 1543 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1544 | |
| 1545 | |
| 1546 | /* Shift the error token. */ |
| 1547 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 1548 | |
| 1549 | yystate = yyn; |
| 1550 | goto yynewstate; |
| 1551 | |
| 1552 | |
| 1553 | /*-------------------------------------. |
| 1554 | | yyacceptlab -- YYACCEPT comes here. | |
| 1555 | `-------------------------------------*/ |
| 1556 | yyacceptlab: |
| 1557 | yyresult = 0; |
| 1558 | goto yyreturn; |
| 1559 | |
| 1560 | /*-----------------------------------. |
| 1561 | | yyabortlab -- YYABORT comes here. | |
| 1562 | `-----------------------------------*/ |
| 1563 | yyabortlab: |
| 1564 | yyresult = 1; |
| 1565 | goto yyreturn; |
| 1566 | |
| 1567 | #if !defined yyoverflow || YYERROR_VERBOSE |
| 1568 | /*-------------------------------------------------. |
| 1569 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 1570 | `-------------------------------------------------*/ |
| 1571 | yyexhaustedlab: |
| 1572 | yyerror (YY_("memory exhausted")); |
| 1573 | yyresult = 2; |
| 1574 | /* Fall through. */ |
| 1575 | #endif |
| 1576 | |
| 1577 | yyreturn: |
| 1578 | if (yychar != YYEMPTY) |
| 1579 | { |
| 1580 | /* Make sure we have latest lookahead translation. See comments at |
| 1581 | user semantic actions for why this is necessary. */ |
| 1582 | yytoken = YYTRANSLATE (yychar); |
| 1583 | yydestruct ("Cleanup: discarding lookahead", |
| 1584 | yytoken, &yylval); |
| 1585 | } |
| 1586 | /* Do not reclaim the symbols of the rule whose action triggered |
| 1587 | this YYABORT or YYACCEPT. */ |
| 1588 | YYPOPSTACK (yylen); |
| 1589 | YY_STACK_PRINT (yyss, yyssp); |
| 1590 | while (yyssp != yyss) |
| 1591 | { |
| 1592 | yydestruct ("Cleanup: popping", |
| 1593 | yystos[*yyssp], yyvsp); |
| 1594 | YYPOPSTACK (1); |
| 1595 | } |
| 1596 | #ifndef yyoverflow |
| 1597 | if (yyss != yyssa) |
| 1598 | YYSTACK_FREE (yyss); |
| 1599 | #endif |
| 1600 | #if YYERROR_VERBOSE |
| 1601 | if (yymsg != yymsgbuf) |
| 1602 | YYSTACK_FREE (yymsg); |
| 1603 | #endif |
| 1604 | return yyresult; |
| 1605 | } |
| 1606 | #line 150 "fmd_parser.y" /* yacc.c:1906 */ |
| 1607 | |
| 1608 | |
| 1609 | struct flashmap_descriptor *parse_descriptor(char *name, |
| 1610 | struct unsigned_option offset, struct unsigned_option size, |
| 1611 | struct descriptor_list children) |
| 1612 | { |
| 1613 | struct flashmap_descriptor *region = malloc(sizeof(*region)); |
| 1614 | if (!region) { |
| 1615 | perror("ERROR: While allocating descriptor section"); |
| 1616 | return NULL; |
| 1617 | } |
| 1618 | region->name = name; |
| 1619 | region->offset_known = offset.val_known; |
| 1620 | region->offset = offset.val; |
| 1621 | region->size_known = size.val_known; |
| 1622 | region->size = size.val; |
| 1623 | region->list_len = children.len; |
| 1624 | if (region->list_len) { |
| 1625 | region->list = malloc(region->list_len * sizeof(*region->list)); |
| 1626 | if (!region->list) { |
| 1627 | perror("ERROR: While allocating node children array"); |
| 1628 | return NULL; |
| 1629 | } |
| 1630 | struct descriptor_node *cur_node = children.head; |
| 1631 | for (unsigned idx = 0; idx < region->list_len; ++idx) { |
| 1632 | region->list[idx] = cur_node->val; |
| 1633 | |
| 1634 | struct descriptor_node *next_node = cur_node->next; |
| 1635 | free(cur_node); |
| 1636 | cur_node = next_node; |
| 1637 | } |
| 1638 | } else { |
| 1639 | region->list = NULL; |
| 1640 | } |
| 1641 | return region; |
| 1642 | } |
| 1643 | |
| 1644 | void yyerror(const char *s) |
| 1645 | { |
| 1646 | fprintf(stderr, "%s\n", s); |
| 1647 | } |