getArgs() now accepts curly braces as arg delimiters, which allows us

to include spaces in arguments. "print 80" and "print {80}" are equivalent,
but "print 80 + 1" and "print {80 + 1}" are not (the former counts as 3
arguments, the latter only one).

Actually, I haven't tied the YaccParser to getArgs() yet, so both would
still be errors. I still need to fix the segfaults on parse error.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@654 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-15 03:27:04 +00:00
parent 8260b7b495
commit 58925d3c92
1 changed files with 17 additions and 2 deletions

View File

@ -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.cxx,v 1.57 2005-07-15 01:20:11 urchlay Exp $
// $Id: DebuggerParser.cxx,v 1.58 2005-07-15 03:27:04 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -423,6 +423,7 @@ Command DebuggerParser::commands[] = {
enum {
kIN_COMMAND,
kIN_SPACE,
kIN_BRACE,
kIN_ARG
};
@ -587,9 +588,23 @@ bool DebuggerParser::getArgs(const string& command) {
break;
case kIN_SPACE:
if(*c != ' ')
if(*c == '{')
state = kIN_BRACE;
else if(*c != ' ') {
state = kIN_ARG;
curArg += *c;
}
break;
case kIN_BRACE:
if(*c == '}' || *c == '\0') {
state = kIN_SPACE;
argStrings.push_back(curArg);
// cerr << "{" << curArg << "}" << endl;
curArg = "";
} else {
curArg += *c;
}
break;
case kIN_ARG: