diff options
author | Teddy <[email protected]> | 2013-08-15 20:06:54 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-08-15 20:06:54 +0800 |
commit | 9b1d0e016822509e5d3ea7bdc6341b4533b42080 (patch) | |
tree | 07707035e1684435f10065421be5e57805e1363c | |
parent | 7aa4faa9dc814b4068544c48bb7aa6915777b03b (diff) |
move ParseBracket to model files
-rw-r--r-- | TODO.rst | 18 | ||||
-rw-r--r-- | model.cpp | 14 | ||||
-rw-r--r-- | model.h | 15 | ||||
-rw-r--r-- | types.cpp | 8 | ||||
-rw-r--r-- | types.h | 9 |
5 files changed, 36 insertions, 28 deletions
@@ -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 @@ -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)) {} @@ -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 @@ -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) {} @@ -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 |