public bool ParseLocation(ScriptingContext context, string arg,
out SourceLocation location)
{
int line;
int pos = arg.IndexOf (':');
if (pos >= 0) {
string filename = arg.Substring (0, pos);
try {
line = (int) UInt32.Parse (arg.Substring (pos+1));
} catch {
throw new ScriptingException ("Expected filename:line");
}
location = FindFile (context, filename, line);
return true;
}
try {
line = (int) UInt32.Parse (arg);
} catch {
location = null;
return false;
}
StackFrame frame = context.CurrentFrame;
if ((frame == null) || (frame.SourceLocation == null) ||
(frame.SourceLocation.FileName == null))
throw new ScriptingException (
"Current stack frame doesn't have source code");
location = FindFile (context, frame.SourceLocation.FileName, line);
return true;
}