Ejemplo n.º 1
0
 /// <summary>
 /// Reset Basic to initial state
 /// </summary>
 public void Reset()
 {
     this.GOSUBStackPosition = 0;
     this.FORStackPosition = 0;
     this.WHILEStackPosition = 0;
     this.Ended = false;
     this.DontExectuteIF = false;
     this.CodeParser.Reset();
     this.NumericModifier = new NumericModifiers(this);
     this.StringModifier = new StringModifiers(this);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new BASIC Interpreter Instance
        /// </summary>
        /// <param name="Program">Program to excecute</param>
        /// <param name="CustomTokens">Custom Tokens</param>
        public Basic(String SourceCode, CodeParser.KeywordTokenConstructor[] CustomTokens)
        {
            for (byte i = 0; i < 26; i++)
            {
                NumericVariables.Add(new NumericBasicVariable(((char) (((char)i) + 'a')).ToString(), 0));
            }

            // Remove carrage return from sourcecode
            this.SourceCode = "";
            foreach (char c in SourceCode)
            {
                if (c != '\r')
                    this.SourceCode += c;
            }

            this.GOSUBStackPosition = 0;
            this.FORStackPosition = 0;
            this.WHILEStackPosition = 0;
            this.Ended = false;
            this.DontExectuteIF = false;
            this.CodeParser = new CodeParser(this.SourceCode, CustomTokens);
            this.NumericModifier = new NumericModifiers(this);
            this.StringModifier = new StringModifiers(this);
        }