2013-12-31 23:43:49 -06:00
|
|
|
#ifndef __IMPORTER__H_
|
|
|
|
|
#define __IMPORTER__H_
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
|
|
#include "Parser.h"
|
|
|
|
|
#include "NodeTree.h"
|
|
|
|
|
#include "ASTData.h"
|
|
|
|
|
#include "Symbol.h"
|
|
|
|
|
#include "RemovalTransformation.h"
|
|
|
|
|
#include "CollapseTransformation.h"
|
|
|
|
|
#include "ASTTransformation.h"
|
|
|
|
|
|
2014-05-24 14:04:32 -04:00
|
|
|
class ASTTransformation;
|
|
|
|
|
|
2013-12-31 23:43:49 -06:00
|
|
|
class Importer {
|
|
|
|
|
public:
|
2014-05-01 01:18:01 -04:00
|
|
|
Importer(Parser* parserIn, std::vector<std::string> includePaths);
|
2013-12-31 23:43:49 -06:00
|
|
|
~Importer();
|
2014-05-24 14:04:32 -04:00
|
|
|
void import(std::string fileName);
|
|
|
|
|
NodeTree<ASTData>* getUnit(std::string fileName);
|
|
|
|
|
NodeTree<ASTData>* importFirstPass(std::string fileName);
|
|
|
|
|
NodeTree<Symbol>* parseAndTrim(std::string fileName);
|
|
|
|
|
void registerAST(std::string name, NodeTree<ASTData>* ast, NodeTree<Symbol>* syntaxTree);
|
2014-01-01 17:29:19 -06:00
|
|
|
std::map<std::string, NodeTree<ASTData>*> getASTMap();
|
2013-12-31 23:43:49 -06:00
|
|
|
private:
|
2014-05-24 14:04:32 -04:00
|
|
|
ASTTransformation *ASTTransformer;
|
|
|
|
|
struct importTriplet {
|
|
|
|
|
std::string name;
|
|
|
|
|
NodeTree<ASTData>* ast;
|
|
|
|
|
NodeTree<Symbol>* syntaxTree;
|
|
|
|
|
};
|
|
|
|
|
std::vector<importTriplet> importedTrips;
|
2014-05-01 01:18:01 -04:00
|
|
|
std::vector<std::string> includePaths;
|
2013-12-31 23:43:49 -06:00
|
|
|
Parser* parser;
|
|
|
|
|
std::vector<Symbol> removeSymbols;
|
|
|
|
|
std::vector<Symbol> collapseSymbols;
|
2014-01-01 17:29:19 -06:00
|
|
|
std::map<std::string, NodeTree<ASTData>*> imported;
|
2013-12-31 23:43:49 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|