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