diff options
Diffstat (limited to 'Sencha-lang/AST/ImportStatement.cpp')
-rw-r--r-- | Sencha-lang/AST/ImportStatement.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Sencha-lang/AST/ImportStatement.cpp b/Sencha-lang/AST/ImportStatement.cpp new file mode 100644 index 0000000..9f05da0 --- /dev/null +++ b/Sencha-lang/AST/ImportStatement.cpp @@ -0,0 +1,42 @@ +/* + * ImportStatement.cpp + * + * Created on: Jan 7, 2013 + * Author: att + */ + +#include "ImportStatement.h" + +ImportStatement::ImportStatement(std::string name_of_module, ContextManager * context_manager) : +name_of_module(name_of_module), context_manager(context_manager){ + //Hrum hrum magic + + std::ifstream module_file(name_of_module); + std::string module_source_text = ""; + std::string line; + Lexer lexer; + vector<Token> tokens; + Parser parser(context_manager); + if (module_file.is_open()) + { + while ( module_file.good() ) + { + getline (module_file, line); + module_source_text += line; + tokens = lexer.parse_line(line); + parser.add_tokens(tokens); + } + module_file.close(); + } + import_body = parser.interpret(); + children.push_back(import_body); +} + +ImportStatement::~ImportStatement() { + // TODO Auto-generated destructor stub +} + +SenchaObject ImportStatement::execute() +{ + return import_body->execute(); +} |