1 /* A Bison parser, made by GNU Bison 2.1. */ 2 3 /* Skeleton parser for Yacc-like parsing with Bison, 4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. */ 20 21 /* As a special exception, when this file is copied by Bison into a 22 Bison output file, you may use that output file without restriction. 23 This special exception was added by the Free Software Foundation 24 in version 1.24 of Bison. */ 25 26 /* Written by Richard Stallman by simplifying the original so called 27 ``semantic'' parser. */ 28 29 /* All symbols defined below should begin with yy or YY, to avoid 30 infringing on user name space. This should be done even for local 31 variables, as they might otherwise be expanded by user macros. 32 There are some unavoidable exceptions within include files to 33 define necessary library symbols; they are noted "INFRINGES ON 34 USER NAME SPACE" below. */ 35 36 /* Identify Bison output. */ 37 #define YYBISON 1 38 39 /* Bison version. */ 40 #define YYBISON_VERSION "2.1" 41 42 /* Skeleton name. */ 43 #define YYSKELETON_NAME "yacc.c" 44 45 /* Pure parsers. */ 46 #define YYPURE 1 47 48 /* Using locations. */ 49 #define YYLSP_NEEDED 1 50 51 52 53 /* Tokens. */ 54 #ifndef YYTOKENTYPE 55 # define YYTOKENTYPE 56 /* Put the tokens into the symbol table, so that GDB and other debuggers 57 know about them. */ 58 enum yytokentype { 59 TOK_IDENT = 258, 60 TOK_STRING_LITERAL = 259, 61 TOK_INT_LITERAL = 260, 62 TOK_SECTION_NAME = 261, 63 TOK_SOURCE_NAME = 262, 64 TOK_BLOB = 263, 65 TOK_DOT_DOT = 264, 66 TOK_AND = 265, 67 TOK_OR = 266, 68 TOK_GEQ = 267, 69 TOK_LEQ = 268, 70 TOK_EQ = 269, 71 TOK_NEQ = 270, 72 TOK_POWER = 271, 73 TOK_LSHIFT = 272, 74 TOK_RSHIFT = 273, 75 TOK_INT_SIZE = 274, 76 TOK_OPTIONS = 275, 77 TOK_CONSTANTS = 276, 78 TOK_SOURCES = 277, 79 TOK_FILTERS = 278, 80 TOK_SECTION = 279, 81 TOK_EXTERN = 280, 82 TOK_FROM = 281, 83 TOK_RAW = 282, 84 TOK_LOAD = 283, 85 TOK_JUMP = 284, 86 TOK_CALL = 285, 87 TOK_MODE = 286, 88 TOK_IF = 287, 89 TOK_ELSE = 288, 90 TOK_DEFINED = 289, 91 TOK_INFO = 290, 92 TOK_WARNING = 291, 93 TOK_ERROR = 292, 94 TOK_SIZEOF = 293, 95 TOK_DCD = 294, 96 TOK_HAB = 295, 97 TOK_IVT = 296, 98 UNARY_OP = 297 99 }; 100 #endif 101 /* Tokens. */ 102 #define TOK_IDENT 258 103 #define TOK_STRING_LITERAL 259 104 #define TOK_INT_LITERAL 260 105 #define TOK_SECTION_NAME 261 106 #define TOK_SOURCE_NAME 262 107 #define TOK_BLOB 263 108 #define TOK_DOT_DOT 264 109 #define TOK_AND 265 110 #define TOK_OR 266 111 #define TOK_GEQ 267 112 #define TOK_LEQ 268 113 #define TOK_EQ 269 114 #define TOK_NEQ 270 115 #define TOK_POWER 271 116 #define TOK_LSHIFT 272 117 #define TOK_RSHIFT 273 118 #define TOK_INT_SIZE 274 119 #define TOK_OPTIONS 275 120 #define TOK_CONSTANTS 276 121 #define TOK_SOURCES 277 122 #define TOK_FILTERS 278 123 #define TOK_SECTION 279 124 #define TOK_EXTERN 280 125 #define TOK_FROM 281 126 #define TOK_RAW 282 127 #define TOK_LOAD 283 128 #define TOK_JUMP 284 129 #define TOK_CALL 285 130 #define TOK_MODE 286 131 #define TOK_IF 287 132 #define TOK_ELSE 288 133 #define TOK_DEFINED 289 134 #define TOK_INFO 290 135 #define TOK_WARNING 291 136 #define TOK_ERROR 292 137 #define TOK_SIZEOF 293 138 #define TOK_DCD 294 139 #define TOK_HAB 295 140 #define TOK_IVT 296 141 #define UNARY_OP 297 142 143 144 145 146 /* Copy the first part of user declarations. */ 147 148 #include "ElftosbLexer.h" 149 #include "ElftosbAST.h" 150 #include "Logging.h" 151 #include "Blob.h" 152 #include "format_string.h" 153 #include "Value.h" 154 #include "ConversionController.h" 155 156 using namespace elftosb; 157 158 //! Our special location type. 159 #define YYLTYPE token_loc_t 160 161 // this indicates that we're using our own type. it should be unset automatically 162 // but that's not working for some reason with the .hpp file. 163 #if defined(YYLTYPE_IS_TRIVIAL) 164 #undef YYLTYPE_IS_TRIVIAL 165 #define YYLTYPE_IS_TRIVIAL 0 166 #endif 167 168 //! Default location action 169 #define YYLLOC_DEFAULT(Current, Rhs, N) \ 170 do { \ 171 if (N) \ 172 { \ 173 (Current).m_firstLine = YYRHSLOC(Rhs, 1).m_firstLine; \ 174 (Current).m_lastLine = YYRHSLOC(Rhs, N).m_lastLine; \ 175 } \ 176 else \ 177 { \ 178 (Current).m_firstLine = (Current).m_lastLine = YYRHSLOC(Rhs, 0).m_lastLine; \ 179 } \ 180 } while (0) 181 182 //! Forward declaration of yylex(). 183 static int yylex(YYSTYPE * lvalp, YYLTYPE * yylloc, ElftosbLexer * lexer); 184 185 // Forward declaration of error handling function. 186 static void yyerror(YYLTYPE * yylloc, ElftosbLexer * lexer, CommandFileASTNode ** resultAST, const char * error); 187 188 189 190 /* Enabling traces. */ 191 #ifndef YYDEBUG 192 # define YYDEBUG 0 193 #endif 194 195 /* Enabling verbose error messages. */ 196 #ifdef YYERROR_VERBOSE 197 # undef YYERROR_VERBOSE 198 # define YYERROR_VERBOSE 1 199 #else 200 # define YYERROR_VERBOSE 1 201 #endif 202 203 /* Enabling the token table. */ 204 #ifndef YYTOKEN_TABLE 205 # define YYTOKEN_TABLE 0 206 #endif 207 208 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 209 typedef union YYSTYPE { 210 int m_num; 211 elftosb::SizedIntegerValue * m_int; 212 Blob * m_blob; 213 std::string * m_str; 214 elftosb::ASTNode * m_ast; // must use full name here because this is put into *.tab.hpp 215 } YYSTYPE; 216 /* Line 196 of yacc.c. */ 217 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 218 # define YYSTYPE_IS_DECLARED 1 219 # define YYSTYPE_IS_TRIVIAL 1 220 #endif 221 222 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) 223 typedef struct YYLTYPE 224 { 225 int first_line; 226 int first_column; 227 int last_line; 228 int last_column; 229 } YYLTYPE; 230 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ 231 # define YYLTYPE_IS_DECLARED 1 232 # define YYLTYPE_IS_TRIVIAL 1 233 #endif 234 235 236 /* Copy the second part of user declarations. */ 237 238 239 /* Line 219 of yacc.c. */ 240 241 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 242 # define YYSIZE_T __SIZE_TYPE__ 243 #endif 244 #if ! defined (YYSIZE_T) && defined (size_t) 245 # define YYSIZE_T size_t 246 #endif 247 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) 248 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 249 # define YYSIZE_T size_t 250 #endif 251 #if ! defined (YYSIZE_T) 252 # define YYSIZE_T unsigned int 253 #endif 254 255 #ifndef YY_ 256 # if YYENABLE_NLS 257 # if ENABLE_NLS 258 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 259 # define YY_(msgid) dgettext ("bison-runtime", msgid) 260 # endif 261 # endif 262 # ifndef YY_ 263 # define YY_(msgid) msgid 264 # endif 265 #endif 266 267 #if ! defined (yyoverflow) || YYERROR_VERBOSE 268 269 /* The parser invokes alloca or malloc; define the necessary symbols. */ 270 271 # ifdef YYSTACK_USE_ALLOCA 272 # if YYSTACK_USE_ALLOCA 273 # ifdef __GNUC__ 274 # define YYSTACK_ALLOC __builtin_alloca 275 # else 276 # define YYSTACK_ALLOC alloca 277 # if defined (__STDC__) || defined (__cplusplus) 278 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 279 # define YYINCLUDED_STDLIB_H 280 # endif 281 # endif 282 # endif 283 # endif 284 285 # ifdef YYSTACK_ALLOC 286 /* Pacify GCC's `empty if-body' warning. */ 287 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 288 # ifndef YYSTACK_ALLOC_MAXIMUM 289 /* The OS might guarantee only one guard page at the bottom of the stack, 290 and a page size can be as small as 4096 bytes. So we cannot safely 291 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 292 to allow for a few compiler-allocated temporary stack slots. */ 293 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ 294 # endif 295 # else 296 # define YYSTACK_ALLOC YYMALLOC 297 # define YYSTACK_FREE YYFREE 298 # ifndef YYSTACK_ALLOC_MAXIMUM 299 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) 300 # endif 301 # ifdef __cplusplus 302 extern "C" { 303 # endif 304 # ifndef YYMALLOC 305 # define YYMALLOC malloc 306 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ 307 && (defined (__STDC__) || defined (__cplusplus))) 308 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 309 # endif 310 # endif 311 # ifndef YYFREE 312 # define YYFREE free 313 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ 314 && (defined (__STDC__) || defined (__cplusplus))) 315 void free (void *); /* INFRINGES ON USER NAME SPACE */ 316 # endif 317 # endif 318 # ifdef __cplusplus 319 } 320 # endif 321 # endif 322 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ 323 324 325 #if (! defined (yyoverflow) \ 326 && (! defined (__cplusplus) \ 327 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \ 328 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) 329 330 /* A type that is properly aligned for any stack member. */ 331 union yyalloc 332 { 333 short int yyss; 334 YYSTYPE yyvs; 335 YYLTYPE yyls; 336 }; 337 338 /* The size of the maximum gap between one aligned stack and the next. */ 339 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 340 341 /* The size of an array large to enough to hold all stacks, each with 342 N elements. */ 343 # define YYSTACK_BYTES(N) \ 344 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 345 + 2 * YYSTACK_GAP_MAXIMUM) 346 347 /* Copy COUNT objects from FROM to TO. The source and destination do 348 not overlap. */ 349 # ifndef YYCOPY 350 # if defined (__GNUC__) && 1 < __GNUC__ 351 # define YYCOPY(To, From, Count) \ 352 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 353 # else 354 # define YYCOPY(To, From, Count) \ 355 do \ 356 { \ 357 YYSIZE_T yyi; \ 358 for (yyi = 0; yyi < (Count); yyi++) \ 359 (To)[yyi] = (From)[yyi]; \ 360 } \ 361 while (0) 362 # endif 363 # endif 364 365 /* Relocate STACK from its old location to the new one. The 366 local variables YYSIZE and YYSTACKSIZE give the old and new number of 367 elements in the stack, and YYPTR gives the new location of the 368 stack. Advance YYPTR to a properly aligned location for the next 369 stack. */ 370 # define YYSTACK_RELOCATE(Stack) \ 371 do \ 372 { \ 373 YYSIZE_T yynewbytes; \ 374 YYCOPY (&yyptr->Stack, Stack, yysize); \ 375 Stack = &yyptr->Stack; \ 376 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 377 yyptr += yynewbytes / sizeof (*yyptr); \ 378 } \ 379 while (0) 380 381 #endif 382 383 #if defined (__STDC__) || defined (__cplusplus) 384 typedef signed char yysigned_char; 385 #else 386 typedef short int yysigned_char; 387 #endif 388 389 /* YYFINAL -- State number of the termination state. */ 390 #define YYFINAL 13 391 /* YYLAST -- Last index in YYTABLE. */ 392 #define YYLAST 418 393 394 /* YYNTOKENS -- Number of terminals. */ 395 #define YYNTOKENS 66 396 /* YYNNTS -- Number of nonterminals. */ 397 #define YYNNTS 52 398 /* YYNRULES -- Number of rules. */ 399 #define YYNRULES 133 400 /* YYNRULES -- Number of states. */ 401 #define YYNSTATES 238 402 403 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 404 #define YYUNDEFTOK 2 405 #define YYMAXUTOK 297 406 407 #define YYTRANSLATE(YYX) \ 408 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 409 410 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 411 static const unsigned char yytranslate[] = 412 { 413 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 416 2, 2, 2, 26, 2, 2, 2, 64, 23, 2, 417 9, 10, 62, 60, 16, 61, 20, 63, 2, 2, 418 2, 2, 2, 2, 2, 2, 2, 2, 18, 17, 419 25, 15, 19, 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, 13, 2, 14, 59, 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, 11, 24, 12, 22, 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, 2, 2, 2, 2, 432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 438 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 439 5, 6, 7, 8, 21, 27, 28, 29, 30, 31, 440 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 441 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 442 52, 53, 54, 55, 56, 57, 58, 65 443 }; 444 445 #if YYDEBUG 446 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 447 YYRHS. */ 448 static const unsigned short int yyprhs[] = 449 { 450 0, 0, 3, 6, 8, 11, 13, 15, 17, 22, 451 27, 29, 32, 35, 36, 40, 45, 47, 50, 54, 452 55, 59, 66, 70, 71, 73, 77, 81, 83, 86, 453 93, 96, 97, 99, 100, 104, 108, 110, 113, 116, 454 118, 120, 121, 123, 126, 129, 131, 132, 134, 136, 455 138, 140, 145, 147, 148, 150, 152, 154, 156, 160, 456 165, 167, 169, 171, 175, 177, 180, 183, 184, 186, 457 188, 193, 195, 196, 200, 205, 207, 209, 211, 213, 458 217, 220, 221, 227, 230, 233, 236, 239, 246, 251, 459 254, 255, 257, 261, 263, 265, 267, 271, 275, 279, 460 283, 287, 291, 295, 299, 302, 307, 311, 316, 318, 461 322, 325, 327, 329, 331, 335, 339, 343, 347, 351, 462 355, 359, 363, 367, 371, 375, 377, 381, 385, 390, 463 395, 400, 403, 406 464 }; 465 466 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 467 static const yysigned_char yyrhs[] = 468 { 469 67, 0, -1, 68, 82, -1, 69, -1, 68, 69, 470 -1, 70, -1, 71, -1, 75, -1, 37, 11, 72, 471 12, -1, 38, 11, 72, 12, -1, 73, -1, 72, 472 73, -1, 74, 17, -1, -1, 3, 15, 111, -1, 473 39, 11, 76, 12, -1, 77, -1, 76, 77, -1, 474 78, 79, 17, -1, -1, 3, 15, 4, -1, 3, 475 15, 42, 9, 113, 10, -1, 9, 80, 10, -1, 476 -1, 81, -1, 80, 16, 81, -1, 3, 15, 111, 477 -1, 83, -1, 82, 83, -1, 41, 9, 113, 84, 478 10, 86, -1, 17, 85, -1, -1, 80, -1, -1, 479 30, 94, 17, -1, 11, 87, 12, -1, 88, -1, 480 87, 88, -1, 91, 17, -1, 105, -1, 108, -1, 481 -1, 90, -1, 89, 90, -1, 91, 17, -1, 108, 482 -1, -1, 92, -1, 101, -1, 106, -1, 107, -1, 483 45, 93, 94, 97, -1, 56, -1, -1, 113, -1, 484 4, -1, 7, -1, 95, -1, 95, 43, 7, -1, 485 7, 13, 95, 14, -1, 8, -1, 99, -1, 96, 486 -1, 95, 16, 96, -1, 6, -1, 22, 6, -1, 487 19, 98, -1, -1, 20, -1, 110, -1, 58, 9, 488 100, 10, -1, 80, -1, -1, 102, 103, 104, -1, 489 57, 102, 110, 104, -1, 47, -1, 46, -1, 7, 490 -1, 113, -1, 9, 113, 10, -1, 9, 10, -1, 491 -1, 43, 7, 11, 89, 12, -1, 48, 113, -1, 492 52, 4, -1, 53, 4, -1, 54, 4, -1, 49, 493 112, 11, 87, 12, 109, -1, 50, 11, 87, 12, 494 -1, 50, 108, -1, -1, 113, -1, 113, 21, 113, 495 -1, 112, -1, 4, -1, 113, -1, 112, 25, 112, 496 -1, 112, 19, 112, -1, 112, 29, 112, -1, 112, 497 30, 112, -1, 112, 31, 112, -1, 112, 32, 112, 498 -1, 112, 27, 112, -1, 112, 28, 112, -1, 26, 499 112, -1, 3, 9, 7, 10, -1, 9, 112, 10, 500 -1, 51, 9, 3, 10, -1, 115, -1, 7, 18, 501 3, -1, 18, 3, -1, 117, -1, 3, -1, 114, 502 -1, 115, 60, 115, -1, 115, 61, 115, -1, 115, 503 62, 115, -1, 115, 63, 115, -1, 115, 64, 115, 504 -1, 115, 33, 115, -1, 115, 23, 115, -1, 115, 505 24, 115, -1, 115, 59, 115, -1, 115, 34, 115, 506 -1, 115, 35, 115, -1, 116, -1, 115, 20, 36, 507 -1, 9, 115, 10, -1, 55, 9, 114, 10, -1, 508 55, 9, 3, 10, -1, 55, 9, 7, 10, -1, 509 60, 115, -1, 61, 115, -1, 5, -1 510 }; 511 512 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 513 static const unsigned short int yyrline[] = 514 { 515 0, 162, 162, 172, 178, 186, 187, 188, 191, 197, 516 203, 209, 216, 217, 220, 227, 233, 239, 247, 259, 517 262, 267, 275, 276, 280, 286, 294, 301, 307, 314, 518 329, 334, 340, 345, 351, 357, 365, 371, 379, 380, 519 381, 382, 385, 391, 399, 400, 401, 404, 405, 406, 520 407, 410, 433, 443, 445, 449, 454, 459, 464, 469, 521 474, 479, 484, 490, 498, 503, 510, 515, 521, 526, 522 532, 544, 545, 548, 577, 614, 615, 618, 623, 630, 523 631, 632, 635, 642, 649, 654, 659, 666, 677, 681, 524 688, 691, 696, 703, 707, 714, 718, 725, 732, 739, 525 746, 753, 760, 767, 774, 779, 784, 789, 796, 799, 526 804, 812, 816, 821, 832, 839, 846, 853, 860, 867, 527 874, 881, 888, 895, 902, 909, 913, 918, 923, 928, 528 933, 940, 944, 951 529 }; 530 #endif 531 532 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 533 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 534 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 535 static const char *const yytname[] = 536 { 537 "$end", "error", "$undefined", "\"identifier\"", "\"string\"", 538 "\"integer\"", "\"section name\"", "\"source name\"", 539 "\"binary object\"", "'('", "')'", "'{'", "'}'", "'['", "']'", "'='", 540 "','", "';'", "':'", "'>'", "'.'", "\"..\"", "'~'", "'&'", "'|'", "'<'", 541 "'!'", "\"&&\"", "\"||\"", "\">=\"", "\"<=\"", "\"==\"", "\"!=\"", 542 "\"**\"", "\"<<\"", "\">>\"", "\"integer size\"", "\"options\"", 543 "\"constants\"", "\"sources\"", "\"filters\"", "\"section\"", 544 "\"extern\"", "\"from\"", "\"raw\"", "\"load\"", "\"jump\"", "\"call\"", 545 "\"mode\"", "\"if\"", "\"else\"", "\"defined\"", "\"info\"", 546 "\"warning\"", "\"error\"", "\"sizeof\"", "\"dcd\"", "\"hab\"", 547 "\"ivt\"", "'^'", "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY_OP", 548 "$accept", "command_file", "blocks_list", "pre_section_block", 549 "options_block", "constants_block", "const_def_list", 550 "const_def_list_elem", "const_def", "sources_block", "source_def_list", 551 "source_def_list_elem", "source_def", "source_attrs_opt", 552 "source_attr_list", "source_attr_list_elem", "section_defs", 553 "section_def", "section_options_opt", "source_attr_list_opt", 554 "section_contents", "full_stmt_list", "full_stmt_list_elem", 555 "basic_stmt_list", "basic_stmt_list_elem", "basic_stmt", "load_stmt", 556 "dcd_opt", "load_data", "section_list", "section_list_elem", 557 "load_target_opt", "load_target", "ivt_def", "assignment_list_opt", 558 "call_stmt", "call_or_jump", "call_target", "call_arg_opt", "from_stmt", 559 "mode_stmt", "message_stmt", "if_stmt", "else_opt", "address_or_range", 560 "const_expr", "bool_expr", "int_const_expr", "symbol_ref", "expr", 561 "unary_expr", "int_value", 0 562 }; 563 #endif 564 565 # ifdef YYPRINT 566 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 567 token YYLEX-NUM. */ 568 static const unsigned short int yytoknum[] = 569 { 570 0, 256, 257, 258, 259, 260, 261, 262, 263, 40, 571 41, 123, 125, 91, 93, 61, 44, 59, 58, 62, 572 46, 264, 126, 38, 124, 60, 33, 265, 266, 267, 573 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 574 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 575 288, 289, 290, 291, 292, 293, 294, 295, 296, 94, 576 43, 45, 42, 47, 37, 297 577 }; 578 # endif 579 580 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 581 static const unsigned char yyr1[] = 582 { 583 0, 66, 67, 68, 68, 69, 69, 69, 70, 71, 584 72, 72, 73, 73, 74, 75, 76, 76, 77, 77, 585 78, 78, 79, 79, 80, 80, 81, 82, 82, 83, 586 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 587 88, 88, 89, 89, 90, 90, 90, 91, 91, 91, 588 91, 92, 93, 93, 94, 94, 94, 94, 94, 94, 589 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 590 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 591 104, 104, 105, 106, 107, 107, 107, 108, 109, 109, 592 109, 110, 110, 111, 111, 112, 112, 112, 112, 112, 593 112, 112, 112, 112, 112, 112, 112, 112, 113, 114, 594 114, 115, 115, 115, 115, 115, 115, 115, 115, 115, 595 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 596 115, 116, 116, 117 597 }; 598 599 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 600 static const unsigned char yyr2[] = 601 { 602 0, 2, 2, 1, 2, 1, 1, 1, 4, 4, 603 1, 2, 2, 0, 3, 4, 1, 2, 3, 0, 604 3, 6, 3, 0, 1, 3, 3, 1, 2, 6, 605 2, 0, 1, 0, 3, 3, 1, 2, 2, 1, 606 1, 0, 1, 2, 2, 1, 0, 1, 1, 1, 607 1, 4, 1, 0, 1, 1, 1, 1, 3, 4, 608 1, 1, 1, 3, 1, 2, 2, 0, 1, 1, 609 4, 1, 0, 3, 4, 1, 1, 1, 1, 3, 610 2, 0, 5, 2, 2, 2, 2, 6, 4, 2, 611 0, 1, 3, 1, 1, 1, 3, 3, 3, 3, 612 3, 3, 3, 3, 2, 4, 3, 4, 1, 3, 613 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 614 3, 3, 3, 3, 3, 1, 3, 3, 4, 4, 615 4, 2, 2, 1 616 }; 617 618 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 619 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 620 means the default is an error. */ 621 static const unsigned char yydefact[] = 622 { 623 0, 0, 0, 0, 0, 0, 3, 5, 6, 7, 624 13, 13, 19, 1, 0, 4, 2, 27, 0, 0, 625 10, 0, 0, 0, 0, 16, 23, 0, 28, 0, 626 8, 11, 12, 9, 0, 15, 17, 0, 0, 112, 627 133, 0, 0, 0, 0, 0, 0, 31, 113, 108, 628 125, 111, 112, 94, 0, 0, 0, 14, 93, 95, 629 20, 0, 0, 0, 24, 18, 0, 0, 110, 0, 630 131, 132, 33, 0, 0, 0, 0, 0, 0, 0, 631 0, 0, 0, 0, 0, 0, 0, 0, 108, 104, 632 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633 0, 22, 0, 109, 127, 0, 0, 0, 32, 30, 634 0, 126, 120, 121, 119, 123, 124, 122, 114, 115, 635 116, 117, 118, 0, 106, 0, 97, 96, 102, 103, 636 98, 99, 100, 101, 0, 26, 25, 129, 130, 128, 637 41, 0, 29, 105, 107, 21, 0, 53, 76, 75, 638 0, 0, 0, 0, 0, 0, 0, 36, 0, 47, 639 48, 0, 39, 49, 50, 40, 55, 64, 56, 60, 640 0, 0, 0, 57, 62, 61, 54, 0, 52, 0, 641 83, 0, 84, 85, 86, 0, 35, 37, 38, 77, 642 81, 78, 0, 65, 72, 34, 0, 0, 46, 67, 643 41, 81, 91, 0, 73, 0, 71, 0, 63, 58, 644 0, 42, 0, 45, 0, 51, 0, 74, 0, 80, 645 0, 59, 70, 82, 43, 44, 68, 66, 69, 90, 646 92, 79, 0, 87, 41, 89, 0, 88 647 }; 648 649 /* YYDEFGOTO[NTERM-NUM]. */ 650 static const short int yydefgoto[] = 651 { 652 -1, 4, 5, 6, 7, 8, 19, 20, 21, 9, 653 24, 25, 26, 38, 63, 64, 16, 17, 73, 109, 654 142, 156, 157, 210, 211, 158, 159, 179, 172, 173, 655 174, 215, 227, 175, 207, 160, 161, 190, 204, 162, 656 163, 164, 165, 233, 201, 57, 58, 59, 48, 49, 657 50, 51 658 }; 659 660 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 661 STATE-NUM. */ 662 #define YYPACT_NINF -181 663 static const short int yypact[] = 664 { 665 128, 17, 25, 48, 69, 123, -181, -181, -181, -181, 666 96, 96, 101, -181, 80, -181, 68, -181, 112, 85, 667 -181, 115, 89, 114, 91, -181, 124, 30, -181, 47, 668 -181, -181, -181, -181, 11, -181, -181, 134, 125, -181, 669 -181, 133, 30, 140, 144, 30, 30, 153, -181, 225, 670 -181, -181, 148, -181, 61, 61, 162, -181, 359, -181, 671 -181, 164, 159, 22, -181, -181, 172, 121, -181, 9, 672 -181, -181, 134, 168, 143, 30, 30, 30, 30, 30, 673 30, 30, 30, 30, 30, 30, 179, 303, 121, -181, 674 194, 61, 61, 61, 61, 61, 61, 61, 61, 30, 675 47, -181, 134, -181, -181, 188, 4, 200, 199, -181, 676 56, -181, 241, 231, 236, 86, 86, 247, 76, 76, 677 196, 196, 196, 208, -181, 210, -181, -181, 373, 373, 678 -181, -181, -181, -181, 216, -181, -181, -181, -181, -181, 679 314, 2, -181, -181, -181, -181, 220, 175, -181, -181, 680 30, 61, 228, 230, 237, 28, 147, -181, 223, -181, 681 -181, 108, -181, -181, -181, -181, -181, -181, 92, -181, 682 240, 243, 233, 15, -181, -181, -181, 242, -181, 2, 683 -181, 345, -181, -181, -181, 30, -181, -181, -181, 133, 684 246, -181, 7, -181, 134, -181, 7, 250, 361, 244, 685 314, 246, 248, 16, -181, 104, 199, 252, -181, -181, 686 190, -181, 251, -181, 75, -181, 160, -181, 30, -181, 687 261, -181, -181, -181, -181, -181, -181, -181, -181, 222, 688 -181, -181, 6, -181, 314, -181, 176, -181 689 }; 690 691 /* YYPGOTO[NTERM-NUM]. */ 692 static const short int yypgoto[] = 693 { 694 -181, -181, -181, 268, -181, -181, 266, 106, -181, -181, 695 -181, 254, -181, -181, -70, 177, -181, 267, -181, -181, 696 -181, -151, -155, -181, 107, -180, -181, -181, 127, 122, 697 129, -181, -181, -181, -181, -181, 163, -181, 118, -181, 698 -181, -181, -21, -181, 109, 221, -51, -27, 257, 270, 699 -181, -181 700 }; 701 702 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 703 positive, shift that token. If negative, reduce the rule which 704 number is the opposite. If zero, do what YYDEFACT says. 705 If YYTABLE_NINF, syntax error. */ 706 #define YYTABLE_NINF -1 707 static const unsigned char yytable[] = 708 { 709 47, 187, 108, 87, 89, 39, 166, 40, 167, 168, 710 169, 42, 105, 167, 138, 60, 106, 234, 212, 39, 711 43, 40, 66, 41, 170, 42, 219, 43, 10, 170, 712 212, 196, 101, 39, 43, 40, 11, 41, 102, 42, 713 126, 127, 128, 129, 130, 131, 132, 133, 43, 216, 714 52, 53, 40, 61, 41, 151, 54, 44, 197, 12, 715 171, 187, 45, 46, 52, 43, 40, 140, 41, 13, 716 54, 44, 134, 55, 148, 149, 45, 46, 39, 43, 717 40, 187, 41, 236, 42, 44, 141, 55, 18, 27, 718 45, 46, 18, 43, 23, 226, 74, 30, 56, 18, 719 181, 33, 44, 35, 23, 192, 74, 45, 46, 14, 720 66, 39, 56, 40, 176, 189, 44, 42, 221, 77, 721 196, 45, 46, 180, 206, 31, 43, 29, 31, 34, 722 44, 104, 32, 37, 191, 45, 46, 62, 83, 84, 723 85, 74, 65, 68, 75, 76, 81, 82, 83, 84, 724 85, 66, 176, 69, 77, 78, 79, 86, 202, 186, 725 1, 2, 3, 44, 14, 1, 2, 3, 45, 46, 726 72, 90, 229, 99, 100, 103, 220, 213, 110, 111, 727 80, 81, 82, 83, 84, 85, 123, 202, 237, 213, 728 146, 230, 147, 148, 149, 150, 151, 125, 137, 152, 729 153, 154, 223, 146, 155, 147, 148, 149, 150, 151, 730 139, 235, 152, 153, 154, 102, 74, 155, 143, 146, 731 144, 147, 148, 149, 150, 151, 145, 177, 152, 153, 732 154, 178, 182, 155, 183, 147, 148, 149, 150, 151, 733 188, 184, 152, 153, 154, 74, 193, 155, 75, 76, 734 195, 74, 194, 198, 75, 203, 74, 209, 77, 78, 735 79, 74, 222, 214, 77, 78, 79, 74, 225, 218, 736 75, 231, 232, 15, 77, 78, 79, 22, 36, 136, 737 77, 78, 79, 28, 80, 81, 82, 83, 84, 85, 738 80, 81, 82, 83, 84, 85, 81, 82, 83, 84, 739 85, 81, 82, 83, 84, 85, 199, 81, 82, 83, 740 84, 85, 67, 124, 205, 70, 71, 224, 185, 217, 741 0, 135, 91, 228, 88, 208, 107, 0, 92, 0, 742 93, 94, 95, 96, 97, 98, 0, 0, 0, 0, 743 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 744 117, 118, 119, 120, 121, 122, 200, 146, 0, 147, 745 148, 149, 150, 151, 91, 0, 152, 153, 154, 0, 746 92, 155, 93, 94, 95, 96, 97, 98, 91, 0, 747 0, 0, 0, 0, 92, 0, 93, 94, 95, 96, 748 97, 98, 91, 0, 0, 0, 0, 0, 92, 0, 749 0, 0, 95, 96, 97, 98, 147, 148, 149, 150, 750 151, 0, 0, 152, 153, 154, 0, 0, 155 751 }; 752 753 static const short int yycheck[] = 754 { 755 27, 156, 72, 54, 55, 3, 4, 5, 6, 7, 756 8, 9, 3, 6, 10, 4, 7, 11, 198, 3, 757 18, 5, 18, 7, 22, 9, 10, 18, 11, 22, 758 210, 16, 10, 3, 18, 5, 11, 7, 16, 9, 759 91, 92, 93, 94, 95, 96, 97, 98, 18, 200, 760 3, 4, 5, 42, 7, 49, 9, 55, 43, 11, 761 58, 216, 60, 61, 3, 18, 5, 11, 7, 0, 762 9, 55, 99, 26, 46, 47, 60, 61, 3, 18, 763 5, 236, 7, 234, 9, 55, 30, 26, 3, 9, 764 60, 61, 3, 18, 3, 20, 20, 12, 51, 3, 765 151, 12, 55, 12, 3, 13, 20, 60, 61, 41, 766 18, 3, 51, 5, 141, 7, 55, 9, 14, 33, 767 16, 60, 61, 150, 194, 19, 18, 15, 22, 15, 768 55, 10, 17, 9, 161, 60, 61, 3, 62, 63, 769 64, 20, 17, 3, 23, 24, 60, 61, 62, 63, 770 64, 18, 179, 9, 33, 34, 35, 9, 185, 12, 771 37, 38, 39, 55, 41, 37, 38, 39, 60, 61, 772 17, 9, 12, 9, 15, 3, 203, 198, 10, 36, 773 59, 60, 61, 62, 63, 64, 7, 214, 12, 210, 774 43, 218, 45, 46, 47, 48, 49, 3, 10, 52, 775 53, 54, 12, 43, 57, 45, 46, 47, 48, 49, 776 10, 232, 52, 53, 54, 16, 20, 57, 10, 43, 777 10, 45, 46, 47, 48, 49, 10, 7, 52, 53, 778 54, 56, 4, 57, 4, 45, 46, 47, 48, 49, 779 17, 4, 52, 53, 54, 20, 6, 57, 23, 24, 780 17, 20, 9, 11, 23, 9, 20, 7, 33, 34, 781 35, 20, 10, 19, 33, 34, 35, 20, 17, 21, 782 23, 10, 50, 5, 33, 34, 35, 11, 24, 102, 783 33, 34, 35, 16, 59, 60, 61, 62, 63, 64, 784 59, 60, 61, 62, 63, 64, 60, 61, 62, 63, 785 64, 60, 61, 62, 63, 64, 179, 60, 61, 62, 786 63, 64, 42, 10, 192, 45, 46, 210, 155, 201, 787 -1, 100, 19, 214, 54, 196, 69, -1, 25, -1, 788 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, 789 -1, -1, -1, -1, -1, 75, 76, 77, 78, 79, 790 80, 81, 82, 83, 84, 85, 11, 43, -1, 45, 791 46, 47, 48, 49, 19, -1, 52, 53, 54, -1, 792 25, 57, 27, 28, 29, 30, 31, 32, 19, -1, 793 -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, 794 31, 32, 19, -1, -1, -1, -1, -1, 25, -1, 795 -1, -1, 29, 30, 31, 32, 45, 46, 47, 48, 796 49, -1, -1, 52, 53, 54, -1, -1, 57 797 }; 798 799 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 800 symbol of state STATE-NUM. */ 801 static const unsigned char yystos[] = 802 { 803 0, 37, 38, 39, 67, 68, 69, 70, 71, 75, 804 11, 11, 11, 0, 41, 69, 82, 83, 3, 72, 805 73, 74, 72, 3, 76, 77, 78, 9, 83, 15, 806 12, 73, 17, 12, 15, 12, 77, 9, 79, 3, 807 5, 7, 9, 18, 55, 60, 61, 113, 114, 115, 808 116, 117, 3, 4, 9, 26, 51, 111, 112, 113, 809 4, 42, 3, 80, 81, 17, 18, 115, 3, 9, 810 115, 115, 17, 84, 20, 23, 24, 33, 34, 35, 811 59, 60, 61, 62, 63, 64, 9, 112, 115, 112, 812 9, 19, 25, 27, 28, 29, 30, 31, 32, 9, 813 15, 10, 16, 3, 10, 3, 7, 114, 80, 85, 814 10, 36, 115, 115, 115, 115, 115, 115, 115, 115, 815 115, 115, 115, 7, 10, 3, 112, 112, 112, 112, 816 112, 112, 112, 112, 113, 111, 81, 10, 10, 10, 817 11, 30, 86, 10, 10, 10, 43, 45, 46, 47, 818 48, 49, 52, 53, 54, 57, 87, 88, 91, 92, 819 101, 102, 105, 106, 107, 108, 4, 6, 7, 8, 820 22, 58, 94, 95, 96, 99, 113, 7, 56, 93, 821 113, 112, 4, 4, 4, 102, 12, 88, 17, 7, 822 103, 113, 13, 6, 9, 17, 16, 43, 11, 94, 823 11, 110, 113, 9, 104, 95, 80, 100, 96, 7, 824 89, 90, 91, 108, 19, 97, 87, 104, 21, 10, 825 113, 14, 10, 12, 90, 17, 20, 98, 110, 12, 826 113, 10, 50, 109, 11, 108, 87, 12 827 }; 828 829 #define yyerrok (yyerrstatus = 0) 830 #define yyclearin (yychar = YYEMPTY) 831 #define YYEMPTY (-2) 832 #define YYEOF 0 833 834 #define YYACCEPT goto yyacceptlab 835 #define YYABORT goto yyabortlab 836 #define YYERROR goto yyerrorlab 837 838 839 /* Like YYERROR except do call yyerror. This remains here temporarily 840 to ease the transition to the new meaning of YYERROR, for GCC. 841 Once GCC version 2 has supplanted version 1, this can go. */ 842 843 #define YYFAIL goto yyerrlab 844 845 #define YYRECOVERING() (!!yyerrstatus) 846 847 #define YYBACKUP(Token, Value) \ 848 do \ 849 if (yychar == YYEMPTY && yylen == 1) \ 850 { \ 851 yychar = (Token); \ 852 yylval = (Value); \ 853 yytoken = YYTRANSLATE (yychar); \ 854 YYPOPSTACK; \ 855 goto yybackup; \ 856 } \ 857 else \ 858 { \ 859 yyerror (&yylloc, lexer, resultAST, YY_("syntax error: cannot back up")); \ 860 YYERROR; \ 861 } \ 862 while (0) 863 864 865 #define YYTERROR 1 866 #define YYERRCODE 256 867 868 869 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 870 If N is 0, then set CURRENT to the empty location which ends 871 the previous symbol: RHS[0] (always defined). */ 872 873 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 874 #ifndef YYLLOC_DEFAULT 875 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 876 do \ 877 if (N) \ 878 { \ 879 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 880 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 881 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 882 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 883 } \ 884 else \ 885 { \ 886 (Current).first_line = (Current).last_line = \ 887 YYRHSLOC (Rhs, 0).last_line; \ 888 (Current).first_column = (Current).last_column = \ 889 YYRHSLOC (Rhs, 0).last_column; \ 890 } \ 891 while (0) 892 #endif 893 894 895 /* YY_LOCATION_PRINT -- Print the location on the stream. 896 This macro was not mandated originally: define only if we know 897 we won't break user code: when these are the locations we know. */ 898 899 #ifndef YY_LOCATION_PRINT 900 # if YYLTYPE_IS_TRIVIAL 901 # define YY_LOCATION_PRINT(File, Loc) \ 902 fprintf (File, "%d.%d-%d.%d", \ 903 (Loc).first_line, (Loc).first_column, \ 904 (Loc).last_line, (Loc).last_column) 905 # else 906 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 907 # endif 908 #endif 909 910 911 /* YYLEX -- calling `yylex' with the right arguments. */ 912 913 #ifdef YYLEX_PARAM 914 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) 915 #else 916 # define YYLEX yylex (&yylval, &yylloc, lexer) 917 #endif 918 919 /* Enable debugging if requested. */ 920 #if YYDEBUG 921 922 # ifndef YYFPRINTF 923 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 924 # define YYFPRINTF fprintf 925 # endif 926 927 # define YYDPRINTF(Args) \ 928 do { \ 929 if (yydebug) \ 930 YYFPRINTF Args; \ 931 } while (0) 932 933 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 934 do { \ 935 if (yydebug) \ 936 { \ 937 YYFPRINTF (stderr, "%s ", Title); \ 938 yysymprint (stderr, \ 939 Type, Value, Location); \ 940 YYFPRINTF (stderr, "\n"); \ 941 } \ 942 } while (0) 943 944 /*------------------------------------------------------------------. 945 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 946 | TOP (included). | 947 `------------------------------------------------------------------*/ 948 949 #if defined (__STDC__) || defined (__cplusplus) 950 static void 951 yy_stack_print (short int *bottom, short int *top) 952 #else 953 static void 954 yy_stack_print (bottom, top) 955 short int *bottom; 956 short int *top; 957 #endif 958 { 959 YYFPRINTF (stderr, "Stack now"); 960 for (/* Nothing. */; bottom <= top; ++bottom) 961 YYFPRINTF (stderr, " %d", *bottom); 962 YYFPRINTF (stderr, "\n"); 963 } 964 965 # define YY_STACK_PRINT(Bottom, Top) \ 966 do { \ 967 if (yydebug) \ 968 yy_stack_print ((Bottom), (Top)); \ 969 } while (0) 970 971 972 /*------------------------------------------------. 973 | Report that the YYRULE is going to be reduced. | 974 `------------------------------------------------*/ 975 976 #if defined (__STDC__) || defined (__cplusplus) 977 static void 978 yy_reduce_print (int yyrule) 979 #else 980 static void 981 yy_reduce_print (yyrule) 982 int yyrule; 983 #endif 984 { 985 int yyi; 986 unsigned long int yylno = yyrline[yyrule]; 987 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", 988 yyrule - 1, yylno); 989 /* Print the symbols being reduced, and their result. */ 990 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) 991 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); 992 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); 993 } 994 995 # define YY_REDUCE_PRINT(Rule) \ 996 do { \ 997 if (yydebug) \ 998 yy_reduce_print (Rule); \ 999 } while (0) 1000 1001 /* Nonzero means print parse trace. It is left uninitialized so that 1002 multiple parsers can coexist. */ 1003 int yydebug; 1004 #else /* !YYDEBUG */ 1005 # define YYDPRINTF(Args) 1006 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1007 # define YY_STACK_PRINT(Bottom, Top) 1008 # define YY_REDUCE_PRINT(Rule) 1009 #endif /* !YYDEBUG */ 1010 1011 1012 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1013 #ifndef YYINITDEPTH 1014 # define YYINITDEPTH 200 1015 #endif 1016 1017 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1018 if the built-in stack extension method is used). 1019 1020 Do not make this value too large; the results are undefined if 1021 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1022 evaluated with infinite-precision integer arithmetic. */ 1023 1024 #ifndef YYMAXDEPTH 1025 # define YYMAXDEPTH 10000 1026 #endif 1027 1028 1029 1030 #if YYERROR_VERBOSE 1031 1032 # ifndef yystrlen 1033 # if defined (__GLIBC__) && defined (_STRING_H) 1034 # define yystrlen strlen 1035 # else 1036 /* Return the length of YYSTR. */ 1037 static YYSIZE_T 1038 # if defined (__STDC__) || defined (__cplusplus) 1039 yystrlen (const char *yystr) 1040 # else 1041 yystrlen (yystr) 1042 const char *yystr; 1043 # endif 1044 { 1045 const char *yys = yystr; 1046 1047 while (*yys++ != '\0') 1048 continue; 1049 1050 return yys - yystr - 1; 1051 } 1052 # endif 1053 # endif 1054 1055 # ifndef yystpcpy 1056 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 1057 # define yystpcpy stpcpy 1058 # else 1059 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1060 YYDEST. */ 1061 static char * 1062 # if defined (__STDC__) || defined (__cplusplus) 1063 yystpcpy (char *yydest, const char *yysrc) 1064 # else 1065 yystpcpy (yydest, yysrc) 1066 char *yydest; 1067 const char *yysrc; 1068 # endif 1069 { 1070 char *yyd = yydest; 1071 const char *yys = yysrc; 1072 1073 while ((*yyd++ = *yys++) != '\0') 1074 continue; 1075 1076 return yyd - 1; 1077 } 1078 # endif 1079 # endif 1080 1081 # ifndef yytnamerr 1082 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1083 quotes and backslashes, so that it's suitable for yyerror. The 1084 heuristic is that double-quoting is unnecessary unless the string 1085 contains an apostrophe, a comma, or backslash (other than 1086 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1087 null, do not copy; instead, return the length of what the result 1088 would have been. */ 1089 static YYSIZE_T 1090 yytnamerr (char *yyres, const char *yystr) 1091 { 1092 if (*yystr == '"') 1093 { 1094 size_t yyn = 0; 1095 char const *yyp = yystr; 1096 1097 for (;;) 1098 switch (*++yyp) 1099 { 1100 case '\'': 1101 case ',': 1102 goto do_not_strip_quotes; 1103 1104 case '\\': 1105 if (*++yyp != '\\') 1106 goto do_not_strip_quotes; 1107 /* Fall through. */ 1108 default: 1109 if (yyres) 1110 yyres[yyn] = *yyp; 1111 yyn++; 1112 break; 1113 1114 case '"': 1115 if (yyres) 1116 yyres[yyn] = '\0'; 1117 return yyn; 1118 } 1119 do_not_strip_quotes: ; 1120 } 1121 1122 if (! yyres) 1123 return yystrlen (yystr); 1124 1125 return yystpcpy (yyres, yystr) - yyres; 1126 } 1127 # endif 1128 1129 #endif /* YYERROR_VERBOSE */ 1130 1131 1132 1133 #if YYDEBUG 1134 /*--------------------------------. 1135 | Print this symbol on YYOUTPUT. | 1136 `--------------------------------*/ 1137 1138 #if defined (__STDC__) || defined (__cplusplus) 1139 static void 1140 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) 1141 #else 1142 static void 1143 yysymprint (yyoutput, yytype, yyvaluep, yylocationp) 1144 FILE *yyoutput; 1145 int yytype; 1146 YYSTYPE *yyvaluep; 1147 YYLTYPE *yylocationp; 1148 #endif 1149 { 1150 /* Pacify ``unused variable'' warnings. */ 1151 (void) yyvaluep; 1152 (void) yylocationp; 1153 1154 if (yytype < YYNTOKENS) 1155 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1156 else 1157 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1158 1159 YY_LOCATION_PRINT (yyoutput, *yylocationp); 1160 YYFPRINTF (yyoutput, ": "); 1161 1162 # ifdef YYPRINT 1163 if (yytype < YYNTOKENS) 1164 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1165 # endif 1166 switch (yytype) 1167 { 1168 default: 1169 break; 1170 } 1171 YYFPRINTF (yyoutput, ")"); 1172 } 1173 1174 #endif /* ! YYDEBUG */ 1175 /*-----------------------------------------------. 1176 | Release the memory associated to this symbol. | 1177 `-----------------------------------------------*/ 1178 1179 #if defined (__STDC__) || defined (__cplusplus) 1180 static void 1181 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) 1182 #else 1183 static void 1184 yydestruct (yymsg, yytype, yyvaluep, yylocationp) 1185 const char *yymsg; 1186 int yytype; 1187 YYSTYPE *yyvaluep; 1188 YYLTYPE *yylocationp; 1189 #endif 1190 { 1191 /* Pacify ``unused variable'' warnings. */ 1192 (void) yyvaluep; 1193 (void) yylocationp; 1194 1195 if (!yymsg) 1196 yymsg = "Deleting"; 1197 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1198 1199 switch (yytype) 1200 { 1201 case 3: /* "\"identifier\"" */ 1202 { delete (yyvaluep->m_str); }; 1203 break; 1204 case 4: /* "\"string\"" */ 1205 { delete (yyvaluep->m_str); }; 1206 break; 1207 case 5: /* "\"integer\"" */ 1208 { delete (yyvaluep->m_int); }; 1209 break; 1210 case 6: /* "\"section name\"" */ 1211 { delete (yyvaluep->m_str); }; 1212 break; 1213 case 7: /* "\"source name\"" */ 1214 { delete (yyvaluep->m_str); }; 1215 break; 1216 case 8: /* "\"binary object\"" */ 1217 { delete (yyvaluep->m_blob); }; 1218 break; 1219 case 36: /* "\"integer size\"" */ 1220 { delete (yyvaluep->m_int); }; 1221 break; 1222 1223 default: 1224 break; 1225 } 1226 } 1227 1228 1229 /* Prevent warnings from -Wmissing-prototypes. */ 1230 1231 #ifdef YYPARSE_PARAM 1232 # if defined (__STDC__) || defined (__cplusplus) 1233 int yyparse (void *YYPARSE_PARAM); 1234 # else 1235 int yyparse (); 1236 # endif 1237 #else /* ! YYPARSE_PARAM */ 1238 #if defined (__STDC__) || defined (__cplusplus) 1239 int yyparse (ElftosbLexer * lexer, CommandFileASTNode ** resultAST); 1240 #else 1241 int yyparse (); 1242 #endif 1243 #endif /* ! YYPARSE_PARAM */ 1244 1245 1246 1247 1248 1249 1250 /*----------. 1251 | yyparse. | 1252 `----------*/ 1253 1254 #ifdef YYPARSE_PARAM 1255 # if defined (__STDC__) || defined (__cplusplus) 1256 int yyparse (void *YYPARSE_PARAM) 1257 # else 1258 int yyparse (YYPARSE_PARAM) 1259 void *YYPARSE_PARAM; 1260 # endif 1261 #else /* ! YYPARSE_PARAM */ 1262 #if defined (__STDC__) || defined (__cplusplus) 1263 int 1264 yyparse (ElftosbLexer * lexer, CommandFileASTNode ** resultAST) 1265 #else 1266 int 1267 yyparse (lexer, resultAST) 1268 ElftosbLexer * lexer; 1269 CommandFileASTNode ** resultAST; 1270 #endif 1271 #endif 1272 { 1273 /* The look-ahead symbol. */ 1274 int yychar; 1275 1276 /* The semantic value of the look-ahead symbol. */ 1277 YYSTYPE yylval; 1278 1279 /* Number of syntax errors so far. */ 1280 int yynerrs; 1281 /* Location data for the look-ahead symbol. */ 1282 YYLTYPE yylloc; 1283 1284 int yystate; 1285 int yyn; 1286 int yyresult; 1287 /* Number of tokens to shift before error messages enabled. */ 1288 int yyerrstatus; 1289 /* Look-ahead token as an internal (translated) token number. */ 1290 int yytoken = 0; 1291 1292 /* Three stacks and their tools: 1293 `yyss': related to states, 1294 `yyvs': related to semantic values, 1295 `yyls': related to locations. 1296 1297 Refer to the stacks thru separate pointers, to allow yyoverflow 1298 to reallocate them elsewhere. */ 1299 1300 /* The state stack. */ 1301 short int yyssa[YYINITDEPTH]; 1302 short int *yyss = yyssa; 1303 short int *yyssp; 1304 1305 /* The semantic value stack. */ 1306 YYSTYPE yyvsa[YYINITDEPTH]; 1307 YYSTYPE *yyvs = yyvsa; 1308 YYSTYPE *yyvsp; 1309 1310 /* The location stack. */ 1311 YYLTYPE yylsa[YYINITDEPTH]; 1312 YYLTYPE *yyls = yylsa; 1313 YYLTYPE *yylsp; 1314 /* The locations where the error started and ended. */ 1315 YYLTYPE yyerror_range[2]; 1316 1317 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 1318 1319 YYSIZE_T yystacksize = YYINITDEPTH; 1320 1321 /* The variables used to return semantic value and location from the 1322 action routines. */ 1323 YYSTYPE yyval; 1324 YYLTYPE yyloc; 1325 1326 /* When reducing, the number of symbols on the RHS of the reduced 1327 rule. */ 1328 int yylen; 1329 1330 YYDPRINTF ((stderr, "Starting parse\n")); 1331 1332 yystate = 0; 1333 yyerrstatus = 0; 1334 yynerrs = 0; 1335 yychar = YYEMPTY; /* Cause a token to be read. */ 1336 1337 /* Initialize stack pointers. 1338 Waste one element of value and location stack 1339 so that they stay on the same level as the state stack. 1340 The wasted elements are never initialized. */ 1341 1342 yyssp = yyss; 1343 yyvsp = yyvs; 1344 yylsp = yyls; 1345 #if YYLTYPE_IS_TRIVIAL 1346 /* Initialize the default location before parsing starts. */ 1347 yylloc.first_line = yylloc.last_line = 1; 1348 yylloc.first_column = yylloc.last_column = 0; 1349 #endif 1350 1351 goto yysetstate; 1352 1353 /*------------------------------------------------------------. 1354 | yynewstate -- Push a new state, which is found in yystate. | 1355 `------------------------------------------------------------*/ 1356 yynewstate: 1357 /* In all cases, when you get here, the value and location stacks 1358 have just been pushed. so pushing a state here evens the stacks. 1359 */ 1360 yyssp++; 1361 1362 yysetstate: 1363 *yyssp = yystate; 1364 1365 if (yyss + yystacksize - 1 <= yyssp) 1366 { 1367 /* Get the current used size of the three stacks, in elements. */ 1368 YYSIZE_T yysize = yyssp - yyss + 1; 1369 1370 #ifdef yyoverflow 1371 { 1372 /* Give user a chance to reallocate the stack. Use copies of 1373 these so that the &'s don't force the real ones into 1374 memory. */ 1375 YYSTYPE *yyvs1 = yyvs; 1376 short int *yyss1 = yyss; 1377 YYLTYPE *yyls1 = yyls; 1378 1379 /* Each stack pointer address is followed by the size of the 1380 data in use in that stack, in bytes. This used to be a 1381 conditional around just the two extra args, but that might 1382 be undefined if yyoverflow is a macro. */ 1383 yyoverflow (YY_("memory exhausted"), 1384 &yyss1, yysize * sizeof (*yyssp), 1385 &yyvs1, yysize * sizeof (*yyvsp), 1386 &yyls1, yysize * sizeof (*yylsp), 1387 &yystacksize); 1388 yyls = yyls1; 1389 yyss = yyss1; 1390 yyvs = yyvs1; 1391 } 1392 #else /* no yyoverflow */ 1393 # ifndef YYSTACK_RELOCATE 1394 goto yyexhaustedlab; 1395 # else 1396 /* Extend the stack our own way. */ 1397 if (YYMAXDEPTH <= yystacksize) 1398 goto yyexhaustedlab; 1399 yystacksize *= 2; 1400 if (YYMAXDEPTH < yystacksize) 1401 yystacksize = YYMAXDEPTH; 1402 1403 { 1404 short int *yyss1 = yyss; 1405 union yyalloc *yyptr = 1406 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1407 if (! yyptr) 1408 goto yyexhaustedlab; 1409 YYSTACK_RELOCATE (yyss); 1410 YYSTACK_RELOCATE (yyvs); 1411 YYSTACK_RELOCATE (yyls); 1412 # undef YYSTACK_RELOCATE 1413 if (yyss1 != yyssa) 1414 YYSTACK_FREE (yyss1); 1415 } 1416 # endif 1417 #endif /* no yyoverflow */ 1418 1419 yyssp = yyss + yysize - 1; 1420 yyvsp = yyvs + yysize - 1; 1421 yylsp = yyls + yysize - 1; 1422 1423 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1424 (unsigned long int) yystacksize)); 1425 1426 if (yyss + yystacksize - 1 <= yyssp) 1427 YYABORT; 1428 } 1429 1430 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1431 1432 goto yybackup; 1433 1434 /*-----------. 1435 | yybackup. | 1436 `-----------*/ 1437 yybackup: 1438 1439 /* Do appropriate processing given the current state. */ 1440 /* Read a look-ahead token if we need one and don't already have one. */ 1441 /* yyresume: */ 1442 1443 /* First try to decide what to do without reference to look-ahead token. */ 1444 1445 yyn = yypact[yystate]; 1446 if (yyn == YYPACT_NINF) 1447 goto yydefault; 1448 1449 /* Not known => get a look-ahead token if don't already have one. */ 1450 1451 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 1452 if (yychar == YYEMPTY) 1453 { 1454 YYDPRINTF ((stderr, "Reading a token: ")); 1455 yychar = YYLEX; 1456 } 1457 1458 if (yychar <= YYEOF) 1459 { 1460 yychar = yytoken = YYEOF; 1461 YYDPRINTF ((stderr, "Now at end of input.\n")); 1462 } 1463 else 1464 { 1465 yytoken = YYTRANSLATE (yychar); 1466 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1467 } 1468 1469 /* If the proper action on seeing token YYTOKEN is to reduce or to 1470 detect an error, take that action. */ 1471 yyn += yytoken; 1472 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1473 goto yydefault; 1474 yyn = yytable[yyn]; 1475 if (yyn <= 0) 1476 { 1477 if (yyn == 0 || yyn == YYTABLE_NINF) 1478 goto yyerrlab; 1479 yyn = -yyn; 1480 goto yyreduce; 1481 } 1482 1483 if (yyn == YYFINAL) 1484 YYACCEPT; 1485 1486 /* Shift the look-ahead token. */ 1487 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1488 1489 /* Discard the token being shifted unless it is eof. */ 1490 if (yychar != YYEOF) 1491 yychar = YYEMPTY; 1492 1493 *++yyvsp = yylval; 1494 *++yylsp = yylloc; 1495 1496 /* Count tokens shifted since error; after three, turn off error 1497 status. */ 1498 if (yyerrstatus) 1499 yyerrstatus--; 1500 1501 yystate = yyn; 1502 goto yynewstate; 1503 1504 1505 /*-----------------------------------------------------------. 1506 | yydefault -- do the default action for the current state. | 1507 `-----------------------------------------------------------*/ 1508 yydefault: 1509 yyn = yydefact[yystate]; 1510 if (yyn == 0) 1511 goto yyerrlab; 1512 goto yyreduce; 1513 1514 1515 /*-----------------------------. 1516 | yyreduce -- Do a reduction. | 1517 `-----------------------------*/ 1518 yyreduce: 1519 /* yyn is the number of a rule to reduce with. */ 1520 yylen = yyr2[yyn]; 1521 1522 /* If YYLEN is nonzero, implement the default value of the action: 1523 `$$ = $1'. 1524 1525 Otherwise, the following line sets YYVAL to garbage. 1526 This behavior is undocumented and Bison 1527 users should not rely upon it. Assigning to YYVAL 1528 unconditionally makes the parser a bit smaller, and it avoids a 1529 GCC warning that YYVAL may be used uninitialized. */ 1530 yyval = yyvsp[1-yylen]; 1531 1532 /* Default location. */ 1533 YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen); 1534 YY_REDUCE_PRINT (yyn); 1535 switch (yyn) 1536 { 1537 case 2: 1538 { 1539 CommandFileASTNode * commandFile = new CommandFileASTNode(); 1540 commandFile->setBlocks(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))); 1541 commandFile->setSections(dynamic_cast<ListASTNode*>((yyvsp[0].m_ast))); 1542 commandFile->setLocation((yylsp[-1]), (yylsp[0])); 1543 *resultAST = commandFile; 1544 ;} 1545 break; 1546 1547 case 3: 1548 { 1549 ListASTNode * list = new ListASTNode(); 1550 list->appendNode((yyvsp[0].m_ast)); 1551 (yyval.m_ast) = list; 1552 ;} 1553 break; 1554 1555 case 4: 1556 { 1557 dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast)); 1558 (yyval.m_ast) = (yyvsp[-1].m_ast); 1559 ;} 1560 break; 1561 1562 case 5: 1563 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1564 break; 1565 1566 case 6: 1567 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1568 break; 1569 1570 case 7: 1571 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1572 break; 1573 1574 case 8: 1575 { 1576 (yyval.m_ast) = new OptionsBlockASTNode(dynamic_cast<ListASTNode *>((yyvsp[-1].m_ast))); 1577 ;} 1578 break; 1579 1580 case 9: 1581 { 1582 (yyval.m_ast) = new ConstantsBlockASTNode(dynamic_cast<ListASTNode *>((yyvsp[-1].m_ast))); 1583 ;} 1584 break; 1585 1586 case 10: 1587 { 1588 ListASTNode * list = new ListASTNode(); 1589 list->appendNode((yyvsp[0].m_ast)); 1590 (yyval.m_ast) = list; 1591 ;} 1592 break; 1593 1594 case 11: 1595 { 1596 dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast)); 1597 (yyval.m_ast) = (yyvsp[-1].m_ast); 1598 ;} 1599 break; 1600 1601 case 12: 1602 { (yyval.m_ast) = (yyvsp[-1].m_ast); ;} 1603 break; 1604 1605 case 13: 1606 { (yyval.m_ast) = NULL; ;} 1607 break; 1608 1609 case 14: 1610 { 1611 (yyval.m_ast) = new AssignmentASTNode((yyvsp[-2].m_str), (yyvsp[0].m_ast)); 1612 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 1613 ;} 1614 break; 1615 1616 case 15: 1617 { 1618 (yyval.m_ast) = new SourcesBlockASTNode(dynamic_cast<ListASTNode *>((yyvsp[-1].m_ast))); 1619 ;} 1620 break; 1621 1622 case 16: 1623 { 1624 ListASTNode * list = new ListASTNode(); 1625 list->appendNode((yyvsp[0].m_ast)); 1626 (yyval.m_ast) = list; 1627 ;} 1628 break; 1629 1630 case 17: 1631 { 1632 dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast)); 1633 (yyval.m_ast) = (yyvsp[-1].m_ast); 1634 ;} 1635 break; 1636 1637 case 18: 1638 { 1639 // tell the lexer that this is the name of a source file 1640 SourceDefASTNode * node = dynamic_cast<SourceDefASTNode*>((yyvsp[-2].m_ast)); 1641 if ((yyvsp[-1].m_ast)) 1642 { 1643 node->setAttributes(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))); 1644 } 1645 node->setLocation(node->getLocation(), (yylsp[0])); 1646 lexer->addSourceName(node->getName()); 1647 (yyval.m_ast) = (yyvsp[-2].m_ast); 1648 ;} 1649 break; 1650 1651 case 19: 1652 { (yyval.m_ast) = NULL; ;} 1653 break; 1654 1655 case 20: 1656 { 1657 (yyval.m_ast) = new PathSourceDefASTNode((yyvsp[-2].m_str), (yyvsp[0].m_str)); 1658 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 1659 ;} 1660 break; 1661 1662 case 21: 1663 { 1664 (yyval.m_ast) = new ExternSourceDefASTNode((yyvsp[-5].m_str), dynamic_cast<ExprASTNode*>((yyvsp[-1].m_ast))); 1665 (yyval.m_ast)->setLocation((yylsp[-5]), (yylsp[0])); 1666 ;} 1667 break; 1668 1669 case 22: 1670 { (yyval.m_ast) = (yyvsp[-1].m_ast); ;} 1671 break; 1672 1673 case 23: 1674 { (yyval.m_ast) = NULL; ;} 1675 break; 1676 1677 case 24: 1678 { 1679 ListASTNode * list = new ListASTNode(); 1680 list->appendNode((yyvsp[0].m_ast)); 1681 (yyval.m_ast) = list; 1682 ;} 1683 break; 1684 1685 case 25: 1686 { 1687 dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast))->appendNode((yyvsp[0].m_ast)); 1688 (yyval.m_ast) = (yyvsp[-2].m_ast); 1689 ;} 1690 break; 1691 1692 case 26: 1693 { 1694 (yyval.m_ast) = new AssignmentASTNode((yyvsp[-2].m_str), (yyvsp[0].m_ast)); 1695 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 1696 ;} 1697 break; 1698 1699 case 27: 1700 { 1701 ListASTNode * list = new ListASTNode(); 1702 list->appendNode((yyvsp[0].m_ast)); 1703 (yyval.m_ast) = list; 1704 ;} 1705 break; 1706 1707 case 28: 1708 { 1709 dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast)); 1710 (yyval.m_ast) = (yyvsp[-1].m_ast); 1711 ;} 1712 break; 1713 1714 case 29: 1715 { 1716 SectionContentsASTNode * sectionNode = dynamic_cast<SectionContentsASTNode*>((yyvsp[0].m_ast)); 1717 if (sectionNode) 1718 { 1719 ExprASTNode * exprNode = dynamic_cast<ExprASTNode*>((yyvsp[-3].m_ast)); 1720 sectionNode->setSectionNumberExpr(exprNode); 1721 sectionNode->setOptions(dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast))); 1722 sectionNode->setLocation((yylsp[-5]), sectionNode->getLocation()); 1723 } 1724 (yyval.m_ast) = (yyvsp[0].m_ast); 1725 ;} 1726 break; 1727 1728 case 30: 1729 { 1730 (yyval.m_ast) = (yyvsp[0].m_ast); 1731 ;} 1732 break; 1733 1734 case 31: 1735 { 1736 (yyval.m_ast) = NULL; 1737 ;} 1738 break; 1739 1740 case 32: 1741 { 1742 (yyval.m_ast) = (yyvsp[0].m_ast); 1743 ;} 1744 break; 1745 1746 case 33: 1747 { 1748 (yyval.m_ast) = NULL; 1749 ;} 1750 break; 1751 1752 case 34: 1753 { 1754 DataSectionContentsASTNode * dataSection = new DataSectionContentsASTNode((yyvsp[-1].m_ast)); 1755 dataSection->setLocation((yylsp[-2]), (yylsp[0])); 1756 (yyval.m_ast) = dataSection; 1757 ;} 1758 break; 1759 1760 case 35: 1761 { 1762 ListASTNode * listNode = dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)); 1763 (yyval.m_ast) = new BootableSectionContentsASTNode(listNode); 1764 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 1765 ;} 1766 break; 1767 1768 case 36: 1769 { 1770 ListASTNode * list = new ListASTNode(); 1771 list->appendNode((yyvsp[0].m_ast)); 1772 (yyval.m_ast) = list; 1773 ;} 1774 break; 1775 1776 case 37: 1777 { 1778 dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast)); 1779 (yyval.m_ast) = (yyvsp[-1].m_ast); 1780 ;} 1781 break; 1782 1783 case 38: 1784 { (yyval.m_ast) = (yyvsp[-1].m_ast); ;} 1785 break; 1786 1787 case 39: 1788 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1789 break; 1790 1791 case 40: 1792 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1793 break; 1794 1795 case 41: 1796 { (yyval.m_ast) = NULL; ;} 1797 break; 1798 1799 case 42: 1800 { 1801 ListASTNode * list = new ListASTNode(); 1802 list->appendNode((yyvsp[0].m_ast)); 1803 (yyval.m_ast) = list; 1804 ;} 1805 break; 1806 1807 case 43: 1808 { 1809 dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))->appendNode((yyvsp[0].m_ast)); 1810 (yyval.m_ast) = (yyvsp[-1].m_ast); 1811 ;} 1812 break; 1813 1814 case 44: 1815 { (yyval.m_ast) = (yyvsp[-1].m_ast); ;} 1816 break; 1817 1818 case 45: 1819 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1820 break; 1821 1822 case 46: 1823 { (yyval.m_ast) = NULL; ;} 1824 break; 1825 1826 case 47: 1827 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1828 break; 1829 1830 case 48: 1831 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1832 break; 1833 1834 case 49: 1835 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1836 break; 1837 1838 case 50: 1839 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 1840 break; 1841 1842 case 51: 1843 { 1844 LoadStatementASTNode * stmt = new LoadStatementASTNode(); 1845 stmt->setData((yyvsp[-1].m_ast)); 1846 stmt->setTarget((yyvsp[0].m_ast)); 1847 // set dcd load flag if the "dcd" keyword was present. 1848 if ((yyvsp[-2].m_num)) 1849 { 1850 stmt->setDCDLoad(true); 1851 } 1852 // set char locations for the statement 1853 if ((yyvsp[0].m_ast)) 1854 { 1855 stmt->setLocation((yylsp[-3]), (yylsp[0])); 1856 } 1857 else 1858 { 1859 stmt->setLocation((yylsp[-3]), (yylsp[-1])); 1860 } 1861 (yyval.m_ast) = stmt; 1862 ;} 1863 break; 1864 1865 case 52: 1866 { 1867 if (!elftosb::g_enableHABSupport) 1868 { 1869 yyerror(&yylloc, lexer, resultAST, "HAB features not supported with the selected family"); 1870 YYABORT; 1871 } 1872 1873 (yyval.m_num) = 1; 1874 ;} 1875 break; 1876 1877 case 53: 1878 { (yyval.m_num) = 0; ;} 1879 break; 1880 1881 case 54: 1882 { 1883 (yyval.m_ast) = (yyvsp[0].m_ast); 1884 ;} 1885 break; 1886 1887 case 55: 1888 { 1889 (yyval.m_ast) = new StringConstASTNode((yyvsp[0].m_str)); 1890 (yyval.m_ast)->setLocation((yylsp[0])); 1891 ;} 1892 break; 1893 1894 case 56: 1895 { 1896 (yyval.m_ast) = new SourceASTNode((yyvsp[0].m_str)); 1897 (yyval.m_ast)->setLocation((yylsp[0])); 1898 ;} 1899 break; 1900 1901 case 57: 1902 { 1903 (yyval.m_ast) = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>((yyvsp[0].m_ast))); 1904 (yyval.m_ast)->setLocation((yylsp[0])); 1905 ;} 1906 break; 1907 1908 case 58: 1909 { 1910 (yyval.m_ast) = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast)), (yyvsp[0].m_str)); 1911 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 1912 ;} 1913 break; 1914 1915 case 59: 1916 { 1917 (yyval.m_ast) = new SectionMatchListASTNode(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast)), (yyvsp[-3].m_str)); 1918 (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0])); 1919 ;} 1920 break; 1921 1922 case 60: 1923 { 1924 (yyval.m_ast) = new BlobConstASTNode((yyvsp[0].m_blob)); 1925 (yyval.m_ast)->setLocation((yylsp[0])); 1926 ;} 1927 break; 1928 1929 case 61: 1930 { 1931 ;} 1932 break; 1933 1934 case 62: 1935 { 1936 ListASTNode * list = new ListASTNode(); 1937 list->appendNode((yyvsp[0].m_ast)); 1938 (yyval.m_ast) = list; 1939 ;} 1940 break; 1941 1942 case 63: 1943 { 1944 dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast))->appendNode((yyvsp[0].m_ast)); 1945 (yyval.m_ast) = (yyvsp[-2].m_ast); 1946 ;} 1947 break; 1948 1949 case 64: 1950 { 1951 (yyval.m_ast) = new SectionASTNode((yyvsp[0].m_str), SectionASTNode::kInclude); 1952 (yyval.m_ast)->setLocation((yylsp[0])); 1953 ;} 1954 break; 1955 1956 case 65: 1957 { 1958 (yyval.m_ast) = new SectionASTNode((yyvsp[0].m_str), SectionASTNode::kExclude); 1959 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 1960 ;} 1961 break; 1962 1963 case 66: 1964 { 1965 (yyval.m_ast) = (yyvsp[0].m_ast); 1966 ;} 1967 break; 1968 1969 case 67: 1970 { 1971 (yyval.m_ast) = new NaturalLocationASTNode(); 1972 // $$->setLocation(); 1973 ;} 1974 break; 1975 1976 case 68: 1977 { 1978 (yyval.m_ast) = new NaturalLocationASTNode(); 1979 (yyval.m_ast)->setLocation((yylsp[0])); 1980 ;} 1981 break; 1982 1983 case 69: 1984 { 1985 (yyval.m_ast) = (yyvsp[0].m_ast); 1986 ;} 1987 break; 1988 1989 case 70: 1990 { 1991 IVTConstASTNode * ivt = new IVTConstASTNode(); 1992 if ((yyvsp[-1].m_ast)) 1993 { 1994 ivt->setFieldAssignments(dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))); 1995 } 1996 ivt->setLocation((yylsp[-3]), (yylsp[0])); 1997 (yyval.m_ast) = ivt; 1998 ;} 1999 break; 2000 2001 case 71: 2002 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 2003 break; 2004 2005 case 72: 2006 { (yyval.m_ast) = NULL; ;} 2007 break; 2008 2009 case 73: 2010 { 2011 CallStatementASTNode * stmt = new CallStatementASTNode(); 2012 switch ((yyvsp[-2].m_num)) 2013 { 2014 case 1: 2015 stmt->setCallType(CallStatementASTNode::kCallType); 2016 break; 2017 case 2: 2018 stmt->setCallType(CallStatementASTNode::kJumpType); 2019 break; 2020 default: 2021 yyerror(&yylloc, lexer, resultAST, "invalid call_or_jump value"); 2022 YYABORT; 2023 break; 2024 } 2025 stmt->setTarget((yyvsp[-1].m_ast)); 2026 stmt->setArgument((yyvsp[0].m_ast)); 2027 stmt->setIsHAB(false); 2028 if ((yyvsp[0].m_ast)) 2029 { 2030 stmt->setLocation((yylsp[-2]), (yylsp[0])); 2031 } 2032 else 2033 { 2034 stmt->setLocation((yylsp[-2]), (yylsp[-1])); 2035 } 2036 (yyval.m_ast) = stmt; 2037 ;} 2038 break; 2039 2040 case 74: 2041 { 2042 if (!elftosb::g_enableHABSupport) 2043 { 2044 yyerror(&yylloc, lexer, resultAST, "HAB features not supported with the selected family"); 2045 YYABORT; 2046 } 2047 2048 CallStatementASTNode * stmt = new CallStatementASTNode(); 2049 switch ((yyvsp[-2].m_num)) 2050 { 2051 case 1: 2052 stmt->setCallType(CallStatementASTNode::kCallType); 2053 break; 2054 case 2: 2055 stmt->setCallType(CallStatementASTNode::kJumpType); 2056 break; 2057 default: 2058 yyerror(&yylloc, lexer, resultAST, "invalid call_or_jump value"); 2059 YYABORT; 2060 break; 2061 } 2062 stmt->setTarget((yyvsp[-1].m_ast)); 2063 stmt->setArgument((yyvsp[0].m_ast)); 2064 stmt->setIsHAB(true); 2065 if ((yyvsp[0].m_ast)) 2066 { 2067 stmt->setLocation((yylsp[-3]), (yylsp[0])); 2068 } 2069 else 2070 { 2071 stmt->setLocation((yylsp[-3]), (yylsp[-1])); 2072 } 2073 (yyval.m_ast) = stmt; 2074 ;} 2075 break; 2076 2077 case 75: 2078 { (yyval.m_num) = 1; ;} 2079 break; 2080 2081 case 76: 2082 { (yyval.m_num) = 2; ;} 2083 break; 2084 2085 case 77: 2086 { 2087 (yyval.m_ast) = new SymbolASTNode(NULL, (yyvsp[0].m_str)); 2088 (yyval.m_ast)->setLocation((yylsp[0])); 2089 ;} 2090 break; 2091 2092 case 78: 2093 { 2094 (yyval.m_ast) = new AddressRangeASTNode((yyvsp[0].m_ast), NULL); 2095 (yyval.m_ast)->setLocation((yyvsp[0].m_ast)); 2096 ;} 2097 break; 2098 2099 case 79: 2100 { (yyval.m_ast) = (yyvsp[-1].m_ast); ;} 2101 break; 2102 2103 case 80: 2104 { (yyval.m_ast) = NULL; ;} 2105 break; 2106 2107 case 81: 2108 { (yyval.m_ast) = NULL; ;} 2109 break; 2110 2111 case 82: 2112 { 2113 (yyval.m_ast) = new FromStatementASTNode((yyvsp[-3].m_str), dynamic_cast<ListASTNode*>((yyvsp[-1].m_ast))); 2114 (yyval.m_ast)->setLocation((yylsp[-4]), (yylsp[0])); 2115 ;} 2116 break; 2117 2118 case 83: 2119 { 2120 (yyval.m_ast) = new ModeStatementASTNode(dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast))); 2121 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2122 ;} 2123 break; 2124 2125 case 84: 2126 { 2127 (yyval.m_ast) = new MessageStatementASTNode(MessageStatementASTNode::kInfo, (yyvsp[0].m_str)); 2128 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2129 ;} 2130 break; 2131 2132 case 85: 2133 { 2134 (yyval.m_ast) = new MessageStatementASTNode(MessageStatementASTNode::kWarning, (yyvsp[0].m_str)); 2135 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2136 ;} 2137 break; 2138 2139 case 86: 2140 { 2141 (yyval.m_ast) = new MessageStatementASTNode(MessageStatementASTNode::kError, (yyvsp[0].m_str)); 2142 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2143 ;} 2144 break; 2145 2146 case 87: 2147 { 2148 IfStatementASTNode * ifStmt = new IfStatementASTNode(); 2149 ifStmt->setConditionExpr(dynamic_cast<ExprASTNode*>((yyvsp[-4].m_ast))); 2150 ifStmt->setIfStatements(dynamic_cast<ListASTNode*>((yyvsp[-2].m_ast))); 2151 ifStmt->setElseStatements(dynamic_cast<ListASTNode*>((yyvsp[0].m_ast))); 2152 ifStmt->setLocation((yylsp[-5]), (yylsp[0])); 2153 (yyval.m_ast) = ifStmt; 2154 ;} 2155 break; 2156 2157 case 88: 2158 { 2159 (yyval.m_ast) = (yyvsp[-1].m_ast); 2160 ;} 2161 break; 2162 2163 case 89: 2164 { 2165 ListASTNode * list = new ListASTNode(); 2166 list->appendNode((yyvsp[0].m_ast)); 2167 (yyval.m_ast) = list; 2168 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2169 ;} 2170 break; 2171 2172 case 90: 2173 { (yyval.m_ast) = NULL; ;} 2174 break; 2175 2176 case 91: 2177 { 2178 (yyval.m_ast) = new AddressRangeASTNode((yyvsp[0].m_ast), NULL); 2179 (yyval.m_ast)->setLocation((yyvsp[0].m_ast)); 2180 ;} 2181 break; 2182 2183 case 92: 2184 { 2185 (yyval.m_ast) = new AddressRangeASTNode((yyvsp[-2].m_ast), (yyvsp[0].m_ast)); 2186 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2187 ;} 2188 break; 2189 2190 case 93: 2191 { 2192 (yyval.m_ast) = (yyvsp[0].m_ast); 2193 ;} 2194 break; 2195 2196 case 94: 2197 { 2198 (yyval.m_ast) = new StringConstASTNode((yyvsp[0].m_str)); 2199 (yyval.m_ast)->setLocation((yylsp[0])); 2200 ;} 2201 break; 2202 2203 case 95: 2204 { 2205 (yyval.m_ast) = (yyvsp[0].m_ast); 2206 ;} 2207 break; 2208 2209 case 96: 2210 { 2211 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2212 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2213 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kLessThan, right); 2214 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2215 ;} 2216 break; 2217 2218 case 97: 2219 { 2220 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2221 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2222 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kGreaterThan, right); 2223 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2224 ;} 2225 break; 2226 2227 case 98: 2228 { 2229 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2230 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2231 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kGreaterThanEqual, right); 2232 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2233 ;} 2234 break; 2235 2236 case 99: 2237 { 2238 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2239 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2240 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kLessThanEqual, right); 2241 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2242 ;} 2243 break; 2244 2245 case 100: 2246 { 2247 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2248 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2249 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kEqual, right); 2250 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2251 ;} 2252 break; 2253 2254 case 101: 2255 { 2256 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2257 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2258 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kNotEqual, right); 2259 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2260 ;} 2261 break; 2262 2263 case 102: 2264 { 2265 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2266 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2267 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBooleanAnd, right); 2268 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2269 ;} 2270 break; 2271 2272 case 103: 2273 { 2274 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2275 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2276 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBooleanOr, right); 2277 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2278 ;} 2279 break; 2280 2281 case 104: 2282 { 2283 (yyval.m_ast) = new BooleanNotExprASTNode(dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast))); 2284 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2285 ;} 2286 break; 2287 2288 case 105: 2289 { 2290 (yyval.m_ast) = new SourceFileFunctionASTNode((yyvsp[-3].m_str), (yyvsp[-1].m_str)); 2291 (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0])); 2292 ;} 2293 break; 2294 2295 case 106: 2296 { 2297 (yyval.m_ast) = (yyvsp[-1].m_ast); 2298 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2299 ;} 2300 break; 2301 2302 case 107: 2303 { 2304 (yyval.m_ast) = new DefinedOperatorASTNode((yyvsp[-1].m_str)); 2305 (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0])); 2306 ;} 2307 break; 2308 2309 case 108: 2310 { (yyval.m_ast) = (yyvsp[0].m_ast); ;} 2311 break; 2312 2313 case 109: 2314 { 2315 (yyval.m_ast) = new SymbolASTNode((yyvsp[0].m_str), (yyvsp[-2].m_str)); 2316 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2317 ;} 2318 break; 2319 2320 case 110: 2321 { 2322 (yyval.m_ast) = new SymbolASTNode((yyvsp[0].m_str)); 2323 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2324 ;} 2325 break; 2326 2327 case 111: 2328 { 2329 (yyval.m_ast) = (yyvsp[0].m_ast); 2330 ;} 2331 break; 2332 2333 case 112: 2334 { 2335 (yyval.m_ast) = new VariableExprASTNode((yyvsp[0].m_str)); 2336 (yyval.m_ast)->setLocation((yylsp[0])); 2337 ;} 2338 break; 2339 2340 case 113: 2341 { 2342 (yyval.m_ast) = new SymbolRefExprASTNode(dynamic_cast<SymbolASTNode*>((yyvsp[0].m_ast))); 2343 (yyval.m_ast)->setLocation((yylsp[0])); 2344 ;} 2345 break; 2346 2347 case 114: 2348 { 2349 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2350 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2351 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kAdd, right); 2352 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2353 ;} 2354 break; 2355 2356 case 115: 2357 { 2358 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2359 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2360 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kSubtract, right); 2361 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2362 ;} 2363 break; 2364 2365 case 116: 2366 { 2367 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2368 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2369 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kMultiply, right); 2370 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2371 ;} 2372 break; 2373 2374 case 117: 2375 { 2376 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2377 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2378 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kDivide, right); 2379 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2380 ;} 2381 break; 2382 2383 case 118: 2384 { 2385 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2386 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2387 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kModulus, right); 2388 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2389 ;} 2390 break; 2391 2392 case 119: 2393 { 2394 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2395 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2396 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kPower, right); 2397 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2398 ;} 2399 break; 2400 2401 case 120: 2402 { 2403 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2404 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2405 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseAnd, right); 2406 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2407 ;} 2408 break; 2409 2410 case 121: 2411 { 2412 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2413 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2414 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseOr, right); 2415 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2416 ;} 2417 break; 2418 2419 case 122: 2420 { 2421 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2422 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2423 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kBitwiseXor, right); 2424 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2425 ;} 2426 break; 2427 2428 case 123: 2429 { 2430 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2431 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2432 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kShiftLeft, right); 2433 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2434 ;} 2435 break; 2436 2437 case 124: 2438 { 2439 ExprASTNode * left = dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)); 2440 ExprASTNode * right = dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast)); 2441 (yyval.m_ast) = new BinaryOpExprASTNode(left, BinaryOpExprASTNode::kShiftRight, right); 2442 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2443 ;} 2444 break; 2445 2446 case 125: 2447 { 2448 (yyval.m_ast) = (yyvsp[0].m_ast); 2449 ;} 2450 break; 2451 2452 case 126: 2453 { 2454 (yyval.m_ast) = new IntSizeExprASTNode(dynamic_cast<ExprASTNode*>((yyvsp[-2].m_ast)), (yyvsp[0].m_int)->getWordSize()); 2455 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2456 ;} 2457 break; 2458 2459 case 127: 2460 { 2461 (yyval.m_ast) = (yyvsp[-1].m_ast); 2462 (yyval.m_ast)->setLocation((yylsp[-2]), (yylsp[0])); 2463 ;} 2464 break; 2465 2466 case 128: 2467 { 2468 (yyval.m_ast) = new SizeofOperatorASTNode(dynamic_cast<SymbolASTNode*>((yyvsp[-1].m_ast))); 2469 (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0])); 2470 ;} 2471 break; 2472 2473 case 129: 2474 { 2475 (yyval.m_ast) = new SizeofOperatorASTNode((yyvsp[-1].m_str)); 2476 (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0])); 2477 ;} 2478 break; 2479 2480 case 130: 2481 { 2482 (yyval.m_ast) = new SizeofOperatorASTNode((yyvsp[-1].m_str)); 2483 (yyval.m_ast)->setLocation((yylsp[-3]), (yylsp[0])); 2484 ;} 2485 break; 2486 2487 case 131: 2488 { 2489 (yyval.m_ast) = (yyvsp[0].m_ast); 2490 ;} 2491 break; 2492 2493 case 132: 2494 { 2495 (yyval.m_ast) = new NegativeExprASTNode(dynamic_cast<ExprASTNode*>((yyvsp[0].m_ast))); 2496 (yyval.m_ast)->setLocation((yylsp[-1]), (yylsp[0])); 2497 ;} 2498 break; 2499 2500 case 133: 2501 { 2502 (yyval.m_ast) = new IntConstExprASTNode((yyvsp[0].m_int)->getValue(), (yyvsp[0].m_int)->getWordSize()); 2503 (yyval.m_ast)->setLocation((yylsp[0])); 2504 ;} 2505 break; 2506 2507 2508 default: break; 2509 } 2510 2511 /* Line 1126 of yacc.c. */ 2512 2513 yyvsp -= yylen; 2514 yyssp -= yylen; 2515 yylsp -= yylen; 2516 2517 YY_STACK_PRINT (yyss, yyssp); 2518 2519 *++yyvsp = yyval; 2520 *++yylsp = yyloc; 2521 2522 /* Now `shift' the result of the reduction. Determine what state 2523 that goes to, based on the state we popped back to and the rule 2524 number reduced by. */ 2525 2526 yyn = yyr1[yyn]; 2527 2528 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2529 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2530 yystate = yytable[yystate]; 2531 else 2532 yystate = yydefgoto[yyn - YYNTOKENS]; 2533 2534 goto yynewstate; 2535 2536 2537 /*------------------------------------. 2538 | yyerrlab -- here on detecting error | 2539 `------------------------------------*/ 2540 yyerrlab: 2541 /* If not already recovering from an error, report this error. */ 2542 if (!yyerrstatus) 2543 { 2544 ++yynerrs; 2545 #if YYERROR_VERBOSE 2546 yyn = yypact[yystate]; 2547 2548 if (YYPACT_NINF < yyn && yyn < YYLAST) 2549 { 2550 int yytype = YYTRANSLATE (yychar); 2551 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 2552 YYSIZE_T yysize = yysize0; 2553 YYSIZE_T yysize1; 2554 int yysize_overflow = 0; 2555 char *yymsg = 0; 2556 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 2557 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 2558 int yyx; 2559 2560 #if 0 2561 /* This is so xgettext sees the translatable formats that are 2562 constructed on the fly. */ 2563 YY_("syntax error, unexpected %s"); 2564 YY_("syntax error, unexpected %s, expecting %s"); 2565 YY_("syntax error, unexpected %s, expecting %s or %s"); 2566 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 2567 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 2568 #endif 2569 char *yyfmt; 2570 char const *yyf; 2571 static char const yyunexpected[] = "syntax error, unexpected %s"; 2572 static char const yyexpecting[] = ", expecting %s"; 2573 static char const yyor[] = " or %s"; 2574 char yyformat[sizeof yyunexpected 2575 + sizeof yyexpecting - 1 2576 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 2577 * (sizeof yyor - 1))]; 2578 char const *yyprefix = yyexpecting; 2579 2580 /* Start YYX at -YYN if negative to avoid negative indexes in 2581 YYCHECK. */ 2582 int yyxbegin = yyn < 0 ? -yyn : 0; 2583 2584 /* Stay within bounds of both yycheck and yytname. */ 2585 int yychecklim = YYLAST - yyn; 2586 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 2587 int yycount = 1; 2588 2589 yyarg[0] = yytname[yytype]; 2590 yyfmt = yystpcpy (yyformat, yyunexpected); 2591 2592 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 2593 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2594 { 2595 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 2596 { 2597 yycount = 1; 2598 yysize = yysize0; 2599 yyformat[sizeof yyunexpected - 1] = '\0'; 2600 break; 2601 } 2602 yyarg[yycount++] = yytname[yyx]; 2603 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 2604 yysize_overflow |= yysize1 < yysize; 2605 yysize = yysize1; 2606 yyfmt = yystpcpy (yyfmt, yyprefix); 2607 yyprefix = yyor; 2608 } 2609 2610 yyf = YY_(yyformat); 2611 yysize1 = yysize + yystrlen (yyf); 2612 yysize_overflow |= yysize1 < yysize; 2613 yysize = yysize1; 2614 2615 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) 2616 yymsg = (char *) YYSTACK_ALLOC (yysize); 2617 if (yymsg) 2618 { 2619 /* Avoid sprintf, as that infringes on the user's name space. 2620 Don't have undefined behavior even if the translation 2621 produced a string with the wrong number of "%s"s. */ 2622 char *yyp = yymsg; 2623 int yyi = 0; 2624 while ((*yyp = *yyf)) 2625 { 2626 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 2627 { 2628 yyp += yytnamerr (yyp, yyarg[yyi++]); 2629 yyf += 2; 2630 } 2631 else 2632 { 2633 yyp++; 2634 yyf++; 2635 } 2636 } 2637 yyerror (&yylloc, lexer, resultAST, yymsg); 2638 YYSTACK_FREE (yymsg); 2639 } 2640 else 2641 { 2642 yyerror (&yylloc, lexer, resultAST, YY_("syntax error")); 2643 goto yyexhaustedlab; 2644 } 2645 } 2646 else 2647 #endif /* YYERROR_VERBOSE */ 2648 yyerror (&yylloc, lexer, resultAST, YY_("syntax error")); 2649 } 2650 2651 yyerror_range[0] = yylloc; 2652 2653 if (yyerrstatus == 3) 2654 { 2655 /* If just tried and failed to reuse look-ahead token after an 2656 error, discard it. */ 2657 2658 if (yychar <= YYEOF) 2659 { 2660 /* Return failure if at end of input. */ 2661 if (yychar == YYEOF) 2662 YYABORT; 2663 } 2664 else 2665 { 2666 yydestruct ("Error: discarding", yytoken, &yylval, &yylloc); 2667 yychar = YYEMPTY; 2668 } 2669 } 2670 2671 /* Else will try to reuse look-ahead token after shifting the error 2672 token. */ 2673 goto yyerrlab1; 2674 2675 2676 /*---------------------------------------------------. 2677 | yyerrorlab -- error raised explicitly by YYERROR. | 2678 `---------------------------------------------------*/ 2679 yyerrorlab: 2680 2681 /* Pacify compilers like GCC when the user code never invokes 2682 YYERROR and the label yyerrorlab therefore never appears in user 2683 code. */ 2684 if (0) 2685 goto yyerrorlab; 2686 2687 yyerror_range[0] = yylsp[1-yylen]; 2688 yylsp -= yylen; 2689 yyvsp -= yylen; 2690 yyssp -= yylen; 2691 yystate = *yyssp; 2692 goto yyerrlab1; 2693 2694 2695 /*-------------------------------------------------------------. 2696 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2697 `-------------------------------------------------------------*/ 2698 yyerrlab1: 2699 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2700 2701 for (;;) 2702 { 2703 yyn = yypact[yystate]; 2704 if (yyn != YYPACT_NINF) 2705 { 2706 yyn += YYTERROR; 2707 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2708 { 2709 yyn = yytable[yyn]; 2710 if (0 < yyn) 2711 break; 2712 } 2713 } 2714 2715 /* Pop the current state because it cannot handle the error token. */ 2716 if (yyssp == yyss) 2717 YYABORT; 2718 2719 yyerror_range[0] = *yylsp; 2720 yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp); 2721 YYPOPSTACK; 2722 yystate = *yyssp; 2723 YY_STACK_PRINT (yyss, yyssp); 2724 } 2725 2726 if (yyn == YYFINAL) 2727 YYACCEPT; 2728 2729 *++yyvsp = yylval; 2730 2731 yyerror_range[1] = yylloc; 2732 /* Using YYLLOC is tempting, but would change the location of 2733 the look-ahead. YYLOC is available though. */ 2734 YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2); 2735 *++yylsp = yyloc; 2736 2737 /* Shift the error token. */ 2738 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2739 2740 yystate = yyn; 2741 goto yynewstate; 2742 2743 2744 /*-------------------------------------. 2745 | yyacceptlab -- YYACCEPT comes here. | 2746 `-------------------------------------*/ 2747 yyacceptlab: 2748 yyresult = 0; 2749 goto yyreturn; 2750 2751 /*-----------------------------------. 2752 | yyabortlab -- YYABORT comes here. | 2753 `-----------------------------------*/ 2754 yyabortlab: 2755 yyresult = 1; 2756 goto yyreturn; 2757 2758 #ifndef yyoverflow 2759 /*-------------------------------------------------. 2760 | yyexhaustedlab -- memory exhaustion comes here. | 2761 `-------------------------------------------------*/ 2762 yyexhaustedlab: 2763 yyerror (&yylloc, lexer, resultAST, YY_("memory exhausted")); 2764 yyresult = 2; 2765 /* Fall through. */ 2766 #endif 2767 2768 yyreturn: 2769 if (yychar != YYEOF && yychar != YYEMPTY) 2770 yydestruct ("Cleanup: discarding lookahead", 2771 yytoken, &yylval, &yylloc); 2772 while (yyssp != yyss) 2773 { 2774 yydestruct ("Cleanup: popping", 2775 yystos[*yyssp], yyvsp, yylsp); 2776 YYPOPSTACK; 2777 } 2778 #ifndef yyoverflow 2779 if (yyss != yyssa) 2780 YYSTACK_FREE (yyss); 2781 #endif 2782 return yyresult; 2783 } 2784 2785 2786 2787 2788 /* code goes here */ 2789 2790 static int yylex(YYSTYPE * lvalp, YYLTYPE * yylloc, ElftosbLexer * lexer) 2791 { 2792 int token = lexer->yylex(); 2793 *yylloc = lexer->getLocation(); 2794 lexer->getSymbolValue(lvalp); 2795 return token; 2796 } 2797 2798 static void yyerror(YYLTYPE * yylloc, ElftosbLexer * lexer, CommandFileASTNode ** resultAST, const char * error) 2799 { 2800 throw syntax_error(format_string("line %d: %s\n", yylloc->m_firstLine, error)); 2801 } 2802 2803 2804