void ProcessCommand(string line)
{
Match m = cmdSplit.Match(line);
string cmd = m.Groups[1].ToString();
string arg = m.Groups[2].ToString().TrimStart(null);
switch (cmd)
{
case "n":
AddNamespace(arg);
break;
case "r":
AddReference(arg);
break;
case "v":
foreach (string v in varTable.Keys)
{
Utils.Print(v + " = " + varTable[v]);
}
break;
case "dcl":
MustDeclare = !MustDeclare;
break;
case "code": // show code sent to compiler!
showCode = !showCode;
break;
default:
// a macro may be used as a command; the line is split up and
// and supplied as arguments.
// For macros taking one argument, the whole line is supplied.
MacroEntry me = macro.Lookup(cmd);
if (me != null && me.Parms != null)
{
string[] parms;
if (me.Parms.Length > 1)
{
parms = spaces.Split(arg);
}
else
{
parms = new string[] { arg }
};
string s = macro.ReplaceParms(me, parms);
ExecuteLine(s);
}
else
{
Utils.Print("unrecognized command, or bad macro");
}
break;
}
}