Small changes in paths in import.

imports
Justyna Ilczuk 2013-01-07 20:29:41 +01:00
parent 4754bc5562
commit d959b701bf
2 changed files with 11 additions and 3 deletions

View File

@ -64,15 +64,16 @@ void ImportStatement::prepare_defaults()
std::vector<std::string> ImportStatement::prepare_paths(std::string name_of_module)
{
std::vector<std::string> paths;
if(name_of_module[0] == '\"' && name_of_module[name_of_module.size() -1] == '\"')
if(name_of_module.substr(name_of_module.size() -3,name_of_module.size()) == ".se")
{
paths.push_back(strip_string(name_of_module));
std::cout << name_of_module.substr(name_of_module.size() -3,name_of_module.size() ) << std::endl;
paths.push_back(name_of_module);
}
else
{
for(auto path : DEFAULT_LIB_PATHS)
{
paths.push_back(path + name_of_module);
paths.push_back(path + name_of_module + ".se");
}
}
return paths;

View File

@ -189,6 +189,13 @@ ASTStatement * Parser::statement()
accept(";");
return import;
}
else if (name_expression.name != "")
{
std::string name_of_import = name_expression.name;
ImportStatement * import = new ImportStatement(name_of_import, context_manager);
accept(";");
return import;
}
else
{
string error_message = "ERROR: invalid import\n";