Beispiel #1
0
 private void Execute(string text)
 {
     using (Parser parser = new Parser(text))
     {
         ICommand command = parser.ParseCommand();
         Assert.IsNull(parser.ParseCommand());
         command.Execute(this.environment);
     }
 }
Beispiel #2
0
        private static IExpression ParseExpression(string text)
        {
            Parser parser = new Parser(text);

            IExpression expression = parser.ParseExpression();

            Assert.IsNull(parser.ParseExpression());

            return expression;
        }
Beispiel #3
0
        private static ICommand ParseCommand(string text)
        {
            Parser parser = new Parser(text);

            ICommand command = parser.ParseCommand();

            Assert.IsNull(parser.ParseExpression());

            return command;
        }
Beispiel #4
0
 private object Evaluate(string text)
 {
     using (Parser parser = new Parser(text))
     {
         IExpression expression = parser.ParseExpression();
         Assert.IsNull(parser.ParseExpression());
         return expression.Evaluate(this.environment);
     }
 }