Esempio n. 1
0
            public static float Math(string input)
            {
                string[] args     = input.AdvancedBetween('(', ')').Split(' ');
                float    i_return = 0;

                //reparse the arguments so varibles and eaven the math command in the future can be passed

                args[0] = (string)EggCodeParser.ParseInput(args[0]);
                args[2] = (string)EggCodeParser.ParseInput(args[2]);

                if (args[1] == "+")
                {
                    i_return = float.Parse(args[0]) + float.Parse(args[2]);
                }
                if (args[1] == "-")
                {
                    i_return = float.Parse(args[0]) - float.Parse(args[2]);
                }
                if (args[1] == "*")
                {
                    i_return = float.Parse(args[0]) * float.Parse(args[2]);
                }
                if (args[1] == "/")
                {
                    i_return = float.Parse(args[0]) / float.Parse(args[2]);
                }

                return(i_return);
            }
Esempio n. 2
0
            public void RunWithPrams(string pramCalls)
            {
                CurrentlyRunning = this;
                int i = 0;

                foreach (string pram in prams_string.StringSplit(", "))
                {
                    string s_pram      = (string)EggCodeParser.ParseInput(pram);
                    object s_pramValue = EggCodeParser.ParseInput(pramCalls.StringSplit(", ")[i]);

                    EggCodeTypeVarible temp = new EggCodeTypeVarible(s_pram, s_pramValue);
                    privateVaribles.Add(temp);

                    i++;
                }

                foreach (string line in code)
                {
                    if (EggCodeParser.skip == 0)
                    {
                        EggCodeParser.ParseLine(line);
                    }
                    else if (EggCodeParser.skip != 0)
                    {
                        EggCodeParser.skip -= 1;
                    }
                }
            }
Esempio n. 3
0
            public void Run()
            {
                CurrentlyRunning = this;

                foreach (string line in code)
                {
                    if (EggCodeParser.skip == 0)
                    {
                        EggCodeParser.ParseLine(line);
                    }
                    else if (EggCodeParser.skip != 0)
                    {
                        EggCodeParser.skip -= 1;
                    }
                }

                if (LoopForever)
                {
                    Run();
                }
                else if (LoopConditionTag && !EggCodeParser.Eval(LoopCondition))
                {
                    Run();
                }
            }
Esempio n. 4
0
            public void Run()
            {
                CurrentlyRunning = this;

                foreach (string line in code)
                {
                    if (EggCodeParser.skip == 0)
                    {
                        EggCodeParser.ParseLine(line);
                    }
                    else if (EggCodeParser.skip != 0)
                    {
                        EggCodeParser.skip -= 1;
                    }
                }
            }
Esempio n. 5
0
            public static void DeclarePrivateVarible(string line)
            {
                string[] args = line.Replace("(private)", "").StringSplit(" = ");
                args[1] = EggCodeParser.ParseInput(args[1]).ToString();

                EggCodeTypeVarible var = new EggCodeTypeVarible(args[0], args[1]);

                if (CurrentlyRunning.FindVarible(args[0]) == null)
                {
                    CurrentlyRunning.privateVaribles.Add(var);
                }
                else
                {
                    CurrentlyRunning.privateVaribles[CurrentlyRunning.FindVaribleIndex(args[0])] = var;
                }
            }
Esempio n. 6
0
            public static void DeclareVarible(string line)
            {
                string[] args = line.StringSplit(" = ");
                args[1] = EggCodeParser.ParseInput(args[1]).ToString();

                EggCodeTypeVarible var = new EggCodeTypeVarible(args[0], args[1]);

                if (EggCodeTypeVarible.FindVaribleIndex(args[0]) == -1)
                {
                    eggCodeGlobalVaribles.Add(var);
                }
                else
                {
                    eggCodeGlobalVaribles[EggCodeTypeVarible.FindVaribleIndex(args[0])] = var;
                }
            }
Esempio n. 7
0
 public static void Print(string line)
 {
     Console.WriteLine(EggCodeParser.ParseInput(line.AdvancedBetween('(', ')')));
 }