aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-15 20:06:54 +0800
committerTeddy <[email protected]>2013-08-15 20:06:54 +0800
commit9b1d0e016822509e5d3ea7bdc6341b4533b42080 (patch)
tree07707035e1684435f10065421be5e57805e1363c
parent7aa4faa9dc814b4068544c48bb7aa6915777b03b (diff)
move ParseBracket to model files
-rw-r--r--TODO.rst18
-rw-r--r--model.cpp14
-rw-r--r--model.h15
-rw-r--r--types.cpp8
-rw-r--r--types.h9
5 files changed, 36 insertions, 28 deletions
diff --git a/TODO.rst b/TODO.rst
index b403d33..1befc72 100644
--- a/TODO.rst
+++ b/TODO.rst
@@ -1,7 +1,11 @@
-- OPT:Special Opt Repr
-- OPT:Special Arg Checking
-- Garbage Collection
-- Testing
-- Rounding support
-- ext_repr optimization
-- Add macro support
+- Documents and comment
+
+ - model
+ - eval
+ - builtin
+ - gc
+ - types
+ - consts
+ - parser
+ - exc
+ - main
diff --git a/model.cpp b/model.cpp
index ba664a8..a56e530 100644
--- a/model.cpp
+++ b/model.cpp
@@ -24,7 +24,7 @@ bool FrameObj::is_parse_bracket() {
}
EvalObj::EvalObj(int _otype) :
- FrameObj(CLS_EVAL_OBJ), otype(_otype) {
+FrameObj(CLS_EVAL_OBJ), otype(_otype) {
gc_obj = gc.join(this);
}
@@ -139,5 +139,15 @@ string EvalObj::ext_repr() {
return res;
}
+ParseBracket::ParseBracket(unsigned char _btype) :
+FrameObj(CLS_SIM_OBJ | CLS_PAR_BRA), btype(_btype) {}
+
+UnspecObj::UnspecObj() : EvalObj(CLS_SIM_OBJ) {}
+
+ReprCons *UnspecObj::get_repr_cons() {
+ return new ReprStr("#<Unspecified>");
+}
+
+
Container::Container(int otype, bool override) :
- EvalObj(otype | (override ? 0 : CLS_CONTAINER)) {}
+EvalObj(otype | (override ? 0 : CLS_CONTAINER)) {}
diff --git a/model.h b/model.h
index fd88f7d..66c16f9 100644
--- a/model.h
+++ b/model.h
@@ -103,14 +103,25 @@ class EvalObj : public FrameObj {
virtual ReprCons *get_repr_cons() = 0;
};
+/** @class ParseBracket
+ * To indiate a left bracket when parsing, used in the parse_stack
+ */
+class ParseBracket : public FrameObj {/*{{{*/
+ public:
+ unsigned char btype; /**< The type of the bracket */
+ /** Construct a ParseBracket object */
+ ParseBracket(unsigned char btype);
+};/*}}}*/
+
+
typedef std::set<EvalObj*> EvalObjSet;
-class Container: public EvalObj {
+class Container: public EvalObj {/*{{{*/
public:
bool keep;
size_t gc_refs;
Container(int otype = 0, bool override = false);
virtual void gc_decrement() = 0;
virtual void gc_trigger(EvalObj ** &tail, EvalObjSet &visited) = 0;
-};
+};/*}}}*/
#endif
diff --git a/types.cpp b/types.cpp
index b583061..0cfe0be 100644
--- a/types.cpp
+++ b/types.cpp
@@ -41,14 +41,6 @@ ReprCons *Pair::get_repr_cons() {
return new PairReprCons(this, this);
}
-ParseBracket::ParseBracket(unsigned char _btype) :
- FrameObj(CLS_SIM_OBJ | CLS_PAR_BRA), btype(_btype) {}
-
- UnspecObj::UnspecObj() : EvalObj(CLS_SIM_OBJ) {}
-
- ReprCons *UnspecObj::get_repr_cons() {
- return new ReprStr("#<Unspecified>");
- }
SymObj::SymObj(const string &str) :
EvalObj(CLS_SIM_OBJ | CLS_SYM_OBJ), val(str) {}
diff --git a/types.h b/types.h
index e90e7bb..345e17b 100644
--- a/types.h
+++ b/types.h
@@ -100,15 +100,6 @@ class VectReprCons : public ReprCons {/*{{{*/
EvalObj *next(const string &prev);
};/*}}}*/
-/** @class ParseBracket
- * To indiate a left bracket when parsing, used in the parse_stack
- */
-class ParseBracket : public FrameObj {/*{{{*/
- public:
- unsigned char btype; /**< The type of the bracket */
- /** Construct a ParseBracket object */
- ParseBracket(unsigned char btype);
-};/*}}}*/
/** @class UnspecObj
* The "unspecified" value returned by some builtin procedures