| 
					
				 | 
			
			
				@@ -18,6 +18,7 @@ import { StoreValueRef } from './store/value/store_value_ref'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { ArrayStoreValue } from './store/value/array_store_value'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { ArrayStoreValueRef } from './store/value/array_store_value_ref'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { StoreValueAddress } from './store/value/store_value_address'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { LocalizedStrings } from '../services/localizedStringsService'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export class IVProgProcessor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,10 +43,12 @@ export class IVProgProcessor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.forceKill = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.loopTimers = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.output = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.mode = Modes.RUN; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * Stores the sourceInfo of every function call, command or expression 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.function_call_stack = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.command_count = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   registerInput (input) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,6 +89,7 @@ export class IVProgProcessor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.globalStore = new Store("$global"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.stores = [this.globalStore]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.context = [Context.BASE]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.command_count = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   interpretAST () { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -220,8 +224,9 @@ export class IVProgProcessor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   executeCommand (store, cmd) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.command_count += 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return new Promise((resolve, reject) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setTimeout(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const command_lambda = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(this.forceKill) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return reject("FORCED_KILL!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else if (store.mode === Modes.PAUSE) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -230,6 +235,8 @@ export class IVProgProcessor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return resolve(store); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else if(this.checkContext(Context.BREAKABLE) && store.mode === Modes.BREAK) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return resolve(store); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (this.mode === Modes.ABORT) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return reject(LocalizedStrings.getMessage('aborted_execution')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (cmd instanceof Commands.Declaration) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return resolve(this.executeDeclaration(store, cmd)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -258,7 +265,13 @@ export class IVProgProcessor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return reject(ProcessorErrorFactory.unknown_command(cmd.sourceInfo)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }, 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if(this.command_count % 100 == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //every 100th command should briefly delay its execution in order to allow the browser to process other things 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setTimeout(command_lambda, 5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        command_lambda(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |