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