mirror of https://github.com/stella-emu/stella.git
Added "exec" command, for running script/batch files. If there's a
file named "romfile.stella" in the current directory, it will be run at startup. Fixed memory leakage in YaccParser, when there was a parse error. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@669 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
e6b20266be
commit
c90245bf9a
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.cxx,v 1.67 2005-07-16 21:29:44 stephena Exp $
|
||||
// $Id: Debugger.cxx,v 1.68 2005-07-18 02:03:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -98,6 +98,7 @@ void Debugger::initialize()
|
|||
string initBreak = myOSystem->settings().getString("break");
|
||||
if(initBreak != "") run("break " + initBreak);
|
||||
myOSystem->settings().setString("break", "", false);
|
||||
autoExec();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -129,10 +130,6 @@ void Debugger::setConsole(Console* console)
|
|||
delete myTiaDebug;
|
||||
myTiaDebug = new TIADebug(this, myConsole);
|
||||
|
||||
// Let the parser know about the new subsystems (so YaccParser can use them)
|
||||
// FIXME
|
||||
// myParser->updateDebugger(this, myConsole);
|
||||
|
||||
autoLoadSymbols(myOSystem->romFile());
|
||||
|
||||
saveOldState();
|
||||
|
@ -164,6 +161,20 @@ void Debugger::autoLoadSymbols(string fileName) {
|
|||
// cerr << "loading syms from file " << file << ": " << ret << endl;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::autoExec() {
|
||||
string file = myOSystem->romFile();
|
||||
|
||||
string::size_type pos;
|
||||
if( (pos = file.find_last_of('.')) != string::npos ) {
|
||||
file.replace(pos, file.size(), ".stella");
|
||||
} else {
|
||||
file += ".stella";
|
||||
}
|
||||
myPrompt->print("\nautoExec():\n" + myParser->exec(file));
|
||||
myPrompt->printPrompt();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const string Debugger::run(const string& command)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.hxx,v 1.54 2005-07-15 15:27:29 stephena Exp $
|
||||
// $Id: Debugger.hxx,v 1.55 2005-07-18 02:03:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -63,7 +63,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.54 2005-07-15 15:27:29 stephena Exp $
|
||||
@version $Id: Debugger.hxx,v 1.55 2005-07-18 02:03:40 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -285,6 +285,7 @@ class Debugger : public DialogContainer
|
|||
|
||||
void reset();
|
||||
void autoLoadSymbols(string file);
|
||||
void autoExec();
|
||||
void clearAllBreakPoints();
|
||||
|
||||
void formatFlags(BoolArray& b, char *out);
|
||||
|
|
|
@ -13,15 +13,18 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerParser.cxx,v 1.63 2005-07-17 15:50:34 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.64 2005-07-18 02:03:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "Debugger.hxx"
|
||||
#include "CpuDebug.hxx"
|
||||
#include "DebuggerParser.hxx"
|
||||
#include "YaccParser.hxx"
|
||||
#include "M6502.hxx"
|
||||
#include "Expression.hxx"
|
||||
|
||||
#include "DebuggerParser.hxx"
|
||||
|
||||
|
@ -154,6 +157,14 @@ Command DebuggerParser::commands[] = {
|
|||
&DebuggerParser::executeDump
|
||||
},
|
||||
|
||||
{
|
||||
"exec",
|
||||
"Execute script file",
|
||||
true,
|
||||
{ kARG_FILE, kARG_END_ARGS },
|
||||
&DebuggerParser::executeExec
|
||||
},
|
||||
|
||||
{
|
||||
"frame",
|
||||
"Advance emulation by xx frames (default=1)",
|
||||
|
@ -929,7 +940,7 @@ bool DebuggerParser::validateArgs(int cmd) {
|
|||
|
||||
case kARG_MULTI_BYTE:
|
||||
case kARG_MULTI_WORD:
|
||||
break; // FIXME: implement!
|
||||
break; // FIXME: validate these (for now, any number's allowed)
|
||||
|
||||
default:
|
||||
commandResult = red("too many arguments");
|
||||
|
@ -951,8 +962,10 @@ bool DebuggerParser::validateArgs(int cmd) {
|
|||
|
||||
// main entry point: PromptWidget calls this method.
|
||||
string DebuggerParser::run(const string& command) {
|
||||
|
||||
/*
|
||||
// this was our parser test code. Left for reference.
|
||||
static Expression *lastExpression;
|
||||
int i=0;
|
||||
|
||||
// special case: parser testing
|
||||
if(strncmp(command.c_str(), "expr ", 5) == 0) {
|
||||
|
@ -983,10 +996,16 @@ string DebuggerParser::run(const string& command) {
|
|||
commandResult = "no valid expr";
|
||||
return commandResult;
|
||||
}
|
||||
*/
|
||||
|
||||
getArgs(command);
|
||||
#ifdef EXPR_REF_COUNT
|
||||
extern int refCount;
|
||||
cerr << "Expression count: " << refCount << endl;
|
||||
#endif
|
||||
commandResult = "";
|
||||
|
||||
int i=0;
|
||||
do {
|
||||
if( subStringMatch(verb, commands[i].cmdString.c_str()) ) {
|
||||
if( validateArgs(i) )
|
||||
|
@ -1041,6 +1060,42 @@ const char *DebuggerParser::getCompletionPrefix() {
|
|||
return compPrefix.c_str();
|
||||
}
|
||||
|
||||
string DebuggerParser::exec(const string& cmd, bool verbose) {
|
||||
string file = cmd;
|
||||
string ret;
|
||||
int count = 0;
|
||||
char buffer[256]; // FIXME: static buffers suck
|
||||
|
||||
string::size_type pos;
|
||||
if( (pos = file.find_last_of('.')) == string::npos ) {
|
||||
file += ".stella";
|
||||
}
|
||||
|
||||
ifstream in(file.c_str());
|
||||
if(!in.is_open())
|
||||
return red("file \"" + file + "\" not found.");
|
||||
|
||||
while( !in.eof() ) {
|
||||
if(!in.getline(buffer, 255))
|
||||
break;
|
||||
|
||||
count++;
|
||||
if(verbose) {
|
||||
ret += "exec> ";
|
||||
ret += buffer;
|
||||
ret += "\n";
|
||||
ret += run(buffer);
|
||||
ret += "\n";
|
||||
}
|
||||
}
|
||||
ret += "Executed ";
|
||||
ret += debugger->valueToString(count);
|
||||
ret += " commands from \"";
|
||||
ret += file;
|
||||
ret += "\"\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
////// executor methods for commands[] array. All are void, no args.
|
||||
|
||||
// "a"
|
||||
|
@ -1203,6 +1258,11 @@ void DebuggerParser::executeDump() {
|
|||
commandResult = dump();
|
||||
}
|
||||
|
||||
// "exec"
|
||||
void DebuggerParser::executeExec() {
|
||||
commandResult = exec(argStrings[0]);
|
||||
}
|
||||
|
||||
// "height"
|
||||
void DebuggerParser::executeHeight() {
|
||||
int height = debugger->setHeight(args[0]);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerParser.hxx,v 1.34 2005-07-17 15:50:36 urchlay Exp $
|
||||
// $Id: DebuggerParser.hxx,v 1.35 2005-07-18 02:03:40 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_PARSER_HXX
|
||||
|
@ -50,6 +50,7 @@ class DebuggerParser
|
|||
int countCompletions(const char *in);
|
||||
const char *getCompletions();
|
||||
const char *getCompletionPrefix();
|
||||
string exec(const string& cmd, bool verbose=true);
|
||||
|
||||
static inline string red(string msg ="") {
|
||||
// This is TIA color 0x34. The octal value is 0x80+(0x34>>1).
|
||||
|
@ -107,6 +108,7 @@ class DebuggerParser
|
|||
void executeDelwatch();
|
||||
void executeDisasm();
|
||||
void executeDump();
|
||||
void executeExec();
|
||||
void executeFrame();
|
||||
void executeHeight();
|
||||
void executeHelp();
|
||||
|
|
|
@ -13,21 +13,34 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Expression.cxx,v 1.1 2005-07-12 17:02:35 stephena Exp $
|
||||
// $Id: Expression.cxx,v 1.2 2005-07-18 02:03:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
#ifdef EXPR_REF_COUNT
|
||||
#include "bspf.hxx"
|
||||
int refCount = 0;
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Expression::Expression(Expression* lhs, Expression* rhs)
|
||||
: myLHS(lhs),
|
||||
myRHS(rhs)
|
||||
{
|
||||
#ifdef EXPR_REF_COUNT
|
||||
refCount++;
|
||||
cerr << "new Expression::Expression()" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Expression::~Expression()
|
||||
{
|
||||
#ifdef EXPR_REF_COUNT
|
||||
refCount--;
|
||||
cerr << "~Expression::Expression()" << endl;
|
||||
#endif
|
||||
delete myLHS;
|
||||
delete myRHS;
|
||||
}
|
||||
|
|
|
@ -13,12 +13,16 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Expression.hxx,v 1.1 2005-07-12 17:02:35 stephena Exp $
|
||||
// $Id: Expression.hxx,v 1.2 2005-07-18 02:03:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EXPRESSION_HXX
|
||||
#define EXPRESSION_HXX
|
||||
|
||||
// define this to count Expression instances. Only useful for debugging
|
||||
// Stella itself.
|
||||
//#define EXPR_REF_COUNT
|
||||
|
||||
/**
|
||||
This class provides an implementation of an expression node, which
|
||||
is a construct that is given two other expressions and evaluates and
|
||||
|
@ -26,7 +30,7 @@
|
|||
can represent complex expression statements.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Expression.hxx,v 1.1 2005-07-12 17:02:35 stephena Exp $
|
||||
@version $Id: Expression.hxx,v 1.2 2005-07-18 02:03:41 urchlay Exp $
|
||||
*/
|
||||
class Expression
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: M6502.cxx,v 1.10 2005-07-17 15:50:37 urchlay Exp $
|
||||
// $Id: M6502.cxx,v 1.11 2005-07-18 02:03:41 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "M6502.hxx"
|
||||
|
@ -113,6 +113,7 @@ void M6502::addCondBreak(Expression *e, string name)
|
|||
void M6502::delCondBreak(unsigned int brk)
|
||||
{
|
||||
if(brk < myBreakConds.size()) {
|
||||
delete myBreakConds[brk];
|
||||
myBreakConds.remove_at(brk);
|
||||
myBreakCondNames.remove_at(brk);
|
||||
}
|
||||
|
@ -121,6 +122,8 @@ void M6502::delCondBreak(unsigned int brk)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::clearCondBreaks()
|
||||
{
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++)
|
||||
delete myBreakConds[i];
|
||||
myBreakConds.clear();
|
||||
myBreakCondNames.clear();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: YaccParser.cxx,v 1.12 2005-07-16 23:46:36 urchlay Exp $
|
||||
// $Id: YaccParser.cxx,v 1.13 2005-07-18 02:03:41 urchlay Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -25,6 +25,8 @@
|
|||
//extern "C" {
|
||||
//#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "CpuDebug.hxx"
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
%{
|
||||
#include <stdio.h>
|
||||
|
||||
Expression* lastExp = 0;
|
||||
|
||||
#define YYERROR_VERBOSE 1
|
||||
|
||||
int yylex();
|
||||
|
@ -10,6 +12,8 @@ void yyerror(char *e) {
|
|||
//fprintf(stderr, "%s at token \"%s\"\n", e, yytext);
|
||||
fprintf(stderr, "%s\n", e);
|
||||
errMsg = e;
|
||||
if(lastExp)
|
||||
delete lastExp;
|
||||
}
|
||||
|
||||
%}
|
||||
|
@ -48,35 +52,35 @@ void yyerror(char *e) {
|
|||
statement: expression { fprintf(stderr, "\ndone\n"); result.exp = $1; }
|
||||
;
|
||||
|
||||
expression: expression '+' expression { fprintf(stderr, " +"); $$ = new PlusExpression($1, $3); }
|
||||
| expression '-' expression { fprintf(stderr, " -"); $$ = new MinusExpression($1, $3); }
|
||||
| expression '*' expression { fprintf(stderr, " *"); $$ = new MultExpression($1, $3); }
|
||||
| expression '/' expression { fprintf(stderr, " /"); $$ = new DivExpression($1, $3); }
|
||||
| expression '%' expression { fprintf(stderr, " %%"); $$ = new ModExpression($1, $3); }
|
||||
| expression '&' expression { fprintf(stderr, " &"); $$ = new BinAndExpression($1, $3); }
|
||||
| expression '|' expression { fprintf(stderr, " |"); $$ = new BinOrExpression($1, $3); }
|
||||
| expression '^' expression { fprintf(stderr, " ^"); $$ = new BinXorExpression($1, $3); }
|
||||
| expression '<' expression { fprintf(stderr, " <"); $$ = new LessExpression($1, $3); }
|
||||
| expression '>' expression { fprintf(stderr, " >"); $$ = new GreaterExpression($1, $3); }
|
||||
| expression GTE expression { fprintf(stderr, " >="); $$ = new GreaterEqualsExpression($1, $3); }
|
||||
| expression LTE expression { fprintf(stderr, " <="); $$ = new LessEqualsExpression($1, $3); }
|
||||
| expression NE expression { fprintf(stderr, " !="); $$ = new NotEqualsExpression($1, $3); }
|
||||
| expression EQ expression { fprintf(stderr, " =="); $$ = new EqualsExpression($1, $3); }
|
||||
| expression SHR expression { fprintf(stderr, " >>"); $$ = new ShiftRightExpression($1, $3); }
|
||||
| expression SHL expression { fprintf(stderr, " <<"); $$ = new ShiftLeftExpression($1, $3); }
|
||||
| expression LOG_OR expression { fprintf(stderr, " ||"); $$ = new LogOrExpression($1, $3); }
|
||||
| expression LOG_AND expression { fprintf(stderr, " &&"); $$ = new LogAndExpression($1, $3); }
|
||||
| '-' expression %prec UMINUS { fprintf(stderr, " U-"); $$ = new UnaryMinusExpression($2); }
|
||||
| '~' expression %prec UMINUS { fprintf(stderr, " ~"); $$ = new BinNotExpression($2); }
|
||||
| '!' expression %prec UMINUS { fprintf(stderr, " !"); $$ = new LogNotExpression($2); }
|
||||
| '*' expression %prec DEREF { fprintf(stderr, " U*"); $$ = new ByteDerefExpression($2); }
|
||||
| '@' expression %prec DEREF { fprintf(stderr, " U@"); $$ = new WordDerefExpression($2); }
|
||||
| '<' expression { fprintf(stderr, " U<"); $$ = new LoByteExpression($2); }
|
||||
| '>' expression { fprintf(stderr, " U>"); $$ = new HiByteExpression($2); }
|
||||
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; }
|
||||
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); }
|
||||
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); }
|
||||
| INT_METHOD { fprintf(stderr, " (intMethod)"); $$ = new IntMethodExpression($1); }
|
||||
expression: expression '+' expression { fprintf(stderr, " +"); $$ = new PlusExpression($1, $3); lastExp = $$; }
|
||||
| expression '-' expression { fprintf(stderr, " -"); $$ = new MinusExpression($1, $3); lastExp = $$; }
|
||||
| expression '*' expression { fprintf(stderr, " *"); $$ = new MultExpression($1, $3); lastExp = $$; }
|
||||
| expression '/' expression { fprintf(stderr, " /"); $$ = new DivExpression($1, $3); lastExp = $$; }
|
||||
| expression '%' expression { fprintf(stderr, " %%"); $$ = new ModExpression($1, $3); lastExp = $$; }
|
||||
| expression '&' expression { fprintf(stderr, " &"); $$ = new BinAndExpression($1, $3); lastExp = $$; }
|
||||
| expression '|' expression { fprintf(stderr, " |"); $$ = new BinOrExpression($1, $3); lastExp = $$; }
|
||||
| expression '^' expression { fprintf(stderr, " ^"); $$ = new BinXorExpression($1, $3); lastExp = $$; }
|
||||
| expression '<' expression { fprintf(stderr, " <"); $$ = new LessExpression($1, $3); lastExp = $$; }
|
||||
| expression '>' expression { fprintf(stderr, " >"); $$ = new GreaterExpression($1, $3); lastExp = $$; }
|
||||
| expression GTE expression { fprintf(stderr, " >="); $$ = new GreaterEqualsExpression($1, $3); lastExp = $$; }
|
||||
| expression LTE expression { fprintf(stderr, " <="); $$ = new LessEqualsExpression($1, $3); lastExp = $$; }
|
||||
| expression NE expression { fprintf(stderr, " !="); $$ = new NotEqualsExpression($1, $3); lastExp = $$; }
|
||||
| expression EQ expression { fprintf(stderr, " =="); $$ = new EqualsExpression($1, $3); lastExp = $$; }
|
||||
| expression SHR expression { fprintf(stderr, " >>"); $$ = new ShiftRightExpression($1, $3); lastExp = $$; }
|
||||
| expression SHL expression { fprintf(stderr, " <<"); $$ = new ShiftLeftExpression($1, $3); lastExp = $$; }
|
||||
| expression LOG_OR expression { fprintf(stderr, " ||"); $$ = new LogOrExpression($1, $3); lastExp = $$; }
|
||||
| expression LOG_AND expression { fprintf(stderr, " &&"); $$ = new LogAndExpression($1, $3); lastExp = $$; }
|
||||
| '-' expression %prec UMINUS { fprintf(stderr, " U-"); $$ = new UnaryMinusExpression($2); lastExp = $$; }
|
||||
| '~' expression %prec UMINUS { fprintf(stderr, " ~"); $$ = new BinNotExpression($2); lastExp = $$; }
|
||||
| '!' expression %prec UMINUS { fprintf(stderr, " !"); $$ = new LogNotExpression($2); lastExp = $$; }
|
||||
| '*' expression %prec DEREF { fprintf(stderr, " U*"); $$ = new ByteDerefExpression($2); lastExp = $$; }
|
||||
| '@' expression %prec DEREF { fprintf(stderr, " U@"); $$ = new WordDerefExpression($2); lastExp = $$; }
|
||||
| '<' expression { fprintf(stderr, " U<"); $$ = new LoByteExpression($2); lastExp = $$; }
|
||||
| '>' expression { fprintf(stderr, " U>"); $$ = new HiByteExpression($2); lastExp = $$; }
|
||||
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; lastExp = $$; }
|
||||
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); lastExp = $$; }
|
||||
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); lastExp = $$; }
|
||||
| INT_METHOD { fprintf(stderr, " (intMethod)"); $$ = new IntMethodExpression($1); lastExp = $$; }
|
||||
| ERR { fprintf(stderr, " ERR"); yyerror("Invalid label or constant"); return 1; }
|
||||
;
|
||||
%%
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
Expression* lastExp = 0;
|
||||
|
||||
#define YYERROR_VERBOSE 1
|
||||
|
||||
int yylex();
|
||||
|
@ -32,10 +34,12 @@ void yyerror(char *e) {
|
|||
//fprintf(stderr, "%s at token \"%s\"\n", e, yytext);
|
||||
fprintf(stderr, "%s\n", e);
|
||||
errMsg = e;
|
||||
if(lastExp)
|
||||
delete lastExp;
|
||||
}
|
||||
|
||||
|
||||
#line 17 "stella.y"
|
||||
#line 21 "stella.y"
|
||||
#ifndef YYSTYPE
|
||||
typedef union {
|
||||
int val;
|
||||
|
@ -121,10 +125,10 @@ static const short yyrhs[] =
|
|||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[] =
|
||||
{
|
||||
0, 48, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
|
||||
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80
|
||||
0, 52, 55, 56, 57, 58, 59, 60, 61, 62,
|
||||
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
|
||||
73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
|
||||
83, 84
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -948,128 +952,128 @@ yyreduce:
|
|||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
#line 48 "stella.y"
|
||||
#line 52 "stella.y"
|
||||
{ fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; }
|
||||
break;
|
||||
case 2:
|
||||
#line 51 "stella.y"
|
||||
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 55 "stella.y"
|
||||
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 3:
|
||||
#line 52 "stella.y"
|
||||
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 56 "stella.y"
|
||||
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 4:
|
||||
#line 53 "stella.y"
|
||||
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 57 "stella.y"
|
||||
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 5:
|
||||
#line 54 "stella.y"
|
||||
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 58 "stella.y"
|
||||
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 6:
|
||||
#line 55 "stella.y"
|
||||
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 59 "stella.y"
|
||||
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 7:
|
||||
#line 56 "stella.y"
|
||||
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 60 "stella.y"
|
||||
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 8:
|
||||
#line 57 "stella.y"
|
||||
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 61 "stella.y"
|
||||
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 9:
|
||||
#line 58 "stella.y"
|
||||
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 62 "stella.y"
|
||||
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 10:
|
||||
#line 59 "stella.y"
|
||||
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 63 "stella.y"
|
||||
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 11:
|
||||
#line 60 "stella.y"
|
||||
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 64 "stella.y"
|
||||
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 12:
|
||||
#line 61 "stella.y"
|
||||
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 65 "stella.y"
|
||||
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 13:
|
||||
#line 62 "stella.y"
|
||||
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 66 "stella.y"
|
||||
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 14:
|
||||
#line 63 "stella.y"
|
||||
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 67 "stella.y"
|
||||
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 15:
|
||||
#line 64 "stella.y"
|
||||
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 68 "stella.y"
|
||||
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 16:
|
||||
#line 65 "stella.y"
|
||||
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 69 "stella.y"
|
||||
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 17:
|
||||
#line 66 "stella.y"
|
||||
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 70 "stella.y"
|
||||
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 18:
|
||||
#line 67 "stella.y"
|
||||
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 71 "stella.y"
|
||||
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 19:
|
||||
#line 68 "stella.y"
|
||||
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
#line 72 "stella.y"
|
||||
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 20:
|
||||
#line 69 "stella.y"
|
||||
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); }
|
||||
#line 73 "stella.y"
|
||||
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 21:
|
||||
#line 70 "stella.y"
|
||||
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); }
|
||||
#line 74 "stella.y"
|
||||
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 22:
|
||||
#line 71 "stella.y"
|
||||
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); }
|
||||
#line 75 "stella.y"
|
||||
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 23:
|
||||
#line 72 "stella.y"
|
||||
{ fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); }
|
||||
#line 76 "stella.y"
|
||||
{ fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 24:
|
||||
#line 73 "stella.y"
|
||||
{ fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); }
|
||||
#line 77 "stella.y"
|
||||
{ fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 25:
|
||||
#line 74 "stella.y"
|
||||
{ fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); }
|
||||
#line 78 "stella.y"
|
||||
{ fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 26:
|
||||
#line 75 "stella.y"
|
||||
{ fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); }
|
||||
#line 79 "stella.y"
|
||||
{ fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 27:
|
||||
#line 76 "stella.y"
|
||||
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; }
|
||||
#line 80 "stella.y"
|
||||
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; lastExp = yyval.exp; }
|
||||
break;
|
||||
case 28:
|
||||
#line 77 "stella.y"
|
||||
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); }
|
||||
#line 81 "stella.y"
|
||||
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 29:
|
||||
#line 78 "stella.y"
|
||||
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); }
|
||||
#line 82 "stella.y"
|
||||
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 30:
|
||||
#line 79 "stella.y"
|
||||
{ fprintf(stderr, " (intMethod)"); yyval.exp = new IntMethodExpression(yyvsp[0].intMethod); }
|
||||
#line 83 "stella.y"
|
||||
{ fprintf(stderr, " (intMethod)"); yyval.exp = new IntMethodExpression(yyvsp[0].intMethod); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 31:
|
||||
#line 80 "stella.y"
|
||||
{ fprintf(stderr, " ERR"); yyerror("Invalid label or expression"); return 1; }
|
||||
#line 84 "stella.y"
|
||||
{ fprintf(stderr, " ERR"); yyerror("Invalid label or constant"); return 1; }
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1304,5 +1308,5 @@ yyreturn:
|
|||
#endif
|
||||
return yyresult;
|
||||
}
|
||||
#line 82 "stella.y"
|
||||
#line 86 "stella.y"
|
||||
|
||||
|
|
Loading…
Reference in New Issue