Exemplo n.º 1
0
        public static Action MakeAction(string line)
        {
            Action action = new Action();

            action.Setup();
            if (line.Contains(","))
            {
                string[] chunks = line.Split(',');

                foreach (string chunk in chunks)
                {
                    action.AddSubAction(MakeAction(chunk));
                }
                return(action);
            }
            else
            {
                if (line.Contains(IncrementString))
                {
                    String[] chunks = line.Split(IncrementStringSep, StringSplitOptions.None);
                    ZeptoVar var    = StringToVar(chunks[0]);
                    int      val    = int.Parse(chunks[1]);
                    action.SetVarChanger(var, ZeptoOp.INCREMENT, val);
                }
                if (line.Contains(DecrementString))
                {
                    string[] chunks = line.Split(DecrementStringSep, StringSplitOptions.None);
                    ZeptoVar var    = StringToVar(chunks[0]);
                    int      val    = int.Parse(chunks[1]);
                    action.SetVarChanger(var, ZeptoOp.DECREMENT, val);
                }
                if (line.Contains(AssignmentString))
                {
                    string[] chunks = line.Split(AssignmentStringSep, StringSplitOptions.None);
                    ZeptoVar var    = StringToVar(chunks[0]);
                    int      val    = int.Parse(chunks[1]);
                    action.SetVarChanger(var, ZeptoOp.ASSIGN, val);
                }

                return(action);
            }
        }
Exemplo n.º 2
0
 public void SetVarChanger(ZeptoVar var, ZeptoOp op, int val)
 {
     this.var = var;
     this.op  = op;
     this.val = val;
 }