public string Run(string text) { if (String.IsNullOrEmpty(text)) { return(null); } command += text; switch (CheckBrackets(command)) { case BracketsCheckResult.OK: var exp = _factory.Create(command); command = ""; EvalResult result = exp.Eval(_env); if (result.Success) { ScmExpression resultExp = exp.Eval(_env).Value; return((resultExp as SelfEvaluatingExpression).ToString()); } else { return(result.ErrorMessage); } case BracketsCheckResult.TooMuch: command = ""; return("Too many closing brackets"); default: command += " "; return(null); } }
public static EvalResult ToResult(this ScmExpression exp) { return(EvalResult.From(exp)); }