summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-07 20:29:41 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-07 20:29:41 +0100
commitd959b701bf720e0ee2553452576e7cced12623f3 (patch)
tree1ea97a20f617e439895f1e02b0bd885365738999
parent4754bc5562abfcfc8aec5779d20f0a7a8184226c (diff)
downloadsencha-lang-d959b701bf720e0ee2553452576e7cced12623f3.tar.gz
sencha-lang-d959b701bf720e0ee2553452576e7cced12623f3.tar.bz2
sencha-lang-d959b701bf720e0ee2553452576e7cced12623f3.zip
Small changes in paths in import.
-rw-r--r--Sencha-lang/AST/ImportStatement.cpp7
-rw-r--r--Sencha-lang/Parser.cpp7
2 files changed, 11 insertions, 3 deletions
diff --git a/Sencha-lang/AST/ImportStatement.cpp b/Sencha-lang/AST/ImportStatement.cpp
index 3e5740d..960f8c6 100644
--- a/Sencha-lang/AST/ImportStatement.cpp
+++ b/Sencha-lang/AST/ImportStatement.cpp
@@ -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;
diff --git a/Sencha-lang/Parser.cpp b/Sencha-lang/Parser.cpp
index bdb4c63..bb6acd2 100644
--- a/Sencha-lang/Parser.cpp
+++ b/Sencha-lang/Parser.cpp
@@ -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";