public BreadthFirstIterator(ScriptComNonterminalExpression scriptCommand)
        {
            if (scriptCommand == null)
                return;
            this.List = new List<IAbstractExpression>();
            //Type type = typeof(ScriptComNonterminalExpression);

            while (this.List.Count > -1)
            {
                if (scriptCommand.ExpressionLeft.GetType() != typeof(MainComTerminalExpression))
                {
                    this.List.Add((MainComTerminalExpression)scriptCommand.ExpressionRight);
                    scriptCommand = (ScriptComNonterminalExpression)scriptCommand.ExpressionLeft;
                }
                if (scriptCommand.ExpressionLeft.GetType() == typeof(MainComTerminalExpression))
                {
                    if((MainComTerminalExpression)scriptCommand.ExpressionRight != null)
                        this.List.Add((MainComTerminalExpression)scriptCommand.ExpressionRight);
                    if((MainComTerminalExpression)scriptCommand.ExpressionLeft != null)
                        this.List.Add((MainComTerminalExpression)scriptCommand.ExpressionLeft);
                    break;
                }
            }

            //for (; ; )
            //{
            //    if (scriptCommand.ExpressionRight != null && scriptCommand.ExpressionLeft.GetType() != typeof(ScriptComNonterminalExpression)
            //        && scriptCommand.ExpressionRight.GetType() != typeof(SupportingComTerminalExpression))
            //    {
            //        this.Queue.Enqueue(scriptCommand.ExpressionRight);
            //        if (scriptCommand.ExpressionLeft.GetType() != typeof(ScriptComNonterminalExpression))
            //        {
            //            scriptCommand = (ScriptComNonterminalExpression)scriptCommand.ExpressionLeft;
            //        }
            //        else
            //        {
            //            this.Queue.Enqueue(scriptCommand.ExpressionRight);
            //            this.Queue.Enqueue(scriptCommand.ExpressionLeft);
            //            break;
            //        }
            //    }
            //    else
            //    {
            //        this.Queue.Enqueue(scriptCommand.ExpressionRight);
            //        this.Queue.Enqueue(scriptCommand.ExpressionLeft);
            //        break;
            //    }
            //}
        }
 public CommandCollection(ScriptComNonterminalExpression script)
 {
     ScriptCommand = script;
 }
 private void RunCommand(RichTextBox rtb)
 {
     string[] str = GetDocumentText(rtb.Document).Split('\n'); // GetDocumentText(TextScript.Document).Split('\n');
     for (int i = 0; i < str.Length - 1; i++)
     {
         Lexer lexer = new Lexer(str[i]);
         ScriptComNonterminalExpression test = new ScriptComNonterminalExpression(TokenReader.TokenReaderList);
         test.CreateSyntaxTree();
         CommandCollection collection = new CommandCollection(test);
         string o = "";
         string obj = collection.Excute(null, o);
         tb.AppendText(obj);
     }
 }