Can import other files now. (in same directory, use filename without .krak file extention) Right now, still need to compile both files with kraken.

This commit is contained in:
Nathan Braswell
2013-12-31 23:43:49 -06:00
parent 005659b7b7
commit dbf1820428
13 changed files with 203 additions and 116 deletions

View File

@@ -6,16 +6,19 @@
#include "ASTData.h"
#include "NodeTransformation.h"
#include "Importer.h"
class Importer;
class ASTTransformation: public NodeTransformation<Symbol,ASTData> {
public:
ASTTransformation();
ASTTransformation(Importer* importerIn);
~ASTTransformation();
virtual NodeTree<ASTData>* transform(NodeTree<Symbol>* from);
NodeTree<ASTData>* transform(NodeTree<Symbol>* from, NodeTree<ASTData>* scope);
std::string concatSymbolTree(NodeTree<Symbol>* root);
NodeTree<ASTData>* scopeLookup(NodeTree<ASTData>* scope, std::string lookup);
private:
//Nothing
Importer * importer;
};
#endif

View File

@@ -25,6 +25,7 @@ class GraphStructuredStack {
bool hasEdge(NodeTree<int>* start, NodeTree<int>* end);
NodeTree<Symbol>* getEdge(NodeTree<int>* start, NodeTree<int>* end);
void addEdge(NodeTree<int>* start, NodeTree<int>* end, NodeTree<Symbol>* edge);
void clear();
std::string toString();
private:

28
include/Importer.h Normal file
View File

@@ -0,0 +1,28 @@
#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"
class Importer {
public:
Importer(Parser* parserIn);
~Importer();
NodeTree<ASTData>* import(std::string fileName);
private:
Parser* parser;
std::vector<Symbol> removeSymbols;
std::vector<Symbol> collapseSymbols;
};
#endif

View File

@@ -16,6 +16,7 @@ class Lexer {
void addRegEx(std::string regExString);
void setInput(std::string inputString);
Symbol next();
void reset();
static void test();
private:
std::vector<RegEx*> regExs;