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