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:
@@ -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
|
||||
|
||||
@@ -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
28
include/Importer.h
Normal 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
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user