diff --git a/Changes.txt b/Changes.txt index dee6dc44a..270497e81 100644 --- a/Changes.txt +++ b/Changes.txt @@ -53,6 +53,10 @@ * Added option to disable aspect correct scaling. + * Added debugger pseudo-registers '_timwrapread' and '_timwrapwrite', + which are set when the RIOT timer is read/written on timer wraparound, + respectively. + * Bankswitching schemes BUS, DPC+ and CDFx now work when startup bank randomization is enabled (these schemes now ignore that setting). diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 315a45c3b..d5e56a98a 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -877,23 +877,26 @@ std::array Debugger::ourBuiltinFunctions = { { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Names are defined here, but processed in YaccParser -std::array Debugger::ourPseudoRegisters = { { +std::array Debugger::ourPseudoRegisters = { { // Debugger::PseudoRegister Debugger::ourPseudoRegisters[NUM_PSEUDO_REGS] = { - { "_bank", "Currently selected bank" }, - { "_cclocks", "Color clocks on current scanline" }, - { "_cycleshi", "Higher 32 bits of number of cycles since emulation started" }, - { "_cycleslo", "Lower 32 bits of number of cycles since emulation started" }, - { "_fcount", "Number of frames since emulation started" }, - { "_fcycles", "Number of cycles since frame started" }, - { "_icycles", "Number of cycles of last instruction" }, - { "_scan", "Current scanline count" }, - { "_scanend", "Scanline count at end of last frame" }, - { "_scycles", "Number of cycles in current scanline" }, - { "_vblank", "Whether vertical blank is enabled (1 or 0)" }, - { "_vsync", "Whether vertical sync is enabled (1 or 0)" } + { "_bank", "Currently selected bank" }, + { "_cclocks", "Color clocks on current scanline" }, + { "_cycleshi", "Higher 32 bits of number of cycles since emulation started" }, + { "_cycleslo", "Lower 32 bits of number of cycles since emulation started" }, + { "_fcount", "Number of frames since emulation started" }, + { "_fcycles", "Number of cycles since frame started" }, + { "_icycles", "Number of cycles of last instruction" }, + { "_scan", "Current scanline count" }, + { "_scanend", "Scanline count at end of last frame" }, + { "_scycles", "Number of cycles in current scanline" }, + { "_timwrapread", "Timer read wrapped on this cycle" }, + { "_timwrapwrite", "Timer write wrapped on this cycle" }, + { "_vblank", "Whether vertical blank is enabled (1 or 0)" }, + { "_vsync", "Whether vertical sync is enabled (1 or 0)" } // CPU address access functions: /*{ "_lastread", "last CPU read address" }, { "_lastwrite", "last CPU write address" }, { "__lastbaseread", "last CPU read base address" }, { "__lastbasewrite", "last CPU write base address" }*/ } }; +// diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 6435a6d1a..d594820c6 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -363,7 +363,7 @@ class Debugger : public DialogContainer string name, help; }; static std::array ourBuiltinFunctions; - static std::array ourPseudoRegisters; + static std::array ourPseudoRegisters; private: // rewind/unwind n states diff --git a/src/debugger/DebuggerExpressions.hxx b/src/debugger/DebuggerExpressions.hxx index 6c422fc5a..060411c09 100644 --- a/src/debugger/DebuggerExpressions.hxx +++ b/src/debugger/DebuggerExpressions.hxx @@ -23,6 +23,7 @@ #include "bspf.hxx" #include "CartDebug.hxx" #include "CpuDebug.hxx" +#include "RiotDebug.hxx" #include "TIADebug.hxx" #include "Debugger.hxx" #include "Expression.hxx" @@ -310,6 +311,18 @@ class ShiftRightExpression : public Expression { return myLHS->evaluate() >> myRHS->evaluate(); } }; +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +class RiotMethodExpression : public Expression +{ + public: + RiotMethodExpression(RiotMethod method) : Expression(), myMethod(std::mem_fn(method)) { } + Int32 evaluate() const override + { return myMethod(Debugger::debugger().riotDebug()); } + + private: + std::function myMethod; +}; + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - class TiaMethodExpression : public Expression { diff --git a/src/debugger/RiotDebug.cxx b/src/debugger/RiotDebug.cxx index 4484944aa..7d4bc6c0a 100644 --- a/src/debugger/RiotDebug.cxx +++ b/src/debugger/RiotDebug.cxx @@ -235,6 +235,18 @@ Int32 RiotDebug::timDivider() const return mySystem.m6532().myDivider; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int RiotDebug::timWrappedOnRead() const +{ + return mySystem.m6532().myTimWrappedOnRead; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int RiotDebug::timWrappedOnWrite() const +{ + return mySystem.m6532().myTimWrappedOnWrite; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool RiotDebug::diffP0(int newVal) { diff --git a/src/debugger/RiotDebug.hxx b/src/debugger/RiotDebug.hxx index b86968684..30f4defe8 100644 --- a/src/debugger/RiotDebug.hxx +++ b/src/debugger/RiotDebug.hxx @@ -22,6 +22,10 @@ class M6532; class Debugger; class RiotDebug; +// Function type for RiotDebug instance methods +class RiotDebug; +using RiotMethod = int (RiotDebug::*)() const; + #include "DebuggerSystem.hxx" class RiotState : public DebuggerState @@ -75,6 +79,9 @@ class RiotDebug : public DebuggerSystem Int32 timClocks() const; Int32 intimClocks() const; Int32 timDivider() const; + /* Debugger pseudo-registers for timer accesses */ + int timWrappedOnRead() const; + int timWrappedOnWrite() const; /* Console switches */ bool diffP0(int newVal = -1); diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index 18f950e62..64df91377 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -145,6 +145,10 @@ void M6532::updateEmulation() } myLastCycle = mySystem->cycles(); + +#ifdef DEBUGGER_SUPPORT + myTimWrappedOnRead = myTimWrappedOnWrite = false; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -220,7 +224,9 @@ uInt8 M6532::peek(uInt16 addr) { // Timer Flag is always cleared when accessing INTIM if (!myWrappedThisCycle) myInterruptFlag &= ~TimerBit; - + #ifdef DEBUGGER_SUPPORT + myTimWrappedOnRead = myWrappedThisCycle; + #endif return myTimer; } @@ -316,6 +322,9 @@ void M6532::setTimerRegister(uInt8 value, uInt8 interval) // Interrupt timer flag is cleared (and invalid) when writing to the timer if (!myWrappedThisCycle) myInterruptFlag &= ~TimerBit; +#ifdef DEBUGGER_SUPPORT + myTimWrappedOnWrite = myWrappedThisCycle; +#endif mySetTimerCycle = mySystem->cycles(); } diff --git a/src/emucore/M6532.hxx b/src/emucore/M6532.hxx index d35877ab8..650745811 100644 --- a/src/emucore/M6532.hxx +++ b/src/emucore/M6532.hxx @@ -250,6 +250,10 @@ class M6532 : public Device std::array myIOAccessCounter; // The array used to skip the first ZP access tracking std::array myZPAccessDelay; + + // Detect timer being accessed on wraparound + bool myTimWrappedOnRead{false}; + bool myTimWrappedOnWrite{false}; #endif // DEBUGGER_SUPPORT private: diff --git a/src/yacc/YaccParser.cxx b/src/yacc/YaccParser.cxx index 8bc728ca0..4de3c965f 100644 --- a/src/yacc/YaccParser.cxx +++ b/src/yacc/YaccParser.cxx @@ -228,6 +228,18 @@ CpuMethod getCpuSpecial(char* ch) return nullptr; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// special methods that get RIOT internal state +RiotMethod getRiotSpecial(char* ch) +{ + if(BSPF::equalsIgnoreCase(ch, "_timwrapread")) + return &RiotDebug::timWrappedOnRead; + else if(BSPF::equalsIgnoreCase(ch, "_timwrapwrite")) + return &RiotDebug::timWrappedOnWrite; + else + return nullptr; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // special methods that get TIA internal state TiaMethod getTiaSpecial(char* ch) @@ -281,6 +293,7 @@ int yylex() { { CartMethod cartMeth; CpuMethod cpuMeth; + RiotMethod riotMeth; TiaMethod tiaMeth; char *bufp = idbuf; @@ -309,6 +322,9 @@ int yylex() { } else if( (cartMeth = getCartSpecial(idbuf)) ) { yylval.cartMethod = cartMeth; return CART_METHOD; + } else if( (riotMeth = getRiotSpecial(idbuf)) ) { + yylval.riotMethod = riotMeth; + return RIOT_METHOD; } else if( (tiaMeth = getTiaSpecial(idbuf)) ) { yylval.tiaMethod = tiaMeth; return TIA_METHOD; diff --git a/src/yacc/YaccParser.hxx b/src/yacc/YaccParser.hxx index 0ce067c27..050d4a7e5 100644 --- a/src/yacc/YaccParser.hxx +++ b/src/yacc/YaccParser.hxx @@ -21,6 +21,7 @@ #include "Expression.hxx" #include "CartDebug.hxx" #include "CpuDebug.hxx" +#include "RiotDebug.hxx" #include "TIADebug.hxx" #include "bspf.hxx" @@ -37,6 +38,7 @@ namespace YaccParser CartMethod getCartSpecial(char* ch); CpuMethod getCpuSpecial(char* ch); + RiotMethod getRiotSpecial(char* ch); TiaMethod getTiaSpecial(char* ch); } diff --git a/src/yacc/stella.y b/src/yacc/stella.y index 4f13cb6d4..6836d00cd 100644 --- a/src/yacc/stella.y +++ b/src/yacc/stella.y @@ -30,6 +30,7 @@ void yyerror(const char *e) { char* Equate; CartMethod cartMethod; CpuMethod cpuMethod; + RiotMethod riotMethod; TiaMethod tiaMethod; Expression* exp; char* DefinedFunction; @@ -41,6 +42,7 @@ void yyerror(const char *e) { %token EQUATE %token CART_METHOD %token CPU_METHOD +%token RIOT_METHOD %token TIA_METHOD %token FUNCTION @@ -97,6 +99,7 @@ expression: expression '+' expression { if(DEBUG_EXP) fprintf(stderr, " +"); $$ | EQUATE { if(DEBUG_EXP) fprintf(stderr, "equate %s", $1); $$ = new EquateExpression($1); lastExp = $$; } | CPU_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); $$ = new CpuMethodExpression($1); lastExp = $$; } | CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; } + | RIOT_METHOD { if(DEBUG_EXP) fprintf(stderr, " (RiotMethod)"); $$ = new RiotMethodExpression($1); lastExp = $$; } | TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; } | FUNCTION { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); $$ = new FunctionExpression($1); lastExp = $$; } | ERR { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; } diff --git a/src/yacc/y.tab.c b/src/yacc/y.tab.c index fcd1b4c72..ed1d99c58 100644 --- a/src/yacc/y.tab.c +++ b/src/yacc/y.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -61,8 +65,8 @@ -/* Copy the first part of user declarations. */ -#line 1 "stella.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 1 "stella.y" #include @@ -89,13 +93,26 @@ void yyerror(const char *e) { } -#line 93 "y.tab.c" /* yacc.c:339 */ +#line 97 "y.tab.c" -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) # else -# define YY_NULLPTR 0 +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) # endif # endif @@ -107,8 +124,8 @@ void yyerror(const char *e) { # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_YY_Y_TAB_H_INCLUDED # define YY_YY_Y_TAB_H_INCLUDED /* Debug traces. */ @@ -129,19 +146,20 @@ extern int yydebug; EQUATE = 260, CART_METHOD = 261, CPU_METHOD = 262, - TIA_METHOD = 263, - FUNCTION = 264, - LOG_OR = 265, - LOG_AND = 266, - LOG_NOT = 267, - SHR = 268, - SHL = 269, - GTE = 270, - LTE = 271, - NE = 272, - EQ = 273, - DEREF = 274, - UMINUS = 275 + RIOT_METHOD = 263, + TIA_METHOD = 264, + FUNCTION = 265, + LOG_OR = 266, + LOG_AND = 267, + LOG_NOT = 268, + SHR = 269, + SHL = 270, + GTE = 271, + LTE = 272, + NE = 273, + EQ = 274, + DEREF = 275, + UMINUS = 276 }; #endif /* Tokens. */ @@ -150,38 +168,39 @@ extern int yydebug; #define EQUATE 260 #define CART_METHOD 261 #define CPU_METHOD 262 -#define TIA_METHOD 263 -#define FUNCTION 264 -#define LOG_OR 265 -#define LOG_AND 266 -#define LOG_NOT 267 -#define SHR 268 -#define SHL 269 -#define GTE 270 -#define LTE 271 -#define NE 272 -#define EQ 273 -#define DEREF 274 -#define UMINUS 275 +#define RIOT_METHOD 263 +#define TIA_METHOD 264 +#define FUNCTION 265 +#define LOG_OR 266 +#define LOG_AND 267 +#define LOG_NOT 268 +#define SHR 269 +#define SHL 270 +#define GTE 271 +#define LTE 272 +#define NE 273 +#define EQ 274 +#define DEREF 275 +#define UMINUS 276 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 28 "stella.y" /* yacc.c:355 */ +#line 28 "stella.y" int val; char* Equate; CartMethod cartMethod; CpuMethod cpuMethod; + RiotMethod riotMethod; TiaMethod tiaMethod; Expression* exp; char* DefinedFunction; -#line 183 "y.tab.c" /* yacc.c:355 */ -}; +#line 202 "y.tab.c" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -194,36 +213,81 @@ int yyparse (void); #endif /* !YY_YY_Y_TAB_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 200 "y.tab.c" /* yacc.c:358 */ #ifdef short # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short int yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -231,15 +295,27 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -253,30 +329,19 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif @@ -287,13 +352,13 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -306,6 +371,20 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -382,17 +461,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -405,11 +484,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -421,12 +500,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -436,44 +515,45 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 26 +#define YYFINAL 27 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 227 +#define YYLAST 228 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 38 +#define YYNTOKENS 39 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 3 /* YYNRULES -- Number of rules. */ -#define YYNRULES 36 +#define YYNRULES 37 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 67 +#define YYNSTATES 68 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 275 +#define YYMAXUTOK 276 + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 33, 2, 2, 2, 14, 20, 2, - 35, 36, 12, 11, 2, 10, 2, 13, 2, 2, + 2, 2, 2, 34, 2, 2, 2, 15, 21, 2, + 36, 37, 13, 12, 2, 11, 2, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 23, 2, 24, 2, 34, 2, 2, 2, 2, 2, + 24, 2, 25, 2, 35, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 31, 2, 37, 19, 2, 2, 2, 2, 2, + 2, 32, 2, 38, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 18, 2, 32, 2, 2, 2, + 2, 2, 2, 2, 19, 2, 33, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -487,18 +567,18 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 15, 16, 17, 21, 22, - 25, 26, 27, 28, 29, 30 + 5, 6, 7, 8, 9, 10, 16, 17, 18, 22, + 23, 26, 27, 28, 29, 30, 31 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = +static const yytype_int8 yyrline[] = { - 0, 66, 66, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102 + 0, 68, 68, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105 }; #endif @@ -508,72 +588,73 @@ static const yytype_uint8 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "NUMBER", "ERR", "EQUATE", "CART_METHOD", - "CPU_METHOD", "TIA_METHOD", "FUNCTION", "'-'", "'+'", "'*'", "'/'", - "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'", "SHR", "SHL", - "'<'", "'>'", "GTE", "LTE", "NE", "EQ", "DEREF", "UMINUS", "'['", "'~'", - "'!'", "'@'", "'('", "')'", "']'", "$accept", "statement", "expression", YY_NULLPTR + "CPU_METHOD", "RIOT_METHOD", "TIA_METHOD", "FUNCTION", "'-'", "'+'", + "'*'", "'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'", + "SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ", "DEREF", "UMINUS", + "'['", "'~'", "'!'", "'@'", "'('", "')'", "']'", "$accept", "statement", + "expression", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 45, 43, 42, 47, 37, 265, 266, 267, 124, 94, - 38, 268, 269, 60, 62, 270, 271, 272, 273, 274, - 275, 91, 126, 33, 64, 40, 41, 93 + 265, 45, 43, 42, 47, 37, 266, 267, 268, 124, + 94, 38, 269, 270, 60, 62, 271, 272, 273, 274, + 275, 276, 91, 126, 33, 64, 40, 41, 93 }; # endif -#define YYPACT_NINF -15 +#define YYPACT_NINF (-16) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-15))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -1 +#define YYTABLE_NINF (-1) -#define yytable_value_is_error(Yytable_value) \ - (!!((Yytable_value) == (-1))) +#define yytable_value_is_error(Yyn) \ + ((Yyn) == YYTABLE_NINF) /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { - 35, -15, -15, -15, -15, -15, -15, -15, 35, 35, - 35, 35, 35, 35, 35, 35, 16, 116, -14, -14, - 187, 187, -14, -14, -14, 89, -15, 35, 35, 35, + 35, -16, -16, -16, -16, -16, -16, -16, -16, 35, + 35, 35, 35, 35, 35, 35, 35, 16, 116, -15, + -15, 187, 187, -15, -15, -15, 89, -16, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, -15, 136, 136, 150, - 150, 150, 164, 178, 29, 29, -13, 196, 196, 187, - 187, 187, 187, 187, 187, 61, -15 + 35, 35, 35, 35, 35, 35, 35, -16, 136, 136, + 150, 150, 150, 164, 178, 29, 29, -14, 196, 196, + 187, 187, 187, 187, 187, 187, 61, -16 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const yytype_int8 yydefact[] = { - 0, 30, 36, 31, 33, 32, 34, 35, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, 21, 24, - 26, 27, 22, 23, 25, 0, 1, 0, 0, 0, + 0, 30, 37, 31, 33, 32, 34, 35, 36, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2, 21, + 24, 26, 27, 22, 23, 25, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 28, 4, 3, 5, - 6, 7, 19, 20, 9, 10, 8, 17, 18, 11, - 12, 13, 14, 15, 16, 0, 29 + 0, 0, 0, 0, 0, 0, 0, 28, 4, 3, + 5, 6, 7, 19, 20, 9, 10, 8, 17, 18, + 11, 12, 13, 14, 15, 16, 0, 29 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -15, -15, -8 + -16, -16, -9 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 16, 17 + -1, 17, 18 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -581,87 +662,87 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { - 18, 19, 20, 21, 22, 23, 24, 25, 37, 38, - 39, 40, 41, 42, 43, 44, 26, 45, 45, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 1, 2, - 3, 4, 5, 6, 7, 8, 0, 9, 0, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 10, 11, - 45, 0, 0, 0, 0, 0, 0, 12, 13, 14, - 15, 27, 28, 29, 30, 31, 32, 33, 0, 34, + 19, 20, 21, 22, 23, 24, 25, 26, 38, 39, + 40, 41, 42, 43, 44, 45, 27, 46, 46, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 0, 10, 0, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 11, + 12, 46, 0, 0, 0, 0, 0, 0, 13, 14, + 15, 16, 28, 29, 30, 31, 32, 33, 34, 0, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 0, 0, 45, 0, 0, 0, 0, 0, 66, 27, - 28, 29, 30, 31, 32, 33, 0, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 0, 0, - 45, 0, 0, 0, 0, 46, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 0, 0, 45, 29, 30, - 31, 32, 33, 0, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 32, 33, 45, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 0, - 33, 45, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 0, 0, 45, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 0, 0, 45, - -1, -1, -1, -1, -1, -1, 0, 0, 45, 39, - 40, 41, 42, 43, 44, 0, 0, 45 + 45, 0, 0, 46, 0, 0, 0, 0, 0, 67, + 28, 29, 30, 31, 32, 33, 34, 0, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 0, + 0, 46, 0, 0, 0, 0, 47, 28, 29, 30, + 31, 32, 33, 34, 0, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 0, 0, 46, 30, + 31, 32, 33, 34, 0, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 33, 34, 46, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 0, 34, 46, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 0, 0, 46, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 0, 0, + 46, -1, -1, -1, -1, -1, -1, 0, 0, 46, + 40, 41, 42, 43, 44, 45, 0, 0, 46 }; static const yytype_int8 yycheck[] = { - 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, - 23, 24, 25, 26, 27, 28, 0, 31, 31, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 3, 4, - 5, 6, 7, 8, 9, 10, -1, 12, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 23, 24, - 31, -1, -1, -1, -1, -1, -1, 32, 33, 34, - 35, 10, 11, 12, 13, 14, 15, 16, -1, 18, + 9, 10, 11, 12, 13, 14, 15, 16, 22, 23, + 24, 25, 26, 27, 28, 29, 0, 32, 32, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, -1, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 24, + 25, 32, -1, -1, -1, -1, -1, -1, 33, 34, + 35, 36, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - -1, -1, 31, -1, -1, -1, -1, -1, 37, 10, - 11, 12, 13, 14, 15, 16, -1, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, -1, -1, - 31, -1, -1, -1, -1, 36, 10, 11, 12, 13, - 14, 15, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, -1, -1, 31, 12, 13, - 14, 15, 16, -1, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 15, 16, 31, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, -1, - 16, 31, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, -1, -1, 31, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, -1, -1, 31, - 23, 24, 25, 26, 27, 28, -1, -1, 31, 23, - 24, 25, 26, 27, 28, -1, -1, 31 + 29, -1, -1, 32, -1, -1, -1, -1, -1, 38, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, -1, + -1, 32, -1, -1, -1, -1, 37, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, -1, -1, 32, 13, + 14, 15, 16, 17, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 16, 17, 32, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + -1, 17, 32, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, -1, -1, 32, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, -1, -1, + 32, 24, 25, 26, 27, 28, 29, -1, -1, 32, + 24, 25, 26, 27, 28, 29, -1, -1, 32 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_int8 yystos[] = { - 0, 3, 4, 5, 6, 7, 8, 9, 10, 12, - 23, 24, 32, 33, 34, 35, 39, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 0, 10, 11, 12, - 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 31, 36, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 37 + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 13, 24, 25, 33, 34, 35, 36, 40, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 0, 11, 12, + 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 32, 37, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 38 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_int8 yyr1[] = { - 0, 38, 39, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40 + 0, 39, 40, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, 4, - 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1, 1 }; @@ -677,22 +758,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -732,37 +813,39 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -771,7 +854,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -794,20 +877,20 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + yystos[+yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -851,13 +934,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -893,12 +976,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) @@ -911,7 +994,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -926,10 +1012,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; } # endif @@ -942,19 +1028,19 @@ yytnamerr (char *yyres, const char *yystr) *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -981,7 +1067,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[*yyssp]; + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1006,11 +1094,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1022,6 +1111,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1032,10 +1122,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1061,8 +1154,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; @@ -1105,7 +1198,7 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1117,16 +1210,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYSIZE_T yystacksize; + YYPTRDIFF_T yystacksize; int yyn; int yyresult; @@ -1140,7 +1233,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1161,46 +1254,54 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1209,42 +1310,43 @@ yyparse (void) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1294,15 +1396,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1317,7 +1417,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1337,218 +1437,225 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 66 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, "\ndone\n"); result.exp = (yyvsp[0].exp); } -#line 1344 "y.tab.c" /* yacc.c:1646 */ + case 2: +#line 68 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, "\ndone\n"); result.exp = (yyvsp[0].exp); } +#line 1444 "y.tab.c" break; case 3: -#line 69 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " +"); (yyval.exp) = new PlusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1350 "y.tab.c" /* yacc.c:1646 */ +#line 71 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " +"); (yyval.exp) = new PlusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1450 "y.tab.c" break; case 4: -#line 70 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " -"); (yyval.exp) = new MinusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1356 "y.tab.c" /* yacc.c:1646 */ +#line 72 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " -"); (yyval.exp) = new MinusExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1456 "y.tab.c" break; case 5: -#line 71 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " *"); (yyval.exp) = new MultExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1362 "y.tab.c" /* yacc.c:1646 */ +#line 73 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " *"); (yyval.exp) = new MultExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1462 "y.tab.c" break; case 6: -#line 72 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " /"); (yyval.exp) = new DivExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1368 "y.tab.c" /* yacc.c:1646 */ +#line 74 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " /"); (yyval.exp) = new DivExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1468 "y.tab.c" break; case 7: -#line 73 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " %%"); (yyval.exp) = new ModExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1374 "y.tab.c" /* yacc.c:1646 */ +#line 75 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " %%"); (yyval.exp) = new ModExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1474 "y.tab.c" break; case 8: -#line 74 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " &"); (yyval.exp) = new BinAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1380 "y.tab.c" /* yacc.c:1646 */ +#line 76 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " &"); (yyval.exp) = new BinAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1480 "y.tab.c" break; case 9: -#line 75 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " |"); (yyval.exp) = new BinOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1386 "y.tab.c" /* yacc.c:1646 */ +#line 77 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " |"); (yyval.exp) = new BinOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1486 "y.tab.c" break; case 10: -#line 76 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " ^"); (yyval.exp) = new BinXorExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1392 "y.tab.c" /* yacc.c:1646 */ +#line 78 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " ^"); (yyval.exp) = new BinXorExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1492 "y.tab.c" break; case 11: -#line 77 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " <"); (yyval.exp) = new LessExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1398 "y.tab.c" /* yacc.c:1646 */ +#line 79 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " <"); (yyval.exp) = new LessExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1498 "y.tab.c" break; case 12: -#line 78 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " >"); (yyval.exp) = new GreaterExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1404 "y.tab.c" /* yacc.c:1646 */ +#line 80 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " >"); (yyval.exp) = new GreaterExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1504 "y.tab.c" break; case 13: -#line 79 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " >="); (yyval.exp) = new GreaterEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1410 "y.tab.c" /* yacc.c:1646 */ +#line 81 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " >="); (yyval.exp) = new GreaterEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1510 "y.tab.c" break; case 14: -#line 80 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " <="); (yyval.exp) = new LessEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1416 "y.tab.c" /* yacc.c:1646 */ +#line 82 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " <="); (yyval.exp) = new LessEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1516 "y.tab.c" break; case 15: -#line 81 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " !="); (yyval.exp) = new NotEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1422 "y.tab.c" /* yacc.c:1646 */ +#line 83 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " !="); (yyval.exp) = new NotEqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1522 "y.tab.c" break; case 16: -#line 82 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " =="); (yyval.exp) = new EqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1428 "y.tab.c" /* yacc.c:1646 */ +#line 84 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " =="); (yyval.exp) = new EqualsExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1528 "y.tab.c" break; case 17: -#line 83 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " >>"); (yyval.exp) = new ShiftRightExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1434 "y.tab.c" /* yacc.c:1646 */ +#line 85 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " >>"); (yyval.exp) = new ShiftRightExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1534 "y.tab.c" break; case 18: -#line 84 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " <<"); (yyval.exp) = new ShiftLeftExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1440 "y.tab.c" /* yacc.c:1646 */ +#line 86 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " <<"); (yyval.exp) = new ShiftLeftExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1540 "y.tab.c" break; case 19: -#line 85 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " ||"); (yyval.exp) = new LogOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1446 "y.tab.c" /* yacc.c:1646 */ +#line 87 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " ||"); (yyval.exp) = new LogOrExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1546 "y.tab.c" break; case 20: -#line 86 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " &&"); (yyval.exp) = new LogAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1452 "y.tab.c" /* yacc.c:1646 */ +#line 88 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " &&"); (yyval.exp) = new LogAndExpression((yyvsp[-2].exp), (yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1552 "y.tab.c" break; case 21: -#line 87 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " U-"); (yyval.exp) = new UnaryMinusExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1458 "y.tab.c" /* yacc.c:1646 */ +#line 89 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " U-"); (yyval.exp) = new UnaryMinusExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1558 "y.tab.c" break; case 22: -#line 88 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " ~"); (yyval.exp) = new BinNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1464 "y.tab.c" /* yacc.c:1646 */ +#line 90 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " ~"); (yyval.exp) = new BinNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1564 "y.tab.c" break; case 23: -#line 89 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " !"); (yyval.exp) = new LogNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1470 "y.tab.c" /* yacc.c:1646 */ +#line 91 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " !"); (yyval.exp) = new LogNotExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1570 "y.tab.c" break; case 24: -#line 90 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " U*"); (yyval.exp) = new ByteDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1476 "y.tab.c" /* yacc.c:1646 */ +#line 92 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " U*"); (yyval.exp) = new ByteDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1576 "y.tab.c" break; case 25: -#line 91 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " U@"); (yyval.exp) = new WordDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1482 "y.tab.c" /* yacc.c:1646 */ +#line 93 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " U@"); (yyval.exp) = new WordDerefExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1582 "y.tab.c" break; case 26: -#line 92 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " U<"); (yyval.exp) = new LoByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1488 "y.tab.c" /* yacc.c:1646 */ +#line 94 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " U<"); (yyval.exp) = new LoByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1588 "y.tab.c" break; case 27: -#line 93 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " U>"); (yyval.exp) = new HiByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } -#line 1494 "y.tab.c" /* yacc.c:1646 */ +#line 95 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " U>"); (yyval.exp) = new HiByteExpression((yyvsp[0].exp)); lastExp = (yyval.exp); } +#line 1594 "y.tab.c" break; case 28: -#line 94 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " ()"); (yyval.exp) = (yyvsp[-1].exp); lastExp = (yyval.exp); } -#line 1500 "y.tab.c" /* yacc.c:1646 */ +#line 96 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " ()"); (yyval.exp) = (yyvsp[-1].exp); lastExp = (yyval.exp); } +#line 1600 "y.tab.c" break; case 29: -#line 95 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " []"); (yyval.exp) = new ByteDerefOffsetExpression((yyvsp[-3].exp), (yyvsp[-1].exp)); lastExp = (yyval.exp); } -#line 1506 "y.tab.c" /* yacc.c:1646 */ +#line 97 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " []"); (yyval.exp) = new ByteDerefOffsetExpression((yyvsp[-3].exp), (yyvsp[-1].exp)); lastExp = (yyval.exp); } +#line 1606 "y.tab.c" break; case 30: -#line 96 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, "const %d", (yyvsp[0].val)); (yyval.exp) = new ConstExpression((yyvsp[0].val)); lastExp = (yyval.exp); } -#line 1512 "y.tab.c" /* yacc.c:1646 */ +#line 98 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, "const %d", (yyvsp[0].val)); (yyval.exp) = new ConstExpression((yyvsp[0].val)); lastExp = (yyval.exp); } +#line 1612 "y.tab.c" break; case 31: -#line 97 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, "equate %s", (yyvsp[0].Equate)); (yyval.exp) = new EquateExpression((yyvsp[0].Equate)); lastExp = (yyval.exp); } -#line 1518 "y.tab.c" /* yacc.c:1646 */ +#line 99 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, "equate %s", (yyvsp[0].Equate)); (yyval.exp) = new EquateExpression((yyvsp[0].Equate)); lastExp = (yyval.exp); } +#line 1618 "y.tab.c" break; case 32: -#line 98 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); (yyval.exp) = new CpuMethodExpression((yyvsp[0].cpuMethod)); lastExp = (yyval.exp); } -#line 1524 "y.tab.c" /* yacc.c:1646 */ +#line 100 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " (CpuMethod)"); (yyval.exp) = new CpuMethodExpression((yyvsp[0].cpuMethod)); lastExp = (yyval.exp); } +#line 1624 "y.tab.c" break; case 33: -#line 99 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); (yyval.exp) = new CartMethodExpression((yyvsp[0].cartMethod)); lastExp = (yyval.exp); } -#line 1530 "y.tab.c" /* yacc.c:1646 */ +#line 101 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); (yyval.exp) = new CartMethodExpression((yyvsp[0].cartMethod)); lastExp = (yyval.exp); } +#line 1630 "y.tab.c" break; case 34: -#line 100 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); (yyval.exp) = new TiaMethodExpression((yyvsp[0].tiaMethod)); lastExp = (yyval.exp); } -#line 1536 "y.tab.c" /* yacc.c:1646 */ +#line 102 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " (RiotMethod)"); (yyval.exp) = new RiotMethodExpression((yyvsp[0].riotMethod)); lastExp = (yyval.exp); } +#line 1636 "y.tab.c" break; case 35: -#line 101 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); (yyval.exp) = new FunctionExpression((yyvsp[0].DefinedFunction)); lastExp = (yyval.exp); } -#line 1542 "y.tab.c" /* yacc.c:1646 */ +#line 103 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); (yyval.exp) = new TiaMethodExpression((yyvsp[0].tiaMethod)); lastExp = (yyval.exp); } +#line 1642 "y.tab.c" break; case 36: -#line 102 "stella.y" /* yacc.c:1646 */ - { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; } -#line 1548 "y.tab.c" /* yacc.c:1646 */ +#line 104 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); (yyval.exp) = new FunctionExpression((yyvsp[0].DefinedFunction)); lastExp = (yyval.exp); } +#line 1648 "y.tab.c" + break; + + case 37: +#line 105 "stella.y" + { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; } +#line 1654 "y.tab.c" break; -#line 1552 "y.tab.c" /* yacc.c:1646 */ +#line 1658 "y.tab.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1573,14 +1680,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -1612,7 +1718,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; @@ -1663,20 +1769,18 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ - /*YYPOPSTACK (yylen); + YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; - goto yyerrlab1;*/ + goto yyerrlab1; /*-------------------------------------------------------------. @@ -1730,6 +1834,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -1737,6 +1842,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -1747,6 +1853,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -1763,7 +1873,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[+*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1776,5 +1886,5 @@ yyreturn: #endif return yyresult; } -#line 104 "stella.y" /* yacc.c:1906 */ +#line 107 "stella.y" diff --git a/src/yacc/y.tab.h b/src/yacc/y.tab.h index d06bfd3eb..0356314bd 100644 --- a/src/yacc/y.tab.h +++ b/src/yacc/y.tab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + #ifndef YY_YY_Y_TAB_H_INCLUDED # define YY_YY_Y_TAB_H_INCLUDED /* Debug traces. */ @@ -50,19 +54,20 @@ extern int yydebug; EQUATE = 260, CART_METHOD = 261, CPU_METHOD = 262, - TIA_METHOD = 263, - FUNCTION = 264, - LOG_OR = 265, - LOG_AND = 266, - LOG_NOT = 267, - SHR = 268, - SHL = 269, - GTE = 270, - LTE = 271, - NE = 272, - EQ = 273, - DEREF = 274, - UMINUS = 275 + RIOT_METHOD = 263, + TIA_METHOD = 264, + FUNCTION = 265, + LOG_OR = 266, + LOG_AND = 267, + LOG_NOT = 268, + SHR = 269, + SHL = 270, + GTE = 271, + LTE = 272, + NE = 273, + EQ = 274, + DEREF = 275, + UMINUS = 276 }; #endif /* Tokens. */ @@ -71,38 +76,39 @@ extern int yydebug; #define EQUATE 260 #define CART_METHOD 261 #define CPU_METHOD 262 -#define TIA_METHOD 263 -#define FUNCTION 264 -#define LOG_OR 265 -#define LOG_AND 266 -#define LOG_NOT 267 -#define SHR 268 -#define SHL 269 -#define GTE 270 -#define LTE 271 -#define NE 272 -#define EQ 273 -#define DEREF 274 -#define UMINUS 275 +#define RIOT_METHOD 263 +#define TIA_METHOD 264 +#define FUNCTION 265 +#define LOG_OR 266 +#define LOG_AND 267 +#define LOG_NOT 268 +#define SHR 269 +#define SHL 270 +#define GTE 271 +#define LTE 272 +#define NE 273 +#define EQ 274 +#define DEREF 275 +#define UMINUS 276 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 28 "stella.y" /* yacc.c:1909 */ +#line 28 "stella.y" int val; char* Equate; CartMethod cartMethod; CpuMethod cpuMethod; + RiotMethod riotMethod; TiaMethod tiaMethod; Expression* exp; char* DefinedFunction; -#line 104 "y.tab.h" /* yacc.c:1909 */ -}; +#line 110 "y.tab.h" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1