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; }
public BlockEntry( int entryPoint, Block block ) { EntryPoint = entryPoint; Block = block; }
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(); }