shell解释器伪代码问题!
)以下程序是一个 Shell解释器的伪代码,请指出以下程序违反了什么设计原
则,并指出如何改正这个程序::
public void Parse()
{
StringReader reader = new StringReader(scriptTextToProcess); StringBuilder scope = new StringBuilder();
string line = reader.ReadLine();
scope = new StringBuilder();
while (line != null)
{
switch (line[0])
{
case '$':
// Process the entire "line" as a variable,
// i.e. add it to a collection of KeyValuePair.
line.AddToVariables(); break;
case '!':
// Depending of what comes after the '!' character,
// process the entire "scope" or command in "line".
if (line == "!execute")
scope.ExecuteScope();
else if (line.StartsWith("!custom_command"))
line.RunCustomCommand(scope);
else if (line == "!single_line_directive")
line.ProcessDirective(); break;
default:
// No processing directive, i.e. add the "line"
// to the current scope. scope.Append(line); break;
}
line = reader.ReadLine();
}
}
求助啊没太看懂QAQ还没学到这里啊,老师就留了作业