Exemple #1
0
        public static IInstruction Load(string line)
        {
            IfInstruction ifInstruction = new IfInstruction(new List <IInstruction>(), "");
            List <string> list          = new List <string>();

            Program.ToWords(line, '黅', (ICollection <string>)list);
            ifInstruction.variable_name = list[1];
            list.RemoveAt(0);
            list.RemoveAt(0);
            list.RemoveAt(0);
            list.RemoveAt(list.Count - 1);
            foreach (string s in list)
            {
                ifInstruction.instructions.Add(Program.LoadInstruction(s));
            }
            return((IInstruction)ifInstruction);
        }
Exemple #2
0
        public int Know()
        {
            int           num           = 0;
            IfInstruction ifInstruction = this;

            while (true)
            {
                if (ifInstruction.instructions.Count == 2)
                {
                    ifInstruction = (IfInstruction)ifInstruction.instructions[1];
                    ++num;
                }
                else
                {
                    break;
                }
            }
            return(num);
        }