Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
2007-04-17 Martin Baulig <martin@ximian.com>
Browse files Browse the repository at this point in the history
	* frontend/Interpreter.cs
	(Interpreter): Remove support for multiple parser languages; this
	was never used and we only supported "c#" anyways.


svn path=/trunk/debugger/; revision=75827
  • Loading branch information
Martin Baulig committed Apr 17, 2007
1 parent 029da69 commit 6ec1db6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 73 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2007-04-17 Martin Baulig <martin@ximian.com>

* frontend/Interpreter.cs
(Interpreter): Remove support for multiple parser languages; this
was never used and we only supported "c#" anyways.

2007-04-04 Martin Baulig <martin@ximian.com>

* frontend/Command.cs
Expand Down
24 changes: 0 additions & 24 deletions frontend/Command.cs
Expand Up @@ -1784,29 +1784,6 @@ public class SetCommand : NestedCommand, IDocumentableCommand
AssignmentCommand assign;

#region set subcommands
private class SetLangCommand : DebuggerCommand
{
protected string lang;

protected override bool DoResolve (ScriptingContext context)
{
if ((Args == null) || (Args.Count != 1)) {
context.Print ("Invalid argument: Need the name of the language");
return false;
}

lang = (string) Args [0];
return true;
}

protected override object DoExecute (ScriptingContext context)
{
if (lang != null)
context.Interpreter.CurrentLang = lang;
return null;
}
}

private class SetArgsCommand : DebuggerCommand
{
protected override bool DoResolve (ScriptingContext context)
Expand Down Expand Up @@ -1916,7 +1893,6 @@ public SetCommand ()
{
RegisterSubcommand ("env", typeof (SetEnvironmentCommand));
RegisterSubcommand ("args", typeof (SetArgsCommand));
RegisterSubcommand ("lang", typeof (SetLangCommand));
RegisterSubcommand ("style", typeof (SetStyleCommand));
}

Expand Down
50 changes: 1 addition & 49 deletions frontend/Interpreter.cs
Expand Up @@ -30,10 +30,6 @@ public class Interpreter : DebuggerMarshalByRefObject, IDisposable
Hashtable styles;
StyleBase current_style;

Hashtable parsers_by_name;
Hashtable parser_names_by_language;
string current_parser_name;

bool is_interactive;
int exit_code = 0;
int interrupt_level;
Expand Down Expand Up @@ -72,18 +68,6 @@ static Interpreter ()
styles.Add ("cli", new StyleCLI (this));
styles.Add ("emacs", new StyleEmacs (this));
current_style = (StyleBase) styles ["cli"];

parsers_by_name = new Hashtable ();
parsers_by_name.Add ("c#", typeof (CSharp.ExpressionParser));

// XXX we should really get these from the
// actual Name property of a language
// instance..
parser_names_by_language = new Hashtable ();
parser_names_by_language.Add ("Mono", "c#");
parser_names_by_language.Add ("native", "c#");

current_parser_name = "auto";
}

AppDomain debugger_domain;
Expand Down Expand Up @@ -158,41 +142,9 @@ public string[] GetStyleNames ()
return names;
}

public string CurrentLang {
get { return current_parser_name; }
set {
if (value == "auto" || parsers_by_name [value] != null) {
current_parser_name = value;
}
else {
throw new ScriptingException ("No such language: `{0}'", value);
}
}
}

public IExpressionParser GetExpressionParser (ScriptingContext context, string name)
{
Type parser_type;

if (current_parser_name == "auto") {
/* determine the language parser by the current stack frame */
parser_type = (Type)parsers_by_name [parser_names_by_language [context.CurrentLanguage.Name]];
} else {
/* use the user specified language */
parser_type = (Type)parsers_by_name [current_parser_name];
}

if (parser_type != null) {
IExpressionParser parser;
object[] args = new object[2];
args[0] = context;
args[1] = name;
parser = (IExpressionParser)Activator.CreateInstance (parser_type, args);

return parser;
} else {
return new CSharp.ExpressionParser (context, name);
}
return new CSharp.ExpressionParser (context, name);
}

public bool IsInteractive {
Expand Down

0 comments on commit 6ec1db6

Please sign in to comment.