Exemple #1
0
        static void Main(string[] args)
        {
            //работаем с аргументами в интерпретаторе
            var context               = new Context(args);
            var list                  = new List <AbstractExpression>();
            TerminalExpression ob1    = new TerminalExpression();
            NonterminalExpression ob2 = new NonterminalExpression();

            list.Add(ob1);
            list.Add(ob2);
            foreach (AbstractExpression exp in list)
            {
                exp.Interpret(context);
            }//terminal exp. have key for collection with objects commands
             //Nonterminal expression have arguments for processing data in this command


            FuncCreateDB createDB = new FuncCreateDB();//make object
            CreateTable createT   = new CreateTable();
            FuncSelect select     = new FuncSelect();
            Update Upd            = new Update();
            Dictionary <string, ICommand> ListCommand = new Dictionary <string, ICommand>();//make collection

            ListCommand.Add("helpme", new OutInfo());
            ListCommand.Add("CreateDB", new FuncCreateDBCommand(createDB, ob2));//distribution him in collection and add key for him
            ListCommand.Add("CreateTable", new CreateTableCommand(createT, ob2));
            ListCommand.Add("Select", new FuncSelectCommand(select, ob2));
            ListCommand.Add("Update", new UpdateCommand(Upd, ob2));

            Set set = new Set();

            set.SetCommand(ListCommand[ob1.TerInfo]);
            set.Processing();
            ClearExcel.Clear_all();
            Console.ReadKey();
        }
Exemple #2
0
 public FuncSelectCommand(FuncSelect m, NonterminalExpression arg)
 {
     argOb  = arg;
     select = m;
 }