Ejemplo n.º 1
0
        public override double GetNumericResult(Basic BasicIntrepeter)
        {
            String Needle = "";
            String HayStack = "";

            BasicIntrepeter.CodeParser.Expect(typeof(StrPosToken));
            BasicIntrepeter.CodeParser.Expect(typeof(LeftParenToken));

            // Expect Needle
            if (BasicIntrepeter.StringModifier.isString())
                Needle = BasicIntrepeter.StringModifier.Value();
            else
                BasicIntrepeter.CodeParser.Expect(typeof(StringToken));

            // Expect Comma ,
            BasicIntrepeter.CodeParser.Expect(typeof(CommaToken));

            // Expect HayStack
            if (BasicIntrepeter.StringModifier.isString())
                HayStack = BasicIntrepeter.StringModifier.Value();
            else
                BasicIntrepeter.CodeParser.Expect(typeof(StringToken));

            BasicIntrepeter.CodeParser.Expect(typeof(RightParenToken));

            return HayStack.IndexOf(Needle);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(RandomizeToken));

            // Expression
            if (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)) & !BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(TimerToken)))
            {
                BasicIntrepeter.NumericModifier.Value();
                BasicIntrepeter.CodeParser.Expect(typeof(EndOfLineToken));
            }

            // Noting
            else if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)))
            {
                BasicIntrepeter.CodeParser.Expect(typeof(EndOfLineToken));
            }

            // TIMER
            else if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(TimerToken)))
            {
                BasicIntrepeter.CodeParser.Expect(typeof(TimerToken));
                BasicIntrepeter.CodeParser.Expect(typeof(EndOfLineToken));
            }

            // Do a Randomize
            Random r = new Random();
        }
Ejemplo n.º 3
0
        public override double GetNumericResult(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(NowToken));
            BasicIntrepeter.CodeParser.Expect(typeof(LeftParenToken));
            BasicIntrepeter.CodeParser.Expect(typeof(RightParenToken));

            return (double)(DateTime.Now.Ticks / TimeSpan.TicksPerSecond);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(RemToken));

            while (!typeof(EndOfLineToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
                BasicIntrepeter.CodeParser.Next();

            BasicIntrepeter.CodeParser.Next();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Token Content as Variable number
        /// </summary>
        /// <returns>Variable number</returns>
        public override byte asVariableID(Basic BasicIntrepeter)
        {
            for (byte i = 0; i < BasicIntrepeter.StringVariables.Count; i++)
            {
                if (((Basic.StringBasicVariable)BasicIntrepeter.StringVariables[i]).Name == this.Content)
                {
                    return i;
                }
            }

            return (byte)BasicIntrepeter.StringVariables.Add(new Basic.StringBasicVariable(this.Content,""));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(GotoToken));

            if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(NumericToken)))
            {
                BasicIntrepeter.JumpToLine(Parser.CurrentToken.asNumber());
            }
            else if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(TextToken)))
            {
                BasicIntrepeter.JumpToLabel(Parser.CurrentToken.Content);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            int Time = 0;

            BasicIntrepeter.CodeParser.Expect(typeof(SleepToken));

            // If time given get it
            if (BasicIntrepeter.NumericModifier.isNumeric())
                Time = (int) BasicIntrepeter.NumericModifier.ExpressionLevel3();

            // Do the actual sleeping
            System.Threading.Thread.Sleep(Time);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Run Statement
 /// </summary>
 /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
 public override void ExcecuteStatement(Basic BasicIntrepeter)
 {
     BasicIntrepeter.CodeParser.Expect(typeof(ReturnToken));
     if (BasicIntrepeter.GOSUBStackPosition > 0)
     {
         BasicIntrepeter.GOSUBStackPosition--;
         BasicIntrepeter.CodeParser.ProgramPosition = BasicIntrepeter.GOSUBStack[BasicIntrepeter.GOSUBStackPosition];
         // BasicIntrepeter.CodeParser.Next();
     }
     else
     {
         throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.RETURN_WITHOUT_GOSUB);
     }
 }
Ejemplo n.º 9
0
        public override double GetNumericResult(Basic BasicIntrepeter)
        {
            double Input = 0F;

            BasicIntrepeter.CodeParser.Expect(typeof(CIntToken));

            if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(LeftParenToken)))
            {
                Input = BasicIntrepeter.NumericModifier.Value();
            }
            else
            {
                BasicIntrepeter.CodeParser.Expect(typeof(LeftParenToken));
            }

            return System.Math.Round(Input);
        }
Ejemplo n.º 10
0
        public override double GetNumericResult(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(RndToken));
            BasicIntrepeter.CodeParser.Expect(typeof(LeftParenToken));

            if (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(RightParenToken)))
            {
                BasicIntrepeter.CodeParser.ProgramPosition--;
                BasicIntrepeter.NumericModifier.Value();
            }
            else
            {
                BasicIntrepeter.CodeParser.Expect(typeof(RightParenToken));
            }
            Random r = new Random();
            return  (double) r.Next(0,10000)/ 10000F;//(((double)Math.Random(10000)) / 10000F);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(GosubToken));

            if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(NumericToken)))
            {
                double GotoLineNumber = BasicIntrepeter.CodeParser.CurrentToken.asNumber();
                BasicIntrepeter.CodeParser.Expect(typeof(NumericToken));

                // Find start of next line (Used for if then else loops)
                while (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)) && !BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    BasicIntrepeter.CodeParser.Next();

                if (BasicIntrepeter.GOSUBStackPosition < (BasicIntrepeter.GOSUBStack.Length - 1))
                {
                    BasicIntrepeter.GOSUBStack[BasicIntrepeter.GOSUBStackPosition] = BasicIntrepeter.CodeParser.ProgramPosition - 1;
                    BasicIntrepeter.GOSUBStackPosition++;
                    BasicIntrepeter.JumpToLine(GotoLineNumber);
                }
                else
                {
                    throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.GOSUB_STACK_EXHAUSTED);
                }
            }
            else if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(TextToken)))
            {
                String GotoLabel = BasicIntrepeter.CodeParser.CurrentToken.Content;
                BasicIntrepeter.CodeParser.Expect(typeof(TextToken));

                // Find start of next line (Used for if then else loops)
                while (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)) && !BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    BasicIntrepeter.CodeParser.Next();

                if (BasicIntrepeter.GOSUBStackPosition < (BasicIntrepeter.GOSUBStack.Length - 1))
                {
                    BasicIntrepeter.GOSUBStack[BasicIntrepeter.GOSUBStackPosition] = BasicIntrepeter.CodeParser.ProgramPosition - 1;
                    BasicIntrepeter.GOSUBStackPosition++;
                    BasicIntrepeter.JumpToLabel(GotoLabel);
                }
                else
                {
                    throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.GOSUB_STACK_EXHAUSTED);
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            BasicIntrepeter.CodeParser.Expect(typeof(PrintToken));
            String PrintOutput = "";

            do
            {
                // Comma, Output space, Expect next value/expression/string
                if (typeof(CommaToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
                {
                    PrintOutput += " ";
                    BasicIntrepeter.CodeParser.Next();
                    continue;
                }

                // Semicolom, Output nothing, Expect next value/expression/string
                if (typeof(SemicolonToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
                {
                    BasicIntrepeter.CodeParser.Next();
                    continue;
                }

                // Numeric Function
                if (BasicIntrepeter.NumericModifier.isNumeric())
                {
                    PrintOutput += BasicIntrepeter.NumericModifier.ExpressionLevel3().ToString();
                    continue;
                }

                // String Function
                if (BasicIntrepeter.StringModifier.isString())
                {
                    PrintOutput += BasicIntrepeter.StringModifier.Value().ToString();
                    continue;
                }

                break;

            } while ((!typeof(EndOfLineToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType())) && (!typeof(EndOfInputToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType())));

            // TODO: Something usefull for Print output?!
            Console.Write(PrintOutput);
            BasicIntrepeter.CodeParser.Next();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            byte var;
            double to;
            double step = 1;

            BasicIntrepeter.CodeParser.Expect(typeof(ForToken));

            var = BasicIntrepeter.CodeParser.CurrentToken.asVariableID(BasicIntrepeter);
            BasicIntrepeter.CodeParser.Expect(typeof(NumericVariableToken));

            BasicIntrepeter.CodeParser.Expect(typeof(EqualToken));

            ((Basic.NumericBasicVariable)BasicIntrepeter.NumericVariables[var]).Value = BasicIntrepeter.NumericModifier.ExpressionsLevel2();

            BasicIntrepeter.CodeParser.Expect(typeof(ToToken));
            to = BasicIntrepeter.NumericModifier.ExpressionLevel3();

            // Check for Step
            if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(StepToken)))
            {
                BasicIntrepeter.CodeParser.Expect(typeof(StepToken));
                step = BasicIntrepeter.NumericModifier.ExpressionLevel3();

            }

            // Ok, can't be used on a single if then else line
            BasicIntrepeter.CodeParser.Expect(typeof(EndOfLineToken));

            if (BasicIntrepeter.FORStackPosition < (BasicIntrepeter.FORStack.Length - 1))
            {
                // Debug.Print(Parser.CurrentTokenValue().ToString());
                BasicIntrepeter.FORStack[BasicIntrepeter.FORStackPosition] = new ForStackItem(BasicIntrepeter.CodeParser.ProgramPosition - 1, (byte)var, to, step);
                BasicIntrepeter.FORStackPosition++;
            }
            else
            {
                throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.FOR_STACK_EXHAUSTED);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            if (typeof(LetToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
                BasicIntrepeter.CodeParser.Expect(typeof(LetToken));

            if (typeof(StringVariableToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
            {
                byte var = BasicIntrepeter.CodeParser.CurrentToken.asVariableID(BasicIntrepeter);
                BasicIntrepeter.CodeParser.Expect(typeof(StringVariableToken));
                BasicIntrepeter.CodeParser.Expect(typeof(EqualToken));
                ((Basic.StringBasicVariable)BasicIntrepeter.StringVariables[var]).Value = BasicIntrepeter.StringModifier.Value();
            }

            if (typeof(NumericVariableToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
            {
                byte var = BasicIntrepeter.CodeParser.CurrentToken.asVariableID(BasicIntrepeter);
                BasicIntrepeter.CodeParser.Expect(typeof(NumericVariableToken));
                BasicIntrepeter.CodeParser.Expect(typeof(EqualToken));
                ((Basic.NumericBasicVariable)BasicIntrepeter.NumericVariables[var]).Value = BasicIntrepeter.NumericModifier.Value();
            }

            BasicIntrepeter.CodeParser.Expect(typeof(EndOfLineToken));
        }
Ejemplo n.º 15
0
 public NumericModifiers(Basic BasicIntrepeter)
 {
     this.BasicIntrepeter = BasicIntrepeter;
 }
Ejemplo n.º 16
0
 public StringModifiers(Basic BasicIntrepeter)
 {
     this.BasicIntrepeter = BasicIntrepeter;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Run Statement
 /// </summary>
 /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
 public virtual void ExcecuteStatement(Basic BasicIntrepeter)
 {
     throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.EXCECUTESTATEMENT_NOT_SUPPORTED);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Token Content as Variable number
 /// </summary>
 /// <returns>Variable number</returns>
 public virtual byte asVariableID(Basic BasicIntrepeter)
 {
     throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.AS_VARIABLEID_NOT_SUPPORTED);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Get String Result
 /// Used for String functions
 /// </summary>
 /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
 /// <returns>Function result</returns>
 public virtual String GetStringResult(Basic BasicIntrepeter)
 {
     throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.GET_STRING_RESULT_NOT_SUPPORTED);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Get Numeric Result
 /// Used for Numeric functions
 /// </summary>
 /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
 /// <returns>Function result</returns>
 public virtual double GetNumericResult(Basic BasicIntrepeter)
 {
     throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.GET_NUMERIC_RESULT_NOT_SUPPORTED);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Run Statement
 /// </summary>
 /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
 public override void ExcecuteStatement(Basic BasicIntrepeter)
 {
     BasicIntrepeter.CodeParser.Expect(typeof(EndToken));
     BasicIntrepeter.Ended = true;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Run Statement
        /// </summary>
        /// <param name="BasicIntrepeter">Basic Intrepeter that called the Statement</param>
        public override void ExcecuteStatement(Basic BasicIntrepeter)
        {
            bool openParenthis = false;
            bool MultiLineIF = false;
            double ComparisonResult;

            BasicIntrepeter.CodeParser.Expect(typeof(IfToken));

            // Alow the usage of parenthis like C language
            if (typeof(LeftParenToken).Equals(BasicIntrepeter.CodeParser.CurrentToken.GetType()))
            {
                BasicIntrepeter.CodeParser.Expect(typeof(LeftParenToken));
                openParenthis = true;
            }

            // Get comparison result
            ComparisonResult = BasicIntrepeter.NumericModifier.ExpressionLevel3();

            // If we had an opening parenthis we expect a closing one
            if (openParenthis)
                BasicIntrepeter.CodeParser.Expect(typeof(RightParenToken));

            // Expect THEN
            Parser.Expect(typeof(ThenToken));

            // Check if multiline
            if (Parser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)))
            {
                MultiLineIF = true;
                BasicIntrepeter.CodeParser.Next();
            }

            if (MultiLineIF)
            {

                ///////////////////////////////////////////////////////////////////
                //
                //                            MULTILINE IF
                //
                ///////////////////////////////////////////////////////////////////
                if (ComparisonResult >= 1)
                {

                    // 1. Excecute Statements until ENDIF or ELSE
                    // ------------------------------------------------------------
                    while (true)
                    {
                        if (
                            (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndIfToken))) ||
                            (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(ElseToken))) ||
                            (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                        )
                            break;

                        // If NewLine skip it.
                        // So we can be sure that all ELSE and ENDIF tokens are catched!
                        if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)))
                        {
                            BasicIntrepeter.CodeParser.Next();
                            continue;
                        }

                        if (!BasicIntrepeter.DontExectuteIF) BasicIntrepeter.ProcessNextStatement();
                    }

                    // 2. If ELSE then Skip until ENDIF
                    // ------------------------------------------------------------
                    if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(ElseToken)))
                    {
                        bool BackupDontExectuteIF = BasicIntrepeter.DontExectuteIF;
                        BasicIntrepeter.DontExectuteIF = true;

                        while (
                            (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndIfToken))) &&
                            (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                        )
                        {
                            if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(IfToken))) BasicIntrepeter.ProcessNextStatement();
                            BasicIntrepeter.CodeParser.Next();
                        }

                        BasicIntrepeter.DontExectuteIF = BackupDontExectuteIF;
                    }

                    // 3. If ENDOFINPUT then throw error
                    // ------------------------------------------------------------
                    if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    {
                        throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.MULTILINE_IF_WITHOUT_ENDIF);
                    }

                    // Skip EndIf Token
                    BasicIntrepeter.CodeParser.Next();

                }
                else
                {

                    // 1. Skip Tokens until ENDIF or ELSE
                    // ------------------------------------------------------------
                    bool BackupDontExectuteIF = BasicIntrepeter.DontExectuteIF;
                    BasicIntrepeter.DontExectuteIF = true;
                    while (
                        (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndIfToken))) &
                        (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(ElseToken))) &
                        (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    )
                    {
                        if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(IfToken))) BasicIntrepeter.ProcessNextStatement();
                        BasicIntrepeter.CodeParser.Next();
                    }
                    BasicIntrepeter.DontExectuteIF = BackupDontExectuteIF;

                    // 2. If ENDOFINPUT then throw error
                    // ------------------------------------------------------------
                    if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    {
                        throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.MULTILINE_IF_WITHOUT_ENDIF);
                    }

                    // 3. If ELSE then Execute until ENDIF
                    // ------------------------------------------------------------
                    if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(ElseToken)))
                    {
                        // Skip ELSE
                        BasicIntrepeter.CodeParser.Next();

                        while (
                            (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndIfToken))) &&
                            (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                        )
                        {

                            // If NewLine skip it.
                            // So we can be sure that all ENDIF tokens are catched!
                            if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken)))
                            {
                                BasicIntrepeter.CodeParser.Next();
                                continue;
                            }

                            if (!BasicIntrepeter.DontExectuteIF) BasicIntrepeter.ProcessNextStatement();

                        }
                    }

                    // 4. If ENDOFINPUT then throw error
                    // ------------------------------------------------------------
                    if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    {
                        throw new MFBasic.Exceptions.BasicLanguageException(MFBasic.Exceptions.BasicLanguageException.MULTILINE_IF_WITHOUT_ENDIF);
                    }

                    // 5. Skip ENDIF
                    // ------------------------------------------------------------
                    BasicIntrepeter.CodeParser.Expect(typeof(EndIfToken));

                }
            }
            else
            {
                ///////////////////////////////////////////////////////////////////
                //
                //                          SINGLE LINE IF
                //
                ///////////////////////////////////////////////////////////////////

                // If outcome is true
                if (ComparisonResult >= 1)
                {
                    // 1. Process statement
                    // ------------------------------------------------------------
                    if (!BasicIntrepeter.DontExectuteIF) BasicIntrepeter.ProcessNextStatement();

                    // 2. If ELSE Skip until NEWLINE/ENDOFINPUT
                    // ------------------------------------------------------------
                    while ((!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken))) &&
                           (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    )
                    {
                        if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(IfToken))) BasicIntrepeter.ProcessNextStatement();
                        BasicIntrepeter.CodeParser.Next();
                    }

                    // 3. If EndIfToken and Dont Execute is true go back one program position
                    if ((BasicIntrepeter.DontExectuteIF) && (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndIfToken))))
                        BasicIntrepeter.CodeParser.ProgramPosition--;

                }
                else
                {
                    // 1. Skip until ELSE/NEWLINE/ENDOFINPUT
                    // ------------------------------------------------------------
                    bool BackupDontExectuteIF = BasicIntrepeter.DontExectuteIF;
                    BasicIntrepeter.DontExectuteIF = true;
                    while ((!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfLineToken))) &&
                           (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(ElseToken))) &&
                           (!BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndOfInputToken)))
                    )
                    {
                        if (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(IfToken))) BasicIntrepeter.ProcessNextStatement();
                        BasicIntrepeter.CodeParser.Next();
                    }
                    BasicIntrepeter.DontExectuteIF = BackupDontExectuteIF;

                    // 2. If ELSE excecute statement
                    // ------------------------------------------------------------
                    if ((BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(ElseToken))))
                    {
                        // Skip Next
                        BasicIntrepeter.CodeParser.Next();

                        // Execute Statement
                        // Don't execute if searching for ELSE/ENDIF
                        if (!BasicIntrepeter.DontExectuteIF) BasicIntrepeter.ProcessNextStatement();

                    }

                    // 3. If EndIfToken and Dont Execute is true go back one program position
                    if ((BasicIntrepeter.DontExectuteIF) && (BasicIntrepeter.CodeParser.CurrentToken.GetType().Equals(typeof(EndIfToken))))
                        BasicIntrepeter.CodeParser.ProgramPosition--;

                }
            }
        }