예제 #1
0
        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);
            }
        }
예제 #2
0
 public static EvalResult ToResult(this ScmExpression exp)
 {
     return(EvalResult.From(exp));
 }