aboutsummaryrefslogtreecommitdiff
path: root/model.h
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-09 09:16:48 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-09 09:16:48 +0800
commite782bbeb805fffaaa4a118fb88be96894ac68c28 (patch)
tree146519740693e14950cf124aa5a28ff57c3c99be /model.h
parente24962104b203bd699ed3cfa2f30402a1268f9f8 (diff)
deal with circular reference
Diffstat (limited to 'model.h')
-rw-r--r--model.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/model.h b/model.h
index dfbca59..7a53c8e 100644
--- a/model.h
+++ b/model.h
@@ -5,11 +5,13 @@
#include <list>
#include <map>
#include <vector>
+#include <set>
using std::list;
using std::string;
using std::map;
using std::vector;
+using std::set;
// the range of unsigned char is enough for these types
typedef unsigned char ClassType;
@@ -113,7 +115,9 @@ class EvalObj : public FrameObj {
virtual ReprCons *get_repr_cons() = 0;
};
-class ListReprCons;
+typedef set<EvalObj*> EvalObjAddrHash;
+
+class PairReprCons;
/** @class Pair
* Pair construct, which can be used to represent a list, or further
* more, a syntax tree
@@ -152,9 +156,10 @@ class RetAddr : public FrameObj {
class ReprCons {
public:
+ EvalObj *ori;
bool done;
string repr;
- ReprCons(bool done);
+ ReprCons(bool done, EvalObj *ori = NULL);
virtual EvalObj *next(const string &prev) = 0;
};
@@ -164,11 +169,12 @@ class ReprStr : public ReprCons {
EvalObj *next(const string &prev);
};
-class ListReprCons : public ReprCons {
+class PairReprCons : public ReprCons {
private:
+ int state;
EvalObj *ptr;
public:
- ListReprCons(Pair *ptr);
+ PairReprCons(Pair *ptr, EvalObj *ori);
EvalObj *next(const string &prev);
};
@@ -178,7 +184,7 @@ class VectReprCons : public ReprCons {
VecObj *ptr;
int idx;
public:
- VectReprCons(VecObj *ptr);
+ VectReprCons(VecObj *ptr, EvalObj *ori);
EvalObj *next(const string &prev);
};