From 58925d3c92d8dd01e20b01cc79ab2ebf28b33ef4 Mon Sep 17 00:00:00 2001 From: urchlay Date: Fri, 15 Jul 2005 03:27:04 +0000 Subject: [PATCH] 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 --- stella/src/debugger/DebuggerParser.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index a4a1734f5..9d114d58b 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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: