Пример #1
0
        public Thread( Block startBlock, Scope startScope = null, bool keepScope = false )
        {
            myStack = new Stack<BlockEntry>();
            myPastScopes = new Stack<Scope>();

            if( !keepScope )
                Scope = startScope ?? stGlobalScope;

            EnterBlock( startBlock );

            if( keepScope )
                Scope = startScope ?? stGlobalScope;
        }
Пример #2
0
 public BlockEntry( int entryPoint, Block block )
 {
     EntryPoint = entryPoint;
     Block = block;
 }
Пример #3
0
        public void EnterBlock( Block block, bool newScope = false, Scope scope = null )
        {
            if ( myStack.Count >= MaximumStackSize )
                throw new Exception( "Stack overflow when attempting to enter block." );

            myStack.Push( new BlockEntry( myCurrentCommandNum, block ) );

            myCurrentCommandNum = 0;

            if ( !newScope )
                Scope = new Scope( Scope );
            else
            {
                myPastScopes.Push( Scope );
                Scope = scope ?? stGlobalScope;
            }

            if ( myCurrentCommandNum >= CurrentBlock.Commands.Length )
                ExitBlock();
        }