private void ImportLocalFile(ImportAST importAST) { ScopeSymbolTable mainScope = currentScope; string fileName = string.Join('/', importAST.FileName.ConvertAll(file => Visit(file))); folder = importAST.Relative ? relativeFolder : rootFolder; Interpret(fileName); if (importAST.Symbols.Count == 0) { currentScope = mainScope.Merge(currentScope); } else { foreach (var symbolName in importAST.Symbols) { var symbol = currentScope.Lookup(Visit(symbolName), false); if (symbol == null) { throw logger.Error(new SemanticException(symbolName.FindToken(), $"Cannot import {Visit(symbolName)} from {importAST.FileName.Last()}")); } if (!mainScope.Insert(symbol, false)) { throw logger.Error(new SemanticException(symbolName.FindToken(), $"Cannot import {Visit(symbolName)} since it has already exists")); } } currentScope = mainScope; } }