| 
					
				 | 
			
			
				@@ -1,7 +1,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { CommonTokenStream, InputStream } from 'antlr4/index'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import * as Expressions from './expressions/'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import * as Commands from './commands/'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { recover } from "./ivprogLexer"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import * as AstHelpers from "./ast_helpers"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { toInt, toString, toBool, toReal } from './../typeSystem/parsers'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Types } from "./../typeSystem/types"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { CompoundType } from "./../typeSystem/compoundType"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,7 +36,7 @@ export class IVProgParser { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   constructor (input, lexerClass) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.lexerClass = lexerClass; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.lexer = new lexerClass(new InputStream(input)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.lexer.recover = recover.bind(this.lexer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.lexer.recover = AstHelpers.recover.bind(this.lexer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.tokenStream = new CommonTokenStream(this.lexer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.tokenStream.fill(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.pos = 1; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -608,6 +608,7 @@ export class IVProgParser { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       hasOpen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.consumeNewLines(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let parsedCommand =  false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     while(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const cmd = this.parseCommand(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -615,8 +616,13 @@ export class IVProgParser { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if(cmd !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (cmd instanceof Array) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(parsedCommand) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const lastToken = this.getToken(this.pos - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw SyntaxErrorFactory.invalid_var_declaration(lastToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           variablesDecl = variablesDecl.concat(cmd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          parsedCommand = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           commands.push(cmd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -634,7 +640,7 @@ export class IVProgParser { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const token = this.getToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (this.isVariableType(token)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if(!this.insideScope(IVProgParser.FUNCTION)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        throw SyntaxErrorFactory.invalid_var_declaration(token.line); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        throw SyntaxErrorFactory.invalid_var_declaration(token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.pushScope(IVProgParser.BASE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const varType = this.parseType(); 
			 |