Added rough but working scoping.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#define ASTDATA_H
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "Symbol.h"
|
||||
#include "Type.h"
|
||||
@@ -28,6 +28,7 @@ class ASTData {
|
||||
ASTType type;
|
||||
Type valueType;
|
||||
Symbol symbol;
|
||||
std::map<std::string, NodeTree<ASTData>*> scope;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef ASTTRANSFORMATION_H
|
||||
#define ASTTRANSFORMATION_H
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "ASTData.h"
|
||||
#include "NodeTransformation.h"
|
||||
|
||||
@@ -9,8 +12,9 @@ class ASTTransformation: public NodeTransformation<Symbol,ASTData> {
|
||||
ASTTransformation();
|
||||
~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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user