private void Execute(string text) { using (Parser parser = new Parser(text)) { ICommand command = parser.ParseCommand(); Assert.IsNull(parser.ParseCommand()); command.Execute(this.environment); } }
private static IExpression ParseExpression(string text) { Parser parser = new Parser(text); IExpression expression = parser.ParseExpression(); Assert.IsNull(parser.ParseExpression()); return expression; }
private static ICommand ParseCommand(string text) { Parser parser = new Parser(text); ICommand command = parser.ParseCommand(); Assert.IsNull(parser.ParseExpression()); return command; }
private object Evaluate(string text) { using (Parser parser = new Parser(text)) { IExpression expression = parser.ParseExpression(); Assert.IsNull(parser.ParseExpression()); return expression.Evaluate(this.environment); } }